From 79f401f5fb68ff05598f01c5e9efddf34a0c6c6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Mon, 30 Jan 2023 11:50:23 +0100 Subject: [PATCH 01/23] Get data back when error on command create --- htdocs/commande/card.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 586cf98d606..776b07e0a93 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -13,8 +13,9 @@ * Copyright (C) 2014 Ferran Marcet * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2018-2021 Frédéric France - * Copyright (C) 2022 Gauthier VERDOL - * + * Copyright (C) 2022 Gauthier VERDOL + * Copyright (C) 2023 Benjamin Falière + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -1730,32 +1731,32 @@ if ($action == 'create' && $usercancreate) { // Delivery delay print ''.$langs->trans('AvailabilityPeriod').''; print img_picto('', 'clock', 'class="pictofixedwidth"'); - $form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); + $form->selectAvailabilityDelay((GETPOST('availability_id')?GETPOST('availability_id'):$availability_id), 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); print ''; // Terms of payment print ''.$langs->trans('PaymentConditionsShort').''; print img_picto('', 'payment', 'class="pictofixedwidth"'); - $form->select_conditions_paiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent); + $form->select_conditions_paiements((GETPOST('cond_reglement_id')?GETPOST('cond_reglement_id'):$cond_reglement_id), 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent); print ''; // Payment mode print ''.$langs->trans('PaymentMode').''; print img_picto('', 'bank', 'class="pictofixedwidth"'); - $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); + $form->select_types_paiements((GETPOST('mode_reglement_id')?GETPOST('mode_reglement_id'):$mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); print ''; // Bank Account if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && !empty($conf->banque->enabled)) { print ''.$langs->trans('BankAccount').''; - print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); + print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes((GETPOST('fk_account')?GETPOST('fk_account'):$fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); print ''; } // Shipping Method if (isModEnabled('expedition')) { print ''.$langs->trans('SendingMethod').''; - print img_picto('', 'object_dolly', 'class="pictofixedwidth"').$form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); + print img_picto('', 'object_dolly', 'class="pictofixedwidth"').$form->selectShippingMethod((GETPOST('shipping_method_id')?GETPOST('shipping_method_id'):$shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); print ''; } @@ -1764,14 +1765,14 @@ if ($action == 'create' && $usercancreate) { require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); print ''.$langs->trans('Warehouse').''; - print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx'); + print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses((GETPOST('warehouse_id')?GETPOST('warehouse_id'):$warehouse_id), 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx'); print ''; } // Source / Channel - What trigger creation print ''.$langs->trans('Channel').''; print img_picto('', 'question', 'class="pictofixedwidth"'); - $form->selectInputReason($demand_reason_id, 'demand_reason_id', '', 1, 'maxwidth200 widthcentpercentminusx'); + $form->selectInputReason((GETPOST('demand_reason_id')?GETPOST('demand_reason_id'):$demand_reason_id), 'demand_reason_id', '', 1, 'maxwidth200 widthcentpercentminusx'); print ''; // TODO How record was recorded OrderMode (llx_c_input_method) @@ -1781,7 +1782,7 @@ if ($action == 'create' && $usercancreate) { $langs->load("projects"); print ''; print ''.$langs->trans("Project").''; - print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); + print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), (GETPOST('projectid')?GETPOST('projectid'):$projectid), 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); print ' id).'">'; print ''; print ''; @@ -1840,7 +1841,7 @@ if ($action == 'create' && $usercancreate) { print ''; print ''.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).''; print ''; - print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency($currency_code, 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx'); + print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency((GETPOST('multicurrency_code')?GETPOST('multicurrency_code'):$currency_code), 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx'); print ''; } From f2c877f66af1433a003934c9c8958a867ba2e6bf Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 30 Jan 2023 11:06:30 +0000 Subject: [PATCH 02/23] Fixing style errors. --- htdocs/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 776b07e0a93..4b0fb283e17 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -15,7 +15,7 @@ * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 Benjamin Falière - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or From e7c6eac984eeb56167b72c0b78a8313e57cc5cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Mon, 30 Jan 2023 14:05:17 +0100 Subject: [PATCH 03/23] Replaced GETPOST with GETPOSTISSET --- htdocs/commande/card.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 4b0fb283e17..d746c93a315 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1731,32 +1731,32 @@ if ($action == 'create' && $usercancreate) { // Delivery delay print ''.$langs->trans('AvailabilityPeriod').''; print img_picto('', 'clock', 'class="pictofixedwidth"'); - $form->selectAvailabilityDelay((GETPOST('availability_id')?GETPOST('availability_id'):$availability_id), 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); + $form->selectAvailabilityDelay((GETPOSTISSET('availability_id')?GETPOST('availability_id'):$availability_id), 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); print ''; // Terms of payment print ''.$langs->trans('PaymentConditionsShort').''; print img_picto('', 'payment', 'class="pictofixedwidth"'); - $form->select_conditions_paiements((GETPOST('cond_reglement_id')?GETPOST('cond_reglement_id'):$cond_reglement_id), 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent); + $form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id')?GETPOST('cond_reglement_id'):$cond_reglement_id), 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent); print ''; // Payment mode print ''.$langs->trans('PaymentMode').''; print img_picto('', 'bank', 'class="pictofixedwidth"'); - $form->select_types_paiements((GETPOST('mode_reglement_id')?GETPOST('mode_reglement_id'):$mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); + $form->select_types_paiements((GETPOSTISSET('mode_reglement_id')?GETPOST('mode_reglement_id'):$mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); print ''; // Bank Account if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && !empty($conf->banque->enabled)) { print ''.$langs->trans('BankAccount').''; - print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes((GETPOST('fk_account')?GETPOST('fk_account'):$fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); + print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes((GETPOSTISSET('fk_account')?GETPOST('fk_account'):$fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); print ''; } // Shipping Method if (isModEnabled('expedition')) { print ''.$langs->trans('SendingMethod').''; - print img_picto('', 'object_dolly', 'class="pictofixedwidth"').$form->selectShippingMethod((GETPOST('shipping_method_id')?GETPOST('shipping_method_id'):$shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); + print img_picto('', 'object_dolly', 'class="pictofixedwidth"').$form->selectShippingMethod((GETPOST('shipping_method_id')?GETPOSTISSET('shipping_method_id'):$shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); print ''; } @@ -1765,14 +1765,14 @@ if ($action == 'create' && $usercancreate) { require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); print ''.$langs->trans('Warehouse').''; - print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses((GETPOST('warehouse_id')?GETPOST('warehouse_id'):$warehouse_id), 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx'); + print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses((GETPOSTISSET('warehouse_id')?GETPOST('warehouse_id'):$warehouse_id), 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx'); print ''; } // Source / Channel - What trigger creation print ''.$langs->trans('Channel').''; print img_picto('', 'question', 'class="pictofixedwidth"'); - $form->selectInputReason((GETPOST('demand_reason_id')?GETPOST('demand_reason_id'):$demand_reason_id), 'demand_reason_id', '', 1, 'maxwidth200 widthcentpercentminusx'); + $form->selectInputReason((GETPOSTISSET('demand_reason_id')?GETPOST('demand_reason_id'):$demand_reason_id), 'demand_reason_id', '', 1, 'maxwidth200 widthcentpercentminusx'); print ''; // TODO How record was recorded OrderMode (llx_c_input_method) @@ -1782,7 +1782,7 @@ if ($action == 'create' && $usercancreate) { $langs->load("projects"); print ''; print ''.$langs->trans("Project").''; - print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), (GETPOST('projectid')?GETPOST('projectid'):$projectid), 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); + print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), (GETPOSTISSET('projectid')?GETPOST('projectid'):$projectid), 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); print ' id).'">'; print ''; print ''; @@ -1841,7 +1841,7 @@ if ($action == 'create' && $usercancreate) { print ''; print ''.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).''; print ''; - print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency((GETPOST('multicurrency_code')?GETPOST('multicurrency_code'):$currency_code), 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx'); + print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency((GETPOSTISSET('multicurrency_code')?GETPOST('multicurrency_code'):$currency_code), 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx'); print ''; } From 9f85e4a60f93dfe1609c89a192d0243a62d3b395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Mon, 30 Jan 2023 14:21:10 +0100 Subject: [PATCH 04/23] Fixed another little error --- htdocs/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index d746c93a315..6e4c5f45420 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1756,7 +1756,7 @@ if ($action == 'create' && $usercancreate) { // Shipping Method if (isModEnabled('expedition')) { print ''.$langs->trans('SendingMethod').''; - print img_picto('', 'object_dolly', 'class="pictofixedwidth"').$form->selectShippingMethod((GETPOST('shipping_method_id')?GETPOSTISSET('shipping_method_id'):$shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); + print img_picto('', 'object_dolly', 'class="pictofixedwidth"').$form->selectShippingMethod((GETPOSTISSET('shipping_method_id')?GETPOST('shipping_method_id'):$shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); print ''; } From afa1fd3e8ae61d3adae9d2e373a8aad477218c42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9lina=20JOUM?= Date: Wed, 1 Feb 2023 16:51:13 +0100 Subject: [PATCH 05/23] Get data back on product update --- htdocs/product/card.php | 71 ++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 351245794c3..90c48e44140 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1660,15 +1660,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // Ref - print ''; + print ''; // Label - print ''; + print ''; // Status To sell print ''; if (!empty($object->status_batch) || !empty($conf->use_javascript_ajax)) { $langs->load("admin"); @@ -1815,7 +1815,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Default warehouse print ''; /* @@ -1854,7 +1854,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { // Nature print ''; } } @@ -1862,7 +1862,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (!$object->isService() && !empty($conf->bom->enabled)) { print ''; } @@ -1870,40 +1870,40 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) { // Brut Weight print ''; } if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { // Brut Length print ''; } if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { // Brut Surface print ''; } if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) { // Brut Volume print ''; } if (!empty($conf->global->PRODUCT_ADD_NET_MEASURE)) { // Net Measure print ''; } } @@ -1917,7 +1917,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Custom code if (!$object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) { - print ''; + print ''; // Origin country print ''; print '"; } @@ -1995,76 +2000,76 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Accountancy_code_sell print ''; print ''; // Accountancy_code_sell_intra if ($mysoc->isInEEC()) { print ''; print ''; } // Accountancy_code_sell_export print ''; print ''; // Accountancy_code_buy print ''; print ''; // Accountancy_code_buy_intra if ($mysoc->isInEEC()) { print ''; print ''; } // Accountancy_code_buy_export print ''; print ''; } else { // For external software // Accountancy_code_sell print ''; - print ''; // Accountancy_code_sell_intra if ($mysoc->isInEEC()) { print ''; - print ''; } // Accountancy_code_sell_export print ''; - print ''; // Accountancy_code_buy print ''; - print ''; // Accountancy_code_buy_intra if ($mysoc->isInEEC()) { print ''; - print ''; } // Accountancy_code_buy_export print ''; - print ''; } } From eb6c25f64d67788a11d54ce0036eb8c2054cc035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 1 Feb 2023 22:06:22 +0100 Subject: [PATCH 06/23] fix https://github.com/Dolibarr/dolibarr/issues/23753 --- .../doc/doc_generic_invoice_odt.modules.php | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index fc73460bd1b..53f1e6f9619 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -334,15 +334,19 @@ class doc_generic_invoice_odt extends ModelePDFFactures $object->fetchObjectLinked('', '', '', ''); //print_r($object->linkedObjects['propal']); exit; - $propal_object = $object->linkedObjects['propal'][0]; + if (isset($object->linkedObjects['propal'][0])) { + $propal_object = $object->linkedObjects['propal'][0]; + } else { + $propal_object = null; + } // Make substitution $substitutionarray = array( - '__FROM_NAME__' => $this->emetteur->name, - '__FROM_EMAIL__' => $this->emetteur->email, - '__TOTAL_TTC__' => $object->total_ttc, - '__TOTAL_HT__' => $object->total_ht, - '__TOTAL_VAT__' => $object->total_tva + '__FROM_NAME__' => $this->emetteur->name, + '__FROM_EMAIL__' => $this->emetteur->email, + '__TOTAL_TTC__' => $object->total_ttc, + '__TOTAL_HT__' => $object->total_ht, + '__TOTAL_VAT__' => $object->total_tva ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook @@ -433,8 +437,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures } else { $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - } else // Text - { + } else { + // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } catch (OdfException $e) { From 4b61ef946a9b4370ea93ea3675d4c11a239bb343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9lina=20JOUM?= Date: Thu, 2 Feb 2023 11:44:10 +0100 Subject: [PATCH 07/23] Fix --- htdocs/product/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 90c48e44140..2a4ad20ed04 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1888,7 +1888,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Brut Surface print ''; } if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) { From f46d9f1a153562808b6dd78470f029e26b432992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9lina=20JOUM?= Date: Thu, 2 Feb 2023 15:54:24 +0100 Subject: [PATCH 08/23] Fix GETPOST --- htdocs/product/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 2a4ad20ed04..b9b31762037 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1668,7 +1668,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Status To sell print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("Label").'
'.$langs->trans("Label").'
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; print '
'.$langs->trans("ManageLotSerial").''; $statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial")); - print $form->selectarray('status_batch', $statutarray, $object->status_batch); + print $form->selectarray('status_batch', $statutarray, (GETPOSTISSET('status_batch') ? GETPOST('status_batch') : $object->status_batch)); print '
'.$langs->trans("DefaultWarehouse").''; print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"'); - print $formproduct->selectWarehouses($object->fk_default_warehouse, 'fk_default_warehouse', 'warehouseopen', 1); + print $formproduct->selectWarehouses((GETPOSTISSET('fk_default_warehouse') ? GETPOST('fk_default_warehouse') : $object->fk_default_warehouse), 'fk_default_warehouse', 'warehouseopen', 1); print ' '; print '
'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).''; - print $formproduct->selectProductNature('finished', $object->finished); + print $formproduct->selectProductNature('finished', (GETPOSTISSET('finished') ? GETPOST('finished') : $object->finished)); print '
'.$form->textwithpicto($langs->trans("DefaultBOM"), $langs->trans("DefaultBOMDesc", $langs->transnoentitiesnoconv("Finished"))).''; $bomkey = "Bom:bom/class/bom.class.php:0:t.status=1 AND t.fk_product=".((int) $object->id); - print $form->selectForForms($bomkey, 'fk_default_bom', $object->fk_default_bom, 1); + print $form->selectForForms($bomkey, 'fk_default_bom', (GETPOSTISSET('fk_default_bom') ? GETPOST('fk_default_bom') : $object->fk_default_bom), 1); print '
'.$langs->trans("Weight").''; - print ' '; - print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2); + print ' '; + print $formproduct->selectMeasuringUnits("weight_units", "weight", (GETPOSTISSET('weight_units') ? GETPOST('weight_units') : $object->weight_units), 0, 2); print '
'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; - print 'x'; - print 'x'; - print ' '; - print $formproduct->selectMeasuringUnits("size_units", "size", $object->length_units, 0, 2); + print 'x'; + print 'x'; + print ' '; + print $formproduct->selectMeasuringUnits("size_units", "size", (GETPOSTISSET('size_units') ? GETPOST('size_units') : $object->length_units), 0, 2); print '
'.$langs->trans("Surface").''; - print ' '; - print $formproduct->selectMeasuringUnits("surface_units", "surface", $object->surface_units, 0, 2); + print ' '; + print $formproduct->selectMeasuringUnits("surface_units", "surface", (GETPOSTISSET('surface_units') ? GETPOST('surface_units') : $object->volume), 0, 2); print '
'.$langs->trans("Volume").''; - print ' '; - print $formproduct->selectMeasuringUnits("volume_units", "volume", $object->volume_units, 0, 2); + print ' '; + print $formproduct->selectMeasuringUnits("volume_units", "volume", (GETPOSTISSET('volume_units') ? GETPOST('volume_units') : $volume_units), 0, 2); print '
'.$langs->trans("NetMeasure").''; - print ' '; - print $formproduct->selectMeasuringUnits("net_measure_units", "", $object->net_measure_units, 0, 0); + print ' '; + print $formproduct->selectMeasuringUnits("net_measure_units", "", (GETPOSTISSET('net_measure') ? GETPOST('net_measure') : $object->net_measure), 0, 0); print '
'.$langs->trans("CustomCode").'
'.$langs->trans("CustomCode").'
'.$langs->trans("CountryOrigin").''; @@ -1970,6 +1970,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $arrayselected[] = $cat->id; } } + if (GETPOSTISSET('categories', 'array')) { + foreach (GETPOST('categories', 'array') as $cat) { + $arrayselected[] = $cat; + } + } print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print "
'.$langs->trans("ProductAccountancySellCode").''; - print $formaccounting->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell') : $object->accountancy_code_sell), 'accountancy_code_sell', 1, '', 1, 1, 'minwidth150 maxwidth300'); print '
'.$langs->trans("ProductAccountancySellIntraCode").''; - print $formaccounting->select_account($object->accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra') : $object->accountancy_code_sell_intra), 'accountancy_code_sell_intra', 1, '', 1, 1, 'minwidth150 maxwidth300'); print '
'.$langs->trans("ProductAccountancySellExportCode").''; - print $formaccounting->select_account($object->accountancy_code_sell_export, 'accountancy_code_sell_export', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export') : $object->accountancy_code_sell_export), 'accountancy_code_sell_export', 1, '', 1, 1, 'minwidth150 maxwidth300'); print '
'.$langs->trans("ProductAccountancyBuyCode").''; - print $formaccounting->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy') ? GETPOST('accountancy_code_buy') : $object->accountancy_code_buy), 'accountancy_code_buy', 1, '', 1, 1, 'minwidth150 maxwidth300'); print '
'.$langs->trans("ProductAccountancyBuyIntraCode").''; - print $formaccounting->select_account($object->accountancy_code_buy_intra, 'accountancy_code_buy_intra', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra') : $object->accountancy_code_buy_intra), 'accountancy_code_buy_intra', 1, '', 1, 1, 'minwidth150 maxwidth300'); print '
'.$langs->trans("ProductAccountancyBuyExportCode").''; - print $formaccounting->select_account($object->accountancy_code_buy_export, 'accountancy_code_buy_export', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export') : $object->accountancy_code_buy_export), 'accountancy_code_buy_export', 1, '', 1, 1, 'minwidth150 maxwidth300'); print '
'.$langs->trans("ProductAccountancySellCode").''; + print ''; print '
'.$langs->trans("ProductAccountancySellIntraCode").''; + print ''; print '
'.$langs->trans("ProductAccountancySellExportCode").''; + print ''; print '
'.$langs->trans("ProductAccountancyBuyCode").''; + print ''; print '
'.$langs->trans("ProductAccountancyBuyIntraCode").''; + print ''; print '
'.$langs->trans("ProductAccountancyBuyExportCode").''; + print ''; print '
'.$langs->trans("Surface").''; print ' '; - print $formproduct->selectMeasuringUnits("surface_units", "surface", (GETPOSTISSET('surface_units') ? GETPOST('surface_units') : $object->volume), 0, 2); + print $formproduct->selectMeasuringUnits("surface_units", "surface", (GETPOSTISSET('surface_units') ? GETPOST('surface_units') : $object->surface_units), 0, 2); print '
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; print '