From c77d1206d33d1141e5998c166a36b547c9d4850c Mon Sep 17 00:00:00 2001 From: Giovanni Vella Date: Fri, 22 Oct 2021 14:45:28 +0200 Subject: [PATCH 01/48] NEW: receipt beep alternative and current date/time I have added the alternative command for the beep (when that does not work) and the possibility to print the current date and time on the receipt. --- htdocs/core/class/dolreceiptprinter.class.php | 10 ++++++++++ htdocs/langs/en_US/receiptprinter.lang | 2 ++ htdocs/langs/it_IT/receiptprinter.lang | 2 ++ 3 files changed, 14 insertions(+) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 2062f1b351c..cb49f53e0c5 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -42,6 +42,7 @@ * {dol_cut_paper_partial} Cut ticket partially * {dol_open_drawer} Open cash drawer * {dol_beep} Activate buzzer + * {dol_beep_alternative} Activate buzzer (alternative mode) * {dol_print_barcode} Print barcode * {dol_print_logo} Print logo stored on printer. Example : 32|32 * {dol_print_logo_old} Print logo stored on printer. Must be followed by logo code. For old printers. @@ -52,6 +53,7 @@ * {dol_print_order_lines} Print order lines for Printer * {dol_print_object_lines_with_notes} Print object lines with notes * {dol_print_payment} Print payment method + * {dol_print_curr_date} Print the current date/time. Must be followed by format string. * * Code which can be placed everywhere * Replaced by date AAAA-MM-DD @@ -177,6 +179,7 @@ class dolReceiptPrinter extends Printer 'dol_cut_paper_partial' => 'DOL_CUT_PAPER_PARTIAL', 'dol_open_drawer' => 'DOL_OPEN_DRAWER', 'dol_beep' => 'DOL_BEEP', + 'dol_beep_alternative' => 'DOL_BEEP_ALTERNATIVE', 'dol_print_text' => 'DOL_PRINT_TEXT', 'dol_print_barcode' => 'DOL_PRINT_BARCODE', 'dol_value_date' => 'DateInvoice', @@ -187,6 +190,7 @@ class dolReceiptPrinter extends Printer 'dol_value_day' => 'DOL_VALUE_DAY', 'dol_value_day_letters' => 'DOL_VALUE_DAY', 'dol_print_payment' => 'DOL_PRINT_PAYMENT', + 'dol_print_curr_date' => 'DOL_PRINT_CURR_DATE', 'dol_print_logo' => 'DOL_PRINT_LOGO', 'dol_print_logo_old' => 'DOL_PRINT_LOGO_OLD', 'dol_value_object_id' => 'InvoiceID', @@ -707,6 +711,9 @@ class dolReceiptPrinter extends Printer $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0); $this->printer->text($title.$spaces.str_pad(price($object->total_ttc), 10, ' ', STR_PAD_LEFT)."\n"); break; + case 'DOL_PRINT_CURR_DATE': + $this->printer->text(date($vals[$tplline]['value'])."\n"); + break; case 'DOL_LINE_FEED': $this->printer->feed(); break; @@ -789,6 +796,9 @@ class dolReceiptPrinter extends Printer case 'DOL_BEEP': $this->printer->getPrintConnector() -> write("\x1e"); break; + case 'DOL_BEEP_ALTERNATIVE': //if DOL_BEEP not works + $this->printer->getPrintConnector() -> write(Printer::ESC . "B" . chr(4) . chr(1)); + break; case 'DOL_PRINT_ORDER_LINES': foreach ($object->lines as $line) { if ($line->special_code == $this->orderprinter) { diff --git a/htdocs/langs/en_US/receiptprinter.lang b/htdocs/langs/en_US/receiptprinter.lang index 284c4fa61fa..b505ee63cf5 100644 --- a/htdocs/langs/en_US/receiptprinter.lang +++ b/htdocs/langs/en_US/receiptprinter.lang @@ -55,6 +55,8 @@ DOL_DEFAULT_HEIGHT_WIDTH=Default height and width size DOL_UNDERLINE=Enable underline DOL_UNDERLINE_DISABLED=Disable underline DOL_BEEP=Beep sound +DOL_BEEP_ALTERNATIVE=Beep sound (alternative mode) +DOL_PRINT_CURR_DATE=Print current date/time DOL_PRINT_TEXT=Print text DateInvoiceWithTime=Invoice date and time YearInvoice=Invoice year diff --git a/htdocs/langs/it_IT/receiptprinter.lang b/htdocs/langs/it_IT/receiptprinter.lang index 49621049ddf..566f762bbbd 100644 --- a/htdocs/langs/it_IT/receiptprinter.lang +++ b/htdocs/langs/it_IT/receiptprinter.lang @@ -55,6 +55,8 @@ DOL_DEFAULT_HEIGHT_WIDTH=Altezza e larghezza predefinite DOL_UNDERLINE=Abilita sottolineatura DOL_UNDERLINE_DISABLED=Disabilita la sottolineatura DOL_BEEP=Suono di Beep +DOL_BEEP_ALTERNATIVE=Suono di Beep (modalità alternativa) +DOL_PRINT_CURR_DATE=Stampa la data/ora corrente DOL_PRINT_TEXT=Stampa il testo DateInvoiceWithTime=Data e ora della fattura YearInvoice=Anno della fattura From a855ef132951b99675d7e181b3482a1ccca118b1 Mon Sep 17 00:00:00 2001 From: Giovanni Vella Date: Sun, 24 Oct 2021 12:07:23 +0200 Subject: [PATCH 02/48] current date default format string Added a default format for date/time tag DOL_PRINT_CURR_DATE --- htdocs/core/class/dolreceiptprinter.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index cb49f53e0c5..116624c428b 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -712,7 +712,8 @@ class dolReceiptPrinter extends Printer $this->printer->text($title.$spaces.str_pad(price($object->total_ttc), 10, ' ', STR_PAD_LEFT)."\n"); break; case 'DOL_PRINT_CURR_DATE': - $this->printer->text(date($vals[$tplline]['value'])."\n"); + if (strlen($vals[$tplline]['value'])<2) $this->printer->text(date('d/m/Y H:i:s')."\n"); + else $this->printer->text(date($vals[$tplline]['value'])."\n"); break; case 'DOL_LINE_FEED': $this->printer->feed(); From 5c862435a89cebcd46119b26be09bacfc2224fa9 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Mon, 7 Feb 2022 16:06:25 +0100 Subject: [PATCH 03/48] Ajout ligne BOM enfant dans mo_card action "create" --- htdocs/mrp/tpl/originproductline.tpl.php | 98 +++++++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-) diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php index ba1d7fccd86..97847427fcd 100644 --- a/htdocs/mrp/tpl/originproductline.tpl.php +++ b/htdocs/mrp/tpl/originproductline.tpl.php @@ -32,12 +32,30 @@ $qtytoconsumeforline = $this->tpl['qty'] / ( ! empty($this->tpl['efficiency']) ? }*/ $qtytoconsumeforline = price2num($qtytoconsumeforline, 'MS'); +$tmpproduct = new Product($this->db); +$tmpproduct->fetch($line->fk_product); +$tmpbom = new BOM($this->db); +$res = $tmpbom->fetch($line->fk_bom_child); + ?> tpl['strike']) ? '' : ' strikefordisabled').'">'; -print ''.$this->tpl['label'].''; +print ''; +if($res){ + print $tmpproduct->getNomUrl(1); + print ' '.$langs->trans("or").' '; + print $tmpbom->getNomUrl(1); + print ' '; + print (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? img_picto('', 'folder') : img_picto('', 'folder-open')); + print ''; + +} else{ + print $this->tpl['label']; +} +print ''; +//print ''.$this->tpl['label'].''; print ''.$this->tpl['qty'].(($this->tpl['efficiency'] > 0 && $this->tpl['efficiency'] < 1) ? ' / '.$form->textwithpicto($this->tpl['efficiency'], $langs->trans("ValueOfMeansLoss")).' = '.$qtytoconsumeforline : '').''; print ''.(empty($this->tpl['stock']) ? 0 : price2num($this->tpl['stock'], 'MS')); if ($this->tpl['seuil_stock_alerte'] != '' && ($this->tpl['stock'] < $this->tpl['seuil_stock_alerte'])) { @@ -61,5 +79,83 @@ print ''; //print ''; print ''; print ''."\n"; + +// Select of all the sub-BOM lines +$sql = 'SELECT rowid, fk_bom_child, fk_product, qty FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl'; +$sql.= ' WHERE fk_bom ='. (int) $tmpbom->id; +$resql = $this->db->query($sql); + +if ($resql) { + // Loop on all the sub-BOM lines if they exist + while ($obj = $this->db->fetch_object($resql)) { + $sub_bom_product = new Product($this->db); + $sub_bom_product->fetch($obj->fk_product); + $sub_bom_product->load_stock(); + + $sub_bom = new BOM($this->db); + $sub_bom->fetch($obj->fk_bom_child); + + $sub_bom_line = new BOMLine($this->db); + $sub_bom_line->fetch($obj->rowid); + + //If hidden conf is set, we show directly all the sub-BOM lines + if (!empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT)) { + print ''; + } else { + print ''; + } + + // Product OR BOM + print ''; + if (!empty($obj->fk_bom_child)) { + print $sub_bom_product->getNomUrl(1); + print ' '.$langs->trans('or').' '; + print $sub_bom->getNomUrl(1); + } else { + print $sub_bom_product->getNomUrl(1); + print ''; + } + + // Qty + if ($sub_bom_line->qty_frozen > 0) { + print ''.price($sub_bom_line->qty, 0, '', 0, 0).''; + } else { + print ''.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).''; + } + + // Stock réel + if ($sub_bom_product->stock_reel > 0) { + print ''.$sub_bom_product->stock_reel.''; + } else { + print ' '; + } + + // Stock virtuel + if ($sub_bom_product->stock_theorique > 0) { + print ''.$sub_bom_product->stock_theorique.''; + } else { + print ' '; + } + + // Frozen qty + if ($sub_bom_line->qty_frozen > 0) { + print ''.$langs->trans('Yes').''; + } else { + print ' '; + } + + // Disable stock change + if ($sub_bom_line->disable_stock_change > 0) { + print ''.yn($sub_bom_line->disable_stock_change).''; + } else { + print ' '; + } + + print ''; + print ''; + print ''; + } +} + ?> From f921c10e3ac4204ff5bf5a313fe69ede88100a58 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Mon, 7 Feb 2022 16:28:58 +0100 Subject: [PATCH 04/48] =?UTF-8?q?Gestion=20js=20:=20d=C3=A9roulement=20des?= =?UTF-8?q?=20sous=20bom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/mrp/class/mo.class.php | 7 ++++ htdocs/mrp/mo_card.php | 41 +++++++++++++++++++++++- htdocs/mrp/tpl/originproductline.tpl.php | 2 +- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 29db4bcb669..7a2b738b81e 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1312,6 +1312,13 @@ class Mo extends CommonObject $text_stock_options .= (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE) ? '- '.$langs->trans("StockOnReception").'
' : ''); print ''; + // Product or sub-bom + print ''.$langs->trans('Description'); + if (!empty($conf->global->BOM_SUB_BOM)) { + print '   '.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'  '; + print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' '; + } + print ''; print ''.$langs->trans('Ref').''; print ''.$langs->trans('Qty'); if ($this->bom->bomtype == 0) { diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 48e36831592..4ba3fe8f250 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -243,7 +243,46 @@ if ($action == 'create') { ?> - - + + + + array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('propal').')'), 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".$this->db->prefix()."societe as s, ".$this->db->prefix()."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande').')'), @@ -8571,7 +8569,6 @@ class Form $sql = $possiblelink['sql']; $resqllist = $this->db->query($sql); - if ($resqllist) { $num = $this->db->num_rows($resqllist); $i = 0; diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index a686e2892f6..f3df78af869 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -675,7 +675,6 @@ class Mo extends CommonObject } $resultline = $moline->create($user, false); // Never use triggers here - if ($resultline <= 0) { $error++; $this->error = $moline->error; @@ -1206,7 +1205,7 @@ class Mo extends CommonObject /** * Create an array of lines - * + * @param string $rolefilter * @return array|int array of lines if OK, <0 if KO */ public function getLinesArray($rolefilter = '') @@ -1694,9 +1693,7 @@ class MoLine extends CommonObjectLine $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - $i = 0; - while ($i < ($limit ? min($limit, $num) : $num)) { $obj = $this->db->fetch_object($resql); diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index fc6ae99ad55..2b6e7f5dbe4 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp_mo.lib.php'; require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; +require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; + // Load translation files required by the page $langs->loadLangs(array("mrp", "other")); @@ -112,7 +114,6 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - if (empty($reshook)) { $error = 0; @@ -130,14 +131,11 @@ if (empty($reshook)) { if ($cancel && !empty($backtopageforcancel)) { $backtopage = $backtopageforcancel; } - - - $triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen - if ($action == 'add' && empty($id)) { + if ($action == 'add' && empty($id) && !empty($TBomLineId)) { $noback = ""; include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; @@ -281,48 +279,11 @@ if ($action == 'create') { print dol_get_fiche_end(); + print mrpCollapseBomManagement(); + ?> Date: Tue, 15 Feb 2022 16:24:39 +0100 Subject: [PATCH 18/48] Clean Code --- htdocs/langs/en_US/mrp.lang | 1 + htdocs/mrp/class/mo.class.php | 2 +- htdocs/mrp/mo_card.php | 14 +++++--------- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 97b2634d40d..e3167bb7109 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -108,3 +108,4 @@ BOM=Bill Of Materials CollapseBOMHelp=You can define the default display of the details of the nomenclature in the configuration of the BOM module MOAndLines=Manufacturing Orders and lines MoChildGenerate=Generate Child Mo +ParentMo=MO Parent diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index f3df78af869..0eb01e09cb5 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1205,7 +1205,7 @@ class Mo extends CommonObject /** * Create an array of lines - * @param string $rolefilter + * @param string $rolefilter string lines role filter * @return array|int array of lines if OK, <0 if KO */ public function getLinesArray($rolefilter = '') diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 2b6e7f5dbe4..a104a9a5d31 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -133,10 +133,9 @@ if (empty($reshook)) { } $triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record - // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen - + //Create MO with Childs if ($action == 'add' && empty($id) && !empty($TBomLineId)) { - $noback = ""; + $noback = 0; include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; $mo_parent = $object; @@ -163,16 +162,13 @@ if (empty($reshook)) { $res = $object->add_object_linked('mo', $mo_parent->id); } - $noback = 0; - - header("Location: ".$urltogo); + header("Location: ".dol_buildpath('/mrp/mo_list.php', 1)); exit; } + // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; - - // Actions when linking object each other include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; @@ -531,7 +527,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $mo_parent = $object->getMoParent(); if (is_object($mo_parent)) { print ''; - print '' . $langs->trans('MOParent') . ''; + print '' . $langs->trans('ParentMo') . ''; print '' .$mo_parent->getNomUrl(1).''; print ''; } From c2bc3b20bbfd8c40c0e41326f3e8ea9f62417ec6 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Thu, 17 Feb 2022 11:05:03 +0100 Subject: [PATCH 19/48] Don't display collapse if no bom on bomline --- htdocs/mrp/tpl/originproductline.tpl.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php index d261764f1c8..78d58062d4c 100644 --- a/htdocs/mrp/tpl/originproductline.tpl.php +++ b/htdocs/mrp/tpl/originproductline.tpl.php @@ -45,10 +45,12 @@ print 'getNomUrl(1); - print ' '; - print (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? img_picto('', 'folder') : img_picto('', 'folder-open')); + if($tmpbom->id) { + print ' ' . $langs->trans("or") . ' '; + print $tmpbom->getNomUrl(1); + print ' '; + print (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? img_picto('', 'folder') : img_picto('', 'folder-open')); + } print ''; } else { print $this->tpl['label']; @@ -92,6 +94,7 @@ $resql = $this->db->query($sql); if ($resql) { // Loop on all the sub-BOM lines if they exist while ($obj = $this->db->fetch_object($resql)) { + $sub_bom_product = new Product($this->db); $sub_bom_product->fetch($obj->fk_product); $sub_bom_product->load_stock(); From 7e6a5d5792ed06a41e6ad35a43e1f9bcc2c83854 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 17 Feb 2022 10:13:30 +0000 Subject: [PATCH 20/48] Fixing style errors. --- htdocs/mrp/tpl/originproductline.tpl.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php index 78d58062d4c..17ee9305726 100644 --- a/htdocs/mrp/tpl/originproductline.tpl.php +++ b/htdocs/mrp/tpl/originproductline.tpl.php @@ -45,7 +45,7 @@ print 'getNomUrl(1); print ' '; @@ -94,7 +94,6 @@ $resql = $this->db->query($sql); if ($resql) { // Loop on all the sub-BOM lines if they exist while ($obj = $this->db->fetch_object($resql)) { - $sub_bom_product = new Product($this->db); $sub_bom_product->fetch($obj->fk_product); $sub_bom_product->load_stock(); From c4a8bffa4822276a67ba15a5b39025c3ee0369c3 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Mon, 21 Feb 2022 10:05:18 +0100 Subject: [PATCH 21/48] FIX Travis : global $db --- htdocs/mrp/tpl/originproductline.tpl.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php index 78d58062d4c..f4dbf74ea7d 100644 --- a/htdocs/mrp/tpl/originproductline.tpl.php +++ b/htdocs/mrp/tpl/originproductline.tpl.php @@ -22,19 +22,22 @@ if (empty($conf) || !is_object($conf)) { exit; } +global $db; + if (!is_object($form)) { $form = new Form($db); } + $qtytoconsumeforline = $this->tpl['qty'] / ( ! empty($this->tpl['efficiency']) ? $this->tpl['efficiency'] : 1 ); /*if ((empty($this->tpl['qty_frozen']) && $this->tpl['qty_bom'] > 1)) { $qtytoconsumeforline = $qtytoconsumeforline / $this->tpl['qty_bom']; }*/ $qtytoconsumeforline = price2num($qtytoconsumeforline, 'MS'); -$tmpproduct = new Product($this->db); +$tmpproduct = new Product($db); $tmpproduct->fetch($line->fk_product); -$tmpbom = new BOM($this->db); +$tmpbom = new BOM($db); $res = $tmpbom->fetch($line->fk_bom_child); ?> @@ -89,20 +92,20 @@ print ''."\n"; // Select of all the sub-BOM lines $sql = 'SELECT rowid, fk_bom_child, fk_product, qty FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl'; $sql.= ' WHERE fk_bom ='. (int) $tmpbom->id; -$resql = $this->db->query($sql); +$resql = $db->query($sql); if ($resql) { // Loop on all the sub-BOM lines if they exist - while ($obj = $this->db->fetch_object($resql)) { + while ($obj = $db->fetch_object($resql)) { - $sub_bom_product = new Product($this->db); + $sub_bom_product = new Product($db); $sub_bom_product->fetch($obj->fk_product); $sub_bom_product->load_stock(); - $sub_bom = new BOM($this->db); + $sub_bom = new BOM($db); $sub_bom->fetch($obj->fk_bom_child); - $sub_bom_line = new BOMLine($this->db); + $sub_bom_line = new BOMLine($db); $sub_bom_line->fetch($obj->rowid); //If hidden conf is set, we show directly all the sub-BOM lines From e02b82e3464abe8bf46de196737fc0044c6b3502 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 21 Feb 2022 09:09:39 +0000 Subject: [PATCH 22/48] Fixing style errors. --- htdocs/mrp/tpl/originproductline.tpl.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php index 035cb3a2184..22e53ae721e 100644 --- a/htdocs/mrp/tpl/originproductline.tpl.php +++ b/htdocs/mrp/tpl/originproductline.tpl.php @@ -96,7 +96,6 @@ $resql = $db->query($sql); if ($resql) { // Loop on all the sub-BOM lines if they exist while ($obj = $db->fetch_object($resql)) { - $sub_bom_product = new Product($db); $sub_bom_product->fetch($obj->fk_product); $sub_bom_product->load_stock(); From f177973efe21dba3e6984d549ecac06249e64419 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Mon, 21 Feb 2022 10:13:25 +0100 Subject: [PATCH 23/48] Don't create Mo Child if it's only a product line on BOM --- htdocs/mrp/tpl/originproductline.tpl.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php index 035cb3a2184..d8a7eb99ed8 100644 --- a/htdocs/mrp/tpl/originproductline.tpl.php +++ b/htdocs/mrp/tpl/originproductline.tpl.php @@ -82,9 +82,13 @@ print ''; //print ''; print ''; -print ''; -print ''; -print ''; +if($tmpbom->id) { + print ''; + print ''; + print ''; +} else { + print ' '; +} print ''."\n"; From cf2f2c283b4928b4f9e9bfc4180511f5ef261f9e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 21 Feb 2022 09:17:20 +0000 Subject: [PATCH 24/48] Fixing style errors. --- htdocs/mrp/tpl/originproductline.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php index 096ae6109fd..d65f625048b 100644 --- a/htdocs/mrp/tpl/originproductline.tpl.php +++ b/htdocs/mrp/tpl/originproductline.tpl.php @@ -82,7 +82,7 @@ print ''; //print ''; print ''; -if($tmpbom->id) { +if ($tmpbom->id) { print ''; print ''; print ''; From 45fe83289f77614d5315c1745b5f1db45b51c598 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 22 Feb 2022 11:32:33 +0100 Subject: [PATCH 25/48] MoChild category --- htdocs/core/class/html.form.class.php | 4 ++-- htdocs/langs/en_US/mrp.lang | 1 + htdocs/mrp/mo_card.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b8e1850feaf..6ee9bf79049 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8339,7 +8339,7 @@ class Form * @param array $compatibleImportElementsList Array of compatibles elements object for "import from" action * @return int <0 if KO, >=0 if OK */ - public function showLinkedObjectBlock($object, $morehtmlright = '', $compatibleImportElementsList = false) + public function showLinkedObjectBlock($object, $morehtmlright = '', $compatibleImportElementsList = false, $title='RelatedObjects') { global $conf, $langs, $hookmanager; global $bc, $action; @@ -8358,7 +8358,7 @@ class Form $nbofdifferenttypes = count($object->linkedObjects); print ''; - print load_fiche_titre($langs->trans('RelatedObjects'), $morehtmlright, '', 0, 0, 'showlinkedobjectblock'); + print load_fiche_titre($langs->trans($title), $morehtmlright, '', 0, 0, 'showlinkedobjectblock'); print '
'; diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index e3167bb7109..cef9054f727 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -109,3 +109,4 @@ CollapseBOMHelp=You can define the default display of the details of the nomencl MOAndLines=Manufacturing Orders and lines MoChildGenerate=Generate Child Mo ParentMo=MO Parent +MOChild=MO Child diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index a104a9a5d31..34ed92a2164 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -731,7 +731,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, array('mo')); - $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, false, 'MOChild'); print '
'; From e5ba5b208e5f4732dcdf2f285340df552d83c55d Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 22 Feb 2022 11:36:41 +0100 Subject: [PATCH 26/48] Correct Stickler --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6ee9bf79049..48b7b27cc14 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8339,7 +8339,7 @@ class Form * @param array $compatibleImportElementsList Array of compatibles elements object for "import from" action * @return int <0 if KO, >=0 if OK */ - public function showLinkedObjectBlock($object, $morehtmlright = '', $compatibleImportElementsList = false, $title='RelatedObjects') + public function showLinkedObjectBlock($object, $morehtmlright = '', $compatibleImportElementsList = false, $title = 'RelatedObjects') { global $conf, $langs, $hookmanager; global $bc, $action; From 5e644ed0a4afca0ed5e804a1d942e357d6b545f0 Mon Sep 17 00:00:00 2001 From: ATM john Date: Tue, 15 Mar 2022 18:24:49 +0100 Subject: [PATCH 27/48] Fix search degradation --- htdocs/compta/facture/list.php | 1 - htdocs/core/class/extrafields.class.php | 80 +++++++++++++------ .../tpl/extrafields_list_search_sql.tpl.php | 9 ++- 3 files changed, 61 insertions(+), 29 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index ccf3c2f3f0c..c97e1a6d10f 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -139,7 +139,6 @@ $search_btn = GETPOST('button_search', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); - $option = GETPOST('search_option'); if ($option == 'late') { $search_status = '1'; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index f8e5726d344..770956a7581 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1173,35 +1173,56 @@ class ExtraFields $out = ' '; } elseif ($type == 'select') { $out = ''; - if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_EXTRAFIELDS_DISABLE_SELECT2)) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $out .= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); - } + if ($mode) { + $options = array(); + foreach ($param['options'] as $okey => $val) { + if ((string) $okey == '') { + continue; + } - $out .= ''; + $out .= ''; + foreach ($param['options'] as $key => $val) { + if ((string) $key == '') { + continue; + } + $valarray = explode('|', $val); + $val = $valarray[0]; + $parent = ''; + if (!empty($valarray[1])) { + $parent = $valarray[1]; + } + $out .= ''; + } + $out .= ''; } - $out .= ''; } elseif ($type == 'sellist') { $out = ''; if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_EXTRAFIELDS_DISABLE_SELECT2)) { @@ -2208,6 +2229,17 @@ class ExtraFields } else { continue; // Value was not provided, we should not set it. } + } elseif ($key_type == 'select') { + // to detect if we are in search context + $value_arr_test = GETPOST($keysuffix."options_".$key.$keyprefix, 'none'); + if (is_array($value_arr_test)) { + $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix, 'array:aZ09'); + // Make sure we get an array even if there's only one selected + $value_arr = (array) $value_arr; + $value_key = implode(',', $value_arr); + } else { + $value_key = GETPOST($keysuffix."options_".$key.$keyprefix); + } } elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) { if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) { continue; // Value was not provided, we should not set it. diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index 8b7ff9ac62c..a4b0a8591b4 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -48,7 +48,7 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($ } $sql .= ")"; } - } elseif ($crit != '' && (!in_array($typ, array('select', 'sellist')) || $crit != '0') && (!in_array($typ, array('link')) || $crit != '-1')) { + } elseif ($crit != '' && (!in_array($typ, array('select', 'sellist', 'select')) || $crit != '0') && (!in_array($typ, array('link')) || $crit != '-1')) { $mode_search = 0; if (in_array($typ, array('int', 'double', 'real', 'price'))) { $mode_search = 1; // Search on a numeric @@ -59,13 +59,14 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($ if (in_array($typ, array('sellist')) && !is_numeric($crit)) { $mode_search = 0;// Search on a foreign key string } - if (in_array($typ, array('chkbxlst', 'checkbox'))) { + if (in_array($typ, array('chkbxlst', 'checkbox', 'select'))) { $mode_search = 4; // Search on a multiselect field with sql type = text } if (is_array($crit)) { $crit = implode(' ', $crit); // natural_search() expects a string - } elseif ($typ === 'select' and is_string($crit) and strpos($crit, ' ') === false) { - $sql .= " AND (".$extrafieldsobjectprefix.$tmpkey." = '".$db->escape($crit)."')"; + } elseif ($typ === 'select' and is_string($crit) and strpos($crit, ',') === false) { + $critSelect = implode("','", array_map(array($db, 'escape'), explode(',', $crit))); + $sql .= " AND (".$extrafieldsobjectprefix.$tmpkey." IN ('".$critSelect."') )"; continue; } $sql .= natural_search($extrafieldsobjectprefix.$tmpkey, $crit, $mode_search); From 16968b08f9f5f2971af0153923a618bff4c3bb1b Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 30 Mar 2022 11:49:48 +0200 Subject: [PATCH 28/48] Add GETPOSTISARRAY --- htdocs/core/class/extrafields.class.php | 3 +-- htdocs/core/lib/functions.lib.php | 26 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index a840dbd02b9..6e92714293b 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2131,8 +2131,7 @@ class ExtraFields } } elseif ($key_type == 'select') { // to detect if we are in search context - $value_arr_test = GETPOST($keysuffix."options_".$key.$keyprefix, 'none'); - if (is_array($value_arr_test)) { + if (GETPOSTISARRAY($keysuffix."options_".$key.$keyprefix)) { $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix, 'array:aZ09'); // Make sure we get an array even if there's only one selected $value_arr = (array) $value_arr; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f9672f776e5..9c268d31980 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -370,6 +370,32 @@ function GETPOSTISSET($paramname) return $isset; } +/** + * Return true if the parameter $paramname is submit from a POST OR GET as an array. + * Can be used before GETPOST to know if the $check param of GETPOST need to check an array or a string + * + * @param string $paramname Name or parameter to test + * @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get) + * @return bool True if we have just submit a POST or GET request with the parameter provided (even if param is empty) + */ +function GETPOSTISARRAY($paramname, $method = 0) +{ + // for $method test need return the same $val as GETPOST + if (empty($method)) { + $val = isset($_GET[$paramname]) ? $_GET[$paramname] : (isset($_POST[$paramname]) ? $_POST[$paramname] : ''); + } elseif ($method == 1) { + $val = isset($_GET[$paramname]) ? $_GET[$paramname] : ''; + } elseif ($method == 2) { + $val = isset($_POST[$paramname]) ? $_POST[$paramname] : ''; + } elseif ($method == 3) { + $val = isset($_POST[$paramname]) ? $_POST[$paramname] : (isset($_GET[$paramname]) ? $_GET[$paramname] : ''); + } else { + $val = 'BadFirstParameterForGETPOST'; + } + + return is_array($val); +} + /** * Return value of a param into GET or POST supervariable. * Use the property $user->default_values[path]['createform'] and/or $user->default_values[path]['filters'] and/or $user->default_values[path]['sortorder'] From c1d9ea95dcb1d362c951317d1cc8216412cc2c26 Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 30 Mar 2022 12:16:17 +0200 Subject: [PATCH 29/48] fix function name --- htdocs/api/class/api.class.php | 4 ++-- htdocs/categories/class/categorie.class.php | 2 +- .../comm/propal/class/api_proposals.class.php | 8 +++---- htdocs/commande/class/api_orders.class.php | 8 +++---- .../bank/class/api_bankaccounts.class.php | 22 +++++++++---------- .../facture/class/api_invoices.class.php | 8 +++---- htdocs/contrat/class/api_contracts.class.php | 8 +++---- htdocs/core/lib/functions.lib.php | 22 ++++++++++++++++--- .../expedition/class/api_shipments.class.php | 8 +++---- .../class/api_expensereports.class.php | 8 +++---- htdocs/exports/class/export.class.php | 2 +- .../class/api_supplier_invoices.class.php | 8 +++---- .../class/api_knowledgemanagement.class.php | 4 ++-- .../template/class/api_mymodule.class.php | 4 ++-- htdocs/product/class/api_products.class.php | 6 ++--- htdocs/projet/class/api_projects.class.php | 4 ++-- htdocs/projet/class/api_tasks.class.php | 4 ++-- .../class/api_recruitment.class.php | 8 +++---- 18 files changed, 77 insertions(+), 61 deletions(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index fa21c37649f..32d691400d6 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -88,9 +88,9 @@ class DolibarrApi // phpcs:enable // TODO Use type detected in $object->fields if (in_array($field, array('note', 'note_private', 'note_public', 'desc', 'description'))) { - return checkVal($value, 'restricthtml'); + return sanitizeVal($value, 'restricthtml'); } else { - return checkVal($value, 'alphanohtml'); + return sanitizeVal($value, 'alphanohtml'); } } diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index a3d2dc3e57f..fca780cadef 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -913,7 +913,7 @@ class Categorie extends CommonObject $categories = array(); - $type = checkVal($type, 'aZ09'); + $type = sanitizeVal($type, 'aZ09'); $sub_type = $type; $subcol_name = "fk_".$type; diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 59a03f78bb2..882189c86b3 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -343,8 +343,8 @@ class Proposals extends DolibarrApi $request_data = (object) $request_data; - $request_data->desc = checkVal($request_data->desc, 'restricthtml'); - $request_data->label = checkVal($request_data->label); + $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml'); + $request_data->label = sanitizeVal($request_data->label); $updateRes = $this->propal->addline( $request_data->desc, @@ -488,8 +488,8 @@ class Proposals extends DolibarrApi $request_data = (object) $request_data; - $request_data->desc = checkVal($request_data->desc, 'restricthtml'); - $request_data->label = checkVal($request_data->label); + $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml'); + $request_data->label = sanitizeVal($request_data->label); $propalline = new PropaleLigne($this->db); $result = $propalline->fetch($lineid); diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index fb912139d5f..e73fee8941f 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -335,8 +335,8 @@ class Orders extends DolibarrApi $request_data = (object) $request_data; - $request_data->desc = checkVal($request_data->desc, 'restricthtml'); - $request_data->label = checkVal($request_data->label); + $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml'); + $request_data->label = sanitizeVal($request_data->label); $updateRes = $this->commande->addline( $request_data->desc, @@ -403,8 +403,8 @@ class Orders extends DolibarrApi $request_data = (object) $request_data; - $request_data->desc = checkVal($request_data->desc, 'restricthtml'); - $request_data->label = checkVal($request_data->label); + $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml'); + $request_data->label = sanitizeVal($request_data->label); $updateRes = $this->commande->updateline( $lineid, diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 23d4c2eefbb..8e38d1ffe78 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -250,7 +250,7 @@ class BankAccounts extends DolibarrApi } // Clean data - $description = checkVal($description, 'alphanohtml'); + $description = sanitizeVal($description, 'alphanohtml'); /** @@ -498,13 +498,13 @@ class BankAccounts extends DolibarrApi throw new RestException(404, 'account not found'); } - $type = checkVal($type); - $label = checkVal($label); - $cheque_number = checkVal($cheque_number); - $cheque_writer = checkVal($cheque_writer); - $cheque_bank = checkVal($cheque_bank); - $accountancycode = checkVal($accountancycode); - $num_releve = checkVal($num_releve); + $type = sanitizeVal($type); + $label = sanitizeVal($label); + $cheque_number = sanitizeVal($cheque_number); + $cheque_writer = sanitizeVal($cheque_writer); + $cheque_bank = sanitizeVal($cheque_bank); + $accountancycode = sanitizeVal($accountancycode); + $num_releve = sanitizeVal($num_releve); $result = $account->addline( $date, @@ -557,9 +557,9 @@ class BankAccounts extends DolibarrApi throw new RestException(404, 'account line not found'); } - $url = checkVal($url); - $label = checkVal($label); - $type = checkVal($type); + $url = sanitizeVal($url); + $label = sanitizeVal($label); + $type = sanitizeVal($type); $result = $account->add_url_line($line_id, $url_id, $url, $label, $type); if ($result < 0) { diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 551edb05731..19fda9ee253 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -423,8 +423,8 @@ class Invoices extends DolibarrApi $request_data = (object) $request_data; - $request_data->desc = checkVal($request_data->desc, 'restricthtml'); - $request_data->label = checkVal($request_data->label); + $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml'); + $request_data->label = sanitizeVal($request_data->label); $updateRes = $this->invoice->updateline( $lineid, @@ -712,8 +712,8 @@ class Invoices extends DolibarrApi $request_data = (object) $request_data; - $request_data->desc = checkVal($request_data->desc, 'restricthtml'); - $request_data->label = checkVal($request_data->label); + $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml'); + $request_data->label = sanitizeVal($request_data->label); // Reset fk_parent_line for no child products and special product if (($request_data->product_type != 9 && empty($request_data->fk_parent_line)) || $request_data->product_type == 9) { diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index 5e534f3e43c..ea228550cae 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -278,8 +278,8 @@ class Contracts extends DolibarrApi $request_data = (object) $request_data; - $request_data->desc = checkVal($request_data->desc, 'restricthtml'); - $request_data->price_base_type = checkVal($request_data->price_base_type); + $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml'); + $request_data->price_base_type = sanitizeVal($request_data->price_base_type); $updateRes = $this->contract->addline( $request_data->desc, @@ -336,8 +336,8 @@ class Contracts extends DolibarrApi $request_data = (object) $request_data; - $request_data->desc = checkVal($request_data->desc, 'restricthtml'); - $request_data->price_base_type = checkVal($request_data->price_base_type); + $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml'); + $request_data->price_base_type = sanitizeVal($request_data->price_base_type); $updateRes = $this->contract->updateline( $lineid, diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9c268d31980..9d5a9eae857 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -683,11 +683,11 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null $tmpcheck = 'alphanohtml'; } foreach ($out as $outkey => $outval) { - $out[$outkey] = checkVal($outval, $tmpcheck, $filter, $options); + $out[$outkey] = sanitizeVal($outval, $tmpcheck, $filter, $options); } } } else { - $out = checkVal($out, $check, $filter, $options); + $out = sanitizeVal($out, $check, $filter, $options); } // Sanitizing for special parameters. @@ -736,9 +736,11 @@ function GETPOSTINT($paramname, $method = 0) return (int) GETPOST($paramname, 'int', $method, null, null, 0); } + /** - * Return a value after checking on a rule. A sanitization may also have been done. + * Return a sanitized or empty value after checking value against a rule. * + * @deprecated * @param string|array $out Value to check/clear. * @param string $check Type of check/sanitizing * @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails) @@ -746,6 +748,20 @@ function GETPOSTINT($paramname, $method = 0) * @return string|array Value sanitized (string or array). It may be '' if format check fails. */ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options = null) +{ + return sanitizeVal($out, $check, $filter, $options); +} + +/** + * Return a sanitized or empty value after checking value against a rule. + * + * @param string|array $out Value to check/clear. + * @param string $check Type of check/sanitizing + * @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails) + * @param mixed $options Options to pass to filter_var when $check is set to 'custom' + * @return string|array Value sanitized (string or array). It may be '' if format check fails. + */ +function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options = null) { global $conf; diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index 402fbdc04d1..357683ef35a 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -279,8 +279,8 @@ class Shipments extends DolibarrApi $request_data = (object) $request_data; - $request_data->desc = checkVal($request_data->desc, 'restricthtml'); - $request_data->label = checkVal($request_data->label); + $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml'); + $request_data->label = sanitizeVal($request_data->label); $updateRes = $this->shipment->addline( $request_data->desc, @@ -347,8 +347,8 @@ class Shipments extends DolibarrApi $request_data = (object) $request_data; - $request_data->desc = checkVal($request_data->desc, 'restricthtml'); - $request_data->label = checkVal($request_data->label); + $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml'); + $request_data->label = sanitizeVal($request_data->label); $updateRes = $this->shipment->updateline( $lineid, diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 37319a3ec71..876b08f18f0 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -251,8 +251,8 @@ class ExpenseReports extends DolibarrApi $request_data = (object) $request_data; - $request_data->desc = checkVal($request_data->desc, 'restricthtml'); - $request_data->label = checkVal($request_data->label); + $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml'); + $request_data->label = sanitizeVal($request_data->label); $updateRes = $this->expensereport->addline( $request_data->desc, @@ -319,8 +319,8 @@ class ExpenseReports extends DolibarrApi $request_data = (object) $request_data; - $request_data->desc = checkVal($request_data->desc, 'restricthtml'); - $request_data->label = checkVal($request_data->label); + $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml'); + $request_data->label = sanitizeVal($request_data->label); $updateRes = $this->expensereport->updateline( $lineid, diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index c87f03f3110..a836be7d9d4 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -302,7 +302,7 @@ class Export public function build_filterQuery($TypeField, $NameField, $ValueField) { // phpcs:enable - $NameField = checkVal($NameField, 'aZ09'); + $NameField = sanitizeVal($NameField, 'aZ09'); $szFilterQuery = ''; //print $TypeField." ".$NameField." ".$ValueField; diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 35e783729ff..d08409a279b 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -558,8 +558,8 @@ class SupplierInvoices extends DolibarrApi $request_data = (object) $request_data; - $request_data->description = checkVal($request_data->description, 'restricthtml'); - $request_data->ref_supplier = checkVal($request_data->ref_supplier); + $request_data->description = sanitizeVal($request_data->description, 'restricthtml'); + $request_data->ref_supplier = sanitizeVal($request_data->ref_supplier); $updateRes = $this->invoice->addline( $request_data->description, @@ -625,8 +625,8 @@ class SupplierInvoices extends DolibarrApi $request_data = (object) $request_data; - $request_data->description = checkVal($request_data->description, 'restricthtml'); - $request_data->ref_supplier = checkVal($request_data->ref_supplier); + $request_data->description = sanitizeVal($request_data->description, 'restricthtml'); + $request_data->ref_supplier = sanitizeVal($request_data->ref_supplier); $updateRes = $this->invoice->updateline( $lineid, diff --git a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php index 5d26fa90137..e52c677318e 100644 --- a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php +++ b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php @@ -218,7 +218,7 @@ class KnowledgeManagement extends DolibarrApi } // Clean data - // $this->knowledgerecord->abc = checkVal($this->knowledgerecord->abc, 'alphanohtml'); + // $this->knowledgerecord->abc = sanitizeVal($this->knowledgerecord->abc, 'alphanohtml'); if ($this->knowledgerecord->create(DolibarrApiAccess::$user)<0) { throw new RestException(500, "Error creating KnowledgeRecord", array_merge(array($this->knowledgerecord->error), $this->knowledgerecord->errors)); @@ -260,7 +260,7 @@ class KnowledgeManagement extends DolibarrApi } // Clean data - // $this->knowledgerecord->abc = checkVal($this->knowledgerecord->abc, 'alphanohtml'); + // $this->knowledgerecord->abc = sanitizeVal($this->knowledgerecord->abc, 'alphanohtml'); if ($this->knowledgerecord->update(DolibarrApiAccess::$user, false) > 0) { return $this->get($id); diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 4cb50c8de2f..5299ff04caa 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -218,7 +218,7 @@ class MyModuleApi extends DolibarrApi } // Clean data - // $this->myobject->abc = checkVal($this->myobject->abc, 'alphanohtml'); + // $this->myobject->abc = sanitizeVal($this->myobject->abc, 'alphanohtml'); if ($this->myobject->create(DolibarrApiAccess::$user)<0) { throw new RestException(500, "Error creating MyObject", array_merge(array($this->myobject->error), $this->myobject->errors)); @@ -260,7 +260,7 @@ class MyModuleApi extends DolibarrApi } // Clean data - // $this->myobject->abc = checkVal($this->myobject->abc, 'alphanohtml'); + // $this->myobject->abc = sanitizeVal($this->myobject->abc, 'alphanohtml'); if ($this->myobject->update(DolibarrApiAccess::$user, false) > 0) { return $this->get($id); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index e44aef221f6..4c5f0810edd 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -779,9 +779,9 @@ class Products extends DolibarrApi } // Clean data - $ref_fourn = checkVal($ref_fourn, 'alphanohtml'); - $desc_fourn = checkVal($desc_fourn, 'restricthtml'); - $barcode = checkVal($barcode, 'alphanohtml'); + $ref_fourn = sanitizeVal($ref_fourn, 'alphanohtml'); + $desc_fourn = sanitizeVal($desc_fourn, 'restricthtml'); + $barcode = sanitizeVal($barcode, 'alphanohtml'); $result = $this->productsupplier->update_buyprice($qty, $buyprice, DolibarrApiAccess::$user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges, $remise_percent, $remise, $newnpr, $delivery_time_days, $supplier_reputation, $localtaxes_array, $newdefaultvatcode, $multicurrency_buyprice, $multicurrency_price_base_type, $multicurrency_tx, $multicurrency_code, $desc_fourn, $barcode, $fk_barcode_type); diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index 59576b961d4..6a522346210 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -333,7 +333,7 @@ class Projects extends DolibarrApi $request_data = (object) $request_data; - $request_data->desc = checkVal($request_data->desc, 'restricthtml'); + $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml'); $updateRes = $this->project->addline( $request_data->desc, @@ -400,7 +400,7 @@ class Projects extends DolibarrApi $request_data = (object) $request_data; - $request_data->desc = checkVal($request_data->desc, 'restricthtml'); + $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml'); $updateRes = $this->project->updateline( $lineid, diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index cafb60f2865..0eaf8654421 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -333,7 +333,7 @@ class Tasks extends DolibarrApi $request_data = (object) $request_data; - $request_data->desc = checkVal($request_data->desc, 'restricthtml'); + $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml'); $updateRes = $this->project->addline( $request_data->desc, @@ -400,7 +400,7 @@ class Tasks extends DolibarrApi $request_data = (object) $request_data; - $request_data->desc = checkVal($request_data->desc, 'restricthtml'); + $request_data->desc = sanitizeVal($request_data->desc, 'restricthtml'); $updateRes = $this->project->updateline( $lineid, diff --git a/htdocs/recruitment/class/api_recruitment.class.php b/htdocs/recruitment/class/api_recruitment.class.php index e0c2cb5da11..26e6c58fa4a 100644 --- a/htdocs/recruitment/class/api_recruitment.class.php +++ b/htdocs/recruitment/class/api_recruitment.class.php @@ -359,7 +359,7 @@ class Recruitment extends DolibarrApi } // Clean data - // $this->jobposition->abc = checkVal($this->jobposition->abc, 'alphanohtml'); + // $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml'); if ($this->jobposition->create(DolibarrApiAccess::$user)<0) { throw new RestException(500, "Error creating jobposition", array_merge(array($this->jobposition->error), $this->jobposition->errors)); @@ -391,7 +391,7 @@ class Recruitment extends DolibarrApi } // Clean data - // $this->jobposition->abc = checkVal($this->jobposition->abc, 'alphanohtml'); + // $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml'); if ($this->candidature->create(DolibarrApiAccess::$user)<0) { throw new RestException(500, "Error creating candidature", array_merge(array($this->candidature->error), $this->candidature->errors)); @@ -433,7 +433,7 @@ class Recruitment extends DolibarrApi } // Clean data - // $this->jobposition->abc = checkVal($this->jobposition->abc, 'alphanohtml'); + // $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml'); if ($this->jobposition->update(DolibarrApiAccess::$user, false) > 0) { return $this->get($id); @@ -476,7 +476,7 @@ class Recruitment extends DolibarrApi } // Clean data - // $this->jobposition->abc = checkVal($this->jobposition->abc, 'alphanohtml'); + // $this->jobposition->abc = sanitizeVal($this->jobposition->abc, 'alphanohtml'); if ($this->candidature->update(DolibarrApiAccess::$user, false) > 0) { return $this->get($id); From d50e0457f340aa790049d94f15a310a563f77642 Mon Sep 17 00:00:00 2001 From: ATM john Date: Wed, 30 Mar 2022 12:33:17 +0200 Subject: [PATCH 30/48] add todo comment --- htdocs/core/lib/functions.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9d5a9eae857..3515cacd874 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -765,6 +765,7 @@ function sanitizeVal($out = '', $check = 'alphanohtml', $filter = null, $options { global $conf; + // TODO : use class "Validate" to perform tests (and add missing tests) if needed for factorize // Check is done after replacement switch ($check) { case 'none': From 1452e74431ae7eb87fbace7c19a914414bcbff74 Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Fri, 20 May 2022 19:01:25 +0200 Subject: [PATCH 31/48] Fix sanitize --- htdocs/core/tpl/extrafields_list_search_sql.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index 418ecd85522..0c3d98f03a6 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -65,8 +65,8 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($ if (is_array($crit)) { $crit = implode(' ', $crit); // natural_search() expects a string } elseif ($typ === 'select' and is_string($crit) and strpos($crit, ',') === false) { - $critSelect = implode("','", array_map(array($db, 'escape'), explode(',', $crit))); - $sql .= " AND (".$extrafieldsobjectprefix.$tmpkey." IN ('".$critSelect."') )"; + $critSelect = "'".implode("','", array_map(array($db, 'escape'), explode(',', $crit)))."'"; + $sql .= " AND (".$extrafieldsobjectprefix.$tmpkey." IN (".$db->sanitize($critSelect, 1).") )"; continue; } $sql .= natural_search($extrafieldsobjectprefix.$tmpkey, $crit, $mode_search); From bbebb9ef5ad2b7dd97c0932909f52271856d28e4 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Mon, 23 May 2022 08:29:04 +0200 Subject: [PATCH 32/48] fix #20989 : modResource depends on modResource --- htdocs/core/modules/modResource.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index 2c59b6b3172..b43ead29e7f 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -91,7 +91,7 @@ class modResource extends DolibarrModules // Dependencies // List of modules id that must be enabled if this module is enabled - $this->depends = array('modResource'); + $this->depends = array(); // List of modules id to disable if this one is disabled $this->requiredby = array('modPlace'); // Minimum version of PHP required by module From 109181c4ea028d15b300390dd9e57e8802685f5a Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Fri, 22 Apr 2022 13:47:58 +0200 Subject: [PATCH 33/48] fix #20651 : multilang contact support --- htdocs/contact/card.php | 51 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 28a61ce5190..bec9388a0ed 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; @@ -219,7 +220,10 @@ if (empty($reshook)) $object->birthday = dol_mktime(0, 0, 0, GETPOST("birthdaymonth", 'int'), GETPOST("birthdayday", 'int'), GETPOST("birthdayyear", 'int')); $object->birthday_alert = GETPOST("birthday_alert", 'alpha'); - // Fill array 'array_options' with data from add form + //Default language + $object->default_lang = GETPOST('default_lang'); + + // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object); if ($ret < 0) { @@ -402,7 +406,10 @@ if (empty($reshook)) $object->roles = GETPOST("roles", 'array'); // Note GETPOSTISSET("role") is null when combo is empty - // Fill array 'array_options' with data from add form + //Default language + $object->default_lang = GETPOST('default_lang'); + + // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET'); if ($ret < 0) $error++; @@ -521,6 +528,7 @@ $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('', $title, $help_url); $form = new Form($db); +$formadmin = new FormAdmin($db); $formcompany = new FormCompany($db); $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; @@ -843,6 +851,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print $form->selectarray('priv', $selectarray, (GETPOST("priv", 'alpha') ?GETPOST("priv", 'alpha') : $object->priv), 0); print ''; + //Default language + if (!empty($conf->global->MAIN_MULTILANGS)) + { + print ''.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; + print $formadmin->select_language(GETPOST('default_lang', 'alpha') ?GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone', 0, 0, 0, null, 1); + + print ''; + print ''; + } + // Categories if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { print ''.$form->editfieldkey('Categories', 'contcats', '', $object, 0).''; @@ -1125,6 +1143,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print $form->selectarray('priv', $selectarray, $object->priv, 0); print ''; + //Default language + if (!empty($conf->global->MAIN_MULTILANGS)) + { + print ''.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; + print $formadmin->select_language($object->default_lang, 'default_lang', 0, 0, 1, 0, 0, '', 0, 0, 0, null, 1); + + print ''; + print ''; + } + // Note Public print ''; $doleditor = new DolEditor('note_public', $object->note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); @@ -1353,9 +1381,22 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; } - print ''.$langs->trans("ContactVisibility").''; - print $object->LibPubPriv($object->priv); - print ''; + // Default language + if (!empty($conf->global->MAIN_MULTILANGS)) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + print ''.$langs->trans("DefaultLang").''; + //$s=picto_from_langcode($object->default_lang); + //print ($s?$s.' ':''); + $langs->load("languages"); + $labellang = ($object->default_lang ? $langs->trans('Language_'.$object->default_lang.'_'.strtoupper($object->default_lang)) : ''); + print $labellang; + print ''; + } + + print ''.$langs->trans("ContactVisibility").''; + print $object->LibPubPriv($object->priv); + print ''; print ''; print '
'; From 71ed1ec602691baa9c54f9b53b8a138160ace74a Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 23 May 2022 12:07:37 +0200 Subject: [PATCH 34/48] Product lot document management should not use batch but ref (is lot id) --- htdocs/product/stock/productlot_card.php | 9 ++++++++- htdocs/product/stock/productlot_document.php | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index eb6084e5f22..263d9d2c6c8 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -28,6 +28,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; @@ -90,7 +91,13 @@ if ($id || $ref) { $batch = $tmp[1]; } $object->fetch($id, $productid, $batch); - $object->ref = $object->batch; // For document management ( it use $object->ref) + $object->ref = $object->batch; // Old system for document management ( it uses $object->ref) + $upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, $modulepart); + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); + if (empty($filearray)) { + // If no files linked yet, use new system on lot id. (Batch is not unique and can be same on different product) + $object->fetch($id, $productid, $batch); + } } // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php index 789b03aa6ce..dbe2dd517f4 100644 --- a/htdocs/product/stock/productlot_document.php +++ b/htdocs/product/stock/productlot_document.php @@ -83,10 +83,16 @@ if ($id || $ref) { $batch = $tmp[1]; } $object->fetch($id, $productid, $batch); - $object->ref = $object->batch; // For document management ( it use $object->ref) + $object->ref = $object->batch; // Old system for document management ( it uses $object->ref) if (!empty($conf->productbatch->enabled)) { $upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, $modulepart); + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); + if (empty($filearray)) { + // If no files linked yet, use new system on lot id. (Batch is not unique and can be same on different product) + $object->fetch($id, $productid, $batch); + $upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, $modulepart); + } } } From 48151b47a677beb36dd9c891b47f17f6684dbf0b Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Mon, 23 May 2022 12:31:37 +0200 Subject: [PATCH 35/48] FIX mvt origin --- htdocs/mrp/mo_movements.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/mrp/mo_movements.php b/htdocs/mrp/mo_movements.php index 7bb040abe1f..634f1caa092 100644 --- a/htdocs/mrp/mo_movements.php +++ b/htdocs/mrp/mo_movements.php @@ -934,7 +934,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } if (!empty($arrayfields['origin']['checked'])) { // Origin of movement - print ''.dol_escape_htmltag($origin).''; + print ''.$origin.''; } if (!empty($arrayfields['m.fk_projet']['checked'])) { // fk_project From 9ed75d01bda254fc205c576e419b9cfb562386de Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Mon, 23 May 2022 12:43:30 +0200 Subject: [PATCH 36/48] fix missing token on mo card --- htdocs/mrp/mo_card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 48f64b2601c..2a8fa13be52 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -602,7 +602,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($object->status == $object::STATUS_VALIDATED) { if ($permissiontoadd) { // TODO Add test that production has not started - print '
'.$langs->trans("SetToDraft").''; + print ''.$langs->trans("SetToDraft").''; } } @@ -641,16 +641,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $nbProduced += $lineproduced['qty']; } if ($nbProduced > 0) { // If production has started, we can close it - print ''.$langs->trans("Close").''."\n"; + print ''.$langs->trans("Close").''."\n"; } else { print 'transnoentitiesnoconv("Production")).'">'.$langs->trans("Close").''."\n"; } - print ''.$langs->trans("Cancel").''."\n"; + print ''.$langs->trans("Cancel").''."\n"; } if ($object->status == $object::STATUS_PRODUCED || $object->status == $object::STATUS_CANCELED) { - print ''.$langs->trans("ReOpen").''."\n"; + print ''.$langs->trans("ReOpen").''."\n"; } } From 8574f36e352bea8afacbcbcefc68b875c8a258de Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 23 May 2022 15:25:31 +0200 Subject: [PATCH 37/48] dol_dir_list fast mode --- htdocs/product/stock/productlot_card.php | 2 +- htdocs/product/stock/productlot_document.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 263d9d2c6c8..6e6f8991e83 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -93,7 +93,7 @@ if ($id || $ref) { $object->fetch($id, $productid, $batch); $object->ref = $object->batch; // Old system for document management ( it uses $object->ref) $upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, $modulepart); - $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); + $filearray = dol_dir_list($upload_dir, "files"); if (empty($filearray)) { // If no files linked yet, use new system on lot id. (Batch is not unique and can be same on different product) $object->fetch($id, $productid, $batch); diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php index dbe2dd517f4..89ba063e8d7 100644 --- a/htdocs/product/stock/productlot_document.php +++ b/htdocs/product/stock/productlot_document.php @@ -87,7 +87,7 @@ if ($id || $ref) { if (!empty($conf->productbatch->enabled)) { $upload_dir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, $modulepart); - $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); + $filearray = dol_dir_list($upload_dir, "files"); if (empty($filearray)) { // If no files linked yet, use new system on lot id. (Batch is not unique and can be same on different product) $object->fetch($id, $productid, $batch); From 8172cb5b974e4a585c600f03a0f895afe48e8313 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 23 May 2022 19:37:42 +0200 Subject: [PATCH 38/48] Add get knowledgerecord categorie with REST API --- .../class/api_knowledgemanagement.class.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php index 5d26fa90137..d8629547658 100644 --- a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php +++ b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php @@ -19,6 +19,7 @@ use Luracast\Restler\RestException; dol_include_once('/knowledgemanagement/class/knowledgerecord.class.php'); +dol_include_once('/categories/class/categorie.class.php'); @@ -85,6 +86,39 @@ class KnowledgeManagement extends DolibarrApi return $this->_cleanObjectDatas($this->knowledgerecord); } + /** + * Get categories for a knowledgerecord object + * + * @param int $id ID of knowledgerecord object + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * + * @return mixed + * + * @url GET /knowledgerecords/{id}/categories + */ + public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) + { + if (!DolibarrApiAccess::$user->rights->categorie->lire) { + throw new RestException(401); + } + + $categories = new Categorie($this->db); + + $result = $categories->getListForItem($id, 'knowledgemanagement', $sortfield, $sortorder, $limit, $page); + + if (empty($result)) { + throw new RestException(404, 'No category found'); + } + + if ($result < 0) { + throw new RestException(503, 'Error when retrieve category list : '.array_merge(array($categories->error), $categories->errors)); + } + + return $result; + } /** * List knowledgerecords From 351913811046bee61b8dc36fb4b1c144ce47568e Mon Sep 17 00:00:00 2001 From: Ilias Patsiaouras Date: Mon, 23 May 2022 20:26:08 +0200 Subject: [PATCH 39/48] add option to parse extrafield (options_) in emailcollector --- htdocs/emailcollector/class/emailcollector.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 032ee4b534b..2c4741e29b7 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -900,9 +900,17 @@ class EmailCollector extends CommonObject // Overwrite param $tmpproperty $valueextracted = isset($regforval[count($regforval) - 1]) ?trim($regforval[count($regforval) - 1]) : null; if (strtolower($sourcefield) == 'header') { - $object->$tmpproperty = $this->decodeSMTPSubject($valueextracted); + if (preg_match('/^options_/', $tmpproperty)) { + $object->array_options[preg_replace('/^options_/', '', $tmpproperty)] = $this->decodeSMTPSubject($valueextracted); + } else { + $object->$tmpproperty = $this->decodeSMTPSubject($valueextracted); + } } else { - $object->$tmpproperty = $valueextracted; + if (preg_match('/^options_/', $tmpproperty)) { + $object->array_options[preg_replace('/^options_/', '', $tmpproperty)] = $this->decodeSMTPSubject($valueextracted); + } else { + $object->$tmpproperty = $this->decodeSMTPSubject($valueextracted); + } } } else { // Regex not found From 3058d6ff0b468a2034e99e5cac79c890bec46ced Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Mon, 23 May 2022 20:41:22 +0200 Subject: [PATCH 40/48] FIX : bad object name --- htdocs/societe/partnership.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/societe/partnership.php b/htdocs/societe/partnership.php index 05079d263a9..d9b3d3127f9 100644 --- a/htdocs/societe/partnership.php +++ b/htdocs/societe/partnership.php @@ -1,6 +1,7 @@ * Copyright (C) 2021 NextGestion + * Copyright (C) 2022 Charlene Benke * * 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 @@ -180,25 +181,25 @@ if ($id > 0) { print ''; if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field - print ''; + print ''; } - if ($societe->client) { + if ($object->client) { print ''; } - if ($societe->fournisseur) { + if ($object->fournisseur) { print '
'.$langs->trans('Prefix').''.$societe->prefix_comm.'
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; print $langs->trans('CustomerCode').''; - print showValueWithClipboardCPButton(dol_escape_htmltag($societe->code_client)); - $tmpcheck = $societe->check_codeclient(); + print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client)); + $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongCustomerCode").')'; } print '
'; print $langs->trans('SupplierCode').''; - print showValueWithClipboardCPButton(dol_escape_htmltag($societe->code_fournisseur)); - $tmpcheck = $societe->check_codefournisseur(); + print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); + $tmpcheck = $object->check_codefournisseur(); if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongSupplierCode").')'; } From 32202d870436baa74b601a76058c67565e75b30c Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Mon, 23 May 2022 21:18:42 +0200 Subject: [PATCH 41/48] FIX V8 : warning if $objectsrc not defined --- htdocs/fichinter/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index eeb5261ef19..86a39149fe1 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2011-2020 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2018 Ferran Marcet - * Copyright (C) 2014-2018 Charlene Benke + * Copyright (C) 2014-2022 Charlene Benke * Copyright (C) 2015-2016 Abbes Bahfir * Copyright (C) 2018 Philippe Grand * Copyright (C) 2020 Frédéric France @@ -79,6 +79,7 @@ $hookmanager->initHooks(array('interventioncard', 'globalcard')); $object = new Fichinter($db); $extrafields = new ExtraFields($db); +$objectsrc = null; $extrafields->fetch_name_optionals_label($object->table_element); From 977f77cc181dbac5751e4ac4e8adae0814ab111a Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Mon, 23 May 2022 21:22:34 +0200 Subject: [PATCH 42/48] $note_private getpost need --- htdocs/fichinter/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 86a39149fe1..ac3ac3fb124 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -65,6 +65,7 @@ $mesg = GETPOST('msg', 'alpha'); $origin = GETPOST('origin', 'alpha'); $originid = (GETPOST('originid', 'int') ?GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility $note_public = GETPOST('note_public', 'restricthtml'); +$note_private = GETPOST('note_private', 'restricthtml'); $lineid = GETPOST('line_id', 'int'); $error = 0; From d8f0e42c67e700967e92d021b80e2fd0f1c043b8 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 23 May 2022 19:28:28 +0000 Subject: [PATCH 43/48] Fixing style errors. --- htdocs/fichinter/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index ac3ac3fb124..b7ee235c907 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -80,7 +80,7 @@ $hookmanager->initHooks(array('interventioncard', 'globalcard')); $object = new Fichinter($db); $extrafields = new ExtraFields($db); -$objectsrc = null; +$objectsrc = null; $extrafields->fetch_name_optionals_label($object->table_element); From 9b50b63850c113f935bb09c9e3fb1bcfb2d5355f Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Mon, 23 May 2022 21:58:29 +0200 Subject: [PATCH 44/48] FIX PHP V8 warning $sameunits not initialy defined no default_lang needed (and field not present on stock class --- htdocs/product/stock/card.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index c2f8ddb4470..07ce1cde96e 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -6,6 +6,8 @@ * Copyright (C) 2016 Francis Appels * Copyright (C) 2021 Noé Cendrier * Copyright (C) 2021 Frédéric France + * Copyright (C) 2022 Charlene Benke + * * 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 @@ -679,6 +681,8 @@ if ($action == 'create') { if ($resql) { $num = $db->num_rows($resql); $i = 0; + $sameunits = true; + while ($i < $num) { $objp = $db->fetch_object($resql); @@ -960,7 +964,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') { $delallowed = $usercancreate; $modulepart = 'stock'; - print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object); + print $formfile->showdocuments($modulepart, $objectref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, '', 0, '', '', '', $object); $somethingshown = $formfile->numoffiles; print '
'; From dce6271f23e75cc89894e2ccef6fbedc541ddb24 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Mon, 23 May 2022 23:23:02 +0200 Subject: [PATCH 45/48] burundi : add vat rates --- htdocs/install/mysql/data/llx_c_tva.sql | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index b041e07b95f..d78fea4ad4d 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -400,5 +400,7 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (23 --delete from llx_c_tva where rowid = 1181; -- to delete a record that does not follow rules for rowid (fk_pays+'1') --insert into llx_c_tva(rowid, fk_pays, taux, recuperableonly, note, active) SELECT CONCAT(c.rowid, '1'), c.rowid, 0, 0, 'No VAT', 1 from llx_c_country as c where c.rowid not in (select fk_pays from llx_c_tva); - - +-- BURUNDI (id country=61) -- https://www.objectif-import-export.fr/fr/marches-internationaux/fiche-pays/burundi/presentation-fiscalite +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2335,61, '0','0','No VAT',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2336,61, '10','0','VAT 10%',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (2337,61, '18','0','VAT 18%',1); From 52b23c748c1b3273034fcc7d4a895f1df12b6914 Mon Sep 17 00:00:00 2001 From: jpb Date: Tue, 24 May 2022 15:13:22 +0200 Subject: [PATCH 46/48] change same left menu name on GRH top menu --- htdocs/core/menus/standard/eldy.lib.php | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 3dc1ab6c4fd..e4b6762af8b 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -807,7 +807,6 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM if ($mainmenu == 'hrm') { get_left_menu_hrm($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user); } - /* * Menu TOOLS */ @@ -2262,19 +2261,19 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = // Load translation files required by the page $langs->loadLangs(array("holiday", "trips")); - $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'holiday', 'class="pictofixedwidth"')); - $newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=create", $langs->trans("New"), 1, $user->rights->holiday->write); - $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=hrm", $langs->trans("List"), 1, $user->rights->holiday->read); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "hrm") { - $newmenu->add("/holiday/list.php?search_status=1&mainmenu=hrm&leftmenu=hrm", $langs->trans("DraftCP"), 2, $user->rights->holiday->read); - $newmenu->add("/holiday/list.php?search_status=2&mainmenu=hrm&leftmenu=hrm", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read); - $newmenu->add("/holiday/list.php?search_status=3&mainmenu=hrm&leftmenu=hrm", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read); - $newmenu->add("/holiday/list.php?search_status=4&mainmenu=hrm&leftmenu=hrm", $langs->trans("CancelCP"), 2, $user->rights->holiday->read); - $newmenu->add("/holiday/list.php?search_status=5&mainmenu=hrm&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read); + $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'holiday', 0, '', '', '', img_picto('', 'holiday', 'class="pictofixedwidth"')); + $newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=create", $langs->trans("New"), 1, $user->rights->holiday->write, '',$mainmenu); + $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("List"), 1, $user->rights->holiday->read, '',$mainmenu); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "holiday") { + $newmenu->add("/holiday/list.php?search_status=1&mainmenu=hrm&leftmenu=holiday", $langs->trans("DraftCP"), 2, $user->rights->holiday->read,'',$mainmenu,'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=2&mainmenu=hrm&leftmenu=holiday", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read, '',$mainmenu,'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=3&mainmenu=hrm&leftmenu=holiday", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read, '',$mainmenu,'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=4&mainmenu=hrm&leftmenu=holiday", $langs->trans("CancelCP"), 2, $user->rights->holiday->read, '',$mainmenu,'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=5&mainmenu=hrm&leftmenu=holiday", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read, '',$mainmenu,'holiday_sm'); } - $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read); - $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->readall); - $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday); + $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read, '',$mainmenu,'holiday_sm'); + $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->readall, '',$mainmenu,'holiday_sm'); + $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday, '',$mainmenu,'holiday_sm'); } // Trips and expenses (old module) @@ -2316,6 +2315,7 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = } } + /** * Get left Menu TOOLS * From f0fa315a7b6bc955e1221d4eeb71e07f315ebf27 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 24 May 2022 13:24:31 +0000 Subject: [PATCH 47/48] Fixing style errors. --- htdocs/core/menus/standard/eldy.lib.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index e4b6762af8b..b3788d776a0 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -2262,18 +2262,18 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = $langs->loadLangs(array("holiday", "trips")); $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'holiday', 0, '', '', '', img_picto('', 'holiday', 'class="pictofixedwidth"')); - $newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=create", $langs->trans("New"), 1, $user->rights->holiday->write, '',$mainmenu); - $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("List"), 1, $user->rights->holiday->read, '',$mainmenu); + $newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=create", $langs->trans("New"), 1, $user->rights->holiday->write, '', $mainmenu); + $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("List"), 1, $user->rights->holiday->read, '', $mainmenu); if ($usemenuhider || empty($leftmenu) || $leftmenu == "holiday") { - $newmenu->add("/holiday/list.php?search_status=1&mainmenu=hrm&leftmenu=holiday", $langs->trans("DraftCP"), 2, $user->rights->holiday->read,'',$mainmenu,'holiday_sm'); - $newmenu->add("/holiday/list.php?search_status=2&mainmenu=hrm&leftmenu=holiday", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read, '',$mainmenu,'holiday_sm'); - $newmenu->add("/holiday/list.php?search_status=3&mainmenu=hrm&leftmenu=holiday", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read, '',$mainmenu,'holiday_sm'); - $newmenu->add("/holiday/list.php?search_status=4&mainmenu=hrm&leftmenu=holiday", $langs->trans("CancelCP"), 2, $user->rights->holiday->read, '',$mainmenu,'holiday_sm'); - $newmenu->add("/holiday/list.php?search_status=5&mainmenu=hrm&leftmenu=holiday", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read, '',$mainmenu,'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=1&mainmenu=hrm&leftmenu=holiday", $langs->trans("DraftCP"), 2, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=2&mainmenu=hrm&leftmenu=holiday", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=3&mainmenu=hrm&leftmenu=holiday", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=4&mainmenu=hrm&leftmenu=holiday", $langs->trans("CancelCP"), 2, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=5&mainmenu=hrm&leftmenu=holiday", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm'); } - $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read, '',$mainmenu,'holiday_sm'); - $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->readall, '',$mainmenu,'holiday_sm'); - $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday, '',$mainmenu,'holiday_sm'); + $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->readall, '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday, '', $mainmenu, 'holiday_sm'); } // Trips and expenses (old module) From e89c80651b42a32de89d547b502bc85556266bae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 24 May 2022 21:09:12 +0200 Subject: [PATCH 48/48] Update card.php --- htdocs/product/stock/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 07ce1cde96e..252763ef43b 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -7,7 +7,6 @@ * Copyright (C) 2021 Noé Cendrier * Copyright (C) 2021 Frédéric France * Copyright (C) 2022 Charlene Benke - * * 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