This commit is contained in:
Preprod mutu 2017-09-19 16:48:02 +02:00
parent 5614f2c917
commit c7ca03cf57
37 changed files with 4427 additions and 2046 deletions

View File

@ -1,256 +1,256 @@
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
require_once _PS_MODULE_DIR_.'tntofficiel/tntofficiel.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/TNTOfficiel_Debug.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/TNTOfficiel_PasswordManager.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/helper/TNTOfficiel_ShipmentHelper.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/pdf/manifest/TNTOfficiel_ManifestPDF.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/pdf/manifest/TNTOfficiel_ManifestPDFGenerator.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/pdf/manifest/HTMLTemplateTNTOfficielManifest.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/pdf/manifest/TNTOfficiel_ManifestPDFCreator.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/exceptions/TNTOfficiel_MaxPackageWeightException.php';
// <TABNAME>Controller
class AdminTNTOfficielController extends ModuleAdminController
{
/**
* Constructor.
*/
public function __construct()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
// _PS_MODULE_DIR_.$this->module->name.'/views/templates/admin/'
// default : 'content.tpl';
$this->template = 'AdminTNTOfficiel.tpl';
parent::__construct();
}
/**
* Add css files.
*/
public function setMedia()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$this->addCSS(_MODULE_DIR_.$this->module->name.'/views/css/AdminTNTOfficiel.css', 'all');
$this->addCSS(_MODULE_DIR_.$this->module->name.'/views/css/style.css');
parent::setMedia();
}
/**
* {@inheritdoc}
*/
public function createTemplate($tpl_name)
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$this->context->smarty->assign(array(
'username' => Configuration::get('TNT_CARRIER_USERNAME'),
'account' => Configuration::get('TNT_CARRIER_ACCOUNT'),
'password' => TNTOfficiel_PasswordManager::getHash(),
'middlewareUrl' => Configuration::get('TNT_CARRIER_MIDDLEWARE_SHORT_URL'),
));
if (file_exists($this->getTemplatePath().$tpl_name) && $this->viewAccess()) {
return $this->context->smarty->createTemplate($this->getTemplatePath().$tpl_name, $this->context->smarty);
}
return parent::createTemplate($tpl_name);
}
/**
* Generate the manifest for an order (download).
*/
public function processGetManifest()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$objManifestPDF = new TNTOfficiel_ManifestPDFCreator();
$intOrderID = (int)Tools::getValue('id_order');
$arrOrderIDList = array($intOrderID);
$objManifestPDF->createManifest($arrOrderIDList);
// We want to be sure that displaying PDF is the last thing this controller will do.
exit;
}
/**
* Downloads an archive containing all the logs files.
* /_admin/index.php?controller=AdminTNTOfficiel&action=downloadLogs
*/
public function processDownloadLogs()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$strLogPath = _PS_MODULE_DIR_.TNTOfficiel::MODULE_NAME.'/'.TNTOfficiel::LOG_DIR;
$zipName = 'logs.zip';
// Remove Existing.
if (file_exists($strLogPath.$zipName)) {
unlink($strLogPath.$zipName);
}
// Create Zip file.
TNTOfficiel_Logger::getZip($strLogPath.$zipName);
// Download.
header('Content-Type: application/zip');
header('Content-disposition: attachment; filename='.$zipName);
header('Content-Length: '.filesize($strLogPath.$zipName));
// Get Content.
readfile($strLogPath.$zipName);
// We want to be sure that displaying PDF is the last thing this controller will do.
exit;
}
/**
* Add a parcel.
*
* @return array
*/
public function displayAjaxAddParcel()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$fltWeight = (float)Tools::getValue('weight');
$intOderID = (int)Tools::getValue('orderId');
$arrResult = array();
try {
$arrResult['parcel'] = TNTOfficiel_ParcelsHelper::getInstance()->addParcel($intOderID, $fltWeight, false);
$arrResult['result'] = true;
} catch (TNTOfficiel_MaxPackageWeightException $objException) {
$arrResult['result'] = false;
$arrResult['error'] = $objException->getMessage();
} catch (Exception $objException) {
$objFileLogger = new FileLogger();
$objFileLogger->setFilename(_PS_ROOT_DIR_.'/log/'.date('Ymd').'_tnt_exception.log');
$objFileLogger->logError($objException->getMessage());
$arrResult['result'] = false;
}
echo Tools::jsonEncode($arrResult);
return true;
}
/**
* Remove a parcel.
*
* @return array
*/
public function displayAjaxRemoveParcel()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$intParcelID = (int)Tools::getValue('parcelId');
$arrResult = array();
try {
$arrResult['result'] = TNTOfficiel_ParcelsHelper::getInstance()->removeParcel($intParcelID);
} catch (Exception $objException) {
$objFileLogger = new FileLogger();
$objFileLogger->setFilename(_PS_ROOT_DIR_.'/log/'.date('Ymd').'_tnt_exception.log');
$objFileLogger->logError($objException->getMessage());
$arrResult['result'] = false;
}
echo Tools::jsonEncode($arrResult);
return true;
}
/**
* Update a parcel.
*
* @return array
*/
public function displayAjaxUpdateParcel()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$intParcelID = (int)Tools::getValue('parcelId');
$fltWeight = (float)Tools::getValue('weight');
$intOderID = (int)Tools::getValue('orderId');
try {
$arrResult = TNTOfficiel_ParcelsHelper::getInstance()->updateParcel($intParcelID, $fltWeight, $intOderID);
} catch (TNTOfficiel_MaxPackageWeightException $objException) {
$arrResult['result'] = false;
$arrResult['error'] = $objException->getMessage();
} catch (Exception $objException) {
$objFileLogger = new FileLogger();
$objFileLogger->setFilename(_PS_ROOT_DIR_.'/log/'.date('Ymd').'_tnt_exception.log');
$objFileLogger->logError($objException->getMessage());
$arrResult['result'] = false;
}
echo Tools::jsonEncode($arrResult);
return true;
}
/**
* Checks the shipping.
*/
public function displayAjaxCheckShippingDateValid()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$intOrderID = (int)Tools::getValue('orderId');
$strShippingDate = pSQL(Tools::getValue('shippingDate'));
$arrPostDate = explode('/', $strShippingDate);
$strFormatedShippingDate = $arrPostDate[2].'-'.$arrPostDate[1].'-'.$arrPostDate[0];
$objTNTShipmentHelper = TNTOfficiel_ShipmentHelper::getInstance();
$arrMDWShippingDate = $objTNTShipmentHelper->checkSaveShipmentDate($intOrderID, $strFormatedShippingDate);
if (!is_array($arrMDWShippingDate)) {
echo Tools::jsonEncode(array('error' => $arrMDWShippingDate));
return false;
}
if (array_key_exists('error', $arrMDWShippingDate)) {
if ($arrMDWShippingDate['error'] == 1) {
echo Tools::jsonEncode(array('error' => $arrMDWShippingDate['message']));
return false;
} else {
$arrMDWShippingDate['shippingDate'] = $strFormatedShippingDate;
/* $tntDate['dueDate'] = ""; */
}
}
$arrTNTOrder = TNTOfficiel_OrderHelper::getInstance()->getOrderData($intOrderID);
Db::getInstance()->update(
'tntofficiel_order',
array(
'shipping_date' => pSQL($arrMDWShippingDate['shippingDate']),
'due_date' => pSQL($arrMDWShippingDate['dueDate'])
),
'id_tntofficiel_order = '.(int)$arrTNTOrder['id_tntofficiel_order']
);
if (!$arrMDWShippingDate['dueDate']) {
$arrResult = array();
} else {
$tempDate = explode('-', $arrMDWShippingDate['dueDate']);
$arrResult = array('dueDate' => $tempDate[2].'/'.$tempDate[1].'/'.$tempDate[0]);
}
if (array_key_exists('message', $arrMDWShippingDate)) {
$arrResult['mdwMessage'] = $arrMDWShippingDate['message'];
}
echo Tools::jsonEncode($arrResult);
return true;
}
}
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
require_once _PS_MODULE_DIR_.'tntofficiel/tntofficiel.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/TNTOfficiel_Debug.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/TNTOfficiel_PasswordManager.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/helper/TNTOfficiel_ShipmentHelper.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/pdf/manifest/TNTOfficiel_ManifestPDF.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/pdf/manifest/TNTOfficiel_ManifestPDFGenerator.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/pdf/manifest/HTMLTemplateTNTOfficielManifest.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/pdf/manifest/TNTOfficiel_ManifestPDFCreator.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/exceptions/TNTOfficiel_MaxPackageWeightException.php';
// <TABNAME>Controller
class AdminTNTOfficielController extends ModuleAdminController
{
/**
* Constructor.
*/
public function __construct()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
// _PS_MODULE_DIR_.$this->module->name.'/views/templates/admin/'
// default : 'content.tpl';
$this->template = 'AdminTNTOfficiel.tpl';
parent::__construct();
}
/**
* Add css files.
*/
public function setMedia()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$this->addCSS(_MODULE_DIR_.$this->module->name.'/views/css/AdminTNTOfficiel.css', 'all');
$this->addCSS(_MODULE_DIR_.$this->module->name.'/views/css/style.css');
parent::setMedia();
}
/**
* {@inheritdoc}
*/
public function createTemplate($tpl_name)
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$this->context->smarty->assign(array(
'username' => Configuration::get('TNT_CARRIER_USERNAME'),
'account' => Configuration::get('TNT_CARRIER_ACCOUNT'),
'password' => TNTOfficiel_PasswordManager::getHash(),
'middlewareUrl' => Configuration::get('TNT_CARRIER_MIDDLEWARE_SHORT_URL'),
));
if (file_exists($this->getTemplatePath().$tpl_name) && $this->viewAccess()) {
return $this->context->smarty->createTemplate($this->getTemplatePath().$tpl_name, $this->context->smarty);
}
return parent::createTemplate($tpl_name);
}
/**
* Generate the manifest for an order (download).
*/
public function processGetManifest()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$objManifestPDF = new TNTOfficiel_ManifestPDFCreator();
$intOrderID = (int)Tools::getValue('id_order');
$arrOrderIDList = array($intOrderID);
$objManifestPDF->createManifest($arrOrderIDList);
// We want to be sure that displaying PDF is the last thing this controller will do.
exit;
}
/**
* Downloads an archive containing all the logs files.
* /_admin/index.php?controller=AdminTNTOfficiel&action=downloadLogs
*/
public function processDownloadLogs()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$strLogPath = _PS_MODULE_DIR_.TNTOfficiel::MODULE_NAME.'/'.TNTOfficiel::LOG_DIR;
$zipName = 'logs.zip';
// Remove Existing.
if (file_exists($strLogPath.$zipName)) {
unlink($strLogPath.$zipName);
}
// Create Zip file.
TNTOfficiel_Logger::getZip($strLogPath.$zipName);
// Download.
header('Content-Type: application/zip');
header('Content-disposition: attachment; filename='.$zipName);
header('Content-Length: '.filesize($strLogPath.$zipName));
// Get Content.
readfile($strLogPath.$zipName);
// We want to be sure that displaying PDF is the last thing this controller will do.
exit;
}
/**
* Add a parcel.
*
* @return array
*/
public function displayAjaxAddParcel()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$fltWeight = (float)Tools::getValue('weight');
$intOderID = (int)Tools::getValue('orderId');
$arrResult = array();
try {
$arrResult['parcel'] = TNTOfficiel_ParcelsHelper::getInstance()->addParcel($intOderID, $fltWeight, false);
$arrResult['result'] = true;
} catch (TNTOfficiel_MaxPackageWeightException $objException) {
$arrResult['result'] = false;
$arrResult['error'] = $objException->getMessage();
} catch (Exception $objException) {
$objFileLogger = new FileLogger();
$objFileLogger->setFilename(_PS_ROOT_DIR_.'/log/'.date('Ymd').'_tnt_exception.log');
$objFileLogger->logError($objException->getMessage());
$arrResult['result'] = false;
}
echo Tools::jsonEncode($arrResult);
return true;
}
/**
* Remove a parcel.
*
* @return array
*/
public function displayAjaxRemoveParcel()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$intParcelID = (int)Tools::getValue('parcelId');
$arrResult = array();
try {
$arrResult['result'] = TNTOfficiel_ParcelsHelper::getInstance()->removeParcel($intParcelID);
} catch (Exception $objException) {
$objFileLogger = new FileLogger();
$objFileLogger->setFilename(_PS_ROOT_DIR_.'/log/'.date('Ymd').'_tnt_exception.log');
$objFileLogger->logError($objException->getMessage());
$arrResult['result'] = false;
}
echo Tools::jsonEncode($arrResult);
return true;
}
/**
* Update a parcel.
*
* @return array
*/
public function displayAjaxUpdateParcel()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$intParcelID = (int)Tools::getValue('parcelId');
$fltWeight = (float)Tools::getValue('weight');
$intOderID = (int)Tools::getValue('orderId');
try {
$arrResult = TNTOfficiel_ParcelsHelper::getInstance()->updateParcel($intParcelID, $fltWeight, $intOderID);
} catch (TNTOfficiel_MaxPackageWeightException $objException) {
$arrResult['result'] = false;
$arrResult['error'] = $objException->getMessage();
} catch (Exception $objException) {
$objFileLogger = new FileLogger();
$objFileLogger->setFilename(_PS_ROOT_DIR_.'/log/'.date('Ymd').'_tnt_exception.log');
$objFileLogger->logError($objException->getMessage());
$arrResult['result'] = false;
}
echo Tools::jsonEncode($arrResult);
return true;
}
/**
* Checks the shipping.
*/
public function displayAjaxCheckShippingDateValid()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$intOrderID = (int)Tools::getValue('orderId');
$strShippingDate = pSQL(Tools::getValue('shippingDate'));
$arrPostDate = explode('/', $strShippingDate);
$strFormatedShippingDate = $arrPostDate[2].'-'.$arrPostDate[1].'-'.$arrPostDate[0];
$objTNTShipmentHelper = TNTOfficiel_ShipmentHelper::getInstance();
$arrMDWShippingDate = $objTNTShipmentHelper->checkSaveShipmentDate($intOrderID, $strFormatedShippingDate);
if (!is_array($arrMDWShippingDate)) {
echo Tools::jsonEncode(array('error' => $arrMDWShippingDate));
return false;
}
if (array_key_exists('error', $arrMDWShippingDate)) {
if ($arrMDWShippingDate['error'] == 1) {
echo Tools::jsonEncode(array('error' => $arrMDWShippingDate['message']));
return false;
} else {
$arrMDWShippingDate['shippingDate'] = $strFormatedShippingDate;
/* $tntDate['dueDate'] = ""; */
}
}
$arrTNTOrder = TNTOfficiel_OrderHelper::getInstance()->getOrderData($intOrderID);
Db::getInstance()->update(
'tntofficiel_order',
array(
'shipping_date' => pSQL($arrMDWShippingDate['shippingDate']),
'due_date' => pSQL($arrMDWShippingDate['dueDate'])
),
'id_tntofficiel_order = '.(int)$arrTNTOrder['id_tntofficiel_order']
);
if (!$arrMDWShippingDate['dueDate']) {
$arrResult = array();
} else {
$tempDate = explode('-', $arrMDWShippingDate['dueDate']);
$arrResult = array('dueDate' => $tempDate[2].'/'.$tempDate[1].'/'.$tempDate[0]);
}
if (array_key_exists('message', $arrMDWShippingDate)) {
$arrResult['mdwMessage'] = $arrMDWShippingDate['message'];
}
echo Tools::jsonEncode($arrResult);
return true;
}
}

View File

@ -1,160 +1,162 @@
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
require_once _PS_MODULE_DIR_.'tntofficiel/tntofficiel.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/TNTOfficiel_Debug.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/TNTOfficiel_Carrier.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/helper/TNTOfficiel_CarrierHelper.php';
require_once _PS_MODULE_DIR_.'tntofficiel/classes/TNTOfficielCart.php';
class TNTOfficielCarrierModuleFrontController extends ModuleFrontController
{
/**
* TNTOfficielCarrierModuleFrontController constructor.
* Controller always used for AJAX response.
*/
public function __construct()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
parent::__construct();
// No header/footer.
$this->ajax = true;
}
/**
* Store in session the tnt carrier name and store its price.
*
* @return string
*/
public function displayAjaxStoreProductPrice()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$objContext = $this->context;
$objCart = $objContext->cart;
$intCartID = (int)$objCart->id;
$strProductCode = pSQL(Tools::getValue('productCode'));
$objTNTCarrierHelper = TNTOfficiel_CarrierHelper::getInstance();
$arrAvailableTNTCarriers = $objTNTCarrierHelper->getMDWTNTCarrierList($objContext->customer);
$boolCarrierIsValid = false;
$arrTNTCarrier = null;
if (!empty($arrAvailableTNTCarriers) && !empty($arrAvailableTNTCarriers['products'])) {
foreach ($arrAvailableTNTCarriers['products'] as $arrTNTCarrier) {
$arrTNTCarrier['label'] = '';
if (strpos($arrTNTCarrier['type'], 'ENTERPRISE') !== false) {
if (strpos($arrTNTCarrier['code'], 'A') !== false) {
$arrTNTCarrier['label'] = '09:00 Express en Entreprise';
} elseif (strpos($arrTNTCarrier['code'], 'J') !== false) {
$arrTNTCarrier['label'] = 'En entreprise';
} elseif (strpos($arrTNTCarrier['code'], 'M') !== false) {
$arrTNTCarrier['label'] = '12:00 Express en Entreprise';
} elseif (strpos($arrTNTCarrier['code'], 'T') !== false) {
$arrTNTCarrier['label'] = '10:00 Express en Entreprise';
}
} elseif (strpos($arrTNTCarrier['type'], 'INDIVIDUAL') !== false) {
if (strpos($arrTNTCarrier['code'], 'AZ') !== false) {
$arrTNTCarrier['label'] = '09:00 Express à domicile';
} elseif (strpos($arrTNTCarrier['code'], 'JZ') !== false) {
$arrTNTCarrier['label'] = 'À domicile';
} elseif (strpos($arrTNTCarrier['code'], 'MZ') !== false) {
$arrTNTCarrier['label'] = '12:00 Express à domicile';
} elseif (strpos($arrTNTCarrier['code'], 'TZ') !== false) {
$arrTNTCarrier['label'] = '10:00 Express à domicile';
}
} elseif (strpos($arrTNTCarrier['type'], 'DROPOFFPOINT') !== false) {
$arrTNTCarrier['label'] = 'En Relais Colis®';
} elseif (strpos($arrTNTCarrier['type'], 'DEPOT') !== false) {
$arrTNTCarrier['label'] = 'Dépôt restant';
}
// Found current TNT carrier code.
if ($arrTNTCarrier['code'].'_'.$arrTNTCarrier['type'] == $strProductCode) {
// Load TNT cart info or create a new one for it's ID.
$objTNTCartModel = TNTOfficielCart::loadCartID($intCartID);
$boolResult = false;
if (Validate::isLoadedObject($objTNTCartModel)) {
$objTNTCartModel->hydrate(array(
'carrier_code' => $strProductCode,
'carrier_label' => pSQL($arrTNTCarrier['label']),
'delivery_price' => pSQL($arrTNTCarrier['price'])
));
$boolResult = $objTNTCartModel->save();
}
$boolCarrierIsValid = true;
break;
}
}
}
echo Tools::jsonEncode(array(
'result' => $boolCarrierIsValid && $boolResult,
'product' => $arrTNTCarrier,
));
return true;
}
/**
* Check TNT data before payment process.
*
* @return array
*/
public function displayAjaxCheckProductCode()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$objContext = $this->context;
$objCart = $objContext->cart;
//$intCartID = (int)$objCart->id;
//$strCarrierType = pSQL(Tools::getValue('product'));
$arrCarrierCode = (array)Tools::getValue('deliveryOptionTnt');
$strErrorMsg = null;
$arrResult = array(
'error' => 0,
TNTOfficiel::MODULE_NAME => 1
);
if (!$objCart) {
$strErrorMsg = 'No cart object';
} elseif ($objCart->id_carrier == 0) {
$strErrorMsg = 'No carrier selected';
} elseif (!$objCart->id_address_delivery) {
$strErrorMsg = 'No delivery address selected';
}
// If an error.
if ($strErrorMsg !== null) {
$arrResult = array('error' => 1, 'msg' => $strErrorMsg);
} else {
$boolIsTntCarrier = TNTOfficiel_Carrier::isTNTOfficielCarrierID($objCart->id_carrier);
if (!$boolIsTntCarrier) {
// The preselected carrier is not TNT, don't handle.
$arrResult = array('error' => 0, TNTOfficiel::MODULE_NAME => 0);
} elseif (($boolIsTntCarrier && !Tools::getIsset('product'))
|| !$arrCarrierCode
|| !$objCart->delivery_option
) {
// TNT is preselected and no service selected (individual, enterprise, dropoffpoint or depot) -> Error.
$arrResult = array('error' => 1);
}
}
echo Tools::jsonEncode($arrResult);
return true;
}
}
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
require_once _PS_MODULE_DIR_.'tntofficiel/tntofficiel.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/TNTOfficiel_Debug.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/TNTOfficiel_Carrier.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/helper/TNTOfficiel_CarrierHelper.php';
require_once _PS_MODULE_DIR_.'tntofficiel/classes/TNTOfficielCart.php';
class TNTOfficielCarrierModuleFrontController extends ModuleFrontController
{
/**
* TNTOfficielCarrierModuleFrontController constructor.
* Controller always used for AJAX response.
*/
public function __construct()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
parent::__construct();
// No header/footer.
$this->ajax = true;
}
/**
* Store in session the tnt carrier name and store its price.
*
* @return string
*/
public function displayAjaxStoreProductPrice()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$objContext = $this->context;
$objCart = $objContext->cart;
$intCartID = (int)$objCart->id;
$strProductCode = pSQL(Tools::getValue('productCode'));
$objTNTCarrierHelper = TNTOfficiel_CarrierHelper::getInstance();
$arrAvailableTNTCarriers = $objTNTCarrierHelper->getMDWTNTCarrierList($objContext->customer);
$boolCarrierIsValid = false;
$arrTNTCarrier = null;
if (!empty($arrAvailableTNTCarriers) && !empty($arrAvailableTNTCarriers['products'])) {
foreach ($arrAvailableTNTCarriers['products'] as $arrTNTCarrier) {
$arrTNTCarrier['label'] = '';
if (strpos($arrTNTCarrier['type'], 'ENTERPRISE') !== false) {
if (strpos($arrTNTCarrier['code'], 'A') !== false) {
$arrTNTCarrier['label'] = '09:00 Express en Entreprise';
} elseif (strpos($arrTNTCarrier['code'], 'J') !== false) {
$arrTNTCarrier['label'] = 'En entreprise';
} elseif (strpos($arrTNTCarrier['code'], 'M') !== false) {
$arrTNTCarrier['label'] = '12:00 Express en Entreprise';
} elseif (strpos($arrTNTCarrier['code'], 'T') !== false) {
$arrTNTCarrier['label'] = '10:00 Express en Entreprise';
}
} elseif (strpos($arrTNTCarrier['type'], 'INDIVIDUAL') !== false) {
if (strpos($arrTNTCarrier['code'], 'AZ') !== false) {
$arrTNTCarrier['label'] = '09:00 Express à domicile';
} elseif (strpos($arrTNTCarrier['code'], 'JZ') !== false) {
$arrTNTCarrier['label'] = 'À domicile';
} elseif (strpos($arrTNTCarrier['code'], 'MZ') !== false) {
$arrTNTCarrier['label'] = '12:00 Express à domicile';
} elseif (strpos($arrTNTCarrier['code'], 'TZ') !== false) {
$arrTNTCarrier['label'] = '10:00 Express à domicile';
}
} elseif (strpos($arrTNTCarrier['type'], 'DROPOFFPOINT') !== false) {
$arrTNTCarrier['label'] = 'En Relais Colis®';
} elseif (strpos($arrTNTCarrier['type'], 'DEPOT') !== false) {
$arrTNTCarrier['label'] = 'Dépôt restant';
}
// Found current TNT carrier code.
if ($arrTNTCarrier['code'].'_'.$arrTNTCarrier['type'] == $strProductCode) {
// Load TNT cart info or create a new one for it's ID.
$objTNTCartModel = TNTOfficielCart::loadCartID($intCartID);
$boolResult = false;
if (Validate::isLoadedObject($objTNTCartModel)) {
$objTNTCartModel->hydrate(array(
'carrier_code' => $strProductCode,
'carrier_label' => pSQL($arrTNTCarrier['label']),
'delivery_price' => pSQL($arrTNTCarrier['price'])
));
$boolResult = $objTNTCartModel->save();
}
$boolCarrierIsValid = true;
break;
}
}
}
echo Tools::jsonEncode(array(
'result' => $boolCarrierIsValid && $boolResult,
'product' => $arrTNTCarrier,
));
return true;
}
/**
* Check TNT data before payment process.
*
* @return array
*/
public function displayAjaxCheckProductCode()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$objContext = $this->context;
$objCart = $objContext->cart;
//$intCartID = (int)$objCart->id;
//$strCarrierType = pSQL(Tools::getValue('product'));
$arrCarrierCode = (array)Tools::getValue('deliveryOptionTnt');
p($arrCarrierCode);
$strErrorMsg = null;
$arrResult = array(
'error' => 0,
TNTOfficiel::MODULE_NAME => 1
);
if (!$objCart) {
$strErrorMsg = 'No cart object';
} elseif ($objCart->id_carrier == 0) {
$strErrorMsg = 'No carrier selected';
} elseif (!$objCart->id_address_delivery) {
$strErrorMsg = 'No delivery address selected';
}
// If an error.
if ($strErrorMsg !== null) {
$arrResult = array('error' => 1, 'msg' => $strErrorMsg);
} else {
$boolIsTntCarrier = TNTOfficiel_Carrier::isTNTOfficielCarrierID($objCart->id_carrier);
if (!$boolIsTntCarrier) {
// The preselected carrier is not TNT, don't handle.
$arrResult = array('error' => 0, TNTOfficiel::MODULE_NAME => 0);
} elseif (($boolIsTntCarrier && !Tools::getIsset('product'))
|| !$arrCarrierCode
|| !$objCart->delivery_option
) {
// TNT is preselected and no service selected (individual, enterprise, dropoffpoint or depot) -> Error.
$arrResult = array('error' => 1);
}
}
echo Tools::jsonEncode($arrResult);
return true;
}
}

View File

@ -0,0 +1,6 @@
20170914 12:08:38 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170914 12:08:38 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170914 12:10:24 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170914 12:10:24 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170914 12:10:43 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170914 12:10:43 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||

View File

@ -0,0 +1,17 @@
20170919 11:44:24 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170919 11:44:24 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170919 11:45:10 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170919 11:45:10 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170919 11:45:14 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170919 11:45:14 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170919 11:47:34 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170919 11:47:34 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170919 11:47:49 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170919 11:47:49 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170919 11:48:10 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170919 11:48:11 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170919 11:48:11 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170919 11:48:11 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170919 12:30:01 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170919 12:30:02 - 08949425 JSON:getCarrierQuote Error Invalid arguments: Invalid params - error city ||
20170919 12:50:44 - 08949425 JSON:getRelayPoints Error Invalid request/response: City not found or not match with post code ||

View File

@ -212,3 +212,48 @@
20170912 10:46:20 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 10:47:05 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 10:47:09 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 10:50:04 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 10:51:05 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 10:51:09 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 10:51:11 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 10:52:12 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 10:54:09 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 10:54:20 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 11:20:23 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 11:20:32 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 11:35:39 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 11:35:47 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 11:37:40 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 11:39:32 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 11:39:36 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 11:52:04 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 12:06:25 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 12:06:33 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 12:06:45 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 12:07:23 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 12:07:30 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 12:15:24 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 12:16:52 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 12:16:59 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 12:17:55 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 12:18:15 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 12:18:20 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 12:42:53 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 12:42:58 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 12:47:07 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 14:03:18 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 14:03:22 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 14:03:26 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 14:28:22 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 14:28:30 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 14:28:38 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 14:28:46 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 14:28:52 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 14:30:01 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 14:30:29 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 15:58:12 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 16:00:49 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 16:00:57 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 18:01:47 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 18:01:55 - 08949425 SUCCESS JSON:getCarrierQuote
20170912 18:02:03 - 08949425 SUCCESS JSON:getCarrierQuote

View File

@ -0,0 +1,3 @@
20170913 13:57:01 - 08949425 SUCCESS JSON:getCarrierQuote
20170913 14:07:03 - 08949425 SUCCESS JSON:getCarrierQuote
20170913 14:46:40 - 08949425 SUCCESS JSON:getCarrierQuote

View File

@ -0,0 +1,12 @@
20170914 10:08:47 - 08949425 SUCCESS JSON:getCarrierQuote
20170914 10:59:33 - 08949425 SUCCESS JSON:getCarrierQuote
20170914 14:27:30 - 08949425 SUCCESS JSON:getCarrierQuote
20170914 14:33:38 - 08949425 SUCCESS JSON:getCarrierQuote
20170914 14:33:43 - 08949425 SUCCESS JSON:getCarrierQuote
20170914 14:34:00 - 08949425 SUCCESS JSON:getCarrierQuote
20170914 14:34:10 - 08949425 SUCCESS JSON:getCarrierQuote
20170914 17:04:11 - 08949425 SUCCESS JSON:getCarrierQuote
20170914 17:22:22 - 08949425 SUCCESS JSON:getCarrierQuote
20170914 17:22:27 - 08949425 SUCCESS JSON:getCarrierQuote
20170914 17:22:59 - 08949425 SUCCESS JSON:getCarrierQuote
20170914 17:28:22 - 08949425 SUCCESS JSON:getCarrierQuote

View File

@ -0,0 +1,2 @@
20170915 10:13:51 - 08949425 SUCCESS JSON:getCarrierQuote
20170915 10:14:06 - 08949425 SUCCESS JSON:getCarrierQuote

View File

@ -0,0 +1,15 @@
20170918 09:13:26 - 08949425 SUCCESS JSON:getCarrierQuote
20170918 09:51:47 - 08949425 SUCCESS JSON:getCarrierQuote
20170918 09:52:20 - 08949425 SUCCESS JSON:getCarrierQuote
20170918 09:52:41 - 08949425 SUCCESS JSON:getCarrierQuote
20170918 09:53:06 - 08949425 SUCCESS JSON:getCarrierQuote
20170918 09:53:10 - 08949425 SUCCESS JSON:getCarrierQuote
20170918 16:15:38 - 08949425 SUCCESS JSON:getCarrierQuote
20170918 16:15:46 - 08949425 SUCCESS JSON:getCarrierQuote
20170918 16:15:55 - 08949425 SUCCESS JSON:getCarrierQuote
20170918 16:48:44 - 08949425 SUCCESS JSON:getCarrierQuote
20170918 16:48:50 - 08949425 SUCCESS JSON:getCarrierQuote
20170918 16:49:08 - 08949425 SUCCESS JSON:getCarrierQuote
20170918 18:25:16 - 08949425 SUCCESS JSON:getCarrierQuote
20170918 18:25:22 - 08949425 SUCCESS JSON:getCarrierQuote
20170918 18:25:30 - 08949425 SUCCESS JSON:getCarrierQuote

View File

@ -0,0 +1,347 @@
20170919 08:40:22 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:40:55 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:42:25 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:42:31 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:42:48 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:43:36 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:47:13 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:48:20 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:48:32 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:49:12 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:52:40 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:52:57 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:53:29 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:54:31 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:54:32 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:54:33 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:54:34 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:54:36 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:55:04 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:55:05 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:55:07 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:55:15 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:55:15 - 08949425 SUCCESS JSON:testCity
20170919 08:55:16 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:55:23 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:55:24 - 08949425 SUCCESS JSON:getRelayPoints
20170919 08:55:24 - 08949425 SUCCESS JSON:getCities
20170919 08:55:35 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:55:36 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:56:07 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:56:08 - 08949425 SUCCESS JSON:testCity
20170919 08:56:08 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:56:13 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:56:14 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:56:25 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:56:26 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:56:37 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:56:41 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 08:56:42 - 08949425 SUCCESS JSON:getShippingDate
20170919 08:56:42 - 08949425 SUCCESS JSON:checkSaveShipment
20170919 08:56:44 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:05:36 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:05:42 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:05:43 - 08949425 SUCCESS JSON:testCity
20170919 09:05:43 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:06:26 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:07:02 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:07:11 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:14:02 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:14:10 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:14:25 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:16:14 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:16:39 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:16:49 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:16:59 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:18:09 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:20:31 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:20:44 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:22:01 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:24:55 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:25:03 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 09:33:03 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:16:36 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:16:37 - 08949425 SUCCESS JSON:testCity
20170919 10:16:37 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:16:57 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:17:26 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:17:27 - 08949425 SUCCESS JSON:testCity
20170919 10:17:27 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:17:40 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:17:40 - 08949425 SUCCESS JSON:getRelayPoints
20170919 10:17:40 - 08949425 SUCCESS JSON:getCities
20170919 10:17:53 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:17:54 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:18:38 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:18:52 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:19:12 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:19:19 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:19:34 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:19:55 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:22:43 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:23:04 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:23:25 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:23:58 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:24:05 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:26:58 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:27:02 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:27:06 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:27:12 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:29:13 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:36:03 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:36:22 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:38:31 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:38:44 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:38:55 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:39:14 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:39:38 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:39:49 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:40:28 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:40:37 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:41:27 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:44:15 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:44:26 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:47:27 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:49:26 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:50:32 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:50:32 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:50:35 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 10:52:24 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:05:12 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:07:45 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:07:50 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:12:22 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:12:29 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:12:58 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:13:19 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:13:27 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:14:17 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:14:28 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:16:03 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:16:15 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:16:54 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:18:13 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:18:27 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:18:41 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:21:24 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:42:31 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:43:00 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:43:00 - 08949425 SUCCESS JSON:testCity
20170919 11:43:01 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:43:20 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:43:21 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:43:37 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:43:39 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 11:48:11 - 08949425 SUCCESS JSON:testCity
20170919 11:53:21 - info@chocolatdevenement.com SUCCESS JSON:isCorrectAuthentication
20170919 11:53:35 - CHOCOLATS ou Chocolat d\'evenement OP SUCCESS JSON:isCorrectAuthentication
20170919 11:53:49 - 08949425 SUCCESS JSON:isCorrectAuthentication
20170919 12:29:03 - 08949425 SUCCESS JSON:isCorrectAuthentication
20170919 12:29:14 - info@chocolatdevenement.com SUCCESS JSON:isCorrectAuthentication
20170919 12:29:25 - 08949425 SUCCESS JSON:isCorrectAuthentication
20170919 12:30:36 - 08949425 SUCCESS JSON:testCity
20170919 12:35:40 - 08949425 SUCCESS JSON:getShippingDate
20170919 12:35:41 - 08949425 SUCCESS JSON:checkSaveShipment
20170919 12:36:02 - 08949425 SUCCESS JSON:checkSaveShipment
20170919 12:36:10 - 08949425 SUCCESS JSON:checkSaveShipment
20170919 12:36:12 - 08949425 SUCCESS JSON:getShippingDate
20170919 12:36:12 - 08949425 SUCCESS JSON:checkSaveShipment
20170919 12:39:09 - 08949425 SUCCESS JSON:testCity
20170919 12:39:35 - 08949425 SUCCESS JSON:testCity
20170919 12:39:35 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 12:40:42 - 08949425 SUCCESS JSON:testCity
20170919 12:40:43 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 12:41:19 - 08949425 SUCCESS JSON:testCity
20170919 12:41:19 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 12:41:24 - 08949425 SUCCESS JSON:getRelayPoints
20170919 12:41:24 - 08949425 SUCCESS JSON:getCities
20170919 12:41:40 - 08949425 SUCCESS JSON:testCity
20170919 12:41:41 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 12:42:26 - 08949425 SUCCESS JSON:testCity
20170919 12:42:26 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 12:44:11 - 08949425 SUCCESS JSON:testCity
20170919 12:44:11 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 12:44:20 - 08949425 SUCCESS JSON:getRelayPoints
20170919 12:44:20 - 08949425 SUCCESS JSON:getCities
20170919 12:44:29 - 08949425 SUCCESS JSON:getRelayPoints
20170919 12:44:29 - 08949425 SUCCESS JSON:getCities
20170919 12:45:27 - 08949425 SUCCESS JSON:testCity
20170919 12:45:27 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 12:45:33 - 08949425 SUCCESS JSON:getRelayPoints
20170919 12:45:33 - 08949425 SUCCESS JSON:getCities
20170919 12:46:28 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 12:47:04 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 12:47:14 - 08949425 SUCCESS JSON:getRelayPoints
20170919 12:47:14 - 08949425 SUCCESS JSON:getCities
20170919 12:47:44 - 08949425 SUCCESS JSON:getRelayPoints
20170919 12:47:44 - 08949425 SUCCESS JSON:getCities
20170919 12:47:55 - 08949425 SUCCESS JSON:getRelayPoints
20170919 12:47:55 - 08949425 SUCCESS JSON:getCities
20170919 12:50:12 - 08949425 SUCCESS JSON:testCity
20170919 12:50:12 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 12:50:20 - 08949425 SUCCESS JSON:getRelayPoints
20170919 12:50:20 - 08949425 SUCCESS JSON:getCities
20170919 12:50:31 - 08949425 SUCCESS JSON:getRelayPoints
20170919 12:50:32 - 08949425 SUCCESS JSON:getCities
20170919 12:50:33 - 08949425 SUCCESS JSON:getRelayPoints
20170919 12:50:33 - 08949425 SUCCESS JSON:getCities
20170919 12:50:37 - 08949425 SUCCESS JSON:getRelayPoints
20170919 12:50:37 - 08949425 SUCCESS JSON:getCities
20170919 12:50:44 - 08949425 SUCCESS JSON:getCities
20170919 12:50:47 - 08949425 SUCCESS JSON:getRelayPoints
20170919 12:50:47 - 08949425 SUCCESS JSON:getCities
20170919 12:50:58 - 08949425 SUCCESS JSON:getRelayPoints
20170919 12:50:58 - 08949425 SUCCESS JSON:getCities
20170919 12:55:05 - 08949425 SUCCESS JSON:testCity
20170919 12:55:06 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 12:55:38 - 08949425 SUCCESS JSON:testCity
20170919 12:55:38 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 12:55:44 - 08949425 SUCCESS JSON:getRelayPoints
20170919 12:55:44 - 08949425 SUCCESS JSON:getCities
20170919 12:56:05 - 08949425 SUCCESS JSON:testCity
20170919 12:56:06 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 12:56:13 - 08949425 SUCCESS JSON:getRelayPoints
20170919 12:56:13 - 08949425 SUCCESS JSON:getCities
20170919 12:56:36 - 08949425 SUCCESS JSON:testCity
20170919 12:56:37 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 12:57:36 - 08949425 SUCCESS JSON:isCorrectAuthentication
20170919 12:59:52 - 08949425 SUCCESS JSON:testCity
20170919 12:59:53 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 13:00:33 - 08949425 SUCCESS JSON:testCity
20170919 13:00:33 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 13:00:54 - 08949425 SUCCESS JSON:getShippingDate
20170919 13:00:54 - 08949425 SUCCESS JSON:checkSaveShipment
20170919 13:01:05 - 08949425 SUCCESS JSON:getShippingDate
20170919 13:01:06 - 08949425 SUCCESS JSON:checkSaveShipment
20170919 13:03:58 - 08949425 SUCCESS JSON:testCity
20170919 13:03:59 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 13:04:08 - 08949425 SUCCESS JSON:getRelayPoints
20170919 13:04:08 - 08949425 SUCCESS JSON:getCities
20170919 13:04:25 - 08949425 SUCCESS JSON:getShippingDate
20170919 13:04:25 - 08949425 SUCCESS JSON:checkSaveShipment
20170919 13:04:36 - 08949425 SUCCESS JSON:getShippingDate
20170919 13:04:37 - 08949425 SUCCESS JSON:checkSaveShipment
20170919 13:07:29 - 08949425 SUCCESS JSON:getShippingDate
20170919 13:07:29 - 08949425 SUCCESS JSON:checkSaveShipment
20170919 14:37:48 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:38:01 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:38:02 - 08949425 SUCCESS JSON:testCity
20170919 14:38:03 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:38:30 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:38:30 - 08949425 SUCCESS JSON:testCity
20170919 14:38:31 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:44:35 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:44:35 - 08949425 SUCCESS JSON:getRelayPoints
20170919 14:44:35 - 08949425 SUCCESS JSON:getCities
20170919 14:44:38 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:44:40 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:44:40 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:44:42 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:44:54 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:45:02 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:45:03 - 08949425 SUCCESS JSON:getRelayPoints
20170919 14:45:03 - 08949425 SUCCESS JSON:getCities
20170919 14:45:10 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:45:11 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:45:19 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:45:28 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:45:30 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:49:52 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:49:52 - 08949425 SUCCESS JSON:testCity
20170919 14:49:53 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:50:00 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:50:01 - 08949425 SUCCESS JSON:getRelayPoints
20170919 14:50:01 - 08949425 SUCCESS JSON:getCities
20170919 14:50:05 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:50:07 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:50:16 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:50:17 - 08949425 SUCCESS JSON:getRelayPoints
20170919 14:50:17 - 08949425 SUCCESS JSON:getCities
20170919 14:50:20 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:50:22 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:50:24 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:50:26 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:50:41 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:50:45 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:50:49 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:50:56 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:51:01 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:51:05 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:51:05 - 08949425 SUCCESS JSON:testCity
20170919 14:51:06 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:51:12 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:51:15 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:51:15 - 08949425 SUCCESS JSON:getRelayPoints
20170919 14:51:15 - 08949425 SUCCESS JSON:getCities
20170919 14:51:29 - 08949425 SUCCESS JSON:getShippingDate
20170919 14:51:30 - 08949425 SUCCESS JSON:checkSaveShipment
20170919 14:51:47 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:51:48 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:51:52 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:51:54 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:53:08 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:53:13 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:53:37 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 14:57:01 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:18:09 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:18:18 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:18:48 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:19:14 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:19:20 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:19:27 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:19:35 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:19:44 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:20:48 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:21:15 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:21:49 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:22:18 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:22:33 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:23:02 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:24:43 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:24:56 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:35:23 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:40:48 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:43:37 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:45:02 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:45:17 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:45:44 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:46:13 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:48:02 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:48:03 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:48:19 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:48:23 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:48:24 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:48:24 - 08949425 SUCCESS JSON:testCity
20170919 15:48:25 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:48:25 - 08949425 SUCCESS JSON:testCity
20170919 15:48:26 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:48:26 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:48:50 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:49:02 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:51:04 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:53:50 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:54:22 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:57:03 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:58:41 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 15:59:00 - 08949425 SUCCESS JSON:getShippingDate
20170919 15:59:02 - 08949425 SUCCESS JSON:checkSaveShipment
20170919 15:59:10 - 08949425 SUCCESS JSON:checkSaveShipment
20170919 16:02:00 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:02:25 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:02:57 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:31:26 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:31:34 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:31:40 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:35:18 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:35:26 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:35:34 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:35:45 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:37:22 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:37:43 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:39:40 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:41:29 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:44:57 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:45:26 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:46:04 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:46:33 - 08949425 SUCCESS JSON:getCarrierQuote
20170919 16:47:33 - 08949425 SUCCESS JSON:getCarrierQuote

View File

@ -0,0 +1,16 @@
20170919 11:50:44 Starting TNT module install
20170919 11:50:45 parent::install OK
20170919 11:50:45 updateSettings OK
20170919 11:50:45 register hooks OK
20170919 11:50:45 create tab OK
20170919 11:50:45 create database tables OK
20170919 11:50:45 install carrier OK
20170919 11:50:45 override templates KO
20170919 12:27:32 Starting TNT module install
20170919 12:27:33 parent::install OK
20170919 12:27:33 updateSettings OK
20170919 12:27:33 register hooks OK
20170919 12:27:33 create tab OK
20170919 12:27:33 create database tables OK
20170919 12:27:33 install carrier OK
20170919 12:27:33 override templates KO

View File

@ -0,0 +1,16 @@
20170919 11:50:41 Starting TNT module uninstall
20170919 11:50:41 unoverride templates OK
20170919 11:50:41 Unregister hooks OK
20170919 11:50:41 Delete tab OK
20170919 11:50:41 Delete TNT carrier OK
20170919 11:50:41 Delete settings OK
20170919 11:50:44 Parent::uninstall OK
20170919 11:50:44 TNT module uninstall complete
20170919 11:59:45 Starting TNT module uninstall
20170919 11:59:45 unoverride templates OK
20170919 11:59:45 Unregister hooks OK
20170919 11:59:45 Delete tab OK
20170919 11:59:45 Delete TNT carrier OK
20170919 11:59:45 Delete settings OK
20170919 11:59:45 Parent::uninstall OK
20170919 11:59:45 TNT module uninstall complete

View File

@ -1,498 +1,499 @@
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
class AdminOrdersController extends AdminOrdersControllerCore
{
private $carriers_array = array();
public function __construct()
{
// Warning : Dependencies on construct implies to do not create static method using TNTOfficiel class !
require_once _PS_MODULE_DIR_.'tntofficiel/tntofficiel.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/TNTOfficiel_Debug.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/TNTOfficiel_Carrier.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/helper/TNTOfficiel_OrderHelper.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/helper/TNTOfficiel_ShipmentHelper.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/pdf/manifest/TNTOfficiel_ManifestPDFCreator.php';
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
parent::__construct();
$this->bootstrap = true;
$this->table = 'order';
$this->className = 'Order';
$this->lang = false;
$this->addRowAction('view');
$this->explicitSelect = true;
$this->allow_export = true;
$this->deleted = false;
$this->context = Context::getContext();
$this->_select = '
a.id_currency,
a.id_order AS id_pdf,
CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
osl.`name` AS `osname`,
os.`color`,
`to`.`bt_filename` AS `BT`,
`to`.`id_order` as `tntofficiel_id_order`,
`to`.`pickup_number` as `tntofficiel_pickup_number`,
IF((`to`.`carrier_label` IS NULL OR `to`.`carrier_label` = ""),
c1.`name`,
CONCAT(c1.`name` ,\' (\', `to`.`carrier_label`,\')\')) AS `carrier`,
c1.`id_carrier` as id_carrier,
IF((SELECT so.id_order
FROM `'._DB_PREFIX_.'orders` so
WHERE so.id_customer = a.id_customer AND so.id_order < a.id_order LIMIT 1) > 0,
0,
1) as new,
country_lang.name as cname,
IF(a.valid, 1, 0) badge_success';
$this->_join = '
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)
LEFT JOIN `'._DB_PREFIX_.'tntofficiel_order` `to` ON (a.`id_order` = `to`.`id_order`)
INNER JOIN `'._DB_PREFIX_.'carrier` c1 ON (a.`id_carrier` = c1.`id_carrier`)
INNER JOIN `'._DB_PREFIX_.'address` address ON address.id_address = a.id_address_delivery
INNER JOIN `'._DB_PREFIX_.'country` country ON address.id_country = country.id_country
INNER JOIN `'._DB_PREFIX_.'country_lang` country_lang
ON (country.`id_country` = country_lang.`id_country`
AND country_lang.`id_lang` = '.(int)$this->context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = a.`current_state`)
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl
ON (os.`id_order_state` = osl.`id_order_state`
AND osl.`id_lang` = '.(int)$this->context->language->id.')';
$this->_orderBy = 'id_order';
$this->_orderWay = 'DESC';
$statuses = OrderState::getOrderStates((int)$this->context->language->id);
foreach ($statuses as $status) {
$this->statuses_array[$status['id_order_state']] = $status['name'];
}
$carriers = Carrier::getCarriers(
(int)$this->context->language->id,
false,
false,
false,
null,
Carrier::ALL_CARRIERS
);
foreach ($carriers as $carrier) {
$this->carriers_array[$carrier['id_carrier']] = $carrier['name'];
}
$this->fields_list = array(
'id_order' => array(
'title' => $this->l('ID'),
'align' => 'text-center',
'class' => 'fixed-width-xs',
),
'reference' => array(
'title' => $this->l('Reference'),
),
'new' => array(
'title' => $this->l('New client'),
'align' => 'text-center',
'type' => 'bool',
'tmpTableFilter' => true,
'orderby' => false,
'callback' => 'printNewCustomer',
),
'customer' => array(
'title' => $this->l('Customer'),
'havingFilter' => true,
),
'carrier' => array(
'title' => $this->l('Carrier'),
'filter_key' => 'c1!id_carrier',
'filter_type' => 'int',
'order_key' => 'carrier',
'havingFilter' => true,
'type' => 'select',
'list' => $this->carriers_array,
),
);
if (Configuration::get('PS_B2B_ENABLE')) {
$this->fields_list = array_merge(
$this->fields_list,
array(
'company' => array(
'title' => $this->l('Company'),
'filter_key' => 'c!company',
),
)
);
}
$this->fields_list = array_merge(
$this->fields_list,
array(
'total_paid_tax_incl' => array(
'title' => $this->l('Total'),
'align' => 'text-right',
'type' => 'price',
'currency' => true,
'callback' => 'setOrderCurrency',
'badge_success' => true,
),
'payment' => array(
'title' => $this->l('Payment'),
),
'osname' => array(
'title' => $this->l('Status'),
'type' => 'select',
'color' => 'color',
'list' => $this->statuses_array,
'filter_key' => 'os!id_order_state',
'filter_type' => 'int',
'order_key' => 'osname',
),
'date_add' => array(
'title' => $this->l('Date'),
'align' => 'text-right',
'type' => 'datetime',
'filter_key' => 'a!date_add',
),
'id_pdf' => array(
'title' => $this->l('PDF'),
'align' => 'text-center',
'callback' => 'printPDFIcons',
'orderby' => false,
'search' => false,
'remove_onclick' => true,
),
'tntofficiel_id_order' => array(
'title' => $this->l('TNT'),
'align' => 'text-right',
'orderby' => false,
'search' => false,
'callback' => 'printBtIcon',
'remove_onclick' => true,
)
)
);
if (Configuration::get('TNT_CARRIER_PICKUP_NUMBER_SHOW')) {
$this->fields_list = array_merge(
$this->fields_list,
array(
'tntofficiel_pickup_number' => array(
'title' => $this->l('N° de Ramassage'),
'align' => 'text-right',
'orderby' => false,
'search' => false,
),
)
);
}
if (Country::isCurrentlyUsed('country', true)) {
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT DISTINCT c.id_country, cl.`name`
FROM `'._DB_PREFIX_.'orders` o
'.Shop::addSqlAssociation('orders', 'o').'
INNER JOIN `'._DB_PREFIX_.'address` a ON a.id_address = o.id_address_delivery
INNER JOIN `'._DB_PREFIX_.'country` c ON a.id_country = c.id_country
INNER JOIN `'._DB_PREFIX_.'country_lang` cl
ON (c.`id_country` = cl.`id_country`
AND cl.`id_lang` = '.(int)$this->context->language->id.')
ORDER BY cl.name ASC');
$country_array = array();
foreach ($result as $row) {
$country_array[$row['id_country']] = $row['name'];
}
$part1 = array_slice($this->fields_list, 0, 3);
$part2 = array_slice($this->fields_list, 3);
$part1['cname'] = array(
'title' => $this->l('Delivery'),
'type' => 'select',
'list' => $country_array,
'filter_key' => 'country!id_country',
'filter_type' => 'int',
'order_key' => 'cname',
);
$this->fields_list = array_merge($part1, $part2);
}
$this->shopLinkType = 'shop';
$this->shopShareDatas = Shop::SHARE_ORDER;
if (Tools::isSubmit('id_order')) {
$intOrderID = (int)Tools::getValue('id_order');
$objOrder = new Order($intOrderID);
$this->context->cart = new Cart($objOrder->id_cart);
$this->context->customer = new Customer($objOrder->id_customer);
}
$this->bulk_actions = array(
'updateOrderStatus' => array(
'text' => $this->l('Change Order Status'),
'icon' => 'icon-refresh',
),
'getBT' => array(
'text' => $this->l('Bon de transport de TNT'),
'icon' => 'icon-AdminTNTOfficiel',
),
'getManifest' => array(
'text' => $this->l('Manifeste TNT'),
'icon' => 'icon-file-text',
),
);
}
/**
* @param $orderId
*
* @return mixed
*/
public function printBtIcon($orderId)
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$arrTNTOrder = TNTOfficiel_OrderHelper::getInstance()->getOrderData($orderId);
$this->context->smarty->assign(array(
'bt_filename' => $arrTNTOrder['bt_filename'],
'getManifestUrl' => $this->context->link->getAdminLink('AdminTNTOfficiel').'&action=getManifest',
));
return $this->context->smarty->fetch(_PS_MODULE_DIR_.'tntofficiel/views/templates/admin/_print_bt_icon.tpl');
}
/**
* Return all the BT for the selected orders.
*/
public function processBulkGetBT()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
if (Module::isInstalled(TNTOfficiel::MODULE_NAME)) {
$arrOrderID = (array)Tools::getValue('orderBox');
$orderList = array();
foreach ($arrOrderID as $strOrderID) {
$intOrderID = (int)$strOrderID;
$objOrder = new Order($intOrderID);
// Check if it's a tnt order.
if (TNTOfficiel_Carrier::isTNTOfficielCarrierID($objOrder->id_carrier)) {
$orderList[] = $intOrderID;
}
}
TNTOfficiel_OrderHelper::getInstance()->getBt($orderList);
}
}
/**
* Return all the BT for the selected orders.
*/
public function processBulkGetManifest()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$arrOrderIDList = array();
if (!Tools::getIsset('orderBox')) {
return;
}
$arrOrderID = (array)Tools::getValue('orderBox');
foreach ($arrOrderID as $strOrderID) {
$intOrderID = (int)$strOrderID;
$arrOrderIDList[] = $intOrderID;
}
$manifest = new TNTOfficiel_ManifestPDFCreator();
$manifest->createManifest($arrOrderIDList);
}
public function processBulkUpdateOrderStatus()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$intOrderState = (int)Tools::getValue('id_order_state');
if (Tools::isSubmit('submitUpdateOrderStatus') && $intOrderState) {
if ($this->tabAccess['edit'] !== '1') {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
} else {
$objOrderState = new OrderState($intOrderState);
if (!Validate::isLoadedObject($objOrderState)) {
$this->errors[] = sprintf(Tools::displayError('Order status #%d cannot be loaded'), $intOrderState);
} else {
$arrOrderID = (array)Tools::getValue('orderBox');
foreach ($arrOrderID as $strOrderID) {
$intOrderID = (int)$strOrderID;
$objOrder = new Order($intOrderID);
if (!Validate::isLoadedObject($objOrder)) {
$this->errors[] = sprintf(Tools::displayError('Order #%d cannot be loaded'), $intOrderID);
} else {
/* Override start */
if (TNTOfficiel_Carrier::isTNTOfficielCarrierID($objOrder->id_carrier)
&& $objOrderState->id == Configuration::get('PS_OS_SHIPPING')
) {
$arrTNTOrder = TNTOfficiel_OrderHelper::getInstance()->getOrderData($objOrder->id);
if ($arrTNTOrder['shipping_date'] && !$arrTNTOrder['is_shipped']) {
$objTNTShipmentHelper = TNTOfficiel_ShipmentHelper::getInstance();
$arrMDWShippingDate = $objTNTShipmentHelper->checkSaveShipmentDate(
$objOrder->id,
$arrTNTOrder['shipping_date']
);
if (array_key_exists('error', $arrMDWShippingDate)
&& $arrMDWShippingDate['error'] == 1
) {
$arrMDWShippingDate = $objTNTShipmentHelper->getNewShippingDate($objOrder->id);
if (!$arrMDWShippingDate) {
$this->errors[] = sprintf(
Tools::displayError('Cannot change status for order #%d.'),
$intOrderID
);
continue;
}
$tempDate = new DateTime('today');
$startDate = $tempDate->format('Y-m-d');
Db::getInstance()->update(
'tntofficiel_order',
array(
'shipping_date' => pSQL($arrMDWShippingDate['shippingDate']),
'due_date' => pSQL($arrMDWShippingDate['dueDate']),
'start_date' => pSQL($startDate),
),
'id_tntofficiel_order = '.(int)$arrTNTOrder['id_tntofficiel_order']
);
}
} elseif (!$arrTNTOrder['shipping_date'] && !$arrTNTOrder['is_shipped']) {
$this->errors[] = sprintf(
Tools::displayError('Cannot change status for order #%d.'),
$intOrderID
);
continue;
}
}
/* Override end */
$current_order_state = $objOrder->getCurrentOrderState();
if ($current_order_state->id == $objOrderState->id) {
$this->errors[] = $this->displayWarning(
sprintf('Order #%d has already been assigned this status.', $intOrderID)
);
} else {
$history = new OrderHistory();
$history->id_order = $objOrder->id;
$history->id_employee = (int)$this->context->employee->id;
$use_existings_payment = !$objOrder->hasInvoice();
$history->changeIdOrderState(
(int)$objOrderState->id,
$objOrder,
$use_existings_payment
);
$carrier = new Carrier($objOrder->id_carrier, $objOrder->id_lang);
$templateVars = array();
if ($history->id_order_state == Configuration::get('PS_OS_SHIPPING')
&& $objOrder->shipping_number
) {
$templateVars = array(
'{followup}' => str_replace('@', $objOrder->shipping_number, $carrier->url)
);
}
if ($history->addWithemail(true, $templateVars)) {
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
foreach ($objOrder->getProducts() as $product) {
if (StockAvailable::dependsOnStock($product['product_id'])) {
StockAvailable::synchronize(
$product['product_id'],
(int)$product['id_shop']
);
}
}
}
} else {
$this->errors[] = sprintf(
Tools::displayError('Cannot change status for order #%d.'),
$intOrderID
);
}
}
}
}
}
}
if (!count($this->errors)) {
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
}
}
}
/* public function printNewCustomer($tr)
{
return ($tr['new'] ? $this->l('Yes') : $this->l('No'));
} */
public function postProcess()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$objContext = Context::getContext();
// See hookActionOrderStatusUpdate.
$objCookie = $objContext->cookie;
$isTntInstalled = false;
if (Module::isInstalled(TNTOfficiel::MODULE_NAME)) {
$isTntInstalled = true;
$module = Module::getInstanceByName(TNTOfficiel::MODULE_NAME);
}
if (Tools::isSubmit('id_order')) {
$intOrderID = (int)Tools::getValue('id_order');
if ($intOrderID > 0) {
$objOrder = new Order($intOrderID);
if (!Validate::isLoadedObject($objOrder)) {
$this->errors[] = Tools::displayError('The order cannot be found within your database.');
}
ShopUrl::cacheMainDomainForShop((int)$objOrder->id_shop);
if (!Tools::isSubmit('submitState') && $isTntInstalled) {
if ($module->updateShippingDate($objOrder) === false) {
$objCookie->saveShippingError = $this->l('Impossible de récupérer une date de ramassage');
}
}
}
}
if (Tools::isSubmit('submitState') && isset($objOrder) && $isTntInstalled) {
if (TNTOfficiel_Carrier::isTNTOfficielCarrierID($objOrder->id_carrier)) {
$arrTNTOrder = TNTOfficiel_OrderHelper::getInstance()->getOrderData($objOrder->id);
if ($arrTNTOrder['shipping_date'] && !$arrTNTOrder['is_shipped']) {
$objTNTShipmentHelper = TNTOfficiel_ShipmentHelper::getInstance();
$arrMDWShippingDate = $objTNTShipmentHelper->checkSaveShipmentDate(
$objOrder->id,
$arrTNTOrder['shipping_date']
);
if (array_key_exists('error', $arrMDWShippingDate)) {
if ($arrMDWShippingDate['error'] == 1) {
$objCookie->saveShippingError = $this->l('Erreur : '.$arrMDWShippingDate['message']);
return;
}
$objCookie->saveShippingError = $this->l('Attention : '.$arrMDWShippingDate['message']);
}
} elseif (!$arrTNTOrder['shipping_date'] && !$arrTNTOrder['is_shipped']) {
$objCookie->saveShippingError = $this->l('Erreur : Choisir une date de ramassage');
return;
}
}
}
parent::postProcess();
}
}
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
class AdminOrdersController extends AdminOrdersControllerCore
{
private $carriers_array = array();
public function __construct()
{
// Warning : Dependencies on construct implies to do not create static method using TNTOfficiel class !
require_once _PS_MODULE_DIR_.'tntofficiel/tntofficiel.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/TNTOfficiel_Debug.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/TNTOfficiel_Carrier.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/helper/TNTOfficiel_OrderHelper.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/helper/TNTOfficiel_ShipmentHelper.php';
require_once _PS_MODULE_DIR_.'tntofficiel/libraries/pdf/manifest/TNTOfficiel_ManifestPDFCreator.php';
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
parent::__construct();
$this->bootstrap = true;
$this->table = 'order';
$this->className = 'Order';
$this->lang = false;
$this->addRowAction('view');
$this->explicitSelect = true;
$this->allow_export = true;
$this->deleted = false;
$this->context = Context::getContext();
$this->_select = '
a.id_currency,
a.id_order AS id_pdf,
CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
osl.`name` AS `osname`,
os.`color`,
`to`.`bt_filename` AS `BT`,
`to`.`id_order` as `tntofficiel_id_order`,
`to`.`pickup_number` as `tntofficiel_pickup_number`,
IF((`to`.`carrier_label` IS NULL OR `to`.`carrier_label` = ""),
c1.`name`,
CONCAT(c1.`name` ,\' (\', `to`.`carrier_label`,\')\')) AS `carrier`,
c1.`id_carrier` as id_carrier,
IF((SELECT so.id_order
FROM `'._DB_PREFIX_.'orders` so
WHERE so.id_customer = a.id_customer AND so.id_order < a.id_order LIMIT 1) > 0,
0,
1) as new,
country_lang.name as cname,
IF(a.valid, 1, 0) badge_success';
$this->_join = '
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)
LEFT JOIN `'._DB_PREFIX_.'tntofficiel_order` `to` ON (a.`id_order` = `to`.`id_order`)
INNER JOIN `'._DB_PREFIX_.'carrier` c1 ON (a.`id_carrier` = c1.`id_carrier`)
INNER JOIN `'._DB_PREFIX_.'address` address ON address.id_address = a.id_address_delivery
INNER JOIN `'._DB_PREFIX_.'country` country ON address.id_country = country.id_country
INNER JOIN `'._DB_PREFIX_.'country_lang` country_lang
ON (country.`id_country` = country_lang.`id_country`
AND country_lang.`id_lang` = '.(int)$this->context->language->id.')
LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = a.`current_state`)
LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl
ON (os.`id_order_state` = osl.`id_order_state`
AND osl.`id_lang` = '.(int)$this->context->language->id.')';
$this->_orderBy = 'id_order';
$this->_orderWay = 'DESC';
$statuses = OrderState::getOrderStates((int)$this->context->language->id);
foreach ($statuses as $status) {
$this->statuses_array[$status['id_order_state']] = $status['name'];
}
$carriers = Carrier::getCarriers(
(int)$this->context->language->id,
false,
false,
false,
null,
Carrier::ALL_CARRIERS
);
foreach ($carriers as $carrier) {
$this->carriers_array[$carrier['id_carrier']] = $carrier['name'];
}
$this->fields_list = array(
'id_order' => array(
'title' => $this->l('ID'),
'align' => 'text-center',
'class' => 'fixed-width-xs',
),
'reference' => array(
'title' => $this->l('Reference'),
),
'new' => array(
'title' => $this->l('New client'),
'align' => 'text-center',
'type' => 'bool',
'tmpTableFilter' => true,
'orderby' => false,
'callback' => 'printNewCustomer',
),
'customer' => array(
'title' => $this->l('Customer'),
'havingFilter' => true,
),
'carrier' => array(
'title' => $this->l('Carrier'),
'filter_key' => 'c1!id_carrier',
'filter_type' => 'int',
'order_key' => 'carrier',
'havingFilter' => true,
'type' => 'select',
'list' => $this->carriers_array,
),
);
if (Configuration::get('PS_B2B_ENABLE')) {
$this->fields_list = array_merge(
$this->fields_list,
array(
'company' => array(
'title' => $this->l('Company'),
'filter_key' => 'c!company',
),
)
);
}
$this->fields_list = array_merge(
$this->fields_list,
array(
'total_paid_tax_incl' => array(
'title' => $this->l('Total'),
'align' => 'text-right',
'type' => 'price',
'currency' => true,
'callback' => 'setOrderCurrency',
'badge_success' => true,
),
'payment' => array(
'title' => $this->l('Payment'),
),
'osname' => array(
'title' => $this->l('Status'),
'type' => 'select',
'color' => 'color',
'list' => $this->statuses_array,
'filter_key' => 'os!id_order_state',
'filter_type' => 'int',
'order_key' => 'osname',
),
'date_add' => array(
'title' => $this->l('Date'),
'align' => 'text-right',
'type' => 'datetime',
'filter_key' => 'a!date_add',
),
'id_pdf' => array(
'title' => $this->l('PDF'),
'align' => 'text-center',
'callback' => 'printPDFIcons',
'orderby' => false,
'search' => false,
'remove_onclick' => true,
),
'tntofficiel_id_order' => array(
'title' => $this->l('TNT'),
'align' => 'text-right',
'orderby' => false,
'search' => false,
'callback' => 'printBtIcon',
'remove_onclick' => true,
)
)
);
if (Configuration::get('TNT_CARRIER_PICKUP_NUMBER_SHOW')) {
$this->fields_list = array_merge(
$this->fields_list,
array(
'tntofficiel_pickup_number' => array(
'title' => $this->l('N° de Ramassage'),
'align' => 'text-right',
'orderby' => false,
'search' => false,
),
)
);
}
if (Country::isCurrentlyUsed('country', true)) {
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
SELECT DISTINCT c.id_country, cl.`name`
FROM `'._DB_PREFIX_.'orders` o
'.Shop::addSqlAssociation('orders', 'o').'
INNER JOIN `'._DB_PREFIX_.'address` a ON a.id_address = o.id_address_delivery
INNER JOIN `'._DB_PREFIX_.'country` c ON a.id_country = c.id_country
INNER JOIN `'._DB_PREFIX_.'country_lang` cl
ON (c.`id_country` = cl.`id_country`
AND cl.`id_lang` = '.(int)$this->context->language->id.')
ORDER BY cl.name ASC');
$country_array = array();
foreach ($result as $row) {
$country_array[$row['id_country']] = $row['name'];
}
$part1 = array_slice($this->fields_list, 0, 3);
$part2 = array_slice($this->fields_list, 3);
$part1['cname'] = array(
'title' => $this->l('Delivery'),
'type' => 'select',
'list' => $country_array,
'filter_key' => 'country!id_country',
'filter_type' => 'int',
'order_key' => 'cname',
);
$this->fields_list = array_merge($part1, $part2);
}
$this->shopLinkType = 'shop';
$this->shopShareDatas = Shop::SHARE_ORDER;
if (Tools::isSubmit('id_order')) {
$intOrderID = (int)Tools::getValue('id_order');
$objOrder = new Order($intOrderID);
$this->context->cart = new Cart($objOrder->id_cart);
$this->context->customer = new Customer($objOrder->id_customer);
}
$this->bulk_actions = array(
'updateOrderStatus' => array(
'text' => $this->l('Change Order Status'),
'icon' => 'icon-refresh',
),
'getBT' => array(
'text' => $this->l('Bon de transport de TNT'),
'icon' => 'icon-AdminTNTOfficiel',
),
'getManifest' => array(
'text' => $this->l('Manifeste TNT'),
'icon' => 'icon-file-text',
),
);
}
/**
* @param $orderId
*
* @return mixed
*/
public function printBtIcon($orderId)
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$arrTNTOrder = TNTOfficiel_OrderHelper::getInstance()->getOrderData($orderId);
$this->context->smarty->assign(array(
'bt_filename' => $arrTNTOrder['bt_filename'],
'getManifestUrl' => $this->context->link->getAdminLink('AdminTNTOfficiel').'&action=getManifest',
));
return $this->context->smarty->fetch(_PS_MODULE_DIR_.'tntofficiel/views/templates/admin/_print_bt_icon.tpl');
}
/**
* Return all the BT for the selected orders.
*/
public function processBulkGetBT()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
if (Module::isInstalled(TNTOfficiel::MODULE_NAME)) {
$arrOrderID = (array)Tools::getValue('orderBox');
$orderList = array();
foreach ($arrOrderID as $strOrderID) {
$intOrderID = (int)$strOrderID;
$objOrder = new Order($intOrderID);
// Check if it's a tnt order.
if (TNTOfficiel_Carrier::isTNTOfficielCarrierID($objOrder->id_carrier)) {
$orderList[] = $intOrderID;
}
}
TNTOfficiel_OrderHelper::getInstance()->getBt($orderList);
}
}
/**
* Return all the BT for the selected orders.
*/
public function processBulkGetManifest()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$arrOrderIDList = array();
if (!Tools::getIsset('orderBox')) {
return;
}
$arrOrderID = (array)Tools::getValue('orderBox');
foreach ($arrOrderID as $strOrderID) {
$intOrderID = (int)$strOrderID;
$arrOrderIDList[] = $intOrderID;
}
$manifest = new TNTOfficiel_ManifestPDFCreator();
$manifest->createManifest($arrOrderIDList);
}
public function processBulkUpdateOrderStatus()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$intOrderState = (int)Tools::getValue('id_order_state');
if (Tools::isSubmit('submitUpdateOrderStatus') && $intOrderState) {
if ($this->tabAccess['edit'] !== '1') {
$this->errors[] = Tools::displayError('You do not have permission to edit this.');
} else {
$objOrderState = new OrderState($intOrderState);
if (!Validate::isLoadedObject($objOrderState)) {
$this->errors[] = sprintf(Tools::displayError('Order status #%d cannot be loaded'), $intOrderState);
} else {
$arrOrderID = (array)Tools::getValue('orderBox');
foreach ($arrOrderID as $strOrderID) {
$intOrderID = (int)$strOrderID;
$objOrder = new Order($intOrderID);
if (!Validate::isLoadedObject($objOrder)) {
$this->errors[] = sprintf(Tools::displayError('Order #%d cannot be loaded'), $intOrderID);
} else {
/* Override start */
if (TNTOfficiel_Carrier::isTNTOfficielCarrierID($objOrder->id_carrier)
&& $objOrderState->id == Configuration::get('PS_OS_SHIPPING')
) {
$arrTNTOrder = TNTOfficiel_OrderHelper::getInstance()->getOrderData($objOrder->id);
if ($arrTNTOrder['shipping_date'] && !$arrTNTOrder['is_shipped']) {
$objTNTShipmentHelper = TNTOfficiel_ShipmentHelper::getInstance();
$arrMDWShippingDate = $objTNTShipmentHelper->checkSaveShipmentDate(
$objOrder->id,
$arrTNTOrder['shipping_date']
);
if (array_key_exists('error', $arrMDWShippingDate)
&& $arrMDWShippingDate['error'] == 1
) {
$arrMDWShippingDate = $objTNTShipmentHelper->getNewShippingDate($objOrder->id);
if (!$arrMDWShippingDate) {
$this->errors[] = sprintf(
Tools::displayError('Cannot change status for order #%d.'),
$intOrderID
);
continue;
}
$tempDate = new DateTime('today');
$startDate = $tempDate->format('Y-m-d');
Db::getInstance()->update(
'tntofficiel_order',
array(
'shipping_date' => pSQL($arrMDWShippingDate['shippingDate']),
'due_date' => pSQL($arrMDWShippingDate['dueDate']),
'start_date' => pSQL($startDate),
),
'id_tntofficiel_order = '.(int)$arrTNTOrder['id_tntofficiel_order']
);
}
} elseif (!$arrTNTOrder['shipping_date'] && !$arrTNTOrder['is_shipped']) {
$this->errors[] = sprintf(
Tools::displayError('Cannot change status for order #%d.'),
$intOrderID
);
continue;
}
}
/* Override end */
$current_order_state = $objOrder->getCurrentOrderState();
if ($current_order_state->id == $objOrderState->id) {
$this->errors[] = $this->displayWarning(
sprintf('Order #%d has already been assigned this status.', $intOrderID)
);
} else {
$history = new OrderHistory();
$history->id_order = $objOrder->id;
$history->id_employee = (int)$this->context->employee->id;
$use_existings_payment = !$objOrder->hasInvoice();
$history->changeIdOrderState(
(int)$objOrderState->id,
$objOrder,
$use_existings_payment
);
$carrier = new Carrier($objOrder->id_carrier, $objOrder->id_lang);
$templateVars = array();
if ($history->id_order_state == Configuration::get('PS_OS_SHIPPING')
&& $objOrder->shipping_number
) {
$templateVars = array(
'{followup}' => str_replace('@', $objOrder->shipping_number, $carrier->url)
);
}
if ($history->addWithemail(true, $templateVars)) {
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT')) {
foreach ($objOrder->getProducts() as $product) {
if (StockAvailable::dependsOnStock($product['product_id'])) {
StockAvailable::synchronize(
$product['product_id'],
(int)$product['id_shop']
);
}
}
}
} else {
$this->errors[] = sprintf(
Tools::displayError('Cannot change status for order #%d.'),
$intOrderID
);
}
}
}
}
}
}
if (!count($this->errors)) {
Tools::redirectAdmin(self::$currentIndex.'&conf=4&token='.$this->token);
}
}
}
/* public function printNewCustomer($tr)
{
return ($tr['new'] ? $this->l('Yes') : $this->l('No'));
} */
public function postProcess()
{
TNTOfficiel_Debug::log(array('msg' => '>>', 'file' => __FILE__, 'line' => __LINE__));
$objContext = Context::getContext();
// See hookActionOrderStatusUpdate.
$objCookie = $objContext->cookie;
$isTntInstalled = false;
if (Module::isInstalled(TNTOfficiel::MODULE_NAME)) {
$isTntInstalled = true;
$module = Module::getInstanceByName(TNTOfficiel::MODULE_NAME);
}
if (Tools::isSubmit('id_order')) {
$intOrderID = (int)Tools::getValue('id_order');
if ($intOrderID > 0) {
$objOrder = new Order($intOrderID);
if (!Validate::isLoadedObject($objOrder)) {
$this->errors[] = Tools::displayError('The order cannot be found within your database.');
}
ShopUrl::cacheMainDomainForShop((int)$objOrder->id_shop);
if (!Tools::isSubmit('submitState') && $isTntInstalled) {
if ($module->updateShippingDate($objOrder) === false) {
$objCookie->saveShippingError = $this->l('Impossible de récupérer une date de ramassage');
}
}
}
}
if (Tools::isSubmit('submitState') && isset($objOrder) && $isTntInstalled) {
if (TNTOfficiel_Carrier::isTNTOfficielCarrierID($objOrder->id_carrier)) {
$arrTNTOrder = TNTOfficiel_OrderHelper::getInstance()->getOrderData($objOrder->id);
if ($arrTNTOrder['shipping_date'] && !$arrTNTOrder['is_shipped']) {
$objTNTShipmentHelper = TNTOfficiel_ShipmentHelper::getInstance();
$arrMDWShippingDate = $objTNTShipmentHelper->checkSaveShipmentDate(
$objOrder->id,
$arrTNTOrder['shipping_date']
);
if (array_key_exists('error', $arrMDWShippingDate)) {
if ($arrMDWShippingDate['error'] == 1) {
$objCookie->saveShippingError = $this->l('Erreur : '.$arrMDWShippingDate['message']);
return;
}
$objCookie->saveShippingError = $this->l('Attention : '.$arrMDWShippingDate['message']);
}
} elseif (!$arrTNTOrder['shipping_date'] && !$arrTNTOrder['is_shipped']) {
$objCookie->saveShippingError = $this->l('Erreur : Choisir une date de ramassage');
return;
}
}
}
parent::postProcess();
}
}

View File

@ -1,488 +1,488 @@
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016 GFI Informatique, 2016 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
// On DOM Ready.
$(function () {
if (
// If Google Map API not loaded.
!(window.google && window.google.maps && window.google.maps.Map)
// and Google Map config exist.
&& (window.TNTOfficiel && window.TNTOfficiel.config && window.TNTOfficiel.config.google && window.TNTOfficiel.config.google.map)
) {
// Load Google Map API.
$.ajax({
"url": window.TNTOfficiel.config.google.map.url,
"data": window.TNTOfficiel.config.google.map.data,
"dataType": 'script',
"cache": true
})
.done(function () {});
}
});
// Constructor
function TNTOfficielGMapMarkersConstrutor(elmtMapContainer, objGoogleMapsConfig) {
return this.init(elmtMapContainer, objGoogleMapsConfig);
};
// Prototype
TNTOfficielGMapMarkersConstrutor.prototype = {
// Google Map Default Config.
objGMapsConfig: {
"lat": 46.227638,
"lng": 2.213749,
"zoom": 4
},
// Google Map Object.
objGMapMap: null,
// Google Map Markers Area Boundaries.
objGMapMarkersBounds: null,
// Google Map Markers Collection.
arrGMapMarkersCollection: [],
// Google Map Markers Info Window (Bubble).
objGMapMarkersInfoWindow: null,
/**
* Initialisation.
*/
init: function init(elmtMapContainer, objGoogleMapsConfig) {
// Extend Configuration.
jQuery.extend(this.objGMapsConfig, objGoogleMapsConfig);
// Google Map Object.
this.objGMapMap = new window.google.maps.Map(elmtMapContainer, {
center: new window.google.maps.LatLng(this.objGMapsConfig.lat, this.objGMapsConfig.lng),
zoom: this.objGMapsConfig.zoom
});
// Init Markers.
this.objGMapMarkersBounds = new window.google.maps.LatLngBounds();
this.arrGMapMarkersCollection = [];
this.objGMapMarkersInfoWindow = new window.google.maps.InfoWindow();
return this;
},
/**
*
*/
addMarker: function addMarker(fltLatitude, fltLongitude, strURLIcon, strInfoWindowContent, objListeners) {
var _this = this;
var objGMapLatLng = new window.google.maps.LatLng(fltLatitude, fltLongitude);
// Create a new Google Map Marker.
var objGMapMarker = new window.google.maps.Marker({
position: objGMapLatLng,
icon: strURLIcon
});
// Add Marker to the Google Map.
objGMapMarker.setMap(this.objGMapMap);
// Extend Markers Area Boundaries.
this.objGMapMarkersBounds.extend(objGMapMarker.getPosition() /* objGMapLatLng */);
//objGMapMarker.getMap();
// Bind Markers Events.
jQuery.each(objListeners, function (strEventType, evtCallback) {
// If callback is a function.
if (jQuery.type(evtCallback) === 'function') {
// Set Marker Event Listeners and Bind this to callback.
objGMapMarker.addListener(strEventType, $.proxy(function (objGMapEvent) {
// Default click action is to show InfoWindow (if any).
if (strEventType === 'click') {
this.objGMapMarkersInfoWindow.close();
if (strInfoWindowContent) {
this.objGMapMarkersInfoWindow.setContent(strInfoWindowContent);
this.objGMapMarkersInfoWindow.open(this.objGMapMap /* objGMapMarker.getMap() */, objGMapMarker);
}
// Adjust zoom min/max range.
objGMapMarker.map.setZoom(Math.max(Math.min(17, objGMapMarker.map.getZoom()),10));
// Update the Google Maps size.
this.trigger('resize', this.objGMapMap);
// Go to marker position.
objGMapMarker.map.panTo(objGMapMarker.getPosition());
}
return evtCallback.call(this, objGMapEvent);
}, _this));
}
});
// Add Marker to collection.
this.arrGMapMarkersCollection.push(objGMapMarker);
return objGMapMarker;
},
/**
*
*/
fitBounds: function () {
// Fit Boundaries to display all markers.
if (this.arrGMapMarkersCollection.length > 0) {
this.objGMapMap.fitBounds(this.objGMapMarkersBounds);
}
// Bind event to callback to execute only once.
window.google.maps.event.addListenerOnce(this.objGMapMap, 'bounds_changed', function () {
// this === this.objGMapMap
this.setZoom(Math.min(17, this.getZoom()));
});
// Update the Google Maps size.
this.trigger('resize', this.objGMapMap);
return this;
},
/**
*
*/
trigger: function (strEventType, objBind) {
window.google.maps.event.trigger(objBind, strEventType);
return this;
}
};
/**
*
* @param method
* @param strDataB64
* @constructor
*/
var TNTOfficiel_deliveryPointsBox = function (method, strDataB64) {
var _this = this;
// xett, pex
this.strRepoType = (method === 'relay_points') ? 'xett' : 'pex';
// relay_points, repositories.
this.method = method;
// ClassName Plural Prefix.
this.strClassNameRepoPrefixPlural = (this.strRepoType === 'xett') ? 'relay-points' : 'repositories';
// ClassName Prefix.
this.strClassNameRepoPrefix = (this.strRepoType === 'xett') ? 'relay-point' : 'repository';
this.strClassNameInfoBlocSelected = 'is-selected';
this.CSSSelectors = {
// Loading Mask and Progress indicator.
loading: '#loading',
// Popin Content Container.
// div#repositories.repositories
popInContentContainer: '#' + this.method,
// Popin Header Container.
// div.repositories-header
popInHeaderContainer: '.' + this.strClassNameRepoPrefixPlural + '-header',
// Search form CP/Cities.
// form#repositories_form.repositories-form
formSearchRepo: 'form.' + this.strClassNameRepoPrefixPlural + '-form',
// Repo List Container.
// ul#repositories_list.repositories-list
infoBlocListContainer: '.' + this.strClassNameRepoPrefixPlural + '-list',
// Google Map Container.
// div#repositories_map.repositories-map
mapContainer: '.' + this.strClassNameRepoPrefixPlural + '-map',
// All Repo Bloc Item Container.
// li#repositories_item_<INDEX>.repository-item
infoBlocItemContainerCollection: '.' + this.strClassNameRepoPrefix + '-item',
// Repo Selected Button Bloc Item.
// button.repository-item-select
infoBlocItemButtonSelected: '.' + this.strClassNameRepoPrefix + '-item-select'
// One Repo Bloc Item Container.
// li#repositories_item_<CODE>.repository-item
// '#' + this.method + '_item_' + id
};
// getRelayPoints, getRepositories List.
this.arrRepoList = JSON.parse(base64_decode(strDataB64)) || null;
// If invalid repo list.
if ($.type(this.arrRepoList) !== 'array') {
// Set empty repo list.
this.arrRepoList = [];
}
// On repo form search submit.
$(this.CSSSelectors.formSearchRepo).on('submit', function (objEvent) {
$(_this.CSSSelectors.loading).show();
objEvent.preventDefault();
// If test is valid, get all data for postcode and city and update the list
var objJqXHR = $.ajax({
"url": window.TNTOfficiel.link.front.module[_this.strRepoType === 'xett' ? 'boxRelayPoints' : 'boxDropOffPoints'],
"method": 'GET',
"data": $(objEvent.target).serialize(),
"dataType": 'html',
"cache": false,
"global": false
});
objJqXHR
.done(function (mxdData, strTextStatus, objJqXHR) {
// Update PopIn Content.
$(_this.CSSSelectors.popInContentContainer).parent().html(mxdData);
})
.fail(function (objJqXHR, strTextStatus, strErrorThrown) {
// console.error( objJqXHR.status + ' ' + objJqXHR.statusText );
alert('Une erreur de communication avec le serveur est survenue, le transporteur TNT est momentanément indisponible.');
location.reload();
})
.always(function () {
$(_this.CSSSelectors.loading).hide();
});
});
// TODO: remove or add unbinding on close.
/*
$(window).off('.'+window.TNTOfficiel.module.name)
.on('resize.'+window.TNTOfficiel.module.name, $.proxy(this.prepareScrollbar, this));
// this.eventGoogleMaps();
*/
// On select button repo info bloc click.
$(this.CSSSelectors.infoBlocItemButtonSelected).off().on('click', function () {
var intMarkerIndex = $(this).parents(_this.CSSSelectors.infoBlocItemContainerCollection).attr('id').split('_').pop();
// Loading.
$(_this.CSSSelectors.loading).show();
var objJqXHR = $.ajax({
"url": window.TNTOfficiel.link.front.module.saveProductInfo,
"method": 'GET',
"data": {
product: _this.arrRepoList[intMarkerIndex]
},
"dataType": 'html',
"cache": false,
"global": false
});
objJqXHR
.done(function (mxdData, strTextStatus, objJqXHR) {
// Delete existing Repository Info.
$('.shipping-method-info').remove();
// Add Repository Info in Carrier Bloc.
$('.tnt_carrier_radio:checked').parents('tr').find('td.delivery_option_info').append(mxdData);
$.fancybox.close();
$(document).trigger('hook_extra_carrier_shipping_method_popup:close');
})
.fail(function (objJqXHR, strTextStatus, strErrorThrown) {
// console.error( objJqXHR.status + ' ' + objJqXHR.statusText );
})
.always(function () {
if ($('#opc_payment_methods').length > 0) {
$(_this.CSSSelectors.loading).hide();
}
});
});
this.eventGoogleMaps = function () {
// If no Google library.
if (window.google && window.google.maps) {
var objTNTOfficielGMapMarkers = new TNTOfficielGMapMarkersConstrutor(
$(_this.CSSSelectors.mapContainer)[0],
window.TNTOfficiel.config.google.map.default
);
// Prepare and returns data marker to add on the map.
for (var intMarkerIndex = 0; intMarkerIndex < _this.arrRepoList.length; intMarkerIndex++) {
var objRepoItem = _this.arrRepoList[intMarkerIndex];
// Set Marker InfoWindow Content.
var strInfoWindowContent = '\
<ul style="margin: 0;">\
' + ( this.strRepoType == 'xett' ? '<li>Code: <b>' + objRepoItem[this.strRepoType] + '</b></li>' : '') + '\
<li><b>' + objRepoItem.name + '</b></li>\
<li>' + ( objRepoItem.address ? objRepoItem.address : objRepoItem.address1 + '<br />' + objRepoItem.address2 ) + '</li>\
<li>' + objRepoItem.postcode + ' ' + objRepoItem.city + '</li>\
</ul>';
var strCSSSelectorRepoInfoBloc = '#' + _this.method + '_item_' + intMarkerIndex;
var objGMapMarker = objTNTOfficielGMapMarkers.addMarker(
objRepoItem.latitude,
objRepoItem.longitude,
window.TNTOfficiel.link.front.shop + 'modules/' + window.TNTOfficiel.module.name + '/' + 'views/img/' + 'modal/marker/' + (intMarkerIndex + 1) + '.png',
strInfoWindowContent,
{
// On Marker Click.
"click": $.proxy(function (strCSSSelectorRepoInfoBloc, objGMapEvent) {
var strClassNameInfoBlocSelected = 'is-selected',
$elmtInfoBlocSelect = $(strCSSSelectorRepoInfoBloc);
// Highlight Selected Marker Info.
$(_this.CSSSelectors.infoBlocItemContainerCollection + '.' + strClassNameInfoBlocSelected)
.removeClass(strClassNameInfoBlocSelected);
$elmtInfoBlocSelect.addClass(strClassNameInfoBlocSelected);
// The event is the click on marker (not triggered from list).
if (objGMapEvent != null) {
// Scroll to item
_this.scrollY($elmtInfoBlocSelect);
}
}, null, strCSSSelectorRepoInfoBloc)
}
);
// On click on info bloc item, trigger click on marker.
$(strCSSSelectorRepoInfoBloc).off().on('click', $.proxy(function (objGMapMarker) {
objTNTOfficielGMapMarkers.trigger('click', objGMapMarker);
}, null, objGMapMarker));
}
objTNTOfficielGMapMarkers.fitBounds();
}
};
/**
* Prepare scrollbar for list item
* @private
*/
this.prepareScrollbar = function () {
$('#list_scrollbar_container').nanoScroller({
preventPageScrolling: true
});
};
// Scroll to item.
this.scrollY = function ($elmtInfoBlocSelect) {
var $elmtContainer = $('#list_scrollbar_container'),
$elmtContent = $('#list_scrollbar_content'),
intPositionItem = parseInt($elmtInfoBlocSelect.offset().top + $elmtContent.scrollTop() - $elmtContainer.offset().top);
$elmtContent.scrollTop(intPositionItem);
};
this.prepareScrollbar();
this.eventGoogleMaps();
return this;
};
$(document).ready(function () {
/*
* Global jQuery AJAX event, excepted for request with option "global":false.
*/
// Triggered if an AJAX request is started and no other AJAX requests are currently running.
$(document).ajaxStart(function () {
$('#loading').show();
});
// Triggered if there are no more Ajax requests being processed.
$(document).ajaxStop(function () {
$('#loading').hide();
});
/*
* Payment Choice.
*/
if (window.TNTOfficiel.order.isOPC) {
// On payment mode choice with OPC.
$(document).on('click', '#opc_payment_methods a', XHRcheckProductCode);
} else {
// On payment mode choice.
$('#form').on('submit', XHRcheckProductCode);
}
});
function XHRcheckProductCode (objEvent) {
// result from async AJAX request.
var result = null;
var objJqXHR = $.ajax({
"url": window.TNTOfficiel.link.front.module.checkProductCode,
"method": 'POST',
"data": {
product: _getCurrentShippingMethod(),
deliveryOptionTnt: deliveryOptionTnt
},
"async": false
});
objJqXHR
.done(function (mxdData, strTextStatus, objJqXHR) {
result = JSON.parse(mxdData);
})
.fail(function (objJqXHR, strTextStatus, strErrorThrown) {
// console.error( objJqXHR.status + ' ' + objJqXHR.statusText );
})
.always(function () {
});
// If no result or has error.
if (!result || result.error == 1) {
alert("Vous ne pouvez pas continuer votre commande car aucun mode de livraison n'est sélectionné.");
objEvent.preventDefault();
return false;
}
if (!(window.TNTOfficiel.order.isOPC && result.error == 0 && result[ window.TNTOfficiel.module.name ] == 1
|| !window.TNTOfficiel.order.isOPC && result.error == 0)
) {
return false;
}
var $elmtForm = $(this);
if (window.TNTOfficiel.order.isOPC) {
window.$elmtPaymentLink = $elmtForm;
}
var $elmtCurrentSpMethod = $('.tnt_carrier_radio:checked');
var boolCGVDisplayed = $('#cgv').length > 0;
var boolCGVChecked = $('input#cgv:checked').length > 0;
var boolHasRepoAddressSelected = $($elmtCurrentSpMethod).closest('table').find('.shipping-method-info').length > 0;
var boolShowPopup = true;
if (($elmtCurrentSpMethod.attr('product-type') == 'dropoffpoint'|$elmtCurrentSpMethod.attr('product-type') == 'depot')& !boolHasRepoAddressSelected) {
boolShowPopup = false;
}
if ((boolCGVDisplayed&boolCGVChecked| !boolCGVDisplayed) && $elmtCurrentSpMethod.length && boolShowPopup) {
if (!$elmtForm.data('valid')) {
// Stop form submit
objEvent.preventDefault();
// Shows the modal popup
displayExtraAddressDataPopup($elmtCurrentSpMethod.attr('product-type'));
// Save which tnt product was chosen
XHRStoreProductPrice($elmtCurrentSpMethod);
} else {
if (window.TNTOfficiel.order.isOPC) {
window.location = $elmtForm.attr('href');
} else {
$elmtForm.submit();
}
}
}
}
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016 GFI Informatique, 2016 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
// On DOM Ready.
$(function () {
if (
// If Google Map API not loaded.
!(window.google && window.google.maps && window.google.maps.Map)
// and Google Map config exist.
&& (window.TNTOfficiel && window.TNTOfficiel.config && window.TNTOfficiel.config.google && window.TNTOfficiel.config.google.map)
) {
// Load Google Map API.
$.ajax({
"url": window.TNTOfficiel.config.google.map.url,
"data": window.TNTOfficiel.config.google.map.data,
"dataType": 'script',
"cache": true
})
.done(function () {});
}
});
// Constructor
function TNTOfficielGMapMarkersConstrutor(elmtMapContainer, objGoogleMapsConfig) {
return this.init(elmtMapContainer, objGoogleMapsConfig);
};
// Prototype
TNTOfficielGMapMarkersConstrutor.prototype = {
// Google Map Default Config.
objGMapsConfig: {
"lat": 46.227638,
"lng": 2.213749,
"zoom": 4
},
// Google Map Object.
objGMapMap: null,
// Google Map Markers Area Boundaries.
objGMapMarkersBounds: null,
// Google Map Markers Collection.
arrGMapMarkersCollection: [],
// Google Map Markers Info Window (Bubble).
objGMapMarkersInfoWindow: null,
/**
* Initialisation.
*/
init: function init(elmtMapContainer, objGoogleMapsConfig) {
// Extend Configuration.
jQuery.extend(this.objGMapsConfig, objGoogleMapsConfig);
// Google Map Object.
this.objGMapMap = new window.google.maps.Map(elmtMapContainer, {
center: new window.google.maps.LatLng(this.objGMapsConfig.lat, this.objGMapsConfig.lng),
zoom: this.objGMapsConfig.zoom
});
// Init Markers.
this.objGMapMarkersBounds = new window.google.maps.LatLngBounds();
this.arrGMapMarkersCollection = [];
this.objGMapMarkersInfoWindow = new window.google.maps.InfoWindow();
return this;
},
/**
*
*/
addMarker: function addMarker(fltLatitude, fltLongitude, strURLIcon, strInfoWindowContent, objListeners) {
var _this = this;
var objGMapLatLng = new window.google.maps.LatLng(fltLatitude, fltLongitude);
// Create a new Google Map Marker.
var objGMapMarker = new window.google.maps.Marker({
position: objGMapLatLng,
icon: strURLIcon
});
// Add Marker to the Google Map.
objGMapMarker.setMap(this.objGMapMap);
// Extend Markers Area Boundaries.
this.objGMapMarkersBounds.extend(objGMapMarker.getPosition() /* objGMapLatLng */);
//objGMapMarker.getMap();
// Bind Markers Events.
jQuery.each(objListeners, function (strEventType, evtCallback) {
// If callback is a function.
if (jQuery.type(evtCallback) === 'function') {
// Set Marker Event Listeners and Bind this to callback.
objGMapMarker.addListener(strEventType, $.proxy(function (objGMapEvent) {
// Default click action is to show InfoWindow (if any).
if (strEventType === 'click') {
this.objGMapMarkersInfoWindow.close();
if (strInfoWindowContent) {
this.objGMapMarkersInfoWindow.setContent(strInfoWindowContent);
this.objGMapMarkersInfoWindow.open(this.objGMapMap /* objGMapMarker.getMap() */, objGMapMarker);
}
// Adjust zoom min/max range.
objGMapMarker.map.setZoom(Math.max(Math.min(17, objGMapMarker.map.getZoom()),10));
// Update the Google Maps size.
this.trigger('resize', this.objGMapMap);
// Go to marker position.
objGMapMarker.map.panTo(objGMapMarker.getPosition());
}
return evtCallback.call(this, objGMapEvent);
}, _this));
}
});
// Add Marker to collection.
this.arrGMapMarkersCollection.push(objGMapMarker);
return objGMapMarker;
},
/**
*
*/
fitBounds: function () {
// Fit Boundaries to display all markers.
if (this.arrGMapMarkersCollection.length > 0) {
this.objGMapMap.fitBounds(this.objGMapMarkersBounds);
}
// Bind event to callback to execute only once.
window.google.maps.event.addListenerOnce(this.objGMapMap, 'bounds_changed', function () {
// this === this.objGMapMap
this.setZoom(Math.min(17, this.getZoom()));
});
// Update the Google Maps size.
this.trigger('resize', this.objGMapMap);
return this;
},
/**
*
*/
trigger: function (strEventType, objBind) {
window.google.maps.event.trigger(objBind, strEventType);
return this;
}
};
/**
*
* @param method
* @param strDataB64
* @constructor
*/
var TNTOfficiel_deliveryPointsBox = function (method, strDataB64) {
var _this = this;
// xett, pex
this.strRepoType = (method === 'relay_points') ? 'xett' : 'pex';
// relay_points, repositories.
this.method = method;
// ClassName Plural Prefix.
this.strClassNameRepoPrefixPlural = (this.strRepoType === 'xett') ? 'relay-points' : 'repositories';
// ClassName Prefix.
this.strClassNameRepoPrefix = (this.strRepoType === 'xett') ? 'relay-point' : 'repository';
this.strClassNameInfoBlocSelected = 'is-selected';
this.CSSSelectors = {
// Loading Mask and Progress indicator.
loading: '#loading',
// Popin Content Container.
// div#repositories.repositories
popInContentContainer: '#' + this.method,
// Popin Header Container.
// div.repositories-header
popInHeaderContainer: '.' + this.strClassNameRepoPrefixPlural + '-header',
// Search form CP/Cities.
// form#repositories_form.repositories-form
formSearchRepo: 'form.' + this.strClassNameRepoPrefixPlural + '-form',
// Repo List Container.
// ul#repositories_list.repositories-list
infoBlocListContainer: '.' + this.strClassNameRepoPrefixPlural + '-list',
// Google Map Container.
// div#repositories_map.repositories-map
mapContainer: '.' + this.strClassNameRepoPrefixPlural + '-map',
// All Repo Bloc Item Container.
// li#repositories_item_<INDEX>.repository-item
infoBlocItemContainerCollection: '.' + this.strClassNameRepoPrefix + '-item',
// Repo Selected Button Bloc Item.
// button.repository-item-select
infoBlocItemButtonSelected: '.' + this.strClassNameRepoPrefix + '-item-select'
// One Repo Bloc Item Container.
// li#repositories_item_<CODE>.repository-item
// '#' + this.method + '_item_' + id
};
// getRelayPoints, getRepositories List.
this.arrRepoList = JSON.parse(base64_decode(strDataB64)) || null;
// If invalid repo list.
if ($.type(this.arrRepoList) !== 'array') {
// Set empty repo list.
this.arrRepoList = [];
}
// On repo form search submit.
$(this.CSSSelectors.formSearchRepo).on('submit', function (objEvent) {
$(_this.CSSSelectors.loading).show();
objEvent.preventDefault();
// If test is valid, get all data for postcode and city and update the list
var objJqXHR = $.ajax({
"url": window.TNTOfficiel.link.front.module[_this.strRepoType === 'xett' ? 'boxRelayPoints' : 'boxDropOffPoints'],
"method": 'GET',
"data": $(objEvent.target).serialize(),
"dataType": 'html',
"cache": false,
"global": false
});
objJqXHR
.done(function (mxdData, strTextStatus, objJqXHR) {
// Update PopIn Content.
$(_this.CSSSelectors.popInContentContainer).parent().html(mxdData);
})
.fail(function (objJqXHR, strTextStatus, strErrorThrown) {
// console.error( objJqXHR.status + ' ' + objJqXHR.statusText );
alert('Une erreur de communication avec le serveur est survenue, le transporteur TNT est momentanément indisponible.');
location.reload();
})
.always(function () {
$(_this.CSSSelectors.loading).hide();
});
});
// TODO: remove or add unbinding on close.
/*
$(window).off('.'+window.TNTOfficiel.module.name)
.on('resize.'+window.TNTOfficiel.module.name, $.proxy(this.prepareScrollbar, this));
// this.eventGoogleMaps();
*/
// On select button repo info bloc click.
$(this.CSSSelectors.infoBlocItemButtonSelected).off().on('click', function () {
var intMarkerIndex = $(this).parents(_this.CSSSelectors.infoBlocItemContainerCollection).attr('id').split('_').pop();
// Loading.
$(_this.CSSSelectors.loading).show();
var objJqXHR = $.ajax({
"url": window.TNTOfficiel.link.front.module.saveProductInfo,
"method": 'GET',
"data": {
product: _this.arrRepoList[intMarkerIndex]
},
"dataType": 'html',
"cache": false,
"global": false
});
objJqXHR
.done(function (mxdData, strTextStatus, objJqXHR) {
// Delete existing Repository Info.
$('.shipping-method-info').remove();
// Add Repository Info in Carrier Bloc.
$('.tnt_carrier_radio:checked').parents('tr').find('td.delivery_option_info').append(mxdData);
$.fancybox.close();
$(document).trigger('hook_extra_carrier_shipping_method_popup:close');
})
.fail(function (objJqXHR, strTextStatus, strErrorThrown) {
// console.error( objJqXHR.status + ' ' + objJqXHR.statusText );
})
.always(function () {
$(_this.CSSSelectors.loading).hide();
// if ($('#opc_payment_methods').length > 0) {
// }
});
});
this.eventGoogleMaps = function () {
// If no Google library.
if (window.google && window.google.maps) {
var objTNTOfficielGMapMarkers = new TNTOfficielGMapMarkersConstrutor(
$(_this.CSSSelectors.mapContainer)[0],
window.TNTOfficiel.config.google.map.default
);
// Prepare and returns data marker to add on the map.
for (var intMarkerIndex = 0; intMarkerIndex < _this.arrRepoList.length; intMarkerIndex++) {
var objRepoItem = _this.arrRepoList[intMarkerIndex];
// Set Marker InfoWindow Content.
var strInfoWindowContent = '\
<ul style="margin: 0;">\
' + ( this.strRepoType == 'xett' ? '<li>Code: <b>' + objRepoItem[this.strRepoType] + '</b></li>' : '') + '\
<li><b>' + objRepoItem.name + '</b></li>\
<li>' + ( objRepoItem.address ? objRepoItem.address : objRepoItem.address1 + '<br />' + objRepoItem.address2 ) + '</li>\
<li>' + objRepoItem.postcode + ' ' + objRepoItem.city + '</li>\
</ul>';
var strCSSSelectorRepoInfoBloc = '#' + _this.method + '_item_' + intMarkerIndex;
var objGMapMarker = objTNTOfficielGMapMarkers.addMarker(
objRepoItem.latitude,
objRepoItem.longitude,
window.TNTOfficiel.link.front.shop + 'modules/' + window.TNTOfficiel.module.name + '/' + 'views/img/' + 'modal/marker/' + (intMarkerIndex + 1) + '.png',
strInfoWindowContent,
{
// On Marker Click.
"click": $.proxy(function (strCSSSelectorRepoInfoBloc, objGMapEvent) {
var strClassNameInfoBlocSelected = 'is-selected',
$elmtInfoBlocSelect = $(strCSSSelectorRepoInfoBloc);
// Highlight Selected Marker Info.
$(_this.CSSSelectors.infoBlocItemContainerCollection + '.' + strClassNameInfoBlocSelected)
.removeClass(strClassNameInfoBlocSelected);
$elmtInfoBlocSelect.addClass(strClassNameInfoBlocSelected);
// The event is the click on marker (not triggered from list).
if (objGMapEvent != null) {
// Scroll to item
_this.scrollY($elmtInfoBlocSelect);
}
}, null, strCSSSelectorRepoInfoBloc)
}
);
// On click on info bloc item, trigger click on marker.
$(strCSSSelectorRepoInfoBloc).off().on('click', $.proxy(function (objGMapMarker) {
objTNTOfficielGMapMarkers.trigger('click', objGMapMarker);
}, null, objGMapMarker));
}
objTNTOfficielGMapMarkers.fitBounds();
}
};
/**
* Prepare scrollbar for list item
* @private
*/
this.prepareScrollbar = function () {
$('#list_scrollbar_container').nanoScroller({
preventPageScrolling: true
});
};
// Scroll to item.
this.scrollY = function ($elmtInfoBlocSelect) {
var $elmtContainer = $('#list_scrollbar_container'),
$elmtContent = $('#list_scrollbar_content'),
intPositionItem = parseInt($elmtInfoBlocSelect.offset().top + $elmtContent.scrollTop() - $elmtContainer.offset().top);
$elmtContent.scrollTop(intPositionItem);
};
this.prepareScrollbar();
this.eventGoogleMaps();
return this;
};
$(document).ready(function () {
/*
* Global jQuery AJAX event, excepted for request with option "global":false.
*/
// Triggered if an AJAX request is started and no other AJAX requests are currently running.
$(document).ajaxStart(function () {
$('#loading').show();
});
// Triggered if there are no more Ajax requests being processed.
$(document).ajaxStop(function () {
$('#loading').hide();
});
/*
* Payment Choice.
*/
if (window.TNTOfficiel.order.isOPC) {
// On payment mode choice with OPC.
$(document).on('click', '#opc_payment_methods a', XHRcheckProductCode);
} else {
// On payment mode choice.
$('#form').on('submit', XHRcheckProductCode);
}
});
function XHRcheckProductCode (objEvent) {
// result from async AJAX request.
var result = null;
var objJqXHR = $.ajax({
"url": window.TNTOfficiel.link.front.module.checkProductCode,
"method": 'POST',
"data": {
product: _getCurrentShippingMethod(),
deliveryOptionTnt: deliveryOptionTnt
},
"async": false
});
objJqXHR
.done(function (mxdData, strTextStatus, objJqXHR) {
result = JSON.parse(mxdData);
})
.fail(function (objJqXHR, strTextStatus, strErrorThrown) {
// console.error( objJqXHR.status + ' ' + objJqXHR.statusText );
})
.always(function () {
});
// If no result or has error.
if (!result || result.error == 1) {
alert("Vous ne pouvez pas continuer votre commande car aucun mode de livraison n'est sélectionné.");
objEvent.preventDefault();
return false;
}
if (!(window.TNTOfficiel.order.isOPC && result.error == 0 && result[ window.TNTOfficiel.module.name ] == 1
|| !window.TNTOfficiel.order.isOPC && result.error == 0)
) {
return false;
}
var $elmtForm = $(this);
if (window.TNTOfficiel.order.isOPC) {
window.$elmtPaymentLink = $elmtForm;
}
var $elmtCurrentSpMethod = $('.tnt_carrier_radio:checked');
var boolCGVDisplayed = $('#cgv').length > 0;
var boolCGVChecked = $('input#cgv:checked').length > 0;
var boolHasRepoAddressSelected = $($elmtCurrentSpMethod).closest('table').find('.shipping-method-info').length > 0;
var boolShowPopup = true;
if (($elmtCurrentSpMethod.attr('product-type') == 'dropoffpoint'|$elmtCurrentSpMethod.attr('product-type') == 'depot')& !boolHasRepoAddressSelected) {
boolShowPopup = false;
}
if ((boolCGVDisplayed&boolCGVChecked| !boolCGVDisplayed) && $elmtCurrentSpMethod.length && boolShowPopup) {
if (!$elmtForm.data('valid')) {
// Stop form submit
objEvent.preventDefault();
// Shows the modal popup
displayExtraAddressDataPopup($elmtCurrentSpMethod.attr('product-type'));
// Save which tnt product was chosen
XHRStoreProductPrice($elmtCurrentSpMethod);
} else {
if (window.TNTOfficiel.order.isOPC) {
window.location = $elmtForm.attr('href');
} else {
$elmtForm.submit();
}
}
}
}

View File

@ -0,0 +1,10 @@
{*
* TNT OFFICIAL MODULE FOR PRESTASHOP
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016 GFI Informatique, 2016 TNT
* @license https://opensource.org/licenses/MIT MIT License
*}
<div class="fluidMedia">
<iframe src="{$middlewareUrl|escape:'htmlall':'UTF-8'}?username={$username|escape:'htmlall':'UTF-8'}&account={$account|escape:'htmlall':'UTF-8'}&password={$password|escape:'htmlall':'UTF-8'}" frameborder="0"></iframe>
</div>

View File

@ -0,0 +1,44 @@
{*
* TNT OFFICIAL MODULE FOR PRESTASHOP
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016 GFI Informatique, 2016 TNT
* @license https://opensource.org/licenses/MIT MIT License
*}
{* extends /<ADMIN>/themes/default/template/helpers/form/form.tpl *}
{extends file="helpers/form/form.tpl"}
{*block name="other_input"}
    {if isset($input.name) && $input.type == 'test1'}
    {/if}
{/block*}
{block name="defaultForm" prepend}
<h2><img src="{$tntofficiel.titleImgSrc|escape:'html':'UTF-8'}" alt="{$tntofficiel.TNTCarrierTrad|escape:'html':'UTF-8'}" /></h2>
<div class="export-logs">
<a class="btn btn-default" href="{$tntofficiel.downloadLogsURL|escape:'html':'UTF-8'}"><i class="icon-pencil"></i> {$tntofficiel.exportLogsTrad|escape:'html':'UTF-8'}</a>
</div>
{/block}
{*block name="after"}
{/block*}
{block name="script"}
$(document).ready(function () {
$('#TNT_CARRIER_PASSWORD').val("%p#c`Q9,6GSP?U4]e]Zst");
var boolSomethingChanged = false;
$('#configuration_form').on('change', function () {
boolSomethingChanged = true;
});
$('#configuration_form').on('submit', function (objEvent) {
if (boolSomethingChanged) {
//element.submit();
} else {
objEvent.preventDefault();
}
});
});
{/block}

View File

@ -0,0 +1,18 @@
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,18 @@
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,18 @@
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,17 @@
{*
* TNT OFFICIAL MODULE FOR PRESTASHOP
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016 GFI Informatique, 2016 TNT
* @license https://opensource.org/licenses/MIT MIT License
*}
<span class="btn-group-action">
<span class="btn-group">
<a class="btn btn-default _blank {if ($bt_filename == '')}disabled{/if}" href="{$smarty.const._MODULE_DIR_|escape:'htmlall':'UTF-8'}tnt_media/media/bt/{$bt_filename|escape:'html':'UTF-8'}" target="_blank" rel="tooltip" title="{l s='BT' mod='tntofficiel'}">
<i class="icon-AdminTNTOfficiel"></i>
</a>
<a class="btn btn-default _blank" href="{$getManifestUrl|escape:'html':'UTF-8'}&amp;id_order={$order->id|intval}" rel="tooltip" title="{l s='Manifest' mod='tntofficiel'}">
<i class="icon-file-text"></i>
</a>
</span>
</span>

View File

@ -0,0 +1,18 @@
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,91 @@
{*
* TNT OFFICIAL MODULE FOR PRESTASHOP
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016 GFI Informatique, 2016 TNT
* @license https://opensource.org/licenses/MIT MIT License
*}
<head>
<link rel="stylesheet" type="text/css" href="{$smarty.const._PS_MODULE_DIR_|escape:'htmlall':'UTF-8'}tntofficiel/views/css/manifest.css" />
</head>
<div class="body">
<div class="merchant-table-container">
<table class="merchant-table bold">
<tr>
<td style="width: 15%;">Compte exp.</td>
<td style="width: 2%;">:</td>
<td class="uppercase" style="width: 23%;">{$manifestData['carrierAccount']|escape:'htmlall':'UTF-8'}</td>
<td style="width: 60%;">&nbsp;</td>
</tr>
<tr>
<td>Nom exp.</td>
<td>:</td>
<td class="uppercase">{$manifestData['address']['name']|escape:'htmlall':'UTF-8'}</td>
</tr>
<tr><td>& Adresse</td>
<td>:</td>
<td class="uppercase">
{$manifestData['address']['address1']|escape:'htmlall':'UTF-8'}<br>
{if ($manifestData['address']['address2'] != null)}
{$manifestData['address']['address2']|escape:'htmlall':'UTF-8'}<br>
{/if}
{$manifestData['address']['city']|escape:'htmlall':'UTF-8'}{if ($manifestData['address']['city'] != null)},&nbsp;{/if}
{$manifestData['address']['postcode']|escape:'htmlall':'UTF-8'}{if ($manifestData['address']['postcode'] != null)},&nbsp;{/if}
{$manifestData['address']['country']|escape:'htmlall':'UTF-8'}</td>
</tr>
</table>
</div>
<br />
<hr />
<div class="parcels-table-container">
<table class="parcels-table">
<tr><td style="width: 20%">Num BT</td><td>Poids (Kgs)</td><td>Destinataire</td><td>Code Postal</td><td>Ville</td><td>Service</td></tr>
{foreach from=$manifestData['parcelsData'] item=parcel}
<tr><td>&nbsp;</td></tr>
<tr class="parcels">
<td style="width: 20%;">{$parcel['parcel_number']|escape:'htmlall':'UTF-8'}</td>
<td>{$parcel['weight']|escape:'htmlall':'UTF-8'}</td>
<td>{$parcel['address']->firstname|escape:'htmlall':'UTF-8'} {$parcel['address']->lastname|escape:'htmlall':'UTF-8'}</td>
<td>{$parcel['address']->postcode|escape:'htmlall':'UTF-8'}</td>
<td>{$parcel['address']->city|escape:'htmlall':'UTF-8'}</td>
<td>{$parcel['tntData']['carrier_label']|escape:'htmlall':'UTF-8'}</td>
</tr>
{/foreach}
</table>
</div>
<hr>
<div class="total-table-container">
<table class="total">
<tr style="margin: 0; padding: 0;"><td style="margin: 0; padding: 0; width: 20%;">Compte&nbsp;{$manifestData['carrierAccount']|escape:'htmlall':'UTF-8'}</td><td style="margin: 0; padding: 0;">Total</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>&nbsp;</td></tr>
<tr style="margin: 0; padding: 0;"><td style="margin: 0; padding: 0; width: 20%;">{$manifestData['totalWeight']|escape:'htmlall':'UTF-8'}</td><td style="margin: 0; padding: 0;">{$manifestData['parcelsNumber']|escape:'htmlall':'UTF-8'}</td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
<tr><td>&nbsp;</td></tr>
<hr />
<tr><td>&nbsp;</td></tr>
<hr />
</table>
</div>
<div class="signature">
<div>
<table>
<tr><td>&nbsp;</td><td></td><td></td><td></td></tr>
<tr><td>&nbsp;</td><td></td><td></td><td></td></tr>
<tr><td>&nbsp;</td><td></td><td></td><td></td></tr>
<tr><td>&nbsp;</td><td></td><td></td><td></td></tr>
<tr><td>Signature de l'expéditeur</td><td>_____________________</td><td>Date ___/___/______</td><td></td></tr>
</table>
</div>
<br /><br /><br />
<br /><br />
<div>
<table>
<tr>
<td>Reçu par TNT</td><td>_____________________</td><td>Date ___/___/______</td><td>Heure ____:____</td>
</tr>
</table>
</div>
</div>
</div>

View File

@ -0,0 +1,16 @@
{*
* TNT OFFICIAL MODULE FOR PRESTASHOP
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016 GFI Informatique, 2016 TNT
* @license https://opensource.org/licenses/MIT MIT License
*}
<head>
<link rel="stylesheet" type="text/css" href="{$smarty.const._PS_MODULE_DIR_|escape:'htmlall':'UTF-8'}tntofficiel/views/css/manifest.css" />
</head>
<div class="footer-text" style="text-transform: uppercase">
<hr>{"La responsabilité de TNT concernant la perte, l'endommagement et le retard est limitée par la convention CMR ou de Varsovie, applicable quelle qu'elle soit. L'expéditeur accepte que les conditions générales, accessibles via l'aide TNT, sont acceptables et régissent ce contrat. Si aucun service ou option d'achat n'est séléctionné alors le service le plus rapide sera facturé à l'expéditeur."|escape:'htmlall':'UTF-8'|upper}
<hr>
</div>
<br>

View File

@ -0,0 +1,21 @@
{*
* TNT OFFICIAL MODULE FOR PRESTASHOP
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016 GFI Informatique, 2016 TNT
* @license https://opensource.org/licenses/MIT MIT License
*}
<head>
<link rel="stylesheet" type="text/css" href="{$smarty.const._PS_MODULE_DIR_|escape:'htmlall':'UTF-8'}tntofficiel/views/css/manifest.css" />
</head>
<table class="table-header">
<tr>
<td></td>
<td class="title">DOCUMENT MANIFESTE</td>
<td class="logo-container">
<img class="logo" src="{$smarty.const._PS_MODULE_DIR_|escape:'htmlall':'UTF-8'}tntofficiel/logo.gif" alt="logo">
</td>
</tr>
</table>

View File

@ -0,0 +1,18 @@
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,18 @@
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,18 @@
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,18 @@
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,18 @@
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,18 @@
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,18 @@
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,18 @@
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -0,0 +1,66 @@
{*
* TNT OFFICIAL MODULE FOR PRESTASHOP
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016 GFI Informatique, 2016 TNT
* @license https://opensource.org/licenses/MIT MIT License
*}
<html>
<head>
<title>{l s='shipping detail' mod='tntofficiel'}</title>
<link type="text/css" href="{$smarty.const._MODULE_DIR_|escape:'htmlall':'UTF-8'}tntofficiel/views/css/tracking.css" rel="stylesheet" />
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
</head>
<body>
<div class="header">
<div class="tnt-logo"></div>
<div class="title">{l s='shipping detail' mod='tntofficiel'}</div>
<a class="close" href="#" onclick="window.close(); window.opener.focus();return false;" title="{l s='Close' mod='tntofficiel'}"> </a>
</div>
{foreach from=$parcels item=parcel}
<div class="header-track">
<div class="track-label">{l s='tracking number' mod='tntofficiel'}</div>
<div class="track-number">{$parcel['parcel_number']|escape:'htmlall':'UTF-8'}</div>
<div class="button">
<a href="{$parcel['tracking_url']|escape:'html':'UTF-8'}" onclick="this.target='_blank';">{l s='follow my parcel' mod='tntofficiel'}&nbsp;<div class="tnt-arrow"></div></a>
</div>
</div>
<div class="status-track">
<p></p>
{if (isset($parcel['trackingData']['allStatus']) && count($parcel['trackingData']['allStatus']))}
<ul>
{foreach from=$parcel['trackingData']['allStatus'] item=label key=id}
<li class="status {if ($id == $parcel['trackingData']['status'] || ($id == 5 && $parcel['trackingData']['status'] > 5))} current {/if}" style="display: inline-block">{$label|escape:'htmlall':'UTF-8'}</li>
{/foreach}
</ul>
{/if}
{if (isset($parcel['trackingData']['history']))}
<div class="history-track">
<ul>
{foreach from=$parcel['trackingData']['history'] item=info key=idx}
<li>
<ul>
<li class="index">{$idx|intval}</li>
<li class="label">{$info['label']|escape:'htmlall':'UTF-8'} :</li>
{if (isset($info['date']) && strlen($info['date']))}
<li class="date">{$info['date']|escape:'htmlall':'UTF-8'|date_format:"%d.%m.%Y - %R"}</li>
{/if}
{if (isset($info['center']) && strlen($info['center']))}
<li class="center"> - {$info['center']|escape:'htmlall':'UTF-8'}</li>
{/if}
</ul>
</li>
{/foreach}
</ul>
</div>
<br /><br />
{/if}
</div>
{/foreach}
<div class="footer-track">
<div class="button">
<a href="#" onclick="window.close(); window.opener.focus();return false;">{l s='Close' mod='tntofficiel'}</a>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,18 @@
<?php
/**
* TNT OFFICIAL MODULE FOR PRESTASHOP.
*
* @author GFI Informatique <www.gfi.fr>
* @copyright 2016-2017 GFI Informatique, 2016-2017 TNT
* @license https://opensource.org/licenses/MIT MIT License
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../');
exit;

View File

@ -5,6 +5,7 @@
* @copyright 2016 GFI Informatique, 2016 TNT
* @license https://opensource.org/licenses/MIT MIT License
*}
<!-- Tnt carriers -->
{foreach $carriers.products as $tnt_index => $product}
{foreach $current_delivery_option as $idAddressSelected => $idCarrierOptionSelected}
@ -81,13 +82,14 @@
{assign var='descript' value="Pour une livraisons dans une de nos agences TNT en France métropolitaine.<br>
Mise à votre disposition sur présentation d'une pièce d'identité et contre signature dès 8 heures le lendemain de l'expédition de votre commande et ce pendant 10 Jours."}
{/if}
<div class="delivery_option item">
<div class="delivery_option delivery-option item">
<div>
<table class="resume table table-bordered">
<tr>
<td class="delivery_option_radio">
<td class="delivery-option-radio">
<input id="delivery_option_{$idAddress|intval}_tnt{$tnt_index|intval}" {* id="delivery_option_{$id_address|intval}_{$option@index}" *}
class="tnt_carrier_radio" {* class="delivery_option_radio" *}
class="tnt_carrier_radio custom-input" {* class="delivery_option_radio" *}
type="radio"
name="delivery_option_tnt[{$idAddress|intval}]" {* name="delivery_option[{$id_address|intval}]" *}
data-key="{$product.id|escape:'htmlall':'UTF-8'}"
@ -132,7 +134,7 @@
{/if}
</td>
<td class="delivery_option_price">
<div class="delivery_option_price">
<div class="delivery_option_price ">
{if $product.total_price_with_tax && !$product.is_free && (!isset($free_shipping) || (isset($free_shipping) && !$free_shipping))}
{if $use_taxes == 1}
{if $priceDisplay == 1}
@ -175,7 +177,7 @@
</div>
<a id="fancybox_extra_address_data" href="#extra_address_data" hidden="hidden"></a>
<div style="display: none;">
<div style="display:none">
<div id="extra_address_data">
<h1 class="page-subheading">{l s='TNT Additional Address' mod='tntofficiel'}</h1>