From b0d86d12fb8097df071c8c5f05a6e5710208c294 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 18 Nov 2021 10:43:52 +0100 Subject: [PATCH 001/112] fix url on formextra --- htdocs/core/tpl/extrafields_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index b5656c89339..15d529e01b6 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -243,7 +243,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l if ($object->table_element == 'societe') { $fieldid = 'socid'; } - print '
'; + print ''; print ''; print ''; print ''; From ac740e0a93d82f1f0921515705778cdb3a0bff3a Mon Sep 17 00:00:00 2001 From: atm-lena Date: Fri, 4 Mar 2022 11:28:03 +0100 Subject: [PATCH 002/112] Add pages to products list in inventory --- htdocs/product/inventory/inventory.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 95c9e2972cb..fc8b7c5cc35 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -40,6 +40,16 @@ $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'inventorycard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); +$listoffset = GETPOST('listoffset', 'alpha'); +$limit = GETPOST('limit', 'int') > 0 ?GETPOST('limit', 'int') : $conf->liste_limit; +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +if (empty($page) || $page == -1) { + $page = 0; +} +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +$savlimit = $limit; $fk_warehouse = GETPOST('fk_warehouse', 'int'); $fk_product = GETPOST('fk_product', 'int'); @@ -228,6 +238,7 @@ if (empty($reshook)) { $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); + $i = 0; $totalarray = array(); $inventoryline = new InventoryLine($db); @@ -284,7 +295,6 @@ if (empty($reshook)) { } } - $backurlforlist = DOL_URL_ROOT.'/product/inventory/list.php'; $backtopage = DOL_URL_ROOT.'/product/inventory/inventory.php?id='.$object->id; @@ -396,6 +406,14 @@ jQuery(document).ready(function() { // Part to show record if ($object->id > 0) { + + $param = '&id='.$object->id; + $param .= '&action=updateinventorylines'; + if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.urlencode($limit); + } + $paramwithsearch = $param; + $res = $object->fetch_optionals(); $head = inventoryPrepareHead($object); @@ -905,6 +923,7 @@ if ($object->id > 0) { $sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement'; $sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id'; $sql .= ' WHERE id.fk_inventory = '.((int) $object->id); + $sql .= $db->plimit($limit + 1, $offset); $cacheOfProducts = array(); $cacheOfWarehouses = array(); @@ -914,6 +933,10 @@ if ($object->id > 0) { if ($resql) { $num = $db->num_rows($resql); + if (!empty($savlimit != 0) || $num > $limit || $page) { + print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $limit), '', '',$limit, $num); + } + $i = 0; $hasinput = false; $totalarray = array(); From f3fb0ffd8a37966ee2d27c3b9c9854a69d75d97e Mon Sep 17 00:00:00 2001 From: atm-lena Date: Fri, 4 Mar 2022 16:44:15 +0100 Subject: [PATCH 003/112] Keep qty value between pages --- htdocs/core/actions_addupdatedelete.inc.php | 4 +- htdocs/product/inventory/inventory.php | 64 ++++++++++++++++----- 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 4857902b8cc..0a6151a5f60 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -28,6 +28,7 @@ // $permissiontodelete must be defined // $backurlforlist must be defined // $backtopage may be defined +// $gotopage // $triggermodname may be defined if (!empty($permissionedit) && empty($permissiontoadd)) { @@ -348,8 +349,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissionto } setEventMessages($langs->trans('RecordDeleted'), null, 'mesgs'); - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + header('Location: '.((empty($gotopage)) ? $_SERVER["PHP_SELF"].'?id='.$object->id : $gotopage)); exit; } else { $error++; diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index fc8b7c5cc35..480dbbaa27d 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -49,7 +49,6 @@ if (empty($page) || $page == -1) { $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$savlimit = $limit; $fk_warehouse = GETPOST('fk_warehouse', 'int'); $fk_product = GETPOST('fk_product', 'int'); @@ -104,6 +103,13 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $now = dol_now(); +//Parameters Page +$param = '&id='.$object->id; +if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.urlencode($limit); +} +$paramwithsearch = $param; + /* * Actions @@ -232,6 +238,7 @@ if (empty($reshook)) { $sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated'; $sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id'; $sql .= ' WHERE id.fk_inventory = '.((int) $object->id); + $sql .= $db->plimit($limit, $offset); $db->begin(); @@ -295,6 +302,10 @@ if (empty($reshook)) { } } + if($action == 'confirm_deleteline'){ + $gotopage = $_SERVER["PHP_SELF"].'?id='.$object->id.'&page='.$page.$paramwithsearch; + } + $backurlforlist = DOL_URL_ROOT.'/product/inventory/list.php'; $backtopage = DOL_URL_ROOT.'/product/inventory/inventory.php?id='.$object->id; @@ -407,13 +418,6 @@ jQuery(document).ready(function() { // Part to show record if ($object->id > 0) { - $param = '&id='.$object->id; - $param .= '&action=updateinventorylines'; - if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); - } - $paramwithsearch = $param; - $res = $object->fetch_optionals(); $head = inventoryPrepareHead($object); @@ -427,7 +431,7 @@ if ($object->id > 0) { } // Confirmation to delete line if ($action == 'deleteline') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid.'&page='.$page.$paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); } // Clone confirmation @@ -923,7 +927,7 @@ if ($object->id > 0) { $sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement'; $sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id'; $sql .= ' WHERE id.fk_inventory = '.((int) $object->id); - $sql .= $db->plimit($limit + 1, $offset); + $sql .= $db->plimit($limit, $offset); $cacheOfProducts = array(); $cacheOfWarehouses = array(); @@ -933,8 +937,8 @@ if ($object->id > 0) { if ($resql) { $num = $db->num_rows($resql); - if (!empty($savlimit != 0) || $num > $limit || $page) { - print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $limit), '', '',$limit, $num); + if (!empty($limit != 0) || $num > $limit || $page) { + print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num >= $limit), '', '',$limit); } $i = 0; @@ -1014,7 +1018,7 @@ if ($object->id > 0) { // Picto delete line print ''; - print ''.img_delete().''; + print ''.img_delete().''; $qty_tmp = price2num(GETPOST("id_".$obj->rowid."_input_tmp", 'MS')) >= 0 ? GETPOST("id_".$obj->rowid."_input_tmp") : $qty_view; print ''; print ''; @@ -1048,7 +1052,6 @@ if ($object->id > 0) { print ''; - // Call method to disable the button if no qty entered yet for inventory if ($object->status != $object::STATUS_VALIDATED || !$hasinput) { @@ -1060,6 +1063,39 @@ if ($object->id > 0) { '; } print ''; + + + print ''; + } // End of page From 4e8dd1b6a582f39374b9017000643ffbb0704c7e Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 8 Mar 2022 10:02:30 +0100 Subject: [PATCH 004/112] Delete function disable button disablebuttonmakemovementandclose() --- htdocs/langs/en_US/stocks.lang | 4 +-- htdocs/product/inventory/inventory.php | 34 -------------------------- 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 98faab0c423..af06ce7e94c 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -251,7 +251,7 @@ SelectAStockMovementFileToImport=select a stock movement file to import InfoTemplateImport=Uploaded file needs to have this format (* are mandatory fields):
Source Warehouse* | Target Warehouse* | Product* | Quantity* | Lot/serial number
CSV character separator must be "%s" LabelOfInventoryMovemement=Inventory %s ReOpen=Reopen -ConfirmFinish=Do you confirm the closing of the inventory ? This will generate all stock movements to update your stock to the real qty you entered into the inventory. +ConfirmFinish=Do you confirm the closing of the inventory ? This will generate all stock movements to update your stock to the real qty you entered into the inventory.

No stock movement will be made on products that do not have an actual quantity entered. ObjectNotFound=%s not found MakeMovementsAndClose=Generate movements and close AutofillWithExpected=Fill real quantity with expected quantity @@ -271,4 +271,4 @@ ErrorCantFindCodeInInventory=Can't find the following code in inventory QtyWasAddedToTheScannedBarcode=Success !! The quantity was added to all the requested barcode. You can close the Scanner tool. StockChangeDisabled=Change on stock disabled NoWarehouseDefinedForTerminal=No warehouse defined for terminal -ClearQtys=Clear all quantities \ No newline at end of file +ClearQtys=Clear all quantities diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 480dbbaa27d..385aae39248 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -393,28 +393,6 @@ $help_url = ''; llxHeader('', $langs->trans('Inventory'), $help_url); -// Disable button Generate movement if data were modified and not saved -print ''; - - // Part to show record if ($object->id > 0) { @@ -607,7 +585,6 @@ if ($object->id > 0) { objecttofill.value = object.innerText; }) console.log("Values filled (after click on fillwithexpected)"); - disablebuttonmakemovementandclose(); return false; });'; print '});'; @@ -858,7 +835,6 @@ if ($object->id > 0) { id = id.split("_")[1]; tmpvalue = $("#id_"+id+"_input_tmp").val() $("#id_"+id+"_input")[0].value = tmpvalue; - disablebuttonmakemovementandclose(); return false; /* disable submit */ }); });'; @@ -1052,16 +1028,6 @@ if ($object->id > 0) { print ''; - // Call method to disable the button if no qty entered yet for inventory - - if ($object->status != $object::STATUS_VALIDATED || !$hasinput) { - print ''; - } print ''; From 85628bad219028699b53c1e4b708142b4a3a63a6 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 8 Mar 2022 10:20:58 +0100 Subject: [PATCH 005/112] Fix save button --- htdocs/product/inventory/inventory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 385aae39248..ea51080803e 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -516,7 +516,7 @@ if ($object->id > 0) { print dol_get_fiche_end(); - print '
'; + print ''; print ''; print ''; print ''; From 38e0a8817d4f9688398523ce77bcfc4be993a836 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 8 Mar 2022 09:49:31 +0000 Subject: [PATCH 006/112] Fixing style errors. --- htdocs/product/inventory/inventory.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index ea51080803e..34aca5ef35f 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -302,7 +302,7 @@ if (empty($reshook)) { } } - if($action == 'confirm_deleteline'){ + if ($action == 'confirm_deleteline') { $gotopage = $_SERVER["PHP_SELF"].'?id='.$object->id.'&page='.$page.$paramwithsearch; } @@ -395,7 +395,6 @@ llxHeader('', $langs->trans('Inventory'), $help_url); // Part to show record if ($object->id > 0) { - $res = $object->fetch_optionals(); $head = inventoryPrepareHead($object); @@ -914,7 +913,7 @@ if ($object->id > 0) { $num = $db->num_rows($resql); if (!empty($limit != 0) || $num > $limit || $page) { - print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num >= $limit), '', '',$limit); + print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num >= $limit), '', '', $limit); } $i = 0; @@ -1061,7 +1060,6 @@ if ($object->id > 0) { }); }); '; - } // End of page From 7a6a980b69fac8d00e548c24f58d3f9c5b29c62d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 22 Apr 2022 07:36:56 +0000 Subject: [PATCH 007/112] Fixing style errors. --- htdocs/product/inventory/inventory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 05e8e50d514..0ee1806335c 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -1190,7 +1190,7 @@ if ($object->id > 0) { } print ''; -print ''; - - // Part to show record if ($object->id > 0) { $res = $object->fetch_optionals(); @@ -1207,7 +1183,6 @@ print ''; From 99efd244d6f3f1ab9dfcb9d8fe1a12b6b7bcb2d2 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Thu, 16 Jun 2022 14:57:32 +0200 Subject: [PATCH 009/112] FIX Page limit GET / POST --- htdocs/product/inventory/inventory.php | 17 +++++++++-------- htdocs/ticket/list.php | 1 - 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index ff21b499912..5e0bf2055e5 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -94,6 +94,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $id); +//Parameters Page +$param = '&id='.$object->id; +if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.urlencode($limit); +} +$paramwithsearch = $param; + + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $permissiontoadd = $user->rights->stock->creer; $permissiontodelete = $user->rights->stock->supprimer; @@ -104,12 +112,6 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $now = dol_now(); -//Parameters Page -$param = '&id='.$object->id; -if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); -} -$paramwithsearch = $param; /* @@ -547,8 +549,7 @@ if ($object->id > 0) { print dol_get_fiche_end(); - - print '
'; + print ''; print ''; print ''; print ''; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index a8314c4bf89..edc42dadccb 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -683,7 +683,6 @@ if ($search_dateclose_end) { $param .= '&search_date_endmonth='.urlencode($tmparray['mon']); $param .= '&search_date_endyear='.urlencode($tmparray['year']); } - // List of mass actions available $arrayofmassactions = array( //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), From 975d3ecf99f4330b31855b7efee87f99a9ac2291 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 4 Sep 2022 12:11:45 +0200 Subject: [PATCH 010/112] update code --- htdocs/admin/fckeditor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 3c3cd731a7d..60d0f52b036 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -65,7 +65,7 @@ $conditions = array( 'PRODUCTDESC' => (isModEnabled("product") || isModEnabled("service")), 'DETAILS' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande') || isModEnabled('supplier_proposal') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")), 'USERSIGN' => 1, - 'MAILING' => !empty($conf->mailing->enabled), + 'MAILING' => isModEnabled('mailing'), 'MAIL' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande')), 'TICKET' => !empty($conf->ticket->enabled), ); From 34b4ba7f33dd52c139461f4f237b0f799afe3b85 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 4 Sep 2022 13:24:12 +0200 Subject: [PATCH 011/112] update code --- .../canvas/actions_contactcard_common.class.php | 2 +- htdocs/contact/card.php | 16 ++++++++-------- htdocs/contact/list.php | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index d1cc70b4927..4a3fc28c9de 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -180,7 +180,7 @@ abstract class ActionsContactCardCommon if ($action == 'view' || $action == 'edit' || $action == 'delete') { // Emailing - if (!empty($conf->mailing->enabled)) { + if (isModEnabled('mailing')) { $langs->load("mails"); $this->tpl['nb_emailing'] = $this->object->getNbOfEMailings(); } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 4712b673ad1..d751cbef511 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -249,7 +249,7 @@ if (empty($reshook)) { $action = 'create'; } - if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && $object->no_email == -1 && !empty($object->email)) { + if (isModEnabled('mailing') && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && $object->no_email == -1 && !empty($object->email)) { $error++; $errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")); $action = 'create'; @@ -290,7 +290,7 @@ if (empty($reshook)) { } } - if (empty($error) && !empty($conf->mailing->enabled) && !empty($object->email)) { + if (empty($error) && isModEnabled('mailing') && !empty($object->email)) { // Add mass emailing flag into table mailing_unsubscribe $result = $object->setNoEmail($object->no_email); if ($result < 0) { @@ -342,7 +342,7 @@ if (empty($reshook)) { $action = 'edit'; } - if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && GETPOST("no_email", "int") == -1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) { + if (isModEnabled('mailing') && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && GETPOST("no_email", "int") == -1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) { $error++; $errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")); $action = 'edit'; @@ -830,7 +830,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // Unsubscribe - if (!empty($conf->mailing->enabled)) { + if (isModEnabled('mailing')) { if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2) { print "\n".'