Add possibilty to re-send order when first is by philea

This commit is contained in:
Michael RICOIS 2018-01-12 12:32:59 +01:00
parent f32ca94f43
commit bede86e06b
2 changed files with 22 additions and 46 deletions

View File

@ -20,11 +20,12 @@ foreach(array_map(function($value) {
include _PS_ROOT_DIR_.'/modules/privatesales/Sale.php';
class AdminLogistics extends AdminTab {
class AdminLogistics extends AdminTab
{
public $_html = '';
private function stripaccents($str) {
private function stripaccents($str)
{
return preg_replace(
'~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml|caron);~i',
'$1',
@ -32,7 +33,8 @@ class AdminLogistics extends AdminTab {
);
}
private function isoreplace($str) {
private function isoreplace($str)
{
// ISO/CEI 646
return str_replace(array(
'Ç', 'ü', 'é', 'â', 'ä', 'à',
@ -84,41 +86,10 @@ class AdminLogistics extends AdminTab {
), $str);
}
private function printLabel($data, $mr=false) {
private function printLabel($data, $mr=false)
{
global $cookie;
//require dirname(__FILE__).'/libs/predis/autoload.php'; // Conflicts with Prestashop autoload
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Option/OptionInterface.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Option/AbstractOption.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Command/Processor/CommandProcessingInterface.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Command/PrefixableCommandInterface.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Command/CommandInterface.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Command/AbstractCommand.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Command/PrefixableCommand.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Command/PubSubPublish.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Connection/ConnectionInterface.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Connection/SingleConnectionInterface.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Connection/AbstractConnection.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Connection/StreamConnection.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Connection/ConnectionParametersInterface.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Connection/ConnectionParameters.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Connection/ConnectionFactoryInterface.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Connection/ConnectionFactory.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Profile/ServerProfileInterface.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Profile/ServerProfile.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Profile/ServerVersion26.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Option/ClientCluster.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Option/ClientPrefix.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Option/ClientExceptions.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Option/ClientReplication.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Option/ClientConnectionFactory.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Option/ClientProfile.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Option/ClientOptionsInterface.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Option/ClientOptions.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/BasicClientInterface.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/ClientInterface.php';
require_once dirname(__FILE__).'/libs/predis/lib/Predis/Client.php';
$redis = new Predis\Client();
if($mr){
@ -167,7 +138,7 @@ class AdminLogistics extends AdminTab {
&& ( $delete_number = Tools::getValue('delete_number') )) {
// Suppression LAPOSTE
if ($delete = (int) Tools::getValue('delete_laposte')) {
if ($delete = (int) Tools::getValue('delete_soflexibilite')) {
Db::getInstance()->ExecuteS('
DELETE FROM `'._DB_PREFIX_.'lapostews`
WHERE `id_order_detail` = '.$delete.'
@ -302,7 +273,7 @@ class AdminLogistics extends AdminTab {
$weight = 0.24;
$order = new Order((int) $id_order);
if (Validate::isLoadedObject($order)) {
$parcel_carrier == 'laposte'? $weight = 0.24: TRUE;
$parcel_carrier == 'laposte' ? $weight = 0.24 : true;
if ($parcel_carrier == "laposte" || $parcel_carrier == "mondialrelay") {
$result = $logistics_carriers[$parcel_carrier]->registerParcel($order, $products, $weight);
if($result[0] != '') {
@ -847,9 +818,9 @@ class AdminLogistics extends AdminTab {
<td>\' + loaded.logs[i].shipping_number + \'</td>\
<td>\' + ((loaded.logs[i].carrier == "laposte" || loaded.logs[i].carrier == "mondialrelay") ? carriers[loaded.logs[i].carrier] : loaded.logs[i].carrier) + \'</td>\
'.(( in_array((int)$cookie->profile, array(1,9,7,13,14)) ) ?
'\' + ((loaded.logs[i].carrier == "laposte" || loaded.logs[i].carrier == "mondialrelay") ?\'<td><a href="/adm/index.php?tab=AdminLogistics&token='.Tools::getAdminTokenLite('AdminLogistics').'&id_order=\' + loaded.order.id + \'&delete_\' + loaded.logs[i].carrier + \'=\' + loaded.logs[i].id_order_detail + \'&delete_number=\' + loaded.logs[i].shipping_number + \'">x</a></td>': '').'\':"") +\'\
'\' + \'<td><a title="Set article as not sent" href="/adm/index.php?tab=AdminLogistics&token='.Tools::getAdminTokenLite('AdminLogistics').'&id_order=\' + loaded.order.id + \'&delete_\' + loaded.logs[i].carrier + \'=\' + loaded.logs[i].id_order_detail + \'&delete_number=\' + loaded.logs[i].shipping_number + \'">x</a></td>': '').'\' +\'\
'.(( in_array((int)$cookie->profile, array(1,9,7,13,14)) ) ?
'\' + ((loaded.logs[i].carrier == "laposte" || loaded.logs[i].carrier == "mondialrelay") ?\'<td><a title="Re print" class="reprint ui-icon ui-icon-arrowthickstop-1-s" data-product="\' + loaded.logs[i].product_name.replace(" - ", "<br />") + \'" data-weight="\' + loaded.logs[i].weight + \'" data-ref="\' + loaded.logs[i].product_reference + \'" data-id_order="\' + loaded.order.id + \'" data-carrier="\' + loaded.logs[i].carrier + \'" data-id_order_detail="\' + loaded.logs[i].id_order_detail + \'">+</a></td>': '').'\':"") +\'\
'\' + \'<td><a title="Re print" class="reprint ui-icon ui-icon-arrowthickstop-1-s" data-product="\' + loaded.logs[i].product_name.replace(" - ", "<br />") + \'" data-weight="\' + loaded.logs[i].weight + \'" data-ref="\' + loaded.logs[i].product_reference + \'" data-id_order="\' + loaded.order.id + \'" data-carrier="\' + loaded.logs[i].carrier + \'" data-id_order_detail="\' + loaded.logs[i].id_order_detail + \'">+</a></td>': '').'\' +\'\
</tr>\';
}

View File

@ -409,10 +409,11 @@ if(($id_order = (int) Tools::getValue('id_order'))
// Send by LAPOSTE
if($l = Db::getInstance()->ExecuteS('
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`,
e.`firstname`, e.`lastname`, "laposte" AS `carrier`, "0" as philea
e.`firstname`, e.`lastname`, "laposte" as carrier, "0" as philea
FROM `'._DB_PREFIX_.'lapostews` l
LEFT JOIN `'._DB_PREFIX_.'employee` e ON l.`id_employee` = e.`id_employee`
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail`
LEFT JOIN `ps_carrier` c ON c.`id_carrier` = o.`id_carrier`
WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).')
AND l.`quantity` > 0
ORDER BY l.`date_add` DESC
@ -423,10 +424,11 @@ if(($id_order = (int) Tools::getValue('id_order'))
// Send by EXAPAQ
if($l = Db::getInstance()->ExecuteS('
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`,
e.`firstname`, e.`lastname`, "exapaq" AS `carrier`, "0" as philea
e.`firstname`, e.`lastname`, "exapaq" as carrier, "0" as philea
FROM `'._DB_PREFIX_.'exapaqws` l
LEFT JOIN `'._DB_PREFIX_.'employee` e ON l.`id_employee` = e.`id_employee`
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail`
LEFT JOIN `'._DB_PREFIX_.'carrier` c ON c.`id_carrier` = o.`id_carrier`
WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).')
AND l.`quantity` > 0
ORDER BY l.`date_add` DESC
@ -437,10 +439,11 @@ if(($id_order = (int) Tools::getValue('id_order'))
// Send by MONDIAL RELAY
if($l = Db::getInstance()->ExecuteS('
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`,
e.`firstname`, e.`lastname`, "mondialrelay" AS `carrier`, "0" as philea
e.`firstname`, e.`lastname`, "mondialrelay" as carrier, "0" as philea
FROM `'._DB_PREFIX_.'mondialrelay_parcel` l
LEFT JOIN `'._DB_PREFIX_.'employee` e ON l.`id_employee` = e.`id_employee`
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail`
LEFT JOIN `ps_carrier` c ON c.`id_carrier` = o.`id_carrier`
WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).')
AND l.`quantity` > 0
ORDER BY l.`date_add` DESC
@ -451,9 +454,10 @@ if(($id_order = (int) Tools::getValue('id_order'))
// Send by DROPSHIPPING
if($l = Db::getInstance()->ExecuteS('
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`,
"Dropshipping" as firstname, "1" as philea
"Dropshipping" as firstname, "0" as philea
FROM `'._DB_PREFIX_.'ant_dropshipping_parcel` l
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail`
LEFT JOIN `'._DB_PREFIX_.'carrier` c ON c.`id_carrier` = o.`id_carrier`
WHERE l.`id_order_detail` IN ('.implode(', ', $id_order_details).')
AND l.`quantity` > 0
ORDER BY l.`date_add` DESC
@ -464,7 +468,8 @@ if(($id_order = (int) Tools::getValue('id_order'))
// Send by PHILEA
if($l = Db::getInstance()->ExecuteS('
SELECT l.*, d.`product_name`, d.`product_reference`, d.`product_supplier_reference`, "Philea" as firstname,
c.`name` as carrier, "1" as philea
(CASE c.`external_module_name` WHEN "soflexibilite" THEN "laposte" ELSE c.`external_module_name` END) as carrier,
"1" as philea
FROM `'._DB_PREFIX_.'philea_parcel` l
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON d.`id_order_detail` = l.`id_order_detail`
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order`