Skip to content

Commit

Permalink
Merge pull request #56 from logeecom/master
Browse files Browse the repository at this point in the history
Release version 3.2.16
  • Loading branch information
logeecom authored Dec 25, 2023
2 parents 26e55fc + c5f4472 commit 3045683
Show file tree
Hide file tree
Showing 19 changed files with 140 additions and 95 deletions.
Binary file added PluginInstallation/3.2.16/packlink.zip
Binary file not shown.
4 changes: 4 additions & 0 deletions PluginInstallation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
## [3.2.16](https://github.com/packlink-dev/prestashop_module/compare/v3.2.15...v3.2.16)
### Added
- Change to Core version 3.3.18
- Adjust the code to pass the PrestaShop validator

## [3.2.15](https://github.com/packlink-dev/prestashop_module/compare/v3.2.14...v3.2.15)
### Changed
Expand Down
16 changes: 12 additions & 4 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ echo -e "\e[32mSTEP 1:\e[0m Copying plugin source..."
mkdir packlink
cp -r ./src/* packlink

cp ./src/.htaccess packlink/

# Ensure proper composer dependencies
echo -e "\e[32mSTEP 2:\e[0m Installing composer dependencies..."
cd packlink
Expand Down Expand Up @@ -58,15 +60,21 @@ rm -rf packlink/views/countries/toCSV.php
rm -rf packlink/views/countries/fromCSV.php
rm -rf packlink/views/countries/translations.csv

echo -e "\e[32mSTEP 4:\e[0m Adding PrestaShop mandatory licence header to files..."
echo -e "\e[32mSTEP 4:\e[0m Adapt the plugin to the PrestaShop validator"
echo -e "\e[32mSTEP 4.1:\e[0m Adding PS version check in every PHP file"
./scripts/check_ps_version.sh
echo -e "\e[32mSTEP 4.2:\e[0m Remove .html extension from files"
./scripts/remove_html_extension_from_file_name.sh "./packlink/views/templates/core" "./packlink/packlink.php"

echo -e "\e[32mSTEP 5:\e[0m Adding PrestaShop mandatory licence header to files..."
php "$PWD/src/lib/autoLicence.php" "$PWD/packlink"

# Adding PrestaShop mandatory index.php file to all folders
echo -e "\e[32mSTEP 5:\e[0m Adding PrestaShop mandatory index.php file to all folders..."
echo -e "\e[32mSTEP 6:\e[0m Adding PrestaShop mandatory index.php file to all folders..."
php "$PWD/lib/autoindex/index.php" "$PWD/packlink" >/dev/null

# get plugin version
echo -e "\e[32mSTEP 6:\e[0m Reading module version..."
echo -e "\e[32mSTEP 7:\e[0m Reading module version..."

version="$1"
if [ "$version" = "" ]; then
Expand All @@ -80,7 +88,7 @@ if [ "$version" = "" ]; then
fi

# Create plugin archive
echo -e "\e[32mSTEP 7:\e[0m Creating new archive..."
echo -e "\e[32mSTEP 8:\e[0m Creating new archive..."
zip -r -q packlink.zip ./packlink

if [ "$version" != "" ]; then
Expand Down
1 change: 0 additions & 1 deletion lib/autoindex/sources/index.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/

header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');

Expand Down
16 changes: 16 additions & 0 deletions scripts/add_ps_version_check_after_first_line.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

path="$1"
code_to_add="$2"

find "$path" -type f -name "*.php" | while read -r file; do
# Add PS version check after first line (<?php line)
awk -v code="$code_to_add" '
{
if ($0 ~ /^<\?php/) {
print $0 "\n\n" code;
} else {
print $0;
}
}' "$file" > temp && mv temp "$file"
done
16 changes: 16 additions & 0 deletions scripts/add_ps_version_check_after_namespace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

path="$1"
code_to_add="$2"

find "$path" -type f -name "*.php" | while read -r file; do
# Add PS version check after namespace line
awk -v code="$code_to_add" '
{
if ($0 ~ /^namespace /) {
print $0 "\n\n" code;
} else {
print $0;
}
}' "$file" > temp && mv temp "$file"
done
7 changes: 7 additions & 0 deletions scripts/change_file_that_use_html.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

file_using_html="$1"

if [ -e "$file_using_html" ]; then
sed -i "s/\.html'/'/g" "$file_using_html"
fi
10 changes: 10 additions & 0 deletions scripts/check_ps_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

code_to_add="if (!defined('_PS_VERSION_')) {
exit;
}"

./scripts/add_ps_version_check_after_namespace.sh "./packlink" "$code_to_add"
./scripts/add_ps_version_check_after_first_line.sh "./packlink/controllers" "$code_to_add"
./scripts/add_ps_version_check_after_first_line.sh "./packlink/override" "$code_to_add"
./scripts/add_ps_version_check_after_first_line.sh "./packlink/translations" "$code_to_add"
12 changes: 12 additions & 0 deletions scripts/remove_html_extension_from_file_name.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

for html_file in "$1"/*.html; do
if [ -e "$html_file" ]; then
novo_ime="${html_file%.html}"
mv "$html_file" "$novo_ime"
fi
done

./scripts/change_file_that_use_html.sh "./packlink/packlink.php"
./scripts/change_file_that_use_html.sh "./packlink/vendor/packlink/integration-core/src/DemoUI/src/Views/ACME/index.php"
./scripts/change_file_that_use_html.sh "./packlink/vendor/packlink/integration-core/src/DemoUI/src/Views/PRO/index.php"
6 changes: 6 additions & 0 deletions src/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Options -Indexes

<FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh|inc|bak|swp|dist|zip|tar)$">
Order Allow,Deny
Deny from all
</FilesMatch>
36 changes: 1 addition & 35 deletions src/classes/Tasks/UpgradeShopOrderDetailsTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,41 +84,7 @@ public function __unserialize($data)
}

/**
* Returns string representation of object.
*
* @inheritdoc
*/
public function serialize()
{
return Serializer::serialize(
array(
$this->ordersToSync,
$this->batchSize,
$this->numberOfOrders,
$this->currentProgress,
)
);
}

/**
* Constructs the object.
*
* @param string data <p>
* The string representation of the object.
* </p>
*/
public function unserialize($data)
{
list($this->ordersToSync, $this->batchSize, $this->numberOfOrders, $this->currentProgress) =
Serializer::unserialize($data);

$this->orderShipmentDetailsService = ServiceRegister::getService(OrderShipmentDetailsService::CLASS_NAME);
$this->orderService = ServiceRegister::getService(OrderService::CLASS_NAME);
$this->proxy = ServiceRegister::getService(Proxy::CLASS_NAME);
}

/**
* Transforms array into an serializable object,
* Transforms array into a serializable object,
*
* @param array $array Data that is used to instantiate serializable object.
*
Expand Down
4 changes: 2 additions & 2 deletions src/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "packlink/prestashop",
"description": "Packlink Shipping PrestaShop plugin",
"type": "library",
"version": "3.2.15",
"version": "3.2.16",
"repositories": [
{
"type": "vcs",
Expand All @@ -13,7 +13,7 @@
"minimum-stability": "dev",
"require": {
"php": ">=5.3",
"packlink/integration-core": "3.3.15",
"packlink/integration-core": "3.3.18",
"ext-json": "*",
"ext-curl": "*",
"ext-zip": "*",
Expand Down
14 changes: 7 additions & 7 deletions src/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/lib/autoLicence.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ function addLicenceToFile($path)
case 'php':
// strip php header
$file = substr($file, 5);
$header = "<?php\n/**\n" . $licence . " */\n\n";
$header = "<?php\n/**\n" . $licence . " */\n";
break;
case 'tpl':
$header = "{**\n" . $licence . " *}\n\n";
$header = "{**\n" . $licence . " *}\n";
break;
case 'js':
$header = "/**\n" . $licence . " */\n\n";
$header = "/**\n" . $licence . " */\n";
break;
default:
return;
Expand Down
74 changes: 31 additions & 43 deletions src/packlink.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct()
$this->module_key = 'a7a3a395043ca3a09d703f7d1c74a107';
$this->name = 'packlink';
$this->tab = 'shipping_logistics';
$this->version = '3.2.15';
$this->version = '3.2.16';
$this->author = $this->l('Packlink Shipping S.L.');
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.6.0.14', 'max' => _PS_VERSION_);
Expand Down Expand Up @@ -173,15 +173,17 @@ public function isUsingNewTranslationSystem()
*/
public function hookDisplayBeforeCarrier($params)
{
$this->context->smarty->assign(array(
'shippingServicePath' => $this->_path . 'views/js/ShippingService17.js?v=' . $this->version
));

$output = $this->getLocationPickerFilesLinks();

if (version_compare(_PS_VERSION_, '1.7.0.0', '<')) {
return $output . $this->getPresta16ShippingStepPage($params);
}

$shippingServicePath = $this->_path . 'views/js/ShippingService17.js?v=' . $this->version;
$output .= "<script src=\"{$shippingServicePath}\"></script>\n";

$output .= $this->display(__FILE__, 'displayBeforeCarrier.tpl');
$output .= $this->getCheckoutFilesLinks();

return $output;
Expand Down Expand Up @@ -289,6 +291,7 @@ public function hookDisplayOrderConfirmation($params)
$configuration['orderId'] = $order->id;
$configuration['addressId'] = $order->id_address_delivery;
$configuration['cartId'] = $order->id_cart;

$this->context->smarty->assign(
array('configuration' => $configuration)
);
Expand Down Expand Up @@ -999,19 +1002,18 @@ protected function getPresta16ShippingStepPage($params)
{
$configuration = $this->getShippingStepConfiguration($params);

$this->context->smarty->assign(
array('configuration' => $configuration)
);

$stylesPath = $this->_path . 'views/css/packlink-shipping-methods.css?v=' . $this->version;
$output = "<link rel=\"stylesheet\" href=\"{$stylesPath}\"/>\n";
$this->context->smarty->assign(array(
'configuration' => $configuration,
'stylesPath' => $this->_path . 'views/css/packlink-shipping-methods.css?v=' . $this->version,
'shippingServicePath' => $this->_path . 'views/js/ShippingService16.js?v=' . $this->version,
));

$shippingServicePath = $this->_path . 'views/js/ShippingService16.js?v=' . $this->version;
$output .= "<script src=\"{$shippingServicePath}\"></script>\n";
$output = $this->display(__FILE__, 'getPresta16ShippingStepPage.tpl');

$output .= $this->getCheckoutFilesLinks();
$output .= $this->display(__FILE__, 'shipping_methods_16.tpl');

return $output . $this->display(__FILE__, 'shipping_methods_16.tpl');
return $output;
}

/**
Expand All @@ -1021,28 +1023,17 @@ protected function getPresta16ShippingStepPage($params)
*/
protected function getCheckoutFilesLinks()
{
$ajaxPath = $this->getPathUri() . 'views/js/core/AjaxService.js?v=' . $this->version;
$output = "<script src=\"{$ajaxPath}\"></script>\n";

$responsePath = $this->getPathUri() . 'views/js/core/ResponseService.js?v=' . $this->version;
$output .= "<script src=\"{$responsePath}\"></script>\n";

$stateUuidPath = $this->getPathUri() . 'views/js/core/StateUUIDService.js?v=' . $this->version;
$output .= "<script src=\"{$stateUuidPath}\"></script>\n";

$prestaAjaxPath = $this->_path . 'views/js/PrestaAjaxService.js?v=' . $this->version;
$output .= "<script src=\"{$prestaAjaxPath}\"></script>\n";

$stylePath = $this->_path . 'views/css/checkout.css?v=' . $this->version;
$output .= "<link rel=\"stylesheet\" href=\"{$stylePath}\"/>\n";

$checkoutPath = $this->_path . 'views/js/CheckOutController.js?v=' . $this->version;
$output .= "<script src=\"{$checkoutPath}\"></script>\n";

$mapModalPath = $this->_path . 'views/js/MapModalController.js?v=' . $this->version;
$output .= "<script src=\"{$mapModalPath}\"></script>\n";
$this->context->smarty->assign(array(
'ajaxPath' => $this->getPathUri() . 'views/js/core/AjaxService.js?v=' . $this->version,
'responsePath' => $this->getPathUri() . 'views/js/core/ResponseService.js?v=' . $this->version,
'stateUuidPath' => $this->getPathUri() . 'views/js/core/StateUUIDService.js?v=' . $this->version,
'prestaAjaxPath' => $this->_path . 'views/js/PrestaAjaxService.js?v=' . $this->version,
'stylePath' => $this->_path . 'views/css/checkout.css?v=' . $this->version,
'checkoutPath' => $this->_path . 'views/js/CheckOutController.js?v=' . $this->version,
'mapModalPath' => $this->_path . 'views/js/MapModalController.js?v=' . $this->version
));

return $output;
return $this->display(__FILE__, 'checkoutFilesLinks.tpl');
}

/**
Expand All @@ -1052,16 +1043,13 @@ protected function getCheckoutFilesLinks()
*/
protected function getLocationPickerFilesLinks()
{
$locationPickerLibrary = $this->_path . 'views/js/location/LocationPicker.js?v=' . $this->version;
$output = "<script src=\"{$locationPickerLibrary}\"></script>\n";

$locationPickerTrans = $this->_path . 'views/js/location/Translations.js?v=' . $this->version;
$output .= "<script src=\"{$locationPickerTrans}\"></script>\n";

$locationPickerCSS = $this->_path . 'views/css/locationPicker.css?v=' . $this->version;
$output .= "<link rel=\"stylesheet\" href=\"{$locationPickerCSS}\"/>\n";
$this->context->smarty->assign(array(
'locationPickerLibrary' => $this->_path . 'views/js/location/LocationPicker.js?v=' . $this->version,
'locationPickerTrans' => $this->_path . 'views/js/location/Translations.js?v=' . $this->version,
'locationPickerCSS' => $this->_path . 'views/css/locationPicker.css?v=' . $this->version
));

return $output;
return $this->display(__FILE__, 'locationPickerFilesLinks.tpl');
}

/**
Expand Down
Loading

0 comments on commit 3045683

Please sign in to comment.