// clean code
[-] BO : fixed bug #PSTEST-510 - Now, you can't define several times the same order status
This commit is contained in:
@@ -104,7 +104,9 @@
|
||||
<form action="{$currentIndex}&viewOrder&token={$smarty.get.token}" method="post">
|
||||
<select id="id_order_state" name="id_order_state">
|
||||
{foreach from=$states item=state}
|
||||
<option value="{$state['id_order_state']}" {if $state['id_order_state'] == $currentState->id}selected="selected"{/if}>{$state['name']|stripslashes}</option>
|
||||
{if $state['id_order_state'] != $currentState->id}
|
||||
<option value="{$state['id_order_state']}">{$state['name']|stripslashes}</option>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</select>
|
||||
<input type="hidden" name="id_order" value="{$order->id}" />
|
||||
|
||||
@@ -240,31 +240,37 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$this->errors[] = Tools::displayError('Invalid new order status');
|
||||
else
|
||||
{
|
||||
// Create new OrderHistory
|
||||
$history = new OrderHistory();
|
||||
$history->id_order = $order->id;
|
||||
$history->id_employee = (int)$this->context->employee->id;
|
||||
$history->changeIdOrderState($order_state->id, $order->id);
|
||||
$current_order_state = OrderHistory::getLastOrderState($order->id);
|
||||
if ($current_order_state->id != $order_state->id)
|
||||
{
|
||||
// Create new OrderHistory
|
||||
$history = new OrderHistory();
|
||||
$history->id_order = $order->id;
|
||||
$history->id_employee = (int)$this->context->employee->id;
|
||||
$history->changeIdOrderState($order_state->id, $order->id);
|
||||
|
||||
$carrier = new Carrier($order->id_carrier, $order->id_lang);
|
||||
$templateVars = array();
|
||||
if ($history->id_order_state == Configuration::get('PS_OS_SHIPPING') && $order->shipping_number)
|
||||
$templateVars = array('{followup}' => str_replace('@', $order->shipping_number, $carrier->url));
|
||||
elseif ($history->id_order_state == Configuration::get('PS_OS_CHEQUE'))
|
||||
$templateVars = array(
|
||||
'{cheque_name}' => (Configuration::get('CHEQUE_NAME') ? Configuration::get('CHEQUE_NAME') : ''),
|
||||
'{cheque_address_html}' => (Configuration::get('CHEQUE_ADDRESS') ? nl2br(Configuration::get('CHEQUE_ADDRESS')) : '')
|
||||
);
|
||||
elseif ($history->id_order_state == Configuration::get('PS_OS_BANKWIRE'))
|
||||
$templateVars = array(
|
||||
'{bankwire_owner}' => (Configuration::get('BANK_WIRE_OWNER') ? Configuration::get('BANK_WIRE_OWNER') : ''),
|
||||
'{bankwire_details}' => (Configuration::get('BANK_WIRE_DETAILS') ? nl2br(Configuration::get('BANK_WIRE_DETAILS')) : ''),
|
||||
'{bankwire_address}' => (Configuration::get('BANK_WIRE_ADDRESS') ? nl2br(Configuration::get('BANK_WIRE_ADDRESS')) : '')
|
||||
);
|
||||
// Save all changes
|
||||
if ($history->addWithemail(true, $templateVars))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.(int)$order->id.'&vieworder&token='.$this->token);
|
||||
$this->errors[] = Tools::displayError('An error occurred while changing the status or was unable to send e-mail to the customer.');
|
||||
$carrier = new Carrier($order->id_carrier, $order->id_lang);
|
||||
$templateVars = array();
|
||||
if ($history->id_order_state == Configuration::get('PS_OS_SHIPPING') && $order->shipping_number)
|
||||
$templateVars = array('{followup}' => str_replace('@', $order->shipping_number, $carrier->url));
|
||||
elseif ($history->id_order_state == Configuration::get('PS_OS_CHEQUE'))
|
||||
$templateVars = array(
|
||||
'{cheque_name}' => (Configuration::get('CHEQUE_NAME') ? Configuration::get('CHEQUE_NAME') : ''),
|
||||
'{cheque_address_html}' => (Configuration::get('CHEQUE_ADDRESS') ? nl2br(Configuration::get('CHEQUE_ADDRESS')) : '')
|
||||
);
|
||||
elseif ($history->id_order_state == Configuration::get('PS_OS_BANKWIRE'))
|
||||
$templateVars = array(
|
||||
'{bankwire_owner}' => (Configuration::get('BANK_WIRE_OWNER') ? Configuration::get('BANK_WIRE_OWNER') : ''),
|
||||
'{bankwire_details}' => (Configuration::get('BANK_WIRE_DETAILS') ? nl2br(Configuration::get('BANK_WIRE_DETAILS')) : ''),
|
||||
'{bankwire_address}' => (Configuration::get('BANK_WIRE_ADDRESS') ? nl2br(Configuration::get('BANK_WIRE_ADDRESS')) : '')
|
||||
);
|
||||
// Save all changes
|
||||
if ($history->addWithemail(true, $templateVars))
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_order='.(int)$order->id.'&vieworder&token='.$this->token);
|
||||
$this->errors[] = Tools::displayError('An error occurred while changing the status or was unable to send e-mail to the customer.');
|
||||
}
|
||||
else
|
||||
$this->errors[] = Tools::displayError('This order has already this status');
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -317,13 +323,13 @@ class AdminOrdersControllerCore extends AdminController
|
||||
}
|
||||
else
|
||||
$customer_thread = new CustomerThread((int)$id_customer_thread);
|
||||
|
||||
|
||||
$customer_message = new CustomerMessage();
|
||||
$customer_message->id_customer_thread = $customer_thread->id;
|
||||
$customer_message->id_employee = (int)$this->context->employee->id;
|
||||
$customer_message->message = htmlentities(Tools::getValue('message'), ENT_COMPAT, 'UTF-8');
|
||||
$customer_message->private = Tools::getValue('visibility');
|
||||
|
||||
|
||||
if (!$customer_message->add())
|
||||
$this->errors[] = Tools::displayError('An error occurred while sending message.');
|
||||
elseif ($customer_message->private)
|
||||
|
||||
@@ -33,7 +33,7 @@ class BlockViewed extends Module
|
||||
private $_html = '';
|
||||
private $_postErrors = array();
|
||||
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'blockviewed';
|
||||
$this->tab = 'front_office_features';
|
||||
@@ -47,7 +47,7 @@ class BlockViewed extends Module
|
||||
$this->description = $this->l('Adds a block displaying last-viewed products.');
|
||||
}
|
||||
|
||||
function install()
|
||||
public function install()
|
||||
{
|
||||
if (!parent::install()
|
||||
OR !$this->registerHook('leftColumn')
|
||||
@@ -91,10 +91,10 @@ class BlockViewed extends Module
|
||||
return $output;
|
||||
}
|
||||
|
||||
function hookRightColumn($params)
|
||||
public function hookRightColumn($params)
|
||||
{
|
||||
$id_product = (int)(Tools::getValue('id_product'));
|
||||
$productsViewed = (isset($params['cookie']->viewed) AND !empty($params['cookie']->viewed)) ? array_slice(explode(',', $params['cookie']->viewed), 0, Configuration::get('PRODUCTS_VIEWED_NBR')) : array();
|
||||
$id_product = (int)Tools::getValue('id_product');
|
||||
$productsViewed = (isset($params['cookie']->viewed) && !empty($params['cookie']->viewed)) ? array_slice(explode(',', $params['cookie']->viewed), 0, Configuration::get('PRODUCTS_VIEWED_NBR')) : array();
|
||||
|
||||
if (sizeof($productsViewed))
|
||||
{
|
||||
@@ -179,12 +179,12 @@ class BlockViewed extends Module
|
||||
return ;
|
||||
}
|
||||
|
||||
function hookLeftColumn($params)
|
||||
public function hookLeftColumn($params)
|
||||
{
|
||||
return $this->hookRightColumn($params);
|
||||
}
|
||||
|
||||
function hookHeader($params)
|
||||
public function hookHeader($params)
|
||||
{
|
||||
$this->context->controller->addCSS(($this->_path).'blockviewed.css', 'all');
|
||||
}
|
||||
|
||||
+12
-11
@@ -2,16 +2,6 @@
|
||||
|
||||
global $_ERRORS;
|
||||
$_ERRORS = array();
|
||||
$_ERRORS['b417662bce6671781c5285afe872056a'] = 'l\'image est trop grande';
|
||||
$_ERRORS['ab57fd0432e25d5b3013133a1c910d56'] = 'Ko';
|
||||
$_ERRORS['bc54287d97c88a98f594dc488a334e89'] = 'Taille max. :';
|
||||
$_ERRORS['c4ae3afc5d4c01919142f8b39cc5c1c5'] = 'format de l\'image non reconnu ; formats acceptés : GIF, JPG, PNG';
|
||||
$_ERRORS['1391c1ff3846b38862bbfc43938b8270'] = 'une erreur s\'est produite pendant le chargement de l\'image ; vous devez changer votre configuration serveur';
|
||||
$_ERRORS['a84ef667c075cd620781f25c135c73e7'] = 'Code d\'erreur:';
|
||||
$_ERRORS['40f9f62de5a8ccf912bc1cd19d515dd2'] = 'Le fichier est trop volumineux.';
|
||||
$_ERRORS['d139abab2541129dfae24c733635104c'] = 'Le fichier a été partiellement transféré';
|
||||
$_ERRORS['d2bbf245e9591814fe994df3cae95964'] = 'Le fichier est vide';
|
||||
$_ERRORS['2ab146a83f61d2896a472f52f353b321'] = 'format d\'image non reconnu ; les formats autorisés sont : .ico';
|
||||
$_ERRORS['e49f206b6d8f0e5e2a6cb13d96b44ed2'] = 'Ce nom de classe n\'existe pas';
|
||||
$_ERRORS['edd62dfcf50e7a6dea932ca1eca167b2'] = 'Cette propriété n\'existe pas dans la classe ou est interdite';
|
||||
$_ERRORS['b8ab75688d5796c2e61d3047b91acc17'] = 'Cette association contient trop de clés';
|
||||
@@ -85,6 +75,13 @@ $_ERRORS['e96841b0cb2396574006c1e17a45abec'] = 'Une erreur est survenue lors de
|
||||
$_ERRORS['4df3709ec0ff3ceb57341890ccf57641'] = 'Une erreur est survenue pendant la copie de l\'image :';
|
||||
$_ERRORS['efccf3b0fd1b65f88bd6dfa2821060c8'] = 'uen erreur est survenue pendant la mise à jour du statut';
|
||||
$_ERRORS['9d35e3b5d28c6a068a6c6856e359b87b'] = 'Thème actuel indisponible. Merci de vérifier le répertoire de votre thème ou ses permissions.';
|
||||
$_ERRORS['b417662bce6671781c5285afe872056a'] = 'l\'image est trop grande';
|
||||
$_ERRORS['ab57fd0432e25d5b3013133a1c910d56'] = 'Ko';
|
||||
$_ERRORS['bc54287d97c88a98f594dc488a334e89'] = 'Taille max. :';
|
||||
$_ERRORS['c4ae3afc5d4c01919142f8b39cc5c1c5'] = 'format de l\'image non reconnu ; formats acceptés : GIF, JPG, PNG';
|
||||
$_ERRORS['1391c1ff3846b38862bbfc43938b8270'] = 'une erreur s\'est produite pendant le chargement de l\'image ; vous devez changer votre configuration serveur';
|
||||
$_ERRORS['a84ef667c075cd620781f25c135c73e7'] = 'Code d\'erreur:';
|
||||
$_ERRORS['2ab146a83f61d2896a472f52f353b321'] = 'format d\'image non reconnu ; les formats autorisés sont : .ico';
|
||||
$_ERRORS['10f237be40b3205ba97da9b89d290c30'] = 'Impossible de sélectionner la base de données.';
|
||||
$_ERRORS['f1cdcf26d9787f078f7fc0e0645858d7'] = 'Erreur fatale : Format utf-8 non supporté. Merci de vérifier la configuration de votre serveur.';
|
||||
$_ERRORS['49bd922182bd3518641589e3077eacd3'] = 'Impossible de se connecter à la base de données.';
|
||||
@@ -396,8 +393,13 @@ $_ERRORS['42c7641733e2026a7baf5d94327fd340'] = 'une erreur est survenue pendant
|
||||
$_ERRORS['087193a0e83ba92c73396e2e6082ee89'] = 'Selectionnez au moins un module à décrocher';
|
||||
$_ERRORS['dc4b45d6ded64ffc6cfcec146a2b0bf5'] = 'Contrôlleur introuvable';
|
||||
$_ERRORS['5421db7177e5dc293af3f2565811888a'] = 'Objets non valides';
|
||||
$_ERRORS['a7b770c4221d81830ac09059e16083a8'] = 'L\'ID de l\'OrderCarrier est invalide';
|
||||
$_ERRORS['3a636d6a7d184e869fa5b2c05849214b'] = 'Numéro de suivi incorrect';
|
||||
$_ERRORS['75bc8684cb9fc4f73f254270141f0c9b'] = 'L\'OrderCarrier ne peut être mis à jour';
|
||||
$_ERRORS['e1e95b3cea70730a922b35808ca3dce3'] = 'Statut de commande invalide';
|
||||
$_ERRORS['ae831e16712dd5e3b49c1f10c1d4f3c0'] = 'une erreur est survenue lors du changement de statut et/ou de l\'envoi de l\'e-mail au client';
|
||||
$_ERRORS['8934d0647dcf8c73fd668161c30002d6'] = 'Cette commande a déjà ce statut';
|
||||
$_ERRORS['ecd7aa91bf7a1cf55a0d3dbd8c0c6463'] = 'Le client est invalide';
|
||||
$_ERRORS['70f4b635847038d056e33959821a7a66'] = 'caractères max';
|
||||
$_ERRORS['ddccb08d56c9ba148a1e395c2a0901df'] = 'une erreur est survenue lors de l\'envoi de l\'e-mail au client';
|
||||
$_ERRORS['ec995e6aa93ad0264c5593d9d76edbe3'] = 'Impossible de générer un remboursement partiel';
|
||||
@@ -584,7 +586,6 @@ $_ERRORS['4803e6b9e63dabf04de980788d6a13c4'] = 'ligne';
|
||||
$_ERRORS['2dd3ed3563a4e175ad6f9c20ca5173af'] = 'est déprécié(e) et sera supprimé(e) lors de notre prochaine version majeure';
|
||||
$_ERRORS['2031a6bfe5f5bed90694c02868ebf2ed'] = 'Le paramètre';
|
||||
$_ERRORS['4a86eb1f2e0779658266fd6a8582dc9a'] = 'dans la fonction';
|
||||
$_ERRORS['350bf1d858bae55fa9c344b39ea9afcd'] = 'Le produit ne peut pas être chargé';
|
||||
$_ERRORS['c111be82444b7eed2d979636db454ce9'] = 'Accès interdit';
|
||||
$_ERRORS['1b599bf89c1bf4f8640ef31f3acb9f40'] = 'aucun fichier spécifié';
|
||||
$_ERRORS['107b871b48c2c55155eb6849e38171c3'] = 'Impossible d\'ouvrir le fichier de sauvegarde';
|
||||
|
||||
Reference in New Issue
Block a user