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 1/4] 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 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 2/4] 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 3/4] 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 '