From 0d213d1162e1addff669499c9cea90c6d130cb24 Mon Sep 17 00:00:00 2001 From: bMancone Date: Mon, 30 Jan 2012 10:11:36 +0000 Subject: [PATCH] // SupplyOrder form updated --- classes/stock/SupplyOrder.php | 21 +++++++++++++++++++ .../admin/AdminSupplyOrdersController.php | 9 +++++++- themes/default/pdf/lang/fr.php | 8 +++---- themes/default/pdf/supply-order.tpl | 4 ++-- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/classes/stock/SupplyOrder.php b/classes/stock/SupplyOrder.php index b9ec1e357..3d938dae1 100755 --- a/classes/stock/SupplyOrder.php +++ b/classes/stock/SupplyOrder.php @@ -487,6 +487,27 @@ class SupplyOrderCore extends ObjectModel } } + + /** + * Gets the reference of a given order + * + * @param int $id_supply_order + * @return bool|string + */ + public static function getReferenceById($id_supply_order) + { + if (!$id_supply_order) + return false; + + $query = new DbQuery(); + $query->select('so.reference'); + $query->from('supply_order', 'so'); + $query->where('so.id_supply_order = '.(int)$id_supply_order); + $ref = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query); + + return (pSQL($ref)); + } + /*********************************\ * * Webservices Specific Methods diff --git a/controllers/admin/AdminSupplyOrdersController.php b/controllers/admin/AdminSupplyOrdersController.php index 0d825f740..46a94029a 100644 --- a/controllers/admin/AdminSupplyOrdersController.php +++ b/controllers/admin/AdminSupplyOrdersController.php @@ -979,8 +979,15 @@ class AdminSupplyOrdersControllerCore extends AdminController // checks if supply order reference is unique if (Tools::isSubmit('reference')) { + // gets the reference $ref = pSQL(Tools::getValue('reference')); - if ((int)SupplyOrder::exists($ref) != (int)Tools::getValue('id_supply_order')) + + if (Tools::getValue('id_supply_order') != 0 && SupplyOrder::getReferenceById((int)Tools::getValue('id_supply_order')) != $ref) + { + if ((int)SupplyOrder::exists($ref) != 0) + $this->errors[] = Tools::displayError($this->l('The reference has to be unique.')); + } + else if (Tools::getValue('id_supply_order') == 0 && (int)SupplyOrder::exists($ref) != 0) $this->errors[] = Tools::displayError($this->l('The reference has to be unique.')); } diff --git a/themes/default/pdf/lang/fr.php b/themes/default/pdf/lang/fr.php index 0c3efb2ab..aa026cea1 100644 --- a/themes/default/pdf/lang/fr.php +++ b/themes/default/pdf/lang/fr.php @@ -60,19 +60,19 @@ $_LANGPDF['PDF66f6e4bbd0a0af1af6b54763871dd280'] = 'Produits commandés :'; $_LANGPDF['PDF63d5049791d9d79d86e9a108b0a999ca'] = 'Référence'; $_LANGPDF['PDFf107f5a9ee4ecea58d0f29ae7959baa8'] = 'Nom'; $_LANGPDF['PDFc8ba77264f6e923f5ee35abf3108ae7c'] = 'Prix unitaire HT'; -$_LANGPDF['PDF3a6a6d37bea2c7567f8599ea88b47930'] = 'Total HT'; +$_LANGPDF['PDF3a6a6d37bea2c7567f8599ea88b47930'] = 'Prix HT'; $_LANGPDF['PDF7521172dd37ba56442ea866ac18eb49d'] = 'Avant réduction'; $_LANGPDF['PDF6703aa9936582b4381418f7d523370b4'] = 'Taux de remise'; $_LANGPDF['PDFa61109b693023aed557445989c517982'] = 'Après réduction'; $_LANGPDF['PDF20a34c4e30c5bbe1d3f870ac55f0d831'] = 'Taux TVA'; -$_LANGPDF['PDFfa2ce544158555e8f06c69dd9e681832'] = 'Prix TTC'; +$_LANGPDF['PDFfa2ce544158555e8f06c69dd9e681832'] = 'Prix TTC '; $_LANGPDF['PDF716be2c7de31f063369ca297a9928403'] = 'Taxes :'; $_LANGPDF['PDFf4a232c48df10124ee867767a4e7280e'] = 'Base HT'; $_LANGPDF['PDF01a2436b8e3782c1f99e6b26adf901b2'] = 'Montant TVA'; $_LANGPDF['PDF1300f86974cafc2d65eb1f082a26bdf1'] = 'Résumé :'; -$_LANGPDF['PDF9b8362e5321f70746e9cb8f615c28d05'] = 'Prix HT (HR)'; +$_LANGPDF['PDF627be65d466c88030f7afcfdaf6d794f'] = 'Brut (Avant remise)'; $_LANGPDF['PDF6b9e9f2472786ed1e76005bfc37bc8af'] = 'Remise globale'; -$_LANGPDF['PDFa86dc2fff006afd2deb243d7e26b30e7'] = 'Prix HT (RC)'; +$_LANGPDF['PDF77c48b105700c87484e3008ca52a8e57'] = 'Net (Après remise)'; $_LANGPDF['PDF699e6bd4690ed3bd5f658052e12aba04'] = 'Montant TVA'; $_LANGPDF['PDF448634536559b1f8aaa975e0aa12b930'] = 'NET A PAYER'; diff --git a/themes/default/pdf/supply-order.tpl b/themes/default/pdf/supply-order.tpl index 86ccbf905..9fcd7e479 100644 --- a/themes/default/pdf/supply-order.tpl +++ b/themes/default/pdf/supply-order.tpl @@ -142,7 +142,7 @@
- + @@ -150,7 +150,7 @@ - +
{l s='Total TE (DE)' pdf='true'}{l s='Total TE' pdf='true'}
{l s='(Discount excluded)' pdf='true'}
{$currency->prefix} {$supply_order->total_te} {$currency->suffix}
{$currency->prefix} {$supply_order->discount_value_te} {$currency->suffix}
{l s='Total TE (DI)' pdf='true'}{l s='Total TE' pdf='true'}
{l s='(Discount included)' pdf='true'}
{$currency->prefix} {$supply_order->total_with_discount_te} {$currency->suffix}