From a254462bc9e360b047c2d3b44f510cdc207f64ac Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Thu, 2 Feb 2023 17:58:54 +0100 Subject: [PATCH 001/108] FIX : Sub-BOM's services prices were not good --- htdocs/bom/tpl/objectline_view.tpl.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index ac277f6e880..6208abcbf6d 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -172,7 +172,8 @@ print ''; $coldisplay++; if (!empty($line->fk_bom_child)) { echo ''.price($tmpbom->total_cost * $line->qty).''; -} else { +} +else { echo ''.price($line->total_cost).''; } print ''; @@ -301,6 +302,16 @@ if ($resql) { $sub_bom->calculateCosts(); print ''.price(price2num($sub_bom->total_cost * $sub_bom_line->qty * $line->qty, 'MT')).''; $total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty; + } elseif($sub_bom_product->type == Product::TYPE_SERVICE && isModEnabled('workstation') && !empty($sub_bom_product->fk_default_workstation)) { + //Convert qty to hour + $unit = measuringUnitString($sub_bom_line->fk_unit, '', '', 1); + $qty = convertDurationtoHour($sub_bom_line->qty, $unit); + $workstation = new Workstation($this->db); + $res = $workstation->fetch($sub_bom_product->fk_default_workstation); + if ($res > 0) $sub_bom_line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT'); + + print ''.price(price2num($sub_bom_line->total_cost, 'MT')).''; + $this->total_cost += $line->total_cost; } elseif ($sub_bom_product->cost_price > 0) { print ''.price(price2num($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty, 'MT')).''; $total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty; From a07916858f7740dd6260ec2242fb15839bdf4ad7 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Thu, 2 Feb 2023 21:36:41 +0100 Subject: [PATCH 002/108] fix whitepage if modCategorie is not enabled --- htdocs/projet/list.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 32192114a4c..1113cf06b9e 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -152,7 +152,9 @@ $search_date_end_endmonth = GETPOST('search_date_end_endmonth', 'int'); $search_date_end_endyear = GETPOST('search_date_end_endyear', 'int'); $search_date_end_endday = GETPOST('search_date_end_endday', 'int'); $search_date_end_end = dol_mktime(23, 59, 59, $search_date_end_endmonth, $search_date_end_endday, $search_date_end_endyear); // Use tzserver -$search_category_array = GETPOST("search_category_".Categorie::TYPE_PROJECT."_list", "array"); +if (isModEnabled('categorie')) { + $search_category_array = GETPOST("search_category_".Categorie::TYPE_PROJECT."_list", "array"); +} if ($search_status == '') { $search_status = -1; // -1 or 1 From 38eee02272cbe06ada74cfb7b2d56f6cb7024db1 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Wed, 8 Feb 2023 17:34:50 +0100 Subject: [PATCH 003/108] FIX : Make bom_net_needs list standard --- htdocs/bom/bom_net_needs.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index 60736d085da..f6644590a2e 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -218,6 +218,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).''; print ''.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).''; print ''; + + print ''; + print ''; if (!empty($TChildBom)) { if ($action == 'treeview') { foreach ($TChildBom as $fk_bom => $TProduct) { @@ -266,7 +269,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } } - print ''; + print ''; print ''; From cd289ca8ac2145b751f9b5236406c1d02f9dd1cd Mon Sep 17 00:00:00 2001 From: FLIO Date: Wed, 8 Feb 2023 19:09:05 +0100 Subject: [PATCH 004/108] fix(qodana) fix function comment wrong return --- htdocs/compta/facture/class/api_invoices.class.php | 2 +- htdocs/core/ajax/fileupload.php | 1 - htdocs/core/class/dolreceiptprinter.class.php | 2 +- htdocs/core/class/fileupload.class.php | 6 ++++-- htdocs/core/class/hookmanager.class.php | 2 +- .../core/modules/asset/doc/pdf_standard_asset.modules.php | 2 +- htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php | 2 +- htdocs/core/modules/cheque/doc/pdf_blochet.class.php | 2 +- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- htdocs/core/modules/import/import_csv.modules.php | 2 +- htdocs/core/modules/import/import_xlsx.modules.php | 2 +- htdocs/core/modules/mrp/doc/pdf_vinci.modules.php | 2 +- htdocs/core/modules/product/modules_product.class.php | 2 +- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- .../core/modules/supplier_order/doc/pdf_cornas.modules.php | 2 +- .../modules/supplier_order/doc/pdf_muscadet.modules.php | 2 +- .../modules/supplier_proposal/doc/pdf_aurore.modules.php | 2 +- htdocs/fourn/class/paiementfourn.class.php | 2 +- htdocs/projet/class/api_projects.class.php | 2 +- htdocs/user/class/api_users.class.php | 2 +- 21 files changed, 23 insertions(+), 22 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index bae53bce6a8..76275eadb16 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -778,7 +778,7 @@ class Invoices extends DolibarrApi * * @url POST {id}/contacts * - * @return array + * @return object * * @throws RestException 304 * @throws RestException 401 diff --git a/htdocs/core/ajax/fileupload.php b/htdocs/core/ajax/fileupload.php index 67f95700976..b57e03972f1 100644 --- a/htdocs/core/ajax/fileupload.php +++ b/htdocs/core/ajax/fileupload.php @@ -48,7 +48,6 @@ $element = GETPOST('element', 'alpha'); $upload_handler = new FileUpload(null, $fk_element, $element); - /* * View */ diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 3b10f38d238..2bc26fa324c 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -935,7 +935,7 @@ class dolReceiptPrinter extends Printer * Function Init Printer * * @param int $printerid Printer id - * @return int 0 if OK; >0 if KO + * @return void|int 0 if OK; >0 if KO */ public function initPrinter($printerid) { diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 906933c9701..895cf6f8835 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -488,8 +488,9 @@ class FileUpload */ public function post() { + var_dump("here");exit; if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') { - return $this->delete(); + echo $this->delete(); } $upload = isset($_FILES[$this->options['param_name']]) ? $_FILES[$this->options['param_name']] : null; @@ -556,6 +557,7 @@ class FileUpload } } header('Content-type: application/json'); - echo json_encode($success); + $response = json_encode($success); + return $response; } } diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index bcd5a506946..9c0441b3ced 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -77,7 +77,7 @@ class HookManager * Then when a hook executeHooks('aMethod'...) is called, the method aMethod found into class will be executed. * * @param string[] $arraycontext Array list of searched hooks tab/features. For example: 'thirdpartycard' (for hook methods into page card thirdparty), 'thirdpartydao' (for hook methods into Societe), ... - * @return int Always 1 + * @return int|void Always 1 */ public function initHooks($arraycontext) { diff --git a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php index 8ebd1051a06..b20f60fe084 100644 --- a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php +++ b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php @@ -916,7 +916,7 @@ class pdf_standard_asset extends ModelePDFAsset * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param Translate $outputlangsbis Object lang for output bis - * @return void + * @return float */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null) { diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index e296663f39a..ecf7a2a6ad9 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -478,7 +478,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc * @param CompanyBankAccount $object Object to show * @param int $posy Y * @param Translate $outputlangs Langs object - * @return void + * @return float */ protected function _tableau_info(&$pdf, $object, $posy, $outputlangs) { diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 3985cb6be90..43db9a615e6 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -401,7 +401,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts * @param Object $object Object to show * @param Translate $outputlangs Object lang for output * @param int $hidefreetext 1=Hide free text - * @return void + * @return mixed */ protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) { diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index f24517d0667..1e9339c55e2 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -2057,7 +2057,7 @@ class pdf_sponge extends ModelePDFFactures * @param int $showaddress 0=no, 1=yes (usually set to 1 for first page, and 0 for next pages) * @param Translate $outputlangs Object lang for output * @param Translate $outputlangsbis Object lang for output bis - * @return int top shift of linked object lines + * @return array top shift of linked object lines */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null) { diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index a9a82e7cb00..1213cc4cf16 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -238,7 +238,7 @@ class ImportCsv extends ModeleImports /** * Return array of next record in input file. * - * @return Array Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string) + * @return array|boolean Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string) */ public function import_read_record() { diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 0854a0f56c5..c7f6df31d03 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -304,7 +304,7 @@ class ImportXlsx extends ModeleImports /** * Return array of next record in input file. * - * @return Array Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string) + * @return array|boolean Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string) */ public function import_read_record() { diff --git a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php index 8e3eeeafa33..492385a53a3 100644 --- a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php +++ b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php @@ -1067,7 +1067,7 @@ class pdf_vinci extends ModelePDFMo * @param CommandeFournisseur $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output - * @return void + * @return float|int */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php index 3a856763144..e5f5e7e09eb 100644 --- a/htdocs/core/modules/product/modules_product.class.php +++ b/htdocs/core/modules/product/modules_product.class.php @@ -191,7 +191,7 @@ abstract class ModeleProductCode * * @param DoliDB $dbs Database handler * @param integer $maxfilenamelength Max length of value to show - * @return array List of numbers + * @return array|int List of numbers */ public static function liste_modeles($dbs, $maxfilenamelength = 0) { diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 5f637373507..9ea524f2977 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1484,7 +1484,7 @@ class pdf_azur extends ModelePDFPropales * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param Translate $outputlangsbis Object lang for output bis - * @return void + * @return int|float */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null) { diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 88b56eb8fa6..8a41e680fc5 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1547,7 +1547,7 @@ class pdf_cyan extends ModelePDFPropales * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output * @param Translate $outputlangsbis Object lang for output bis - * @return void + * @return float|int */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $outputlangsbis = null) { diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 186ea465568..2343885cb4d 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1223,7 +1223,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders * @param CommandeFournisseur $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output - * @return void + * @return float|int */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 2fdf9828aff..1de4acd1550 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -1130,7 +1130,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param CommandeFournisseur $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output - * @return void + * @return float|int */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index ff90b500969..2f264cfb928 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -1232,7 +1232,7 @@ class pdf_aurore extends ModelePDFSupplierProposal * @param Object $object Object to show * @param int $showaddress 0=no, 1=yes * @param Translate $outputlangs Object lang for output - * @return void + * @return float|int */ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index bdf4f8aa457..21dae0e85b2 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -535,7 +535,7 @@ class PaiementFourn extends Paiement * Return list of supplier invoices the payment point to * * @param string $filter SQL filter. Warning: This value must not come from a user input. - * @return array Array of supplier invoice id + * @return array|int Array of supplier invoice id | <0 si ko */ public function getBillsArray($filter = '') { diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index fc10f49d38d..fa936969754 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -229,7 +229,7 @@ class Projects extends DolibarrApi * * @param int $id Id of project * @param int $includetimespent 0=Return only list of tasks. 1=Include a summary of time spent, 2=Include details of time spent lines - * @return int + * @return array * * @url GET {id}/tasks */ diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 2bbadd267cf..d91fcafffa6 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -593,7 +593,7 @@ class Users extends DolibarrApi * * @param int $group ID of group * @param int $load_members Load members list or not {@min 0} {@max 1} - * @return array Array of User objects + * @return object object of User objects * * @throws RestException 401 Not allowed * @throws RestException 404 User not found From 629f354800e591e549a3a227e19a794845d621ac Mon Sep 17 00:00:00 2001 From: FLIO Date: Wed, 8 Feb 2023 19:20:55 +0100 Subject: [PATCH 005/108] fix(qodana) remove a var_dump --- htdocs/core/class/fileupload.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 895cf6f8835..84ff0a9ed33 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -488,7 +488,6 @@ class FileUpload */ public function post() { - var_dump("here");exit; if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') { echo $this->delete(); } From e83559afb0ab7963a0187dbdcb4f8d5ea89f72fa Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Thu, 9 Feb 2023 15:20:07 +0100 Subject: [PATCH 006/108] FIX strato pdf --- htdocs/core/modules/contract/doc/pdf_strato.modules.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 1875cfb833c..e9c53f4b354 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -230,7 +230,7 @@ class pdf_strato extends ModelePDFContract $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $heightforinfotot = 50; // Height reserved to output the info and total part $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page - $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) + $heightforfooter = $this->marge_basse + 9; // Height reserved to output the footer (value include bottom margin) if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) { $heightforfooter += 6; } @@ -383,7 +383,6 @@ class pdf_strato extends ModelePDFContract $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txtpredefinedservice, dol_concatdesc($txt, $desc)), 0, 1, 0); $pageposafter = $pdf->getPage(); $posyafter = $pdf->GetY(); - if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) { // There is no space left for total+free text if ($i == ($nblines - 1)) { // No more lines, and no space left to show total, so we create a new page $pdf->AddPage('', '', true); @@ -437,6 +436,9 @@ class pdf_strato extends ModelePDFContract $pagenb++; $pdf->setPage($pagenb); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + if(empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { + $this->_pagehead($pdf, $object, 0, $outputlangs); + } if (!empty($tplidx)) { $pdf->useTemplate($tplidx); } @@ -459,6 +461,7 @@ class pdf_strato extends ModelePDFContract } } + // Show square if ($pagenb == 1) { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); From 78e1fad6bdf26548511a671f0c9a1b7830817939 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 9 Feb 2023 14:27:50 +0000 Subject: [PATCH 007/108] Fixing style errors. --- htdocs/core/modules/contract/doc/pdf_strato.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index e9c53f4b354..05e409ac9ed 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -436,7 +436,7 @@ class pdf_strato extends ModelePDFContract $pagenb++; $pdf->setPage($pagenb); $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. - if(empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) { $this->_pagehead($pdf, $object, 0, $outputlangs); } if (!empty($tplidx)) { From 69b690c45e01ec898a3402fed24d282b15f5929a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 15:29:07 +0100 Subject: [PATCH 008/108] Merge pull request #23817 from elcf/develop Added key name to unique constraint --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 7c38fb59b6d..bee0477665f 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -688,7 +688,7 @@ ALTER TABLE llx_actioncomm MODIFY COLUMN note mediumtext; DELETE FROM llx_boxes WHERE box_id IN (select rowid FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php', 'box_members.php', 'box_last_modified_ticket', 'box_members_last_subscriptions', 'box_members_last_modified', 'box_members_subscriptions_by_year')); DELETE FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php', 'box_members.php', 'box_last_modified_ticket', 'box_members_last_subscriptions', 'box_members_last_modified', 'box_members_subscriptions_by_year'); -ALTER TABLE llx_takepos_floor_tables ADD UNIQUE(entity,label); +ALTER TABLE llx_takepos_floor_tables ADD UNIQUE uk_takepos_floor_tables (entity,label); ALTER TABLE llx_partnership ADD COLUMN url_to_check varchar(255); ALTER TABLE llx_c_partnership_type ADD COLUMN keyword varchar(128); From 8bd6f070aab2fd5efe01c4ce78fd274ee8002ac5 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 9 Feb 2023 17:22:45 +0100 Subject: [PATCH 009/108] FIX: product ref fourn same size in supplier order/invoice as in product price fourn --- htdocs/install/mysql/migration/14.0.0-15.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql | 2 +- htdocs/install/mysql/tables/llx_facture_fourn_det.sql | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index 5621ca6fad8..bef7621d282 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -530,3 +530,6 @@ ALTER TABLE llx_element_tag ADD CONSTRAINT fk_element_tag_categorie_rowid FOREIG -- Idea is to update this column manually in v15 with value in currency of company for bank that are not into the main currency and the transfer -- into accounting will use it in priority if value is not null. The script repair.sql contains the sequence to fix datas in llx_bank. ALTER TABLE llx_bank ADD COLUMN amount_main_currency double(24,8) NULL; + +ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN ref varchar(128); +ALTER TABLE llx_facture_fourn_det MODIFY COLUMN ref varchar(128); diff --git a/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql b/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql index f6092bc4c74..0dfed7152aa 100644 --- a/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql +++ b/htdocs/install/mysql/tables/llx_commande_fournisseurdet.sql @@ -25,7 +25,7 @@ create table llx_commande_fournisseurdet fk_commande integer NOT NULL, fk_parent_line integer NULL, fk_product integer, - ref varchar(50), -- supplier product ref + ref varchar(128), -- supplier product ref label varchar(255), -- product label description text, vat_src_code varchar(10) DEFAULT '', -- Vat code used as source of vat fields. Not strict foreign key here. diff --git a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql index 30f57fa184b..8daf658fa68 100644 --- a/htdocs/install/mysql/tables/llx_facture_fourn_det.sql +++ b/htdocs/install/mysql/tables/llx_facture_fourn_det.sql @@ -24,7 +24,7 @@ create table llx_facture_fourn_det fk_facture_fourn integer NOT NULL, fk_parent_line integer NULL, fk_product integer NULL, - ref varchar(50), -- supplier product ref + ref varchar(128), -- supplier product ref label varchar(255), -- product label description text, pu_ht double(24,8), -- unit price excluding tax From e5de31a7dea24c89164a6e870a400d77dd758737 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 18:23:19 +0100 Subject: [PATCH 010/108] Fix size of ref --- htdocs/install/mysql/migration/16.0.0-17.0.0.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 2a1a9ee2fd5..744c000294b 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -393,3 +393,6 @@ ALTER TABLE llx_opensurvey_user_studs ADD COLUMN date_creation datetime NULL; ALTER TABLE llx_opensurvey_comments ADD COLUMN date_creation datetime NULL; ALTER TABLE llx_c_tva ADD COLUMN use_default tinyint DEFAULT 0; + +ALTER TABLE llx_commande_fournisseurdet MODIFY COLUMN ref varchar(128); +ALTER TABLE llx_facture_fourn_det MODIFY COLUMN ref varchar(128); From e9ce09f9d1a987e812c29198033a0f369c37743b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 18:50:22 +0100 Subject: [PATCH 011/108] Doc --- htdocs/core/lib/functions.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3a51575ef57..9311adb11ef 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -411,6 +411,9 @@ function dol_shutdown() /** * Return true if we are in a context of submitting the parameter $paramname from a POST of a form. + * Warning: + * For action=add, use: $var = GETPOST('var'); // No GETPOSTISSET, so GETPOST always called and default value is retreived if not a form POST, and value of form is retreived if it is a form POST. + * For action=update, use: $var = GETPOSTISSET('var') ? GETPOST('var') : $object->var; * * @param string $paramname Name or parameter to test * @return boolean True if we have just submit a POST or GET request with the parameter provided (even if param is empty) From c28f0d9386e1693c51c9ea2059765bc4bef2313a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 19:24:16 +0100 Subject: [PATCH 012/108] FIX #23860 --- htdocs/compta/facture/card.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 80d3ed2b436..3aa43556e43 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3119,7 +3119,11 @@ if ($action == 'create') { } // when bank account is empty (means not override by payment mode form a other object, like third-party), try to use default value - $fk_account = GETPOSTISSET("fk_account") ? GETPOST("fk_account", 'int') : $fk_account; + if ($socid > 0 && $fk_account) { // A company has already been set and it has a default fk_account + $fk_account = GETPOSTISSET('fk_account') ? GETPOST("fk_account", 'int') : $fk_account; // The GETPOST is used only if form was posted to avoid to take default value, because in such case, the default must be the one of the company + } else { // No company forced + $fk_account = GETPOST("fk_account", 'int'); + } if (!empty($soc->id)) { $absolute_discount = $soc->getAvailableDiscounts(); From 081ede08ec540694ad407edafb402bd068388d33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 19:24:42 +0100 Subject: [PATCH 013/108] Fix label --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 01a72c6c7f3..cbc0a3d5975 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -235,7 +235,7 @@ class Societe extends CommonObject 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>270), 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>440), 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>445), - 'fk_account' =>array('type'=>'integer', 'label'=>'AccountingAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>450), + 'fk_account' =>array('type'=>'integer', 'label'=>'PaymentBankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>450), 'fk_warehouse' =>array('type'=>'integer', 'label'=>'Warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>455), 'logo' =>array('type'=>'varchar(255)', 'label'=>'Logo', 'enabled'=>1, 'visible'=>-1, 'position'=>400), 'logo_squarred' =>array('type'=>'varchar(255)', 'label'=>'Logo squarred', 'enabled'=>1, 'visible'=>-1, 'position'=>401), From 802ee770c3cac69d7efdb792d23b28d59b95ce70 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 19:24:16 +0100 Subject: [PATCH 014/108] FIX #23860 --- htdocs/compta/facture/card.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 90f45018489..69155ecd8c7 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2981,7 +2981,11 @@ if ($action == 'create') { } // when bank account is empty (means not override by payment mode form a other object, like third-party), try to use default value - $fk_account = GETPOSTISSET("fk_account") ? GETPOST("fk_account", 'int') : $fk_account; + if ($socid > 0 && $fk_account) { // A company has already been set and it has a default fk_account + $fk_account = GETPOSTISSET('fk_account') ? GETPOST("fk_account", 'int') : $fk_account; // The GETPOST is used only if form was posted to avoid to take default value, because in such case, the default must be the one of the company + } else { // No company forced + $fk_account = GETPOST("fk_account", 'int'); + } if (!empty($soc->id)) { $absolute_discount = $soc->getAvailableDiscounts(); From 5ef4aa78e9f7a29d0a7bfbcbb01b067a094995f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 23:16:34 +0100 Subject: [PATCH 015/108] Fix filter using != --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9311adb11ef..bb69fd4966d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9768,7 +9768,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) $value = preg_replace('/\*/', '%', $value); // Replace * with % } if ($mode == 1) { - $value = preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"), '/').'\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do + $value = preg_replace('/([!<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"), '/').'\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do } $value = preg_replace('/\s*\|\s*/', '|', $value); @@ -9788,10 +9788,10 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) foreach ($fields as $field) { if ($mode == 1) { $operator = '='; - $newcrit = preg_replace('/([<>=]+)/', '', $crit); + $newcrit = preg_replace('/([!<>=]+)/', '', $crit); $reg = array(); - preg_match('/([<>=]+)/', $crit, $reg); + preg_match('/([!<>=]+)/', $crit, $reg); if (!empty($reg[1])) { $operator = $reg[1]; } From 65982c16753840aa88837ba2550e16e77f1b8ca7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 23:17:18 +0100 Subject: [PATCH 016/108] css --- htdocs/admin/emailcollector_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 10e7ea300f8..d140dd39ce2 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -723,7 +723,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Add operation print ''; print ''; - print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth300', 1); + print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'minwidth150 maxwidth300', 1); print ''; //print ''; $htmltext = $langs->transnoentitiesnoconv("OperationParamDesc"); From 73b894dca3bee2895c4dd4ab5039dff2f202e029 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Feb 2023 23:19:58 +0100 Subject: [PATCH 017/108] Fix the qty in stock when product has no lot --- htdocs/product/reassortlot.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 690d3f3f261..6da51124919 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -214,7 +214,7 @@ $morecss = array(); $sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; $sql .= ' p.fk_product_type, p.tms as datem,'; $sql .= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,'; -$sql .= ' ps.fk_entrepot,'; +$sql .= ' ps.fk_entrepot, ps.reel,'; $sql .= ' e.ref as warehouse_ref, e.lieu as warehouse_lieu, e.fk_parent as warehouse_parent,'; $sql .= ' pb.batch, pb.eatby as oldeatby, pb.sellby as oldsellby,'; $sql .= ' pl.rowid as lotid, pl.eatby, pl.sellby,'; @@ -313,7 +313,7 @@ foreach ($search as $key => $val) { $sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,"; $sql .= " p.fk_product_type, p.tms,"; $sql .= " p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock, p.stock, p.tosell, p.tobuy, p.tobatch,"; -$sql .= " ps.fk_entrepot,"; +$sql .= " ps.fk_entrepot, ps.reel,"; $sql .= " e.ref, e.lieu, e.fk_parent,"; $sql .= " pb.batch, pb.eatby, pb.sellby,"; $sql .= " pl.rowid, pl.eatby, pl.sellby"; @@ -322,7 +322,7 @@ if ($toolowstock) { $sql_having .= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet } if ($search_stock_physique != '') { - $natural_search_physique = natural_search('SUM(' . $db->ifsql('pb.qty IS NULL', '0', 'pb.qty') . ')', $search_stock_physique, 1, 1); + $natural_search_physique = natural_search('SUM(' . $db->ifsql('pb.qty IS NULL', $db->ifsql('ps.reel IS NULL', '0', 'ps.reel'), 'pb.qty') . ')', $search_stock_physique, 1, 1); $natural_search_physique = " " . substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters if (!empty($sql_having)) { $sql_having .= " AND"; @@ -689,7 +689,15 @@ while ($i < $imaxinloop) { print ''; //if ($objp->seuil_stock_alerte && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' '; - print $objp->stock_physique; + if (is_null($objp->stock_physique)) { + if (!empty($objp->reel)) { + print price2num($objp->reel, 'MS'); + } + } else { + if (!empty($objp->stock_physique)) { + print price2num($objp->stock_physique, 'MS'); + } + } print ''; print ''; From 616b006f2a053d2a589990adb0c0c3f15a353518 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 10:56:55 +0100 Subject: [PATCH 018/108] fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/modules/facture/mod_facture_mercure.php on line 80 --- htdocs/core/modules/facture/mod_facture_mercure.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 321741ea8a0..1e96c32129a 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -77,7 +77,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Setting the prefix $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; From 3e7879c88671c24d5733c742cefdd8b80b13dac3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 11:00:07 +0100 Subject: [PATCH 019/108] Debug v17 --- htdocs/projet/card.php | 3 ++- htdocs/projet/class/project.class.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 501cdcc5f4b..00b0c11deaf 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1060,7 +1060,8 @@ if ($action == 'create' && $user->rights->projet->creer) { if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) { $filteronlist = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST; } - $text = $form->select_company($object->thirdparty->id, 'socid', $filteronlist, 'None', 1, 0, array(), 0, 'minwidth300'); + $text = img_picto('', 'company', 'class="pictofixedwidth"'); + $text .= $form->select_company($object->thirdparty->id, 'socid', $filteronlist, 'None', 1, 0, array(), 0, 'minwidth300'); if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) { $texthelp = $langs->trans("IfNeedToUseOtherObjectKeepEmpty"); print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index c8d3be0163d..0d6df2ddc98 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -293,8 +293,8 @@ class Project extends CommonObject 'usage_task' =>array('type'=>'integer', 'label'=>'UsageTasks', 'enabled'=>1, 'visible'=>-1, 'position'=>140), 'usage_organize_event' =>array('type'=>'integer', 'label'=>'UsageOrganizeEvent', 'enabled'=>1, 'visible'=>-1, 'position'=>145), // Properties for event organization - 'date_start_event' =>array('type'=>'date', 'label'=>'DateStartEvent', 'enabled'=>1, 'visible'=>1, 'position'=>200), - 'date_end_event' =>array('type'=>'date', 'label'=>'DateEndEvent', 'enabled'=>1, 'visible'=>1, 'position'=>201), + 'date_start_event' =>array('type'=>'date', 'label'=>'DateStartEvent', 'enabled'=>"isModEnabled('eventorganization')", 'visible'=>1, 'position'=>200), + 'date_end_event' =>array('type'=>'date', 'label'=>'DateEndEvent', 'enabled'=>"isModEnabled('eventorganization')", 'visible'=>1, 'position'=>201), 'location' =>array('type'=>'text', 'label'=>'Location', 'enabled'=>1, 'visible'=>3, 'position'=>55, 'searchall'=>202), 'accept_conference_suggestions' =>array('type'=>'integer', 'label'=>'AllowUnknownPeopleSuggestConf', 'enabled'=>1, 'visible'=>-1, 'position'=>210), 'accept_booth_suggestions' =>array('type'=>'integer', 'label'=>'AllowUnknownPeopleSuggestBooth', 'enabled'=>1, 'visible'=>-1, 'position'=>211), From b52de45f73926958a7f7eecd978b7bed868c1b19 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 11:01:09 +0100 Subject: [PATCH 020/108] fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/modules/facture/mod_facture_mercure.php on line 88 --- htdocs/core/modules/facture/mod_facture_mercure.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 1e96c32129a..890d56e874b 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -85,7 +85,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Prefix setting of replacement invoices $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of credit note From f1c929abd0f28aaaeaf3d6d466e5f179832053bc Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 11:03:31 +0100 Subject: [PATCH 021/108] fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/modules/facture/mod_facture_mercure.php on line 93 --- htdocs/core/modules/facture/mod_facture_mercure.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 890d56e874b..65594470c30 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -90,7 +90,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Prefix setting of credit note $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of deposit From 4a826d47e93d30a0ec9e0308876169b410cbbbe5 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 11:17:02 +0100 Subject: [PATCH 022/108] fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/modules/facture/mod_facture_mercure.php on line 98 --- htdocs/core/modules/facture/mod_facture_mercure.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 65594470c30..e624487c9cf 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -77,7 +77,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Setting the prefix $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -85,7 +85,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Prefix setting of replacement invoices $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of credit note From 2e0b7fe4e8da235d76bd64156a83a3029920cc9d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 10 Feb 2023 10:21:39 +0000 Subject: [PATCH 023/108] Fixing style errors. --- htdocs/core/modules/facture/mod_facture_mercure.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index e624487c9cf..4185a8a08b6 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -77,7 +77,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Setting the prefix $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -85,7 +85,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Prefix setting of replacement invoices $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of credit note From 5acefe2e72162f52d95fe2dfc309daa02e16f949 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 11:33:34 +0100 Subject: [PATCH 024/108] cleaning my previous --- htdocs/core/modules/facture/mod_facture_mercure.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index e624487c9cf..1f516fa08f6 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -77,7 +77,7 @@ class mod_facture_mercure extends ModeleNumRefFactures // Setting the prefix $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -85,17 +85,17 @@ class mod_facture_mercure extends ModeleNumRefFactures // Prefix setting of replacement invoices $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of credit note $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of deposit $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; $texte .= ''; From fa856424a4f5a50486ffca16dcc7fcc7decca3aa Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 11:43:01 +0100 Subject: [PATCH 025/108] fix : Warning: Undefined property: Facture:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/modules/facture/doc/pdf_sponge.modules.php on line 1620 --- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 5edfc3f6157..1d106f6f024 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1617,7 +1617,7 @@ class pdf_sponge extends ModelePDFFactures // Get Total HT - $total_ht = (isModEnabled("multicurrency") && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); // Total remise $total_line_remise = 0; From 02475369e638333dfecad09b58e5f84ab7e314a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 12:58:49 +0100 Subject: [PATCH 026/108] Fix bad link --- htdocs/projet/agenda.php | 2 +- htdocs/projet/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/agenda.php b/htdocs/projet/agenda.php index a3c120d0a23..071e9eb2e9a 100644 --- a/htdocs/projet/agenda.php +++ b/htdocs/projet/agenda.php @@ -180,7 +180,7 @@ if (!empty($object->id)) { $morehtmlcenter .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); // Show link to change view in agenda - $messagingUrl = DOL_URL_ROOT.'/projet/info.php?id='.$object->id; + $messagingUrl = DOL_URL_ROOT.'/projet/agenda.php?id='.$object->id; $morehtmlcenter .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 00b0c11deaf..e954f429781 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1614,7 +1614,7 @@ if ($action == 'create' && $user->rights->projet->creer) { $MAXEVENT = 10; - $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/projet/info.php?id='.$object->id); + $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/projet/messaging.php?id='.$object->id); // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; From d37c5ed6b1936f02179c3fd6bdee474179bedbc2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 14:16:30 +0100 Subject: [PATCH 027/108] Debug v17 --- htdocs/admin/mails_templates.php | 31 +++++++++++++++---------------- htdocs/core/lib/functions.lib.php | 8 ++++---- htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/btn.inc.php | 9 ++++++--- htdocs/theme/md/style.css.php | 5 +---- 5 files changed, 27 insertions(+), 28 deletions(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index e462b7854ac..25a1ba101ad 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -675,17 +675,27 @@ if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu } -// Confirmation de la suppression de la ligne +// Confirm deletion of record if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((int) $rowid).'&code='.urlencode($code).'&id='.((int) $id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1); } - - $fieldlist = explode(',', $tabfield[$id]); if ($action == 'create') { + // If data was already input, we define them in obj to populate input fields. + $obj = new stdClass(); + $obj->label = GETPOST('label'); + $obj->lang = GETPOST('lang'); + $obj->type_template = GETPOST('type_template'); + $obj->fk_user = GETPOST('fk_user', 'int'); + $obj->private = GETPOST('private', 'int'); + $obj->position = GETPOST('position'); + $obj->topic = GETPOST('topic'); + $obj->joinfiles = GETPOST('joinfiles'); + $obj->content = GETPOST('content', 'restricthtml'); + // Form to add a new line print '
'; print ''; @@ -761,16 +771,6 @@ if ($action == 'create') { print ''; print ''; - $obj = new stdClass(); - // If data was already input, we define them in obj to populate input fields. - if (GETPOST('actionadd')) { - foreach ($fieldlist as $key => $val) { - if (GETPOST($val) != '') { - $obj->$val = GETPOST($val); - } - } - } - $tmpaction = 'create'; $parameters = array( 'fieldlist' => $fieldlist, @@ -828,7 +828,6 @@ if ($action == 'create') { if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { $okforextended = false; } - $doleditor = new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : ''), '', 180, 'dolibarr_mailings', 'In', false, $acceptlocallinktomedia, $okforextended, ROWS_4, '90%'); print $doleditor->Create(1); } @@ -848,7 +847,7 @@ if ($action == 'create') { print ''; print '
'; print '

'; -} // END IF not edit +} // List of available record in database dol_syslog("htdocs/admin/dict", LOG_DEBUG); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index bb69fd4966d..37949215357 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5371,10 +5371,10 @@ function load_fiche_titre($titre, $morehtmlright = '', $picto = 'generic', $pict $return .= '
'.$titre.'
'; $return .= ''; if (dol_strlen($morehtmlcenter)) { - $return .= ''.$morehtmlcenter.''; + $return .= ''.$morehtmlcenter.''; } if (dol_strlen($morehtmlright)) { - $return .= ''.$morehtmlright.''; + $return .= ''.$morehtmlright.''; } $return .= ''."\n"; @@ -5446,11 +5446,11 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', // Center if ($morehtmlcenter) { - print ''.$morehtmlcenter.''; + print ''.$morehtmlcenter.''; } // Right - print ''; + print ''; print ''; if ($sortfield) { $options .= "&sortfield=".urlencode($sortfield); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 10617a51d72..8f7d4b1ef1e 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -4879,7 +4879,7 @@ div.titre { color: var(--colortexttitlenotab2); } -table.table-fiche-title .col-title div.titre{ +table.table-fiche-title .col-title div.titre, .col-right .btnTitle-icon { line-height: 40px; } table.table-fiche-title { diff --git a/htdocs/theme/md/btn.inc.php b/htdocs/theme/md/btn.inc.php index 5ccd2e100dd..fdd9668c7d3 100644 --- a/htdocs/theme/md/btn.inc.php +++ b/htdocs/theme/md/btn.inc.php @@ -342,8 +342,8 @@ a.btnTitle.btnTitleSelected { position: relative; margin: 0 0 0 10px; text-align: center; - color: #ffffff; - background-color: rgb(); + color: #000; + background-color: #eee; font-size: 12px; text-decoration: none; box-shadow: none; @@ -373,7 +373,10 @@ div.pagination .btnTitle:hover .btnTitle-label{ } .paginationafterarrows a.btnTitlePlus, .titre_right a.btnTitlePlus { - border: 1px solid var(--colorbackbody); + border: 1px solid var(--btncolorborder); +} +.paginationafterarrows a.btnTitlePlus:hover, .titre_right a.btnTitlePlus:hover { + border-color: #ddd; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 780059e3a8f..47a35f8d0bf 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4168,9 +4168,6 @@ table.hidepaginationprevious .paginationprevious { table.hidepaginationnext .paginationnext { display: none; } -.paginationafterarrows a.btnTitlePlus { - border: 1px solid var(--btncolorborder); -} .paginationafterarrows a.btnTitlePlus:hover span:before { /* text-shadow: 0px 0px 5px #ccc; */ /* filter: invert(0.3); */ @@ -4906,7 +4903,7 @@ div.titre { table.centpercent.notopnoleftnoright.table-fiche-title { margin-bottom: 10px !important; } -table.table-fiche-title .col-title div.titre{ +table.table-fiche-title .col-title div.titre, .col-right .btnTitle-icon { line-height: 40px; } From c3a7cf57fcba3e4eafd3f6d1d51d47f93fcc9e14 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 14:47:39 +0100 Subject: [PATCH 028/108] Debug v17 --- htdocs/theme/md/style.css.php | 32 ++++++++++++++---------------- htdocs/theme/md/theme_vars.inc.php | 4 ++-- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 47a35f8d0bf..6d56e452898 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1803,14 +1803,13 @@ tr.nobottom td { /* ============================================================================== */ /* Styles to hide objects */ /* ============================================================================== */ - .clearboth { clear:both; } .hideobject { display: none; } .minwidth25 { min-width: 25px; } .minwidth50 { min-width: 50px; } .minwidth75 { min-width: 75px; } /* rule for not too small screen only */ -@media only screen and (min-width: px) +@media only screen and (min-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3) ? round($nbtopmenuentries * 47, 0) + 130 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3; ?>px) { .width20 { width: 20px; } .width25 { width: 25px; } @@ -3192,7 +3191,7 @@ a.aversion { .alogin, .alogin:hover { color: #888 !important; font-weight: normal !important; - font-size: px !important; + font-size: !important; } .alogin:hover, .atoplogin:hover { text-decoration:underline !important; @@ -3282,16 +3281,16 @@ div.vmenu, td.vmenu { .searchform .bordertransp { border: 0; } a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active, span.vmenu, span.vsmenu { - white-space: nowrap; font-size:px; font-family: ; text-align: ; font-weight: bold; + white-space: nowrap; font-size:; font-family: ; text-align: ; font-weight: bold; } -span.vmenudisabled, font.vmenudisabled { font-size:px; font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; white-space: nowrap; } +span.vmenudisabled, font.vmenudisabled { font-size:; font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; white-space: nowrap; } a.vmenu:link, a.vmenu:visited { color: var(--colortextbackvmenu); } -a.vsmenu:link, a.vsmenu:visited, a.vsmenu:hover, a.vsmenu:active, span.vsmenu { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #202020; margin: 1px 1px 1px 8px; } +a.vsmenu:link, a.vsmenu:visited, a.vsmenu:hover, a.vsmenu:active, span.vsmenu { font-size:; font-family: ; text-align: ; font-weight: normal; color: #202020; margin: 1px 1px 1px 8px; } span.vsmenudisabled:not(.spanlilevel0), font.vsmenudisabled:not(.spanlilevel0) { - font-size:px; + font-size:; } span.vsmenudisabled, font.vsmenudisabled { font-family: ; @@ -5002,7 +5001,7 @@ div#card-errors { .ui-dialog-titlebar { } .ui-dialog-content { - font-size: px !important; + font-size: !important; } .ui-dialog.ui-corner-all.ui-widget.ui-widget-content.ui-front.ui-draggable { z-index: 1002 !important; /* Default 101 with ui-jquery, top menu have a z-index of 1000 */ @@ -7466,13 +7465,12 @@ div.clipboardCPValue.hidewithsize { width: px; } -/* nboftopmenuentries = , fontsize= */ -/* disableimages = */ -/* rule to reduce top menu - 1st reduction */ -@media only screen and (max-width: px) +/* nboftopmenuentries = , fontsize= */ +/* rule to reduce top menu - 1st reduction: Reduce width of top menu icons */ +@media only screen and (max-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC1) ? round($nbtopmenuentries * 90, 0) + 340 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC1; ?>px) /* reduction 1 */ { div.tmenucenter { - max-width: px; /* size of viewport */ + max-width: 56px; /* size of viewport */ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -7496,16 +7494,16 @@ div.clipboardCPValue.hidewithsize { display: none; } } -/* rule to reduce top menu - 2nd reduction */ -@media only screen and (max-width: px) +/* rule to reduce top menu - 2nd reduction: Reduce width of top menu icons again */ +@media only screen and (max-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2) ? round($nbtopmenuentries * 69, 0) + 130 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2; ?>px) /* reduction 2 */ { li.tmenucompanylogo { display: none; } div.tmenucenter { - max-width: px; /* size of viewport */ - text-overflow: clip; + max-width: 24px; /* size of viewport */ + text-overflow: clip; } .mainmenuaspan { font-size: 10px; diff --git a/htdocs/theme/md/theme_vars.inc.php b/htdocs/theme/md/theme_vars.inc.php index 5f26d0d83bd..84a1065f781 100644 --- a/htdocs/theme/md/theme_vars.inc.php +++ b/htdocs/theme/md/theme_vars.inc.php @@ -64,8 +64,8 @@ $colortexttitle = '20,20,20'; $colortexttitlelink = '0,0,120'; $colortext = '0,0,0'; $colortextlink = '0,0,120'; -$fontsize = '14'; -$fontsizesmaller = '11'; +$fontsize = '0.94em'; +$fontsizesmaller = '0.75em'; $topMenuFontSize = '1.1em'; $toolTipBgColor = 'rgba(255, 255, 255, 0.96)'; $toolTipFontColor = '#333'; From 218d7cf148804d4dc0a3a86fb9007560a5819250 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 10 Feb 2023 13:47:46 +0000 Subject: [PATCH 029/108] Fixing style errors. --- htdocs/bom/tpl/objectline_view.tpl.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 6208abcbf6d..95bbed79784 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -172,8 +172,7 @@ print ''; $coldisplay++; if (!empty($line->fk_bom_child)) { echo ''.price($tmpbom->total_cost * $line->qty).''; -} -else { +} else { echo ''.price($line->total_cost).''; } print ''; @@ -302,7 +301,7 @@ if ($resql) { $sub_bom->calculateCosts(); print ''.price(price2num($sub_bom->total_cost * $sub_bom_line->qty * $line->qty, 'MT')).''; $total_cost+= $sub_bom->total_cost * $sub_bom_line->qty * $line->qty; - } elseif($sub_bom_product->type == Product::TYPE_SERVICE && isModEnabled('workstation') && !empty($sub_bom_product->fk_default_workstation)) { + } elseif ($sub_bom_product->type == Product::TYPE_SERVICE && isModEnabled('workstation') && !empty($sub_bom_product->fk_default_workstation)) { //Convert qty to hour $unit = measuringUnitString($sub_bom_line->fk_unit, '', '', 1); $qty = convertDurationtoHour($sub_bom_line->qty, $unit); From 49f093daefec960a3c4e632fcb557dd9a93441a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 14:57:27 +0100 Subject: [PATCH 030/108] css --- htdocs/theme/md/info-box.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index e2179b96162..9938225eebb 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -153,7 +153,7 @@ a.info-box-text-a i.fa.fa-exclamation-triangle { margin-bottom: 15px; border: 1px solid #e9e9e9; } -.info-box.info-box-sm{ +.info-box.info-box-sm { min-height: 80px; margin-bottom: 10px; } @@ -213,6 +213,10 @@ a.info-box-text-a i.fa.fa-exclamation-triangle { font-size: 25px; line-height: 92px; } +.info-box-module .info-box-icon { + padding-top: 4px; + padding-bottom: 4px; +} .opened-dash-board-wrap .info-box .info-box-icon { font-size: 2em; } From 1bc16f47c0633332e9a855bcc499b4b73d5ceb39 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 10 Feb 2023 15:00:27 +0100 Subject: [PATCH 031/108] FIX : Missing right to edit service note when module product is disabled --- htdocs/product/note.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/note.php b/htdocs/product/note.php index b758f414035..52d912933eb 100644 --- a/htdocs/product/note.php +++ b/htdocs/product/note.php @@ -49,7 +49,7 @@ if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); } -$permissionnote = $user->rights->produit->creer; // Used by the include of actions_setnotes.inc.php +$permissionnote = ($user->rights->produit->creer || $user->rights->service->creer); // Used by the include of actions_setnotes.inc.php if ($object->id > 0) { if ($object->type == $object::TYPE_PRODUCT) { From 0cc8b5d7f2e6acc146d9eb51dd2b05179260c1c0 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 15:02:11 +0100 Subject: [PATCH 032/108] fix : Warning: Undefined variable in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/core/class/html.formfile.class.php on line 924 --- htdocs/core/class/html.formfile.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index bc06d1517dc..ca058603ce1 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -920,6 +920,9 @@ class FormFile } if (is_object($hookmanager)) { + $addcolumforpicto = ($delallowed || $printer || $morepicto); + $colspan = (4 + ($addcolumforpicto ? 1 : 0)); + $colspanmore = 0; $parameters = array('colspan'=>($colspan + $colspanmore), 'socid'=>(isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id'=>(isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'modulepart'=>$modulepart, 'relativepath'=>$relativepath); $res = $hookmanager->executeHooks('formBuilddocLineOptions', $parameters, $file); if (empty($res)) { From 26ec131048fa28f3c690cdf48302279c1af04ee7 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 15:24:46 +0100 Subject: [PATCH 033/108] fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/compta/facture/card-rec.php on line 122 --- htdocs/compta/facture/card-rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index b2f3521111e..580b585c28f 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -119,7 +119,7 @@ $usercanreopen = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights $usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->unvalidate))); $usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)); -$usercancreatemargin = $user->rights->margins->creer; +$usercancreatemargin = $user->hasRight("margins", "creer"); $usercanreadallmargin = $user->rights->margins->liretous; $usercancreatewithdrarequest = $user->rights->prelevement->bons->creer; From 66015cb11d754a2404a9a426e44b6187d566e14a Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 15:30:34 +0100 Subject: [PATCH 034/108] fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/compta/facture/card-rec.php on line 123 Warning: Attempt to read property liretous on null in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/compta/facture/card-rec.php on line 123 --- htdocs/compta/facture/card-rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 580b585c28f..39763375fd2 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -120,7 +120,7 @@ $usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($ $usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)); $usercancreatemargin = $user->hasRight("margins", "creer"); -$usercanreadallmargin = $user->rights->margins->liretous; +$usercanreadallmargin = $user->hasRight("margins", "liretous"); $usercancreatewithdrarequest = $user->rights->prelevement->bons->creer; $now = dol_now(); From 457e6883e249938eee7ac1d0f1a4164a337fb5ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 15:34:47 +0100 Subject: [PATCH 035/108] Fix excessive hooks log --- htdocs/core/ajax/selectsearchbox.php | 1 - htdocs/core/class/hookmanager.class.php | 6 +++++- htdocs/main.inc.php | 14 +++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 38c363654d3..d2379f46966 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -58,7 +58,6 @@ if (!isset($usedbyinclude) || empty($usedbyinclude)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; -//global $hookmanager; $hookmanager->initHooks(array('searchform')); $search_boxvalue = GETPOST('q', 'restricthtml'); diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 191887e1725..c9c559fce41 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -127,6 +127,7 @@ class HookManager } } } + // Log the init of hook but only for hooks thare are declared to be managed if (count($arraytolog) > 0) { dol_syslog(get_class($this)."::initHooks Loading hooks: ".join(', ', $arraytolog), LOG_DEBUG); } @@ -275,7 +276,10 @@ class HookManager $actionclassinstance->error = 0; $actionclassinstance->errors = array(); - dol_syslog(get_class($this)."::executeHooks Qualified hook found (hooktype=".$hooktype."). We call method ".get_class($actionclassinstance).'->'.$method.", context=".$context.", module=".$module.", action=".$action.((is_object($object) && property_exists($object, 'id')) ? ', object id='.$object->id : '').((is_object($object) && property_exists($object, 'element')) ? ', object element='.$object->element : ''), LOG_DEBUG); + if (getDolGlobalInt('MAIN_DEBUG_SHOW_EACH_QUALIFIED_HOOK_CALL') >= 2) { + // This his too much verbose, enabled in develop only + dol_syslog(get_class($this)."::executeHooks Qualified hook found (hooktype=".$hooktype."). We call method ".get_class($actionclassinstance).'->'.$method.", context=".$context.", module=".$module.", action=".$action.((is_object($object) && property_exists($object, 'id')) ? ', object id='.$object->id : '').((is_object($object) && property_exists($object, 'element')) ? ', object element='.$object->element : ''), LOG_DEBUG); + } // Add current context to avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return; // Note: The hook can use the $currentcontext in its code to avoid to be ran twice or be ran for one given context only diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 37d018a21ce..f476c9bafed 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2870,14 +2870,9 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_ if (empty($conf->dol_hide_leftmenu) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) { // Instantiate hooks for external modules - $hookmanager->initHooks(array('searchform', 'leftblock')); + $hookmanager->initHooks(array('leftblock')); print "\n".''."\n".'
'."\n"; - - if ($conf->browser->layout == 'phone') { - $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ? - } - print "\n"; if (!is_object($form)) { @@ -2885,9 +2880,14 @@ function left_menu($menu_array_before, $helppagename = '', $notused = '', $menu_ } $selected = -1; if (empty($conf->global->MAIN_USE_TOP_MENU_SEARCH_DROPDOWN)) { + // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ? + if ($conf->browser->layout == 'phone') { + $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; + } + $usedbyinclude = 1; $arrayresult = null; - include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php'; // This set $arrayresult + include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php'; // This make initHooks('searchform') then set $arrayresult if ($conf->use_javascript_ajax && empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) { $searchform .= $form->selectArrayFilter('searchselectcombo', $arrayresult, $selected, '', 1, 0, (empty($conf->global->MAIN_SEARCHBOX_CONTENT_LOADED_BEFORE_KEY) ? 1 : 0), 'vmenusearchselectcombo', 1, $langs->trans("Search"), 1); From d183773ace1f036f1d128294e6c1ac3795031b05 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 10 Feb 2023 15:34:56 +0100 Subject: [PATCH 036/108] fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/compta/facture/card-rec.php on line 124 --- htdocs/compta/facture/card-rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 39763375fd2..96924f3bdd0 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -121,7 +121,7 @@ $usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($ $usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)); $usercancreatemargin = $user->hasRight("margins", "creer"); $usercanreadallmargin = $user->hasRight("margins", "liretous"); -$usercancreatewithdrarequest = $user->rights->prelevement->bons->creer; +$usercancreatewithdrarequest = $user->hasRight("prelevement", "bons","creer"); $now = dol_now(); From 1d9afa4808a64794970a9baaa52a06dc5ececc45 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 10 Feb 2023 14:45:03 +0000 Subject: [PATCH 037/108] Fixing style errors. --- htdocs/compta/facture/card-rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 96924f3bdd0..06e9a762bca 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -121,7 +121,7 @@ $usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($ $usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)); $usercancreatemargin = $user->hasRight("margins", "creer"); $usercanreadallmargin = $user->hasRight("margins", "liretous"); -$usercancreatewithdrarequest = $user->hasRight("prelevement", "bons","creer"); +$usercancreatewithdrarequest = $user->hasRight("prelevement", "bons", "creer"); $now = dol_now(); From fb4077ef95de43de60990235a979c1c2d9fc2f58 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 10 Feb 2023 16:07:55 +0100 Subject: [PATCH 038/108] Remove double code --- htdocs/core/photos_resize.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index efbb3ba9c19..9bb974d75b3 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -453,7 +453,6 @@ if ($action == 'confirm_crop') { if ($result < 0) { setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); } - $result = $ecmfile->create($user); } if ($backtourl) { From 8299501800d27661caf468133979f14c91a27c8f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 16:14:32 +0100 Subject: [PATCH 039/108] Fix subrequest inside a loop --- htdocs/core/class/commonobject.class.php | 7 ++-- htdocs/projet/list.php | 49 ++++++++++++++++-------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b5bcbe3ef8f..38202a0938a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1354,12 +1354,13 @@ abstract class CommonObject * * @param int $statusoflink Status of links to get (-1=all). Not used. * @param string $source Source of contact: 'external' or 'thirdparty' (llx_socpeople) or 'internal' (llx_user) - * @param int $list 0:Return array contains all properties, 1:Return array contains just id + * @param int $list 0:Returned array contains all properties, 1:Return array contains just id * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) * @param int $status Status of user or company + * @param array $arrayoftcids Array with ID of type of contacts. If we provide this, we can make a ec.fk_c_type_contact in ($arrayoftcids) to avoid link on tc table. TODO Not implemented. * @return array|int Array of contacts, -1 if error */ - public function liste_contact($statusoflink = -1, $source = 'external', $list = 0, $code = '', $status = -1) + public function liste_contact($statusoflink = -1, $source = 'external', $list = 0, $code = '', $status = -1, $typecontectids = array()) { // phpcs:enable global $langs; @@ -1401,7 +1402,7 @@ abstract class CommonObject $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople } } - $sql .= " AND tc.active=1"; + $sql .= " AND tc.active = 1"; if ($statusoflink >= 0) { $sql .= " AND ec.statut = ".((int) $statusoflink); } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 32192114a4c..6574cf8d09d 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1331,6 +1331,7 @@ while ($i < $imaxinloop) { $userAccess = $object->restrictedProjectArea($user); // why this ? if ($userAccess >= 0) { + // Thirdparty $companystatic->id = $obj->socid; $companystatic->name = $obj->name; $companystatic->name_alias = $obj->alias; @@ -1343,6 +1344,21 @@ while ($i < $imaxinloop) { $companystatic->town = $obj->town; $companystatic->country_code = $obj->country_code; + // Author + $userstatic->id = $obj->fk_user_creat; + $userstatic->login = $obj->login; + $userstatic->lastname = $obj->lastname; + $userstatic->firstname = $obj->firstname; + $userstatic->email = $obj->user_email; + $userstatic->statut = $obj->user_statut; + $userstatic->entity = $obj->entity; + $userstatic->photo = $obj->photo; + $userstatic->office_phone = $obj->office_phone; + $userstatic->office_fax = $obj->office_fax; + $userstatic->user_mobile = $obj->user_mobile; + $userstatic->job = $obj->job; + $userstatic->gender = $obj->gender; + print ''; // Action column @@ -1496,12 +1512,25 @@ while ($i < $imaxinloop) { if (!empty($numcontact)) { foreach ($tab as $contactproject) { //var_dump($contacttask); + $cid = $contactproject['id']; if ($source == 'internal') { - $c = new User($db); + if (empty($conf->cache['user'][$cid])) { + $c = new User($db); + $c->fetch($cid); + $conf->cache['user'][$cid] = $c; + } else { + $c = $conf->cache['user'][$cid]; + } } else { - $c = new Contact($db); + if (empty($conf->cache['contact'][$cid])) { + $c = new Contact($db); + $c->fetch($cid); + $conf->cache['contact'][$cid] = $c; + } else { + $c = $conf->cache['contact'][$cid]; + } } - $c->fetch($contactproject['id']); + if (!empty($c->photo)) { if (get_class($c) == 'User') { print $c->getNomUrl(-2, '', 0, 0, 24, 1, '', ($ifisrt ? '' : 'notfirst')); @@ -1703,20 +1732,6 @@ while ($i < $imaxinloop) { $totalarray['pos'][$totalarray['nbfield']] = 'p.price_booth'; } } - // Author - $userstatic->id = $obj->fk_user_creat; - $userstatic->login = $obj->login; - $userstatic->lastname = $obj->lastname; - $userstatic->firstname = $obj->firstname; - $userstatic->email = $obj->user_email; - $userstatic->statut = $obj->user_statut; - $userstatic->entity = $obj->entity; - $userstatic->photo = $obj->photo; - $userstatic->office_phone = $obj->office_phone; - $userstatic->office_fax = $obj->office_fax; - $userstatic->user_mobile = $obj->user_mobile; - $userstatic->job = $obj->job; - $userstatic->gender = $obj->gender; if (!empty($arrayfields['u.login']['checked'])) { print ''; From 36b0b7f03cd4cb380683466a884067d4d3874afd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 16:15:05 +0100 Subject: [PATCH 040/108] Fix somes subrequests inside the loop --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 38202a0938a..9eb66fa0745 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1360,7 +1360,7 @@ abstract class CommonObject * @param array $arrayoftcids Array with ID of type of contacts. If we provide this, we can make a ec.fk_c_type_contact in ($arrayoftcids) to avoid link on tc table. TODO Not implemented. * @return array|int Array of contacts, -1 if error */ - public function liste_contact($statusoflink = -1, $source = 'external', $list = 0, $code = '', $status = -1, $typecontectids = array()) + public function liste_contact($statusoflink = -1, $source = 'external', $list = 0, $code = '', $status = -1, $arrayoftcids = array()) { // phpcs:enable global $langs; From a3d32fc7eb8bb0f7c590552aefb8ba43cb0bcfeb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 16:53:16 +0100 Subject: [PATCH 041/108] Trans --- htdocs/categories/viewcat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 6f09e734406..f494dddb082 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -1005,7 +1005,7 @@ if ($type == Categorie::TYPE_PROJECT) { print ''; print ''; print ''; print ''; From 0235e24e0e6d1f01e8d9b8097a35aacad4fa67e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 17:54:07 +0100 Subject: [PATCH 042/108] Fix css multiseclect --- htdocs/core/class/html.form.class.php | 9 +++++++-- htdocs/theme/eldy/global.inc.php | 8 ++++++++ htdocs/theme/md/style.css.php | 8 ++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6f0023548b9..1a15abe53bc 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8408,8 +8408,13 @@ class Form } } - // Try also magic suggest - $out .= ''."\n"; if (is_array($array) && !empty($array)) { if ($value_as_key) { $array = array_combine($array, $array); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 8f7d4b1ef1e..12d068168d0 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -6514,6 +6514,14 @@ ul.select2-results__options li { font-size: 0.95em; } +select.multiselectononeline { + padding: 0; + vertical-align: middle; + height: 28px !important; + opacity: 0; + /* width: 1px !important; */ +} + @media only screen and (min-width: 767px) { /* CSS to have the dropdown boxes larger that the input search area */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 6d56e452898..20349be0b4e 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -6421,6 +6421,14 @@ ul.select2-results__options li { font-size: 0.95em; } +select.multiselectononeline { + padding: 0; + vertical-align: middle; + height: 28px !important; + opacity: 0; + /* width: 1px !important; */ +} + @media only screen and (min-width: 767px) { /* CSS to have the dropdown boxes larger that the input search area */ From c21be771f87ea516ede1f2cd3cebccc8e614a295 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 18:05:05 +0100 Subject: [PATCH 043/108] CSS --- htdocs/theme/eldy/global.inc.php | 1 + htdocs/theme/md/style.css.php | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 12d068168d0..23bb38e8d5a 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -6517,6 +6517,7 @@ ul.select2-results__options li { select.multiselectononeline { padding: 0; vertical-align: middle; + min-height: unset; height: 28px !important; opacity: 0; /* width: 1px !important; */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 20349be0b4e..8c2934fb227 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -6424,6 +6424,7 @@ ul.select2-results__options li { select.multiselectononeline { padding: 0; vertical-align: middle; + min-height: unset; height: 28px !important; opacity: 0; /* width: 1px !important; */ From 211bda455d18e9e4d95d24097fe1b534202e026f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 19:00:44 +0100 Subject: [PATCH 044/108] Debug v17 --- htdocs/core/js/lib_notification.js.php | 35 ++++++++++++++++++-------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index d7e1932ca27..c33dbe2a3bd 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -66,6 +66,8 @@ print "jQuery(document).ready(function () {\n"; print ' var nowtime = Date.now();'; print ' var time_auto_update = '.max(1, getDolGlobalInt('MAIN_BROWSER_NOTIFICATION_FREQUENCY')).';'."\n"; // Always defined print ' var time_js_next_test;'."\n"; +print ' var dolnotif_nb_test_for_page = 0;'."\n"; +print ' var dolnotif_idinterval = null;'."\n"; ?> /* Check if Notification is supported */ @@ -82,7 +84,7 @@ if ("Notification" in window) { //var time_first_execution = (time_auto_update + (time_js_next_test - nowtime)) * 1000; //need milliseconds var time_first_execution = global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION) ? 0 : $conf->global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION); ?>; - setTimeout(first_execution, time_first_execution * 1000); + setTimeout(first_execution, time_first_execution * 1000); // Launch a first execution after a time_first_execution delay time_js_next_test = nowtime + time_first_execution; console.log("Launch browser notif check: setTimeout is set to launch 'first_execution' function after a wait of time_first_execution="+time_first_execution+". nowtime (time php page generation) = "+nowtime+" time_js_next_check = "+time_js_next_test); } else { @@ -91,14 +93,16 @@ if ("Notification" in window) { function first_execution() { - console.log("Call first_execution then set repeat time to time_auto_update = MAIN_BROWSER_NOTIFICATION_FREQUENCY = "+time_auto_update); - check_events(); //one check before setting the new time for other checks - setInterval(check_events, time_auto_update * 1000); // Set new time to run next check events + console.log("Call first_execution"); + result = check_events(); //one check before setting the new time for other checks + if (result > 0) { + console.log("Program a repeated run with a time_auto_update = MAIN_BROWSER_NOTIFICATION_FREQUENCY = "+time_auto_update+"s"); + dolnotif_idinterval = setInterval(check_events, time_auto_update * 1000); // Set new time to run next check events. time_auto_update=nb of seconds + } } function check_events() { - if (Notification.permission === "granted") - { + if (Notification.permission === "granted") { var currentToken = 'notrequired'; const allMeta = document.getElementsByTagName("meta"); for (let i = 0; i < allMeta.length; i++) { @@ -108,7 +112,9 @@ function check_events() { } } time_js_next_test += time_auto_update; - console.log("Call ajax to check events with time_js_next_test = "+time_js_next_test); + dolnotif_nb_test_for_page += 1; + + console.log("Call ajax to check events with time_js_next_test = "+time_js_next_test+" dolnotif_nb_test_for_page="+dolnotif_nb_test_for_page); $.ajax("", { type: "post", // Usually post or get @@ -188,10 +194,17 @@ function check_events() { } } }); - } - else - { - console.log("Cancel check_events. Useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https)."); + + if (dolnotif_nb_test_for_page > 10) { + console.log("We did "+dolnotif_nb_test_for_page+" consecutive test on this page. We stop checking now from here by clearing dolnotif_idinterval="+dolnotif_idinterval); + clearInterval(dolnotif_idinterval); + } + + return 1; + } else { + console.log("Cancel check_events and timer. Useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https)."); + + return 0; } } Date: Fri, 10 Feb 2023 19:08:03 +0100 Subject: [PATCH 045/108] Log --- htdocs/core/js/lib_notification.js.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index c33dbe2a3bd..2659b812bc6 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -93,7 +93,7 @@ if ("Notification" in window) { function first_execution() { - console.log("Call first_execution"); + console.log("Call first_execution of check_events()"); result = check_events(); //one check before setting the new time for other checks if (result > 0) { console.log("Program a repeated run with a time_auto_update = MAIN_BROWSER_NOTIFICATION_FREQUENCY = "+time_auto_update+"s"); @@ -190,12 +190,12 @@ function check_events() { data: { time_js_next_test: time_js_next_test, token: currentToken } }); } else { - console.log("No reminder to do found, next search at "+time_js_next_test); + console.log("No remind to do found, next search at "+time_js_next_test); } } }); - if (dolnotif_nb_test_for_page > 10) { + if (dolnotif_nb_test_for_page > 5) { console.log("We did "+dolnotif_nb_test_for_page+" consecutive test on this page. We stop checking now from here by clearing dolnotif_idinterval="+dolnotif_idinterval); clearInterval(dolnotif_idinterval); } From 582cb35ae4fed24edf935950788ee7537174f252 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 19:15:14 +0100 Subject: [PATCH 046/108] Fix allow time to answer notification permission --- htdocs/core/js/lib_notification.js.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index 2659b812bc6..9724dc8c447 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -96,7 +96,7 @@ function first_execution() { console.log("Call first_execution of check_events()"); result = check_events(); //one check before setting the new time for other checks if (result > 0) { - console.log("Program a repeated run with a time_auto_update = MAIN_BROWSER_NOTIFICATION_FREQUENCY = "+time_auto_update+"s"); + console.log("check_events() is scheduled as a repeated task with a time_auto_update = MAIN_BROWSER_NOTIFICATION_FREQUENCY = "+time_auto_update+"s"); dolnotif_idinterval = setInterval(check_events, time_auto_update * 1000); // Set new time to run next check events. time_auto_update=nb of seconds } } @@ -204,7 +204,7 @@ function check_events() { } else { console.log("Cancel check_events and timer. Useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https)."); - return 0; + return 2; // We return a positive so the repeated check will done even if authroization is not yet allowed may be after this check) } } Date: Fri, 10 Feb 2023 19:15:54 +0100 Subject: [PATCH 047/108] Log --- htdocs/core/js/lib_notification.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index 9724dc8c447..67423200405 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -202,7 +202,7 @@ function check_events() { return 1; } else { - console.log("Cancel check_events and timer. Useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https)."); + console.log("Cancel check_events. Check is useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https)."); return 2; // We return a positive so the repeated check will done even if authroization is not yet allowed may be after this check) } From 78201454e8e1fe8cc14a52b771e1e44d832d3b2c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 19:19:11 +0100 Subject: [PATCH 048/108] Fix stop of timer is done also when checks fail --- htdocs/core/js/lib_notification.js.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index 67423200405..102f760122a 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -102,6 +102,9 @@ function first_execution() { } function check_events() { + var result = 0; + dolnotif_nb_test_for_page += 1; + if (Notification.permission === "granted") { var currentToken = 'notrequired'; const allMeta = document.getElementsByTagName("meta"); @@ -112,7 +115,6 @@ function check_events() { } } time_js_next_test += time_auto_update; - dolnotif_nb_test_for_page += 1; console.log("Call ajax to check events with time_js_next_test = "+time_js_next_test+" dolnotif_nb_test_for_page="+dolnotif_nb_test_for_page); @@ -195,17 +197,19 @@ function check_events() { } }); - if (dolnotif_nb_test_for_page > 5) { - console.log("We did "+dolnotif_nb_test_for_page+" consecutive test on this page. We stop checking now from here by clearing dolnotif_idinterval="+dolnotif_idinterval); - clearInterval(dolnotif_idinterval); - } - - return 1; + result = 1; } else { - console.log("Cancel check_events. Check is useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https)."); + console.log("Cancel check_events() with dolnotif_nb_test_for_page="+dolnotif_nb_test_for_page+". Check is useless because javascript Notification.permission is "+Notification.permission+" (blocked manualy or web site is not https)."); - return 2; // We return a positive so the repeated check will done even if authroization is not yet allowed may be after this check) + result = 2; // We return a positive so the repeated check will done even if authroization is not yet allowed may be after this check) } + + if (dolnotif_nb_test_for_page > 5) { + console.log("We did "+dolnotif_nb_test_for_page+" consecutive test on this page. We stop checking now from here by clearing dolnotif_idinterval="+dolnotif_idinterval); + clearInterval(dolnotif_idinterval); + } + + return result; } Date: Fri, 10 Feb 2023 19:24:50 +0100 Subject: [PATCH 049/108] Fix end of loop --- htdocs/core/js/lib_notification.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index 102f760122a..c2f7096432f 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -204,7 +204,7 @@ function check_events() { result = 2; // We return a positive so the repeated check will done even if authroization is not yet allowed may be after this check) } - if (dolnotif_nb_test_for_page > 5) { + if (dolnotif_nb_test_for_page >= 5) { console.log("We did "+dolnotif_nb_test_for_page+" consecutive test on this page. We stop checking now from here by clearing dolnotif_idinterval="+dolnotif_idinterval); clearInterval(dolnotif_idinterval); } From 23b4e999fbeabad0eba22b782cf497e6a2aacbfa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 10 Feb 2023 19:44:34 +0100 Subject: [PATCH 050/108] Better sql for unique index --- htdocs/install/mysql/migration/15.0.0-16.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index bee0477665f..f4b7689d6df 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -688,7 +688,7 @@ ALTER TABLE llx_actioncomm MODIFY COLUMN note mediumtext; DELETE FROM llx_boxes WHERE box_id IN (select rowid FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php', 'box_members.php', 'box_last_modified_ticket', 'box_members_last_subscriptions', 'box_members_last_modified', 'box_members_subscriptions_by_year')); DELETE FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php', 'box_members.php', 'box_last_modified_ticket', 'box_members_last_subscriptions', 'box_members_last_modified', 'box_members_subscriptions_by_year'); -ALTER TABLE llx_takepos_floor_tables ADD UNIQUE uk_takepos_floor_tables (entity,label); +ALTER TABLE llx_takepos_floor_tables ADD UNIQUE INDEX uk_takepos_floor_tables (entity,label); ALTER TABLE llx_partnership ADD COLUMN url_to_check varchar(255); ALTER TABLE llx_c_partnership_type ADD COLUMN keyword varchar(128); From ba1d3c9d8c6d56c691d4f36054aa446a12184bc5 Mon Sep 17 00:00:00 2001 From: Benjamin Sonntag Date: Fri, 10 Feb 2023 19:49:51 +0100 Subject: [PATCH 051/108] Update llx_accounting_account_fr.sql If you import this by hand, a key violation occurs. the 3352 account is named 3552, which collides which the 3552 below. I propose to fix that easily ;) --- htdocs/install/mysql/data/llx_accounting_account_fr.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_accounting_account_fr.sql b/htdocs/install/mysql/data/llx_accounting_account_fr.sql index 4520969f82b..4c24d63e5b1 100644 --- a/htdocs/install/mysql/data/llx_accounting_account_fr.sql +++ b/htdocs/install/mysql/data/llx_accounting_account_fr.sql @@ -824,7 +824,7 @@ INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, acc INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 5317,'PCG14-DEV','STOCK','3312',5315,'Produits en cours P 2','1'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 5318,'PCG14-DEV','STOCK','335',5314,'Travaux en cours','1'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 5319,'PCG14-DEV','STOCK','3351',5318,'Travaux en cours T 1','1'); -INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 5320,'PCG14-DEV','STOCK','3552',5318,'Travaux en cours T 2','1'); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 5320,'PCG14-DEV','STOCK','3352',5318,'Travaux en cours T 2','1'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 5321,'PCG14-DEV','STOCK','34',5969,'En-cours de production de services','1'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 5322,'PCG14-DEV','STOCK','341',5321,'Etudes en cours','1'); INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 5323,'PCG14-DEV','STOCK','3411',5322,'Etudes en cours E 1','1'); From 9c706061bea8a5011dd273edee6bd815c3fe49aa Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 11 Feb 2023 08:48:09 +0100 Subject: [PATCH 052/108] FIX Object of class LDAP\Connection could not be converted to string --- htdocs/core/class/ldap.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 7b3c6c4ac2c..847a1bf32e3 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -1058,7 +1058,7 @@ class Ldap if (is_array($attributeArray)) { // Return list with required fields $attributeArray = array_values($attributeArray); // This is to force to have index reordered from 0 (not make ldap_search fails) - dol_syslog(get_class($this)."::getRecords connection=".$this->connection." userDn=".$userDn." filter=".$filter." attributeArray=(".join(',', $attributeArray).")"); + dol_syslog(get_class($this)."::getRecords connection=".get_resource_type($this->connection)." userDn=".$userDn." filter=".$filter." attributeArray=(".join(',', $attributeArray).")"); //var_dump($attributeArray); $this->result = @ldap_search($this->connection, $userDn, $filter, $attributeArray); } else { From 8a091de9d79e0c12608626a1099e4a45a571abc7 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 11 Feb 2023 10:06:18 +0100 Subject: [PATCH 053/108] fix : Warning: Undefined property: stdClass:: in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/compta/facture/class/facture.class.php on line 1264 --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 9b93721ca6a..161087a3bf9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1261,7 +1261,7 @@ class Facture extends CommonInvoice $object->ref_client = ''; $object->close_code = ''; $object->close_note = ''; - if ($conf->global->MAIN_DONT_KEEP_NOTE_ON_CLONING == 1) { + if (getDolGlobalInt('MAIN_DONT_KEEP_NOTE_ON_CLONING') == 1) { $object->note_private = ''; $object->note_public = ''; } From 8d531d92df2db14f1340563ff595015e81a740a3 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 11 Feb 2023 10:20:30 +0100 Subject: [PATCH 054/108] fix : typo and translation --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 3aa43556e43..a9d9e040ec8 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4327,7 +4327,7 @@ if ($action == 'create') { array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company($object->socid, 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', 1)), array('type' => 'date', 'name' => 'newdate', 'label' => $langs->trans("Date"), 'value' => dol_now()) ); - // Ask confirmatio to clone + // Request confirmation to clone $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneInvoice', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 250); } From 4a8223ae297b54292f3eab5a3085c4268ea35d99 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 11 Feb 2023 11:59:48 +0100 Subject: [PATCH 055/108] FIX look and feel --- htdocs/core/class/html.form.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1a15abe53bc..a672709cc48 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5115,10 +5115,12 @@ class Form $i = 0; foreach ($input['values'] as $selkey => $selval) { $more .= '
'; - if ($i == 0) { - $more .= '
'.$input['label'].'
'; - } else { - $more .= '
 
'; + if (isset($input['label'])) { + if ($i == 0) { + $more .= '
'.$input['label'].'
'; + } else { + $more .= '
 
'; + } } $more .= '
Date: Sat, 11 Feb 2023 12:28:23 +0100 Subject: [PATCH 056/108] Debug v17 --- htdocs/core/lib/functions.lib.php | 10 ++++--- htdocs/core/menus/standard/eldy.lib.php | 2 +- .../modules/mailings/contacts1.modules.php | 2 +- htdocs/fourn/facture/card.php | 14 ++++----- htdocs/hrm/admin/job_extrafields.php | 2 +- htdocs/hrm/class/evaluation.class.php | 2 +- htdocs/hrm/class/position.class.php | 2 +- htdocs/hrm/compare.php | 2 +- htdocs/hrm/evaluation_agenda.php | 2 +- htdocs/hrm/evaluation_card.php | 2 +- htdocs/hrm/evaluation_contact.php | 2 +- htdocs/hrm/evaluation_document.php | 2 +- htdocs/hrm/evaluation_note.php | 2 +- htdocs/hrm/job_list.php | 2 +- htdocs/hrm/lib/hrm_job.lib.php | 2 +- htdocs/hrm/position_agenda.php | 2 +- htdocs/hrm/position_card.php | 2 +- htdocs/hrm/position_document.php | 2 +- htdocs/hrm/position_note.php | 2 +- htdocs/langs/en_US/hrm.lang | 6 ++-- htdocs/user/list.php | 30 +++++++++++++++++-- 21 files changed, 60 insertions(+), 34 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 37949215357..0f42862b724 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4098,7 +4098,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'autofill', 'folder', 'folder-open', 'folder-plus', 'gears', 'generate', 'globe', 'globe-americas', 'graph', 'grip', 'grip_title', 'group', 'help', 'holiday', - 'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'knowledgemanagement', + 'images', 'incoterm', 'info', 'intervention', 'inventory', 'intracommreport', 'jobprofile', + 'knowledgemanagement', 'label', 'language', 'line', 'link', 'list', 'list-alt', 'listlight', 'loan', 'lock', 'lot', 'long-arrow-alt-right', 'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next', 'off', 'on', 'order', @@ -4113,7 +4114,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'technic', 'ticket', 'error', 'warning', 'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'replacement', 'resource', 'recurring','rss', - 'shapes', 'square', 'stop-circle', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice', + 'shapes', 'skill', 'square', 'stop-circle', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda', 'uncheck', 'url', 'user-cog', 'user-injured', 'user-md', 'vat', 'website', 'workstation', 'webhook', 'world', 'private', 'conferenceorbooth', 'eventorganization', @@ -4145,7 +4146,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'email'=>'at', 'establishment'=>'building', 'edit'=>'pencil-alt', 'entity'=>'globe', 'graph'=>'chart-line', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'question-circle', 'generic'=>'file', 'holiday'=>'umbrella-beach', - 'info'=>'info-circle', 'inventory'=>'boxes', 'intracommreport'=>'globe-europe', 'knowledgemanagement'=>'ticket-alt', 'label'=>'layer-group', 'line'=>'bars', 'loan'=>'money-bill-alt', + 'info'=>'info-circle', 'inventory'=>'boxes', 'intracommreport'=>'globe-europe', 'jobprofile'=>'cogs', + 'knowledgemanagement'=>'ticket-alt', 'label'=>'layer-group', 'line'=>'bars', 'loan'=>'money-bill-alt', 'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right', 'trip'=>'wallet', 'expensereport'=>'wallet', 'group'=>'users', 'movement'=>'people-carry', 'sign-out'=>'sign-out-alt', @@ -4161,7 +4163,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature', 'refresh'=>'redo', 'region'=>'map-marked', 'replacement'=>'exchange-alt', 'resource'=>'laptop-house', 'recurring'=>'history', 'service'=>'concierge-bell', - 'state'=>'map-marked-alt', 'security'=>'key', 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s', + 'skill'=>'shapes', 'state'=>'map-marked-alt', 'security'=>'key', 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s', 'supplier'=>'building', 'technic'=>'cogs', 'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt', diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index d04cf9edc1a..b534a998107 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -2270,7 +2270,7 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = //$newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->hasRight('hrm', 'all', 'read')); // Job (Description of work to do and skills required) - $newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("JobsPosition"), 1, $user->hasRight('hrm', 'all', 'read'), '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("JobsProfiles"), 1, $user->hasRight('hrm', 'all', 'read'), '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); //$newmenu->add("/hrm/job_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->transnoentities("NewObject", $langs->trans("Job")), 1, $user->hasRight('hrm', 'all', 'write')); //$newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->hasRight('hrm', 'all', 'read')); diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 36be5bf40b3..71cbe6e6199 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -463,7 +463,7 @@ class mailing_contacts1 extends MailingTargets 'other' => ($langs->transnoentities("ThirdParty").'='.$obj->companyname).';'. ($langs->transnoentities("UserTitle").'='.($obj->civility_id ? $langs->transnoentities("Civility".$obj->civility_id) : '')).';'. - ($langs->transnoentities("JobPosition").'='.$obj->jobposition), + ($langs->transnoentities("PostOrFunction").'='.$obj->jobposition), 'source_url' => $this->url($obj->id), 'source_id' => $obj->id, 'source_type' => 'contact' diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 7eedcc29403..246f65c19f9 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2199,7 +2199,7 @@ if ($action == 'create') { // Standard invoice print '
'; $tmp = ' '; - $desc = $form->textwithpicto($tmp.$langs->trans("InvoiceStandardAsk"), $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3); + $desc = $form->textwithpicto($tmp.'', $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3); print $desc; print '
'; @@ -2377,7 +2377,7 @@ if ($action == 'create') { }); }); '; - $text = $tmp.$langs->transnoentities("InvoiceAvoirAsk").' '; + $text = $tmp.' '; // $text.=''; $text .= '
'; - // Payment term print ''; + // Due date + print ''; + // Payment mode print '
'; - print $langs->trans("AddProjectIntoCategory").'  '; + print $langs->trans("AddObjectIntoCategory").'  '; $form->selectProjects('', 'elemid'); print '
'.$langs->trans('DateMaxPayment').''; - print $form->selectDate($datedue, 'ech', '', '', '', "add", 1, 1); - print '
'.$langs->trans('PaymentConditionsShort').''; print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ?GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id'); print '
'.$langs->trans('DateMaxPayment').''; + print $form->selectDate($datedue, 'ech', '', '', '', "add", 1, 1); + print '
'.$langs->trans('PaymentMode').''; print img_picto('', 'bank', 'class="pictofixedwidth"'); diff --git a/htdocs/hrm/admin/job_extrafields.php b/htdocs/hrm/admin/job_extrafields.php index 6ac0773c00f..8b30b1c7051 100644 --- a/htdocs/hrm/admin/job_extrafields.php +++ b/htdocs/hrm/admin/job_extrafields.php @@ -67,7 +67,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; * View */ -$textobject = $langs->transnoentitiesnoconv("JobPosition"); +$textobject = $langs->transnoentitiesnoconv("JobProfile"); $help_url = ''; $page_name = "HrmSetup"; diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 51f8c8bc985..039888258b8 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -119,7 +119,7 @@ class Evaluation extends CommonObject 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'default'=>0, 'visible'=>5, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '6' => 'Closed'),), 'date_eval' => array('type'=>'date', 'label'=>'DateEval', 'enabled'=>'1', 'position'=>502, 'notnull'=>1, 'visible'=>1,), 'fk_user' => array('type'=>'integer:User:user/class/user.class.php:0', 'label'=>'User', 'enabled'=>'1', 'position'=>504, 'notnull'=>1, 'visible'=>1,), - 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'JobPosition', 'enabled'=>'1', 'position'=>505, 'notnull'=>1, 'visible'=>1,), + 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'JobProfile', 'enabled'=>'1', 'position'=>505, 'notnull'=>1, 'visible'=>1,), ); public $rowid; public $ref; diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index b685147a9b9..27c7643abe5 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -110,7 +110,7 @@ class Position extends CommonObject 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,), 'fk_contrat' => array('type'=>'integer:Contrat:contrat/class/contrat.class.php', 'label'=>'fk_contrat', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>0,), 'fk_user' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Employee', 'enabled'=>'1', 'position'=>55, 'notnull'=>1, 'visible'=>1, 'default'=>0), - 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'JobPosition', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1,), + 'fk_job' => array('type'=>'integer:Job:/hrm/class/job.class.php', 'label'=>'JobProfile', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1,), 'date_start' => array('type'=>'date', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>51, 'notnull'=>1, 'visible'=>1,), 'date_end' => array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>52, 'notnull'=>0, 'visible'=>1,), 'abort_comment' => array('type'=>'varchar(255)', 'label'=>'AbandonmentComment', 'enabled'=>'getDolGlobalInt("HRM_JOB_POSITON_ENDING_COMMENT")', 'position'=>502, 'notnull'=>0, 'visible'=>1,), diff --git a/htdocs/hrm/compare.php b/htdocs/hrm/compare.php index beee61ca6fa..a9fbb3a1903 100644 --- a/htdocs/hrm/compare.php +++ b/htdocs/hrm/compare.php @@ -155,7 +155,7 @@ $fk_usergroup1 = GETPOST('fk_usergroup1'); $TJobs[$j->id] = $j->label; } - print $form->selectarray('fk_job', $TJobs, $fk_job, 1); + print img_picto('', 'jobprofile', 'class="pictofixedwidth"').$form->selectarray('fk_job', $TJobs, $fk_job, 1); ?>
diff --git a/htdocs/hrm/evaluation_agenda.php b/htdocs/hrm/evaluation_agenda.php index cc314bd9bce..31607e01b28 100644 --- a/htdocs/hrm/evaluation_agenda.php +++ b/htdocs/hrm/evaluation_agenda.php @@ -158,7 +158,7 @@ if ($object->id > 0) { $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= '
'; diff --git a/htdocs/hrm/evaluation_card.php b/htdocs/hrm/evaluation_card.php index 101873a69e4..8f513d654f3 100644 --- a/htdocs/hrm/evaluation_card.php +++ b/htdocs/hrm/evaluation_card.php @@ -410,7 +410,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= '
'; diff --git a/htdocs/hrm/evaluation_contact.php b/htdocs/hrm/evaluation_contact.php index 4ea2e8e81be..c96f562afc7 100644 --- a/htdocs/hrm/evaluation_contact.php +++ b/htdocs/hrm/evaluation_contact.php @@ -145,7 +145,7 @@ if ($object->id) { $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= ''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); diff --git a/htdocs/hrm/evaluation_document.php b/htdocs/hrm/evaluation_document.php index 84bc6023291..7935ea7602c 100644 --- a/htdocs/hrm/evaluation_document.php +++ b/htdocs/hrm/evaluation_document.php @@ -138,7 +138,7 @@ if ($object->id) { $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= ''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/hrm/evaluation_note.php b/htdocs/hrm/evaluation_note.php index 3f0d41e946a..1164a9642b1 100644 --- a/htdocs/hrm/evaluation_note.php +++ b/htdocs/hrm/evaluation_note.php @@ -113,7 +113,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= ''; diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php index 6cb1a4bf62c..0261c968d4c 100644 --- a/htdocs/hrm/job_list.php +++ b/htdocs/hrm/job_list.php @@ -207,7 +207,7 @@ $now = dol_now(); //$help_url="EN:Module_Job|FR:Module_Job_FR|ES:Módulo_Job"; $help_url = ''; -$title = $langs->trans("JobsPosition"); +$title = $langs->trans("JobsProfiles"); $morejs = array(); $morecss = array(); diff --git a/htdocs/hrm/lib/hrm_job.lib.php b/htdocs/hrm/lib/hrm_job.lib.php index 6a948b00439..cff07ef5e67 100644 --- a/htdocs/hrm/lib/hrm_job.lib.php +++ b/htdocs/hrm/lib/hrm_job.lib.php @@ -40,7 +40,7 @@ function jobPrepareHead($object) $head = array(); $head[$h][0] = DOL_URL_ROOT."/hrm/job_card.php?id=".$object->id; - $head[$h][1] = $langs->trans("JobPosition"); + $head[$h][1] = $langs->trans("JobProfile"); $head[$h][2] = 'job_card'; $h++; diff --git a/htdocs/hrm/position_agenda.php b/htdocs/hrm/position_agenda.php index af60ddea1b8..210f8974b68 100644 --- a/htdocs/hrm/position_agenda.php +++ b/htdocs/hrm/position_agenda.php @@ -158,7 +158,7 @@ if ($object->id > 0) { $morehtmlref .= ($u_position->id > 0 ? $u_position->getNomUrl(1) : $langs->trans('Employee').' : '); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= ''; diff --git a/htdocs/hrm/position_card.php b/htdocs/hrm/position_card.php index fae9efd76ba..9004e8d2b13 100644 --- a/htdocs/hrm/position_card.php +++ b/htdocs/hrm/position_card.php @@ -288,7 +288,7 @@ function displayPositionCard(&$object) $morehtmlref .= ($u_position->id > 0 ? $u_position->getNomUrl(1) : $langs->trans('Employee').' : '); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= ''; dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref); diff --git a/htdocs/hrm/position_document.php b/htdocs/hrm/position_document.php index 521d6b0ec24..60c0e87c788 100644 --- a/htdocs/hrm/position_document.php +++ b/htdocs/hrm/position_document.php @@ -136,7 +136,7 @@ if ($object->id) { $morehtmlref .= ($u_position->id > 0 ? $u_position->getNomUrl(1) : $langs->trans('Employee').' : '); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= ''; diff --git a/htdocs/hrm/position_note.php b/htdocs/hrm/position_note.php index a09b0e99699..fba8cd2067c 100644 --- a/htdocs/hrm/position_note.php +++ b/htdocs/hrm/position_note.php @@ -111,7 +111,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= ($u_position->id > 0 ? $u_position->getNomUrl(1) : $langs->trans('Employee').' : '); $job = new Job($db); $job->fetch($object->fk_job); - $morehtmlref .= '
'.$langs->trans('JobPosition').' : '.$job->getNomUrl(1); + $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); $morehtmlref .= ''; diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index 592009b8697..475e11131f4 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -26,8 +26,8 @@ HRM_DEFAULT_SKILL_DESCRIPTION=Default description of ranks when skill is created deplacement=Shift DateEval=Evaluation date JobCard=Job card -JobPosition=Job profile -JobsPosition=Job profiles +JobProfile=Job profile +JobsProfiles=Job profiles NewSkill=New Skill SkillType=Skill type Skilldets=List of ranks for this skill @@ -53,7 +53,7 @@ EmployeePositions=Employee positions EmployeesInThisPosition=Employees in this position group1ToCompare=Usergroup to analyze group2ToCompare=Second usergroup for comparison -OrJobToCompare=Compare to job skills requirements +OrJobToCompare=Compare to skill requirements of a job profile difference=Difference CompetenceAcquiredByOneOrMore=Competence acquired by one or more users but not requested by the second comparator MaxlevelGreaterThan=Max level greater than the one requested diff --git a/htdocs/user/list.php b/htdocs/user/list.php index d3139b438e2..a269a93fb7b 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -131,6 +131,7 @@ $arrayfields = array( 'u.email'=>array('label'=>"EMail", 'checked'=>1, 'position'=>35), 'u.api_key'=>array('label'=>"ApiKey", 'checked'=>0, 'position'=>40, "enabled"=>(!empty($conf->api->enabled) && $user->admin)), 'u.fk_soc'=>array('label'=>"Company", 'checked'=>($contextpage == 'employeelist' ? 0 : 1), 'position'=>45), + 'u.job'=>array('label'=>"PostOrFunction", 'checked'=>-1, 'position'=>50), 'u.salary'=>array('label'=>"Salary", 'checked'=>1, 'position'=>80, 'enabled'=>(!empty($conf->salaries->enabled) && $user->hasRight("salaries", "readall"))), 'u.datelastlogin'=>array('label'=>"LastConnexion", 'checked'=>1, 'position'=>100), 'u.datepreviouslogin'=>array('label'=>"PreviousConnexion", 'checked'=>0, 'position'=>110), @@ -159,6 +160,7 @@ $search_email = GETPOST('search_email', 'alpha'); $search_api_key = GETPOST('search_api_key', 'alphanohtml'); $search_statut = GETPOST('search_statut', 'intcomma'); $search_thirdparty = GETPOST('search_thirdparty', 'alpha'); +$search_job = GETPOST('search_job', 'alpha'); $search_warehouse = GETPOST('search_warehouse', 'alpha'); $search_supervisor = GETPOST('search_supervisor', 'intcomma'); $search_categ = GETPOST("search_categ", 'int'); @@ -250,6 +252,7 @@ if (empty($reshook)) { $search_email = ""; $search_statut = ""; $search_thirdparty = ""; + $search_job = ""; $search_warehouse = ""; $search_supervisor = ""; $search_api_key = ""; @@ -357,7 +360,7 @@ $morehtmlright = ""; // Build and execute select // -------------------------------------------------------------------- $sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.office_phone, u.user_mobile, u.email, u.api_key, u.accountancy_code, u.gender, u.employee, u.photo,"; -$sql .= " u.salary, u.datelastlogin, u.datepreviouslogin,"; +$sql .= " u.job, u.salary, u.datelastlogin, u.datepreviouslogin,"; $sql .= " u.ldap_sid, u.statut as status, u.entity,"; $sql .= " u.tms as date_update, u.datec as date_creation,"; $sql .= " u2.rowid as id2, u2.login as login2, u2.firstname as firstname2, u2.lastname as lastname2, u2.admin as admin2, u2.fk_soc as fk_soc2, u2.office_phone as ofice_phone2, u2.user_mobile as user_mobile2, u2.email as email2, u2.gender as gender2, u2.photo as photo2, u2.entity as entity2, u2.statut as status2,"; @@ -433,6 +436,9 @@ if ($search_email != '') { if ($search_api_key != '') { $sql .= natural_search("u.api_key", $search_api_key); } +if ($search_job != '') { + $sql .= natural_search(array('u.job'), $search_job); +} if ($search_statut != '' && $search_statut >= 0) { $sql .= " AND u.statut IN (".$db->sanitize($search_statut).")"; } @@ -772,6 +778,9 @@ if (!empty($arrayfields['u.fk_soc']['checked'])) { if (!empty($arrayfields['u.entity']['checked'])) { print ''; } +if (!empty($arrayfields['u.job']['checked'])) { + print ''; +} if (!empty($arrayfields['u.salary']['checked'])) { print ''; } @@ -823,7 +832,7 @@ if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { $totalarray['nbfield']++; } if (!empty($arrayfields['u.login']['checked'])) { - print_liste_field_titre("Login", $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder); + print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder); $totalarray['nbfield']++; } if (!empty($arrayfields['u.lastname']['checked'])) { @@ -871,7 +880,11 @@ if (!empty($arrayfields['u.fk_soc']['checked'])) { $totalarray['nbfield']++; } if (!empty($arrayfields['u.entity']['checked'])) { - print_liste_field_titre("Entity", $_SERVER['PHP_SELF'], "u.entity", $param, "", "", $sortfield, $sortorder); + print_liste_field_titre($arrayfields['u.entity']['label'], $_SERVER['PHP_SELF'], "u.entity", $param, "", "", $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['u.job']['checked'])) { + print_liste_field_titre($arrayfields['u.job']['label'], $_SERVER['PHP_SELF'], "u.job", $param, "", "", $sortfield, $sortorder); $totalarray['nbfield']++; } if (!empty($arrayfields['u.salary']['checked'])) { @@ -948,6 +961,7 @@ while ($i < $imaxinloop) { $object->status = $obj->status; $object->office_phone = $obj->office_phone; $object->user_mobile = $obj->user_mobile; + $object->job = $obj->job; $object->email = $obj->email; $object->gender = $obj->gender; $object->socid = $obj->fk_soc; @@ -1160,6 +1174,16 @@ while ($i < $imaxinloop) { } } + // Job position + if (!empty($arrayfields['u.job']['checked'])) { + print ''; + print dol_escape_htmltag($obj->job); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Salary if (!empty($arrayfields['u.salary']['checked'])) { print ''; From 1b3b7c93297118d84f23dd86b99401f8daf43c42 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 12:34:21 +0100 Subject: [PATCH 057/108] Fix default values --- htdocs/admin/defaultvalues.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 6903571d394..4baddd8b29b 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -147,12 +147,12 @@ if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('ac $object->value=$defaultvalue; $object->entity=$conf->entity; $result=$object->create($user); - if ($result<0) { + if ($result < 0) { $action = ''; setEventMessages($object->error, $object->errors, 'errors'); } else { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - $action = ""; + $action = ''; $defaulturl = ''; $defaultkey = ''; $defaultvalue = ''; @@ -324,16 +324,16 @@ print "\n"; print ''; // Page print ''; -print ''; +print ''; print ''."\n"; // Field print ''; -print ''; +print ''; print ''; // Value if ($mode != 'focus' && $mode != 'mandatory') { print ''; - print ''; + print ''; print ''; } // Limit to superadmin From c02113de6a36601ee26af2bc9390da006bd018db Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 13:04:23 +0100 Subject: [PATCH 058/108] Debug v17 --- htdocs/hrm/evaluation_agenda.php | 28 +++++++++------ htdocs/hrm/evaluation_card.php | 2 +- htdocs/hrm/evaluation_contact.php | 2 +- htdocs/hrm/evaluation_document.php | 2 +- htdocs/hrm/evaluation_note.php | 2 +- htdocs/langs/en_US/hrm.lang | 2 +- .../template/myobject_agenda.php | 15 +++++--- htdocs/societe/agenda.php | 35 +++++++++++-------- 8 files changed, 52 insertions(+), 36 deletions(-) diff --git a/htdocs/hrm/evaluation_agenda.php b/htdocs/hrm/evaluation_agenda.php index 31607e01b28..28f4e33e4d4 100644 --- a/htdocs/hrm/evaluation_agenda.php +++ b/htdocs/hrm/evaluation_agenda.php @@ -96,8 +96,10 @@ $permissiontoread = $user->rights->hrm->evaluation->read; // Used by the include //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); -//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->hrm->enabled)) accessforbidden(); +//restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, 'fk_soc', 'rowid', $isdraft); +if (!isModEnabled('hrm')) { + accessforbidden(); +} if (!$permissiontoread) accessforbidden(); @@ -155,7 +157,7 @@ if ($object->id > 0) { $morehtmlref .= $langs->trans('Label').' : '.$object->label; $u_position = new User(($db)); $u_position->fetch($object->fk_user); - $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $morehtmlref .= '
'.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); @@ -196,21 +198,25 @@ if ($object->id > 0) { //$out.=""; } + $morehtmlright = ''; - print '
'; + //$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id; + //$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); + //$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; + //$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); if (isModEnabled('agenda')) { if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { - print ''.$langs->trans("AddAction").''; + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } else { - print ''.$langs->trans("AddAction").''; + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0); } } - print '
'; - if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { - $param = '&id='.$object->id.'&socid='.(!empty($socid) ? '&socid='.$socid : ''); + print '
'; + + $param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : ''); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } @@ -218,8 +224,8 @@ if ($object->id > 0) { $param .= '&limit='.urlencode($limit); } - - //print load_fiche_titre($langs->trans("ActionsOnEvaluation"), '', ''); + //print load_fiche_titre($langs->trans("ActionsOnMyObject"), '', ''); + print_barre_liste($langs->trans("Actions"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); // List of all actions $filters = array(); diff --git a/htdocs/hrm/evaluation_card.php b/htdocs/hrm/evaluation_card.php index 8f513d654f3..e59ba7db462 100644 --- a/htdocs/hrm/evaluation_card.php +++ b/htdocs/hrm/evaluation_card.php @@ -407,7 +407,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtmlref .= $langs->trans('Label').' : '.$object->label; $u_position = new User(($db)); $u_position->fetch($object->fk_user); - $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $morehtmlref .= '
'.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); diff --git a/htdocs/hrm/evaluation_contact.php b/htdocs/hrm/evaluation_contact.php index c96f562afc7..ff41c152080 100644 --- a/htdocs/hrm/evaluation_contact.php +++ b/htdocs/hrm/evaluation_contact.php @@ -142,7 +142,7 @@ if ($object->id) { $morehtmlref .= $langs->trans('Label').' : '.$object->label; $u_position = new User(($db)); $u_position->fetch($object->fk_user); - $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $morehtmlref .= '
'.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); diff --git a/htdocs/hrm/evaluation_document.php b/htdocs/hrm/evaluation_document.php index 7935ea7602c..a707913c3c3 100644 --- a/htdocs/hrm/evaluation_document.php +++ b/htdocs/hrm/evaluation_document.php @@ -135,7 +135,7 @@ if ($object->id) { $morehtmlref .= $langs->trans('Label').' : '.$object->label; $u_position = new User(($db)); $u_position->fetch($object->fk_user); - $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $morehtmlref .= '
'.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); diff --git a/htdocs/hrm/evaluation_note.php b/htdocs/hrm/evaluation_note.php index 1164a9642b1..ba0ec02d616 100644 --- a/htdocs/hrm/evaluation_note.php +++ b/htdocs/hrm/evaluation_note.php @@ -110,7 +110,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $langs->trans('Label').' : '.$object->label; $u_position = new User(($db)); $u_position->fetch($object->fk_user); - $morehtmlref .= '
'.$langs->trans('Employee').' : '.$u_position->getNomUrl(1); + $morehtmlref .= '
'.$u_position->getNomUrl(1); $job = new Job($db); $job->fetch($object->fk_job); $morehtmlref .= '
'.$langs->trans('JobProfile').' : '.$job->getNomUrl(1); diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index 475e11131f4..b31df5ee605 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -46,7 +46,7 @@ NewEval=New evaluation ValidateEvaluation=Validate evaluation ConfirmValidateEvaluation=Are you sure you want to validate this evaluation with reference %s? EvaluationCard=Evaluation card -RequiredRank=Required rank for this job +RequiredRank=Required rank for the job profile EmployeeRank=Employee rank for this skill EmployeePosition=Employee position EmployeePositions=Employee positions diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index d7b84707b95..5cdcc27eade 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -276,20 +276,25 @@ if ($object->id > 0) { //$out.=""; } + $morehtmlright = ''; - print '
'; + //$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id; + //$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); + //$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; + //$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); if (isModEnabled('agenda')) { if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { - print ''.$langs->trans("AddAction").''; + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); } else { - print ''.$langs->trans("AddAction").''; + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0); } } - print '
'; if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + print '
'; + $param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : ''); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); @@ -298,8 +303,8 @@ if ($object->id > 0) { $param .= '&limit='.urlencode($limit); } - //print load_fiche_titre($langs->trans("ActionsOnMyObject"), '', ''); + print_barre_liste($langs->trans("ActionsOnMyObject"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); // List of all actions $filters = array(); diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 9e6c10a0ccd..b5d01422782 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -32,6 +32,8 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; // Load translation files required by the page $langs->loadLangs(array('agenda', 'bills', 'companies', 'orders', 'propal')); @@ -48,13 +50,6 @@ if (GETPOST('actioncode', 'array')) { $search_agenda_label = GETPOST('search_agenda_label'); -// Security check -$socid = GETPOST('socid', 'int'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'societe', $socid, '&societe'); - $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); @@ -72,9 +67,19 @@ if (!$sortorder) { $sortorder = 'DESC,DESC'; } +// Initialize technical objects +$object = new Societe($db); + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('agendathirdparty')); +// Security check +$socid = GETPOST('socid', 'int'); +if ($user->socid) { + $socid = $user->socid; +} +$result = restrictedArea($user, 'societe', $socid, '&societe'); + /* * Actions @@ -109,28 +114,28 @@ if (empty($reshook)) { $form = new Form($db); if ($socid > 0) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - - $object = new Societe($db); $result = $object->fetch($socid); $title = $langs->trans("Agenda"); if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { $title = $object->name." - ".$title; } - llxHeader('', $title); + $help_url = ''; + llxHeader('', $title, $help_url); if (isModEnabled('notification')) { $langs->load("mails"); } $head = societe_prepare_head($object); - print dol_get_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, 'company'); + + print dol_get_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, $object->picto); $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); + $morehtmlref = ''; + + dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom', $morehtmlref); print '
'; @@ -202,7 +207,7 @@ if ($socid > 0) { $filters['search_agenda_label'] = $search_agenda_label; // TODO Replace this with same code than into list.php - show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); + show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module); } } From 216c4f02b6378b64bd5e9f3753ac65d002d08c2b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 13:53:56 +0100 Subject: [PATCH 059/108] Fix bad test --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index f476c9bafed..de331c7c3d4 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -177,7 +177,7 @@ function testSqlAndScriptInject($val, $type) // We refuse html into html because some hacks try to obfuscate evil strings by inserting HTML into HTML. Example: error=alert(1) to bypass test on onerror $tmpval = preg_replace('/<[^<]+>/', '', $val); // List of dom events is on https://www.w3schools.com/jsref/dom_obj_event.asp and https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers - $inj += preg_match('/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $val); // onmousexxx can be set on img or any html tag like + $inj += preg_match('/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $tmpval); // onmousexxx can be set on img or any html tag like $inj += preg_match('/on(abort|afterprint|animation|auxclick|beforecopy|beforecut|beforeprint|beforeunload|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)\s*=/i', $tmpval); $inj += preg_match('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)\s*=/i', $tmpval); $inj += preg_match('/on(lostpointercapture|offline|online|pagehide|pageshow)\s*=/i', $tmpval); From d0858d8eaaa434a708d538ddef71299907b65e0a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 14:55:46 +0100 Subject: [PATCH 060/108] Debug v17 --- htdocs/core/lib/website2.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 05727a1e539..aa6d4fbec21 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -730,6 +730,7 @@ function checkPHPCode($phpfullcodestringold, $phpfullcodestring) if (!$error) { $dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT); $allowimportsite = true; + include DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) { $allowimportsite = false; } From 9e79e00f10c18b75d27dac4739041ac30e5ab1dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 15:19:49 +0100 Subject: [PATCH 061/108] Debug v17 --- htdocs/core/lib/website2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index aa6d4fbec21..e03f711c9c0 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -730,7 +730,7 @@ function checkPHPCode($phpfullcodestringold, $phpfullcodestring) if (!$error) { $dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT); $allowimportsite = true; - include DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) { $allowimportsite = false; } From 9bf878a635dab70742f2b7e8332b46c9b10f5d86 Mon Sep 17 00:00:00 2001 From: FLIO Date: Sat, 11 Feb 2023 19:23:32 +0100 Subject: [PATCH 062/108] fix (qodana) delete the edit of the fuction post in the fileupload and edit the comment --- htdocs/core/class/fileupload.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 84ff0a9ed33..75662d57f94 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -484,12 +484,12 @@ class FileUpload /** * Output data * - * @return void + * @return string|void */ public function post() { if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') { - echo $this->delete(); + return $this->delete(); } $upload = isset($_FILES[$this->options['param_name']]) ? $_FILES[$this->options['param_name']] : null; @@ -556,7 +556,6 @@ class FileUpload } } header('Content-type: application/json'); - $response = json_encode($success); - return $response; + echo json_encode($success); } } From 67d8c74a609a61aaa58916b8e65c8a206e633f71 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 11 Feb 2023 21:23:40 +0100 Subject: [PATCH 063/108] fix : Warning: Undefined array key price_min_ttc in /home/httpd/vhosts/aflac.fr/domains/dev.aflac.fr/httpdocs/compta/facture/card.php on line 2157 --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a9d9e040ec8..7af0f7046f9 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2154,7 +2154,7 @@ if (empty($reshook)) { $pu_ht = $datapriceofproduct['pu_ht']; $pu_ttc = $datapriceofproduct['pu_ttc']; $price_min = $datapriceofproduct['price_min']; - $price_min_ttc = $datapriceofproduct['price_min_ttc']; + $price_min_ttc = (isset($datapriceofproduct['price_min_ttc'])) ? $datapriceofproduct['price_min_ttc'] : null; $price_base_type = $datapriceofproduct['price_base_type']; $tva_tx = $datapriceofproduct['tva_tx']; From 92c4eed7c68eb6322e5ce294688b0f3f6340f718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 11 Feb 2023 21:34:21 +0100 Subject: [PATCH 064/108] add ajax tooltip on knowledge record --- htdocs/core/ajax/ajaxtooltip.php | 4 ++ .../class/knowledgerecord.class.php | 59 +++++++++++++++---- 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index 60220a221ff..3933f03533b 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -163,6 +163,10 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') { $classpath = 'opensurvey/class'; $module = 'opensurvey'; $myobject = 'opensurveysondage'; +} elseif ($objecttype == 'knowledgerecord') { + $classpath = 'knowledgemanagement/class'; + $module = 'knowledgemanagement'; + $myobject = 'knowledgerecord'; } // Generic case for $classfile and $classname diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 3f9f1b40223..d5cd5a82a51 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -129,7 +129,15 @@ class KnowledgeRecord extends CommonObject public $fk_user_valid; public $import_key; public $model_pdf; + + /** + * @var string question asked + */ public $question; + + /** + * @var string answer to question + */ public $answer; public $url; public $status; @@ -265,8 +273,8 @@ class KnowledgeRecord extends CommonObject if (property_exists($object, 'ref')) { $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default']; } - if (property_exists($object, 'label')) { - $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; + if (property_exists($object, 'question')) { + $object->question = empty($this->fields['question']['default']) ? $langs->trans("CopyOf")." ".$object->question : $this->fields['question']['default']; } if (property_exists($object, 'status')) { $object->status = self::STATUS_DRAFT; @@ -706,6 +714,32 @@ class KnowledgeRecord extends CommonObject return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'KNOWLEDGERECORD_REOPEN'); } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs; + + $langs->loadLangs(['knowledgemanagement', 'languages']); + + $datas = []; + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("KnowledgeRecord").''; + if (isset($this->statut)) { + $datas['picto'] .= ' '.$this->getLibStatut(5); + } + $datas['label'] = '
'.$langs->trans('Ref').': '.$this->ref; + $datas['question'] = '
'.$langs->trans('Question').': '.$this->question; + $labellang = ($this->lang ? $langs->trans('Language_'.$this->lang) : ''); + $datas['lang'] = '
'.$langs->trans('Language').': ' . picto_from_langcode($this->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang; + + return $datas; + } + /** * Return a link to the object card (with optionaly the picto) * @@ -726,12 +760,17 @@ class KnowledgeRecord extends CommonObject $result = ''; - $label = img_picto('', $this->picto).' '.$langs->trans("KnowledgeRecord").''; - if (isset($this->status)) { - $label .= ' '.$this->getLibStatut(5); + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); } - $label .= '
'; - $label .= ''.$langs->trans('Ref').': '.$this->ref; + $label = implode($this->getTooltipContentArray($params)); $url = dol_buildpath('/knowledgemanagement/knowledgerecord_card.php', 1).'?id='.$this->id; @@ -752,8 +791,8 @@ class KnowledgeRecord extends CommonObject $label = $langs->trans("ShowKnowledgeRecord"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); } @@ -774,7 +813,7 @@ class KnowledgeRecord extends CommonObject if (empty($this->showphoto_on_popup)) { if ($withpicto) { - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); } } else { if ($withpicto) { From 00898291ed9f23fd3d0fa7fe6bc29f7d0abc0fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 11 Feb 2023 21:49:06 +0100 Subject: [PATCH 065/108] add ajax tooltip on knowledge record --- .../knowledgemanagement/class/knowledgerecord.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index d5cd5a82a51..0d233f37af6 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -735,7 +735,13 @@ class KnowledgeRecord extends CommonObject $datas['label'] = '
'.$langs->trans('Ref').': '.$this->ref; $datas['question'] = '
'.$langs->trans('Question').': '.$this->question; $labellang = ($this->lang ? $langs->trans('Language_'.$this->lang) : ''); - $datas['lang'] = '
'.$langs->trans('Language').': ' . picto_from_langcode($this->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang; + $datas['lang'] = '
'.$langs->trans('Language').': ' . picto_from_langcode($this->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang; + // show categories for this record + if (isModEnabled('categorie')) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $form = new Form($this->db); + $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_KNOWLEDGEMANAGEMENT, 1); + } return $datas; } From f50a43c8822ee1c28da21a12ab88ef3c9bfd7ebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 11 Feb 2023 21:58:57 +0100 Subject: [PATCH 066/108] add ajax tooltip on knowledge record --- htdocs/knowledgemanagement/class/knowledgerecord.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 0d233f37af6..77493590d9d 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -728,6 +728,7 @@ class KnowledgeRecord extends CommonObject $langs->loadLangs(['knowledgemanagement', 'languages']); $datas = []; + $nofetch = empty($params['nofetch']) ? false : true; $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("KnowledgeRecord").''; if (isset($this->statut)) { $datas['picto'] .= ' '.$this->getLibStatut(5); @@ -736,8 +737,8 @@ class KnowledgeRecord extends CommonObject $datas['question'] = '
'.$langs->trans('Question').': '.$this->question; $labellang = ($this->lang ? $langs->trans('Language_'.$this->lang) : ''); $datas['lang'] = '
'.$langs->trans('Language').': ' . picto_from_langcode($this->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang; - // show categories for this record - if (isModEnabled('categorie')) { + // show categories for this record only in ajax to not overload lists + if (isModEnabled('categorie') && !$nofetch) { require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $form = new Form($this->db); $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_KNOWLEDGEMANAGEMENT, 1); @@ -769,6 +770,8 @@ class KnowledgeRecord extends CommonObject $params = [ 'id' => $this->id, 'objecttype' => $this->element, + 'option' => $option, + 'nofetch' => 1, ]; $classfortooltip = 'classfortooltip'; $dataparams = ''; From beba616f3c90574aa959cd05f87b9d23d993acf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 11 Feb 2023 22:13:15 +0100 Subject: [PATCH 067/108] clean code --- htdocs/api/class/api_documents.class.php | 2 +- htdocs/categories/class/api_categories.class.php | 2 +- .../modules/modKnowledgeManagement.class.php | 4 ++-- .../class/api_knowledgemanagement.class.php | 10 +++++----- .../class/knowledgerecord.class.php | 4 ++-- .../knowledgerecord_agenda.php | 2 +- .../knowledgemanagement/knowledgerecord_card.php | 16 ++++++++-------- .../knowledgerecord_contact.php | 2 +- .../knowledgerecord_document.php | 6 +++--- .../knowledgemanagement/knowledgerecord_list.php | 8 ++++---- .../knowledgemanagement/knowledgerecord_note.php | 4 ++-- htdocs/ticket/index.php | 2 +- 12 files changed, 31 insertions(+), 31 deletions(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index d4f252bfd43..8dae305a989 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -461,7 +461,7 @@ class Documents extends DolibarrApi } elseif ($modulepart == 'knowledgemanagement') { require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; - if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read && !DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) { + if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read') && !DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { throw new RestException(401); } diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index e59ff070aec..2de1f43d071 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -323,7 +323,7 @@ class Categories extends DolibarrApi throw new RestException(401); } elseif ($type == Categorie::TYPE_PROJECT && !DolibarrApiAccess::$user->rights->projet->lire) { throw new RestException(401); - } elseif ($type == Categorie::TYPE_KNOWLEDGEMANAGEMENT && !DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) { + } elseif ($type == Categorie::TYPE_KNOWLEDGEMANAGEMENT && !DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { throw new RestException(401); } diff --git a/htdocs/core/modules/modKnowledgeManagement.class.php b/htdocs/core/modules/modKnowledgeManagement.class.php index b331c56a917..68754f530b3 100644 --- a/htdocs/core/modules/modKnowledgeManagement.class.php +++ b/htdocs/core/modules/modKnowledgeManagement.class.php @@ -271,7 +271,7 @@ class modKnowledgeManagement extends DolibarrModules 'langs'=>'knowledgemanagement', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position'=>1000 + $r, 'enabled'=>'$conf->knowledgemanagement->enabled', // Define condition to show or hide menu entry. Use '$conf->knowledgemanagement->enabled' if entry must be visible if module is enabled. - 'perms'=>'1', // Use 'perms'=>'$user->rights->knowledgemanagement->knowledgerecord->read' if you want your menu with a permission rules + 'perms'=>'1', // Use 'perms'=>'$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')' if you want your menu with a permission rules 'target'=>'', 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both ); @@ -334,7 +334,7 @@ class modKnowledgeManagement extends DolibarrModules // Define condition to show or hide menu entry. Use '$conf->knowledgemanagement->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'enabled'=>'$conf->knowledgemanagement->enabled', // Use 'perms'=>'$user->rights->knowledgemanagement->level1->level2' if you want your menu with a permission rules - 'perms'=>'$user->rights->knowledgemanagement->knowledgerecord->write', + 'perms'=>'$user->hasRight("knowledgemanagement", "knowledgerecord", "write")', 'target'=>'', // 0=Menu for internal users, 1=external users, 2=both 'user'=>2 diff --git a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php index 8232287b23b..0806514b968 100644 --- a/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php +++ b/htdocs/knowledgemanagement/class/api_knowledgemanagement.class.php @@ -70,7 +70,7 @@ class KnowledgeManagement extends DolibarrApi */ public function get($id) { - if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) { + if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { throw new RestException(401); } @@ -144,7 +144,7 @@ class KnowledgeManagement extends DolibarrApi $obj_ret = array(); $tmpobject = new KnowledgeRecord($this->db); - if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) { + if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { throw new RestException(401); } @@ -249,7 +249,7 @@ class KnowledgeManagement extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->write) { + if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'write')) { throw new RestException(401); } @@ -282,7 +282,7 @@ class KnowledgeManagement extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->write) { + if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'write')) { throw new RestException(401); } @@ -324,7 +324,7 @@ class KnowledgeManagement extends DolibarrApi */ public function delete($id) { - if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->delete) { + if (!DolibarrApiAccess::$user->hasRight('knowledgemanagement', 'knowledgerecord', 'delete')) { throw new RestException(401); } $result = $this->knowledgerecord->fetch($id); diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 77493590d9d..f85b2f8e9cf 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -200,7 +200,7 @@ class KnowledgeRecord extends CommonObject } // Example to show how to set values of fields definition dynamically - /*if ($user->rights->knowledgemanagement->knowledgerecord->read) { + /*if ($user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { $this->fields['myfield']['visible'] = 1; $this->fields['myfield']['noteditable'] = 0; }*/ @@ -538,7 +538,7 @@ class KnowledgeRecord extends CommonObject return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->knowledgemanagement->knowledgerecord->write)) + /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->knowledgemanagement->knowledgerecord->knowledgerecord_advance->validate)))) { $this->error='NotEnoughPermissions'; diff --git a/htdocs/knowledgemanagement/knowledgerecord_agenda.php b/htdocs/knowledgemanagement/knowledgerecord_agenda.php index e24e23b14e7..6cf8428d06b 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_agenda.php +++ b/htdocs/knowledgemanagement/knowledgerecord_agenda.php @@ -90,7 +90,7 @@ if ($id > 0 || !empty($ref)) { $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft); -$permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_addupdatedelete.inc.php +$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php /* diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index 52143048f72..495b095fb4d 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -74,12 +74,12 @@ if (empty($action) && empty($id) && empty($ref)) { include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. -$permissiontoread = $user->rights->knowledgemanagement->knowledgerecord->read; -$permissiontovalidate = $user->rights->knowledgemanagement->knowledgerecord->write; -$permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->rights->knowledgemanagement->knowledgerecord->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); -$permissionnote = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_dellink.inc.php +$permissiontoread = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read'); +$permissiontovalidate = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); +$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); +$permissionnote = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_dellink.inc.php $upload_dir = $conf->knowledgemanagement->multidir_output[isset($object->entity) ? $object->entity : 1]; // Security check - Protection if external user @@ -538,8 +538,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $relativepath = $objref.'/'.$objref.'.pdf'; $filedir = $conf->knowledgemanagement->dir_output.'/'.$object->element.'/'.$objref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->knowledgemanagement->knowledgerecord->read; // If you can read, you can build the PDF to read content - $delallowed = $user->rights->knowledgemanagement->knowledgerecord->write; // If you can create/edit, you can remove a file on card + $genallowed = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read'); // If you can read, you can build the PDF to read content + $delallowed = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // If you can create/edit, you can remove a file on card print $formfile->showdocuments('knowledgemanagement:KnowledgeRecord', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); } diff --git a/htdocs/knowledgemanagement/knowledgerecord_contact.php b/htdocs/knowledgemanagement/knowledgerecord_contact.php index 4e557a3e1ae..751cdff5c9e 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_contact.php +++ b/htdocs/knowledgemanagement/knowledgerecord_contact.php @@ -56,7 +56,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft); -$permission = $user->rights->knowledgemanagement->knowledgerecord->write; +$permission = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); /* diff --git a/htdocs/knowledgemanagement/knowledgerecord_document.php b/htdocs/knowledgemanagement/knowledgerecord_document.php index 7430de8a495..8d8fe6ac769 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_document.php +++ b/htdocs/knowledgemanagement/knowledgerecord_document.php @@ -81,7 +81,7 @@ if ($id > 0 || !empty($ref)) { $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->module, $object->id, $object->table_element, $object->element, '', 'rowid', $isdraft); -$permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php +$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php @@ -183,9 +183,9 @@ if ($object->id) { print dol_get_fiche_end(); $modulepart = 'knowledgemanagement'; - //$permission = $user->rights->knowledgemanagement->knowledgerecord->write; + //$permission = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); $permission = 1; - //$permtoedit = $user->rights->knowledgemanagement->knowledgerecord->write; + //$permtoedit = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); $permtoedit = 1; $param = '&id='.$object->id; diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index 7cd5a24c764..3a916cb96ef 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -140,9 +140,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -$permissiontoread = $user->rights->knowledgemanagement->knowledgerecord->read; -$permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write; -$permissiontodelete = $user->rights->knowledgemanagement->knowledgerecord->delete; +$permissiontoread = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read'); +$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); +$permissiontodelete = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'delete'); // Security check if (empty($conf->knowledgemanagement->enabled)) { @@ -428,7 +428,7 @@ if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } -if (isModEnabled('category') && $user->rights->knowledgemanagement->knowledgerecord->write) { +if (isModEnabled('category') && $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write')) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } diff --git a/htdocs/knowledgemanagement/knowledgerecord_note.php b/htdocs/knowledgemanagement/knowledgerecord_note.php index 28a2bcaa9d0..ea1052ccc98 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_note.php +++ b/htdocs/knowledgemanagement/knowledgerecord_note.php @@ -52,8 +52,8 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->knowledgemanagement->multidir_output[$object->entity]."/".$object->id; } -$permissionnote = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_setnotes.inc.php -$permissiontoadd = $user->rights->knowledgemanagement->knowledgerecord->write; // Used by the include of actions_addupdatedelete.inc.php +$permissionnote = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_setnotes.inc.php +$permissiontoadd = $user->hasRight('knowledgemanagement', 'knowledgerecord', 'write'); // Used by the include of actions_addupdatedelete.inc.php // Security check - Protection if external user //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index 243084ec89f..f75a93f7082 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -65,7 +65,7 @@ $object = new Ticket($db); // Security check //$result = restrictedArea($user, 'ticket|knowledgemanagement', 0, '', '', '', ''); -if (empty($user->rights->ticket->read) && empty($user->rights->knowledgemanagement->knowledgerecord->read)) { +if (empty($user->rights->ticket->read) && !$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { accessforbidden('Not enought permissions'); } From 6144b6e99d973c2c1bb289258c79856470a8eaec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 09:54:57 +0100 Subject: [PATCH 068/108] add two widgets --- .../core/boxes/box_last_knowledgerecord.php | 187 ++++++++++++++++++ .../box_last_modified_knowledgerecord.php | 187 ++++++++++++++++++ .../modules/modKnowledgeManagement.class.php | 14 +- htdocs/langs/en_US/knowledgemanagement.lang | 8 +- 4 files changed, 389 insertions(+), 7 deletions(-) create mode 100644 htdocs/core/boxes/box_last_knowledgerecord.php create mode 100644 htdocs/core/boxes/box_last_modified_knowledgerecord.php diff --git a/htdocs/core/boxes/box_last_knowledgerecord.php b/htdocs/core/boxes/box_last_knowledgerecord.php new file mode 100644 index 00000000000..20510a5b3b0 --- /dev/null +++ b/htdocs/core/boxes/box_last_knowledgerecord.php @@ -0,0 +1,187 @@ + + * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2018-2023 Frédéric France + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/boxes/box_last_knowledgerecord.php + * \ingroup knowledgerecord + * \brief This box shows latest created knowledgerecords + */ +require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; + +/** + * Class to manage the box + */ +class box_last_knowledgerecord extends ModeleBoxes +{ + + public $boxcode = "box_last_knowledgerecord"; + public $boximg = "knowledgemanagement"; + public $boxlabel; + public $depends = array("knowledgemanagement"); + + /** + * @var DoliDB Database handler. + */ + public $db; + + public $param; + public $info_box_head = array(); + public $info_box_contents = array(); + + /** + * Constructor + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + public function __construct($db, $param = '') + { + global $langs; + $langs->load("boxes", "languages"); + $this->db = $db; + + $this->boxlabel = $langs->transnoentitiesnoconv("BoxLastKnowledgerecord"); + } + + /** + * Load data into info_box_contents array to show array later. + * + * @param int $max Maximum number of records to load + * @return void + */ + public function loadBox($max = 5) + { + global $conf, $user, $langs; + + $this->max = $max; + + require_once DOL_DOCUMENT_ROOT."/knowledgemanagement/class/knowledgerecord.class.php"; + + $text = $langs->trans("BoxLastKnowledgerecordDescription", $max); + $this->info_box_head = array( + 'text' => $text, + 'limit' => dol_strlen($text), + ); + + $this->info_box_contents[0][0] = array( + 'td' => 'class="left"', + 'text' => $langs->trans("BoxLastKnowledgerecordContent"), + ); + + if ($user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { + $sql = 'SELECT k.rowid as id, k.date_creation, k.ref, k.lang, k.question, k.status as status'; + $sql .= " FROM ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as k"; + $sql .= " WHERE k.entity IN (".getEntity('knowledgemanagement').")"; + + if ($user->socid) { + $sql .= " AND k.fk_soc= ".((int) $user->socid); + } + + $sql.= " AND k.status > 0"; + + $sql .= " ORDER BY k.date_creation DESC, k.rowid DESC "; + $sql .= $this->db->plimit($max, 0); + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + + $i = 0; + + while ($i < $num) { + $objp = $this->db->fetch_object($resql); + + $datec = $this->db->jdate($objp->date_creation); + + $knowledgerecord = new KnowledgeRecord($this->db); + $knowledgerecord->id = $objp->id; + $knowledgerecord->date_creation = $objp->date_creation; + $knowledgerecord->ref = $objp->ref; + $knowledgerecord->status = $objp->status; + $knowledgerecord->question = $objp->question; + + $r = 0; + + // Ticket + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="nowraponall"', + 'text' => $knowledgerecord->getNomUrl(1), + 'asis' => 1 + ); + $r++; + + // Question + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="tdoverflowmax200"', + 'text' => ''.dol_escape_htmltag($objp->question).'', + 'url' => DOL_URL_ROOT."/knowledgemanagement/knowledgerecord_card.php?id=".urlencode($objp->id), + ); + $r++; + + // Language + $labellang = ($objp->lang ? $langs->trans('Language_'.$objp->lang) : ''); + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="tdoverflowmax100"', + 'text' => picto_from_langcode($objp->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang, + 'asis' => 1, + ); + $r++; + + // Date creation + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateCreation").': '.dol_print_date($datec, 'dayhour', 'tzuserrel')).'"', + 'text' => dol_print_date($objp->datec, 'dayhour', 'tzuserrel'), + ); + $r++; + + // Statut + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="right nowraponall"', + 'text' => $knowledgerecord->getLibStatut(3), + ); + $r++; + + $i++; + } + + if ($num == 0) { + $this->info_box_contents[$i][0] = array('td' => '', 'text' => ''.$langs->trans("BoxLastTicketNoRecordedTickets").''); + } + } else { + dol_print_error($this->db); + } + } else { + $this->info_box_contents[0][0] = array('td' => '', + 'text' => ''.$langs->trans("ReadPermissionNotAllowed").''); + } + } + + /** + * Method to show box + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string + * @return string + */ + public function showBox($head = null, $contents = null, $nooutput = 0) + { + return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); + } +} diff --git a/htdocs/core/boxes/box_last_modified_knowledgerecord.php b/htdocs/core/boxes/box_last_modified_knowledgerecord.php new file mode 100644 index 00000000000..5e23ee54602 --- /dev/null +++ b/htdocs/core/boxes/box_last_modified_knowledgerecord.php @@ -0,0 +1,187 @@ + + * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2018-2023 Frédéric France + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/boxes/box_last_modified_knowledgerecord.php + * \ingroup knowledgerecord + * \brief This box shows latest created knowledgerecords + */ +require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; + +/** + * Class to manage the box + */ +class box_last_modified_knowledgerecord extends ModeleBoxes +{ + + public $boxcode = "box_last_modified_knowledgerecord"; + public $boximg = "knowledgemanagement"; + public $boxlabel; + public $depends = array("knowledgemanagement"); + + /** + * @var DoliDB Database handler. + */ + public $db; + + public $param; + public $info_box_head = array(); + public $info_box_contents = array(); + + /** + * Constructor + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + public function __construct($db, $param = '') + { + global $langs; + $langs->load("boxes", "knowledgemanagement", "languages"); + $this->db = $db; + + $this->boxlabel = $langs->transnoentitiesnoconv("BoxLastModifiedKnowledgerecord"); + } + + /** + * Load data into info_box_contents array to show array later. + * + * @param int $max Maximum number of records to load + * @return void + */ + public function loadBox($max = 5) + { + global $conf, $user, $langs; + + $this->max = $max; + + require_once DOL_DOCUMENT_ROOT."/knowledgemanagement/class/knowledgerecord.class.php"; + + $text = $langs->trans("BoxLastModifiedKnowledgerecordDescription", $max); + $this->info_box_head = array( + 'text' => $text, + 'limit' => dol_strlen($text), + ); + + $this->info_box_contents[0][0] = array( + 'td' => 'class="left"', + 'text' => $langs->trans("BoxLastKnowledgerecordContent"), + ); + + if ($user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { + $sql = 'SELECT k.rowid as id, k.date_creation, k.ref, k.lang, k.question, k.status as status'; + $sql .= " FROM ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as k"; + $sql .= " WHERE k.entity IN (".getEntity('knowledgemanagement').")"; + + if ($user->socid) { + $sql .= " AND k.fk_soc= ".((int) $user->socid); + } + + $sql.= " AND k.status > 0"; + + $sql .= " ORDER BY k.tms DESC, k.rowid DESC "; + $sql .= $this->db->plimit($max, 0); + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + + $i = 0; + + while ($i < $num) { + $objp = $this->db->fetch_object($resql); + + $datec = $this->db->jdate($objp->date_creation); + + $knowledgerecord = new KnowledgeRecord($this->db); + $knowledgerecord->id = $objp->id; + $knowledgerecord->date_creation = $objp->date_creation; + $knowledgerecord->ref = $objp->ref; + $knowledgerecord->status = $objp->status; + $knowledgerecord->question = $objp->question; + + $r = 0; + + // Ticket + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="nowraponall"', + 'text' => $knowledgerecord->getNomUrl(1), + 'asis' => 1 + ); + $r++; + + // Question + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="tdoverflowmax200"', + 'text' => ''.dol_escape_htmltag($objp->question).'', + 'url' => DOL_URL_ROOT."/knowledgemanagement/knowledgerecord_card.php?id=".urlencode($objp->id), + ); + $r++; + + // Language + $labellang = ($objp->lang ? $langs->trans('Language_'.$objp->lang) : ''); + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="tdoverflowmax100"', + 'text' => picto_from_langcode($objp->lang, 'class="paddingrightonly saturatemedium opacitylow"') . $labellang, + 'asis' => 1, + ); + $r++; + + // Date creation + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateCreation").': '.dol_print_date($datec, 'dayhour', 'tzuserrel')).'"', + 'text' => dol_print_date($objp->datec, 'dayhour', 'tzuserrel'), + ); + $r++; + + // Statut + $this->info_box_contents[$i][$r] = array( + 'td' => 'class="right nowraponall"', + 'text' => $knowledgerecord->getLibStatut(3), + ); + $r++; + + $i++; + } + + if ($num == 0) { + $this->info_box_contents[$i][0] = array('td' => '', 'text' => ''.$langs->trans("BoxLastTicketNoRecordedTickets").''); + } + } else { + dol_print_error($this->db); + } + } else { + $this->info_box_contents[0][0] = array('td' => '', + 'text' => ''.$langs->trans("ReadPermissionNotAllowed").''); + } + } + + /** + * Method to show box + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string + * @return string + */ + public function showBox($head = null, $contents = null, $nooutput = 0) + { + return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); + } +} diff --git a/htdocs/core/modules/modKnowledgeManagement.class.php b/htdocs/core/modules/modKnowledgeManagement.class.php index 68754f530b3..c372f611c60 100644 --- a/htdocs/core/modules/modKnowledgeManagement.class.php +++ b/htdocs/core/modules/modKnowledgeManagement.class.php @@ -201,12 +201,14 @@ class modKnowledgeManagement extends DolibarrModules // Boxes/Widgets // Add here list of php file(s) stored in knowledgemanagement/core/boxes that contains a class to show a widget. $this->boxes = array( - // 0 => array( - // 'file' => 'knowledgemanagementwidget1.php@knowledgemanagement', - // 'note' => 'Widget provided by KnowledgeManagement', - // 'enabledbydefaulton' => 'Home', - // ), - // ... + 0 => array( + 'file' => 'box_last_knowledgerecord.php', + 'enabledbydefaulton' => 'ticketindex', + ), + 1 => array( + 'file' => 'box_last_modified_knowledgerecord.php', + 'enabledbydefaulton' => 'ticketindex', + ), ); // Cronjobs (List of cron jobs entries to add when module is enabled) diff --git a/htdocs/langs/en_US/knowledgemanagement.lang b/htdocs/langs/en_US/knowledgemanagement.lang index 38c1624afad..050ecbcc03a 100644 --- a/htdocs/langs/en_US/knowledgemanagement.lang +++ b/htdocs/langs/en_US/knowledgemanagement.lang @@ -51,4 +51,10 @@ SuggestedForTicketsInGroup=Suggested on ticket creation SetObsolete=Set as obsolete ConfirmCloseKM=Do you confirm the closing of this article as obsolete ? -ConfirmReopenKM=Do you want to restore this article to status "Validated" ? \ No newline at end of file +ConfirmReopenKM=Do you want to restore this article to status "Validated" ? +BoxLastKnowledgerecordDescription=Last %s articles +BoxLastKnowledgerecord=Last articles +BoxLastKnowledgerecordContent=Last articles +BoxLastKnowledgerecordModifiedContent=Last modified articles +BoxLastModifiedKnowledgerecordDescription=Last %s modified articles +BoxLastModifiedKnowledgerecord=Last modified articles From daba310395ed40c88b32e38f3858187215bdac2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 11:39:10 +0100 Subject: [PATCH 069/108] clean code --- .../core/boxes/box_last_knowledgerecord.php | 40 ++++++++++++++++--- .../box_last_modified_knowledgerecord.php | 40 ++++++++++++++++--- 2 files changed, 70 insertions(+), 10 deletions(-) diff --git a/htdocs/core/boxes/box_last_knowledgerecord.php b/htdocs/core/boxes/box_last_knowledgerecord.php index 20510a5b3b0..13635481341 100644 --- a/htdocs/core/boxes/box_last_knowledgerecord.php +++ b/htdocs/core/boxes/box_last_knowledgerecord.php @@ -30,10 +30,24 @@ require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; */ class box_last_knowledgerecord extends ModeleBoxes { - + /** + * @var string boxcode + */ public $boxcode = "box_last_knowledgerecord"; + + /** + * @var string box img + */ public $boximg = "knowledgemanagement"; + + /** + * @var string boc label + */ public $boxlabel; + + /** + * @var array box dependancies + */ public $depends = array("knowledgemanagement"); /** @@ -41,8 +55,19 @@ class box_last_knowledgerecord extends ModeleBoxes */ public $db; + /** + * @var string param + */ public $param; + + /** + * @var array box info heads + */ public $info_box_head = array(); + + /** + * @var array box info content + */ public $info_box_contents = array(); /** @@ -67,7 +92,7 @@ class box_last_knowledgerecord extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs; + global $user, $langs; $this->max = $max; @@ -161,14 +186,19 @@ class box_last_knowledgerecord extends ModeleBoxes } if ($num == 0) { - $this->info_box_contents[$i][0] = array('td' => '', 'text' => ''.$langs->trans("BoxLastTicketNoRecordedTickets").''); + $this->info_box_contents[$i][0] = array( + 'td' => '', + 'text' => ''.$langs->trans("BoxLastTicketNoRecordedTickets").'', + ); } } else { dol_print_error($this->db); } } else { - $this->info_box_contents[0][0] = array('td' => '', - 'text' => ''.$langs->trans("ReadPermissionNotAllowed").''); + $this->info_box_contents[0][0] = array( + 'td' => '', + 'text' => ''.$langs->trans("ReadPermissionNotAllowed").'', + ); } } diff --git a/htdocs/core/boxes/box_last_modified_knowledgerecord.php b/htdocs/core/boxes/box_last_modified_knowledgerecord.php index 5e23ee54602..01ee0771ee1 100644 --- a/htdocs/core/boxes/box_last_modified_knowledgerecord.php +++ b/htdocs/core/boxes/box_last_modified_knowledgerecord.php @@ -30,10 +30,24 @@ require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; */ class box_last_modified_knowledgerecord extends ModeleBoxes { - + /** + * @var string boxcode + */ public $boxcode = "box_last_modified_knowledgerecord"; + + /** + * @var string box img + */ public $boximg = "knowledgemanagement"; + + /** + * @var string boc label + */ public $boxlabel; + + /** + * @var array box dependancies + */ public $depends = array("knowledgemanagement"); /** @@ -41,8 +55,19 @@ class box_last_modified_knowledgerecord extends ModeleBoxes */ public $db; + /** + * @var string param + */ public $param; + + /** + * @var array box info heads + */ public $info_box_head = array(); + + /** + * @var array box info content + */ public $info_box_contents = array(); /** @@ -67,7 +92,7 @@ class box_last_modified_knowledgerecord extends ModeleBoxes */ public function loadBox($max = 5) { - global $conf, $user, $langs; + global $user, $langs; $this->max = $max; @@ -161,14 +186,19 @@ class box_last_modified_knowledgerecord extends ModeleBoxes } if ($num == 0) { - $this->info_box_contents[$i][0] = array('td' => '', 'text' => ''.$langs->trans("BoxLastTicketNoRecordedTickets").''); + $this->info_box_contents[$i][0] = array( + 'td' => '', + 'text' => ''.$langs->trans("BoxLastTicketNoRecordedTickets").'', + ); } } else { dol_print_error($this->db); } } else { - $this->info_box_contents[0][0] = array('td' => '', - 'text' => ''.$langs->trans("ReadPermissionNotAllowed").''); + $this->info_box_contents[0][0] = array( + 'td' => '', + 'text' => ''.$langs->trans("ReadPermissionNotAllowed").'', + ); } } From a7c5140fd6c7e366971e8e3ee324c7dcfa9b9dd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 12:05:14 +0100 Subject: [PATCH 070/108] clean code --- htdocs/core/boxes/box_last_knowledgerecord.php | 2 +- htdocs/core/boxes/box_last_modified_knowledgerecord.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_last_knowledgerecord.php b/htdocs/core/boxes/box_last_knowledgerecord.php index 13635481341..2cb4818d6ac 100644 --- a/htdocs/core/boxes/box_last_knowledgerecord.php +++ b/htdocs/core/boxes/box_last_knowledgerecord.php @@ -171,7 +171,7 @@ class box_last_knowledgerecord extends ModeleBoxes // Date creation $this->info_box_contents[$i][$r] = array( 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateCreation").': '.dol_print_date($datec, 'dayhour', 'tzuserrel')).'"', - 'text' => dol_print_date($objp->datec, 'dayhour', 'tzuserrel'), + 'text' => dol_print_date($datec, 'dayhour', 'tzuserrel'), ); $r++; diff --git a/htdocs/core/boxes/box_last_modified_knowledgerecord.php b/htdocs/core/boxes/box_last_modified_knowledgerecord.php index 01ee0771ee1..2c5319151fa 100644 --- a/htdocs/core/boxes/box_last_modified_knowledgerecord.php +++ b/htdocs/core/boxes/box_last_modified_knowledgerecord.php @@ -171,7 +171,7 @@ class box_last_modified_knowledgerecord extends ModeleBoxes // Date creation $this->info_box_contents[$i][$r] = array( 'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateCreation").': '.dol_print_date($datec, 'dayhour', 'tzuserrel')).'"', - 'text' => dol_print_date($objp->datec, 'dayhour', 'tzuserrel'), + 'text' => dol_print_date($datec, 'dayhour', 'tzuserrel'), ); $r++; From 509dfacbf72a1e0562360d0756807f2d1dcb7afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 18:02:58 +0100 Subject: [PATCH 071/108] missing translations --- htdocs/langs/en_US/mrp.lang | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 82cf7c38012..6c8af64f69a 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -119,3 +119,5 @@ BomCantAddChildBom=The nomenclature %s is already present in the tree leading to BOMNetNeeds = BOM Net Needs BOMProductsList=BOM's products BOMServicesList=BOM's services +Manufacturing=Manufacturing +Disassemble=Disassemble From 3a6b8ebfe7142b9960c6c8092b006cb4e2a57cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 18:31:35 +0100 Subject: [PATCH 072/108] clean code --- htdocs/mrp/class/mo.class.php | 51 ++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index ddfd8a7f57b..afdac2d16a8 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -93,7 +93,6 @@ class Mo extends CommonObject * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. */ - // BEGIN MODULEBUILDER PROPERTIES /** * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ @@ -126,6 +125,10 @@ class Mo extends CommonObject public $rowid; public $entity; public $ref; + + /** + * @var int mrptype + */ public $mrptype; public $label; public $qty; @@ -154,8 +157,17 @@ class Mo extends CommonObject public $fk_user_modif; public $import_key; public $status; + + /** + * @var int ID of product + */ public $fk_product; + /** + * @var Product product object + */ + public $product; + /** * @var integer|string date_start_planned */ @@ -167,10 +179,20 @@ class Mo extends CommonObject public $date_end_planned; + /** + * @var int ID bom + */ public $fk_bom; - public $fk_project; - // END MODULEBUILDER PROPERTIES + /** + * @var Bom bom + */ + public $bom; + + /** + * @var int ID project + */ + public $fk_project; // If this object has a subtable with lines @@ -204,12 +226,24 @@ class Mo extends CommonObject */ public $lines = array(); + /** + * @var MoLine MO line + */ + public $line = array(); + /** * @var integer Mo parent line * */ + /** + * @var int ID of parent line + */ public $fk_parent_line; + /** + * @var array tpl + */ + public $tpl = array(); /** * Constructor @@ -1100,6 +1134,9 @@ class Mo extends CommonObject if (isset($this->label)) { $datas['label'] = '
'.$langs->trans('Label').': '.$this->label; } + if (isset($this->mrptype)) { + $datas['type'] = '
'.$langs->trans('Type').': '.$this->fields['mrptype']['arrayofkeyval'][$this->mrptype]; + } return $datas; } @@ -1458,7 +1495,7 @@ class Mo extends CommonObject * If lines are into a template, title must also be into a template * But for the moment we don't know if it's possible as we keep a method available on overloaded objects. * - * @param CommonObjectLine $line Line + * @param MoLine $line Line * @param string $var Var * @param string $restrictlist ''=All lines, 'services'=Restrict to services only (strike line if not) * @param string $defaulttpldir Directory where to find the template @@ -1519,7 +1556,7 @@ class Mo extends CommonObject /** * Function used to return childs of Mo * - * @return array|int array if OK, -1 if KO + * @return Mo[]|int array if OK, -1 if KO */ public function getMoChilds() { @@ -1557,7 +1594,7 @@ class Mo extends CommonObject /** * Function used to return childs of Mo * - * @return Object|int MO object if OK, -1 if KO, 0 if not exist + * @return Mo|int MO object if OK, -1 if KO, 0 if not exist */ public function getMoParent() { @@ -1680,6 +1717,7 @@ class MoLine extends CommonObjectLine public $qty; public $qty_frozen; public $disable_stock_change; + public $efficiency; public $batch; public $role; public $fk_mrp_production; @@ -1689,6 +1727,7 @@ class MoLine extends CommonObjectLine public $fk_user_creat; public $fk_user_modif; public $import_key; + public $fk_parent_line; /** * Constructor From c3425919c2e10a70d7d243f753f2a0324c2a96c0 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sun, 12 Feb 2023 20:18:39 +0100 Subject: [PATCH 073/108] Update hookmanager.class.php --- htdocs/core/class/hookmanager.class.php | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index bcd5a506946..0e679493ae8 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -166,32 +166,32 @@ class HookManager // TODO Remove hooks with type 'output' (exemple createFrom). All hooks must be converted into 'addreplace' hooks. if (in_array($method, array( 'createFrom', - 'dashboardMembers', - 'dashboardEmailings', - 'dashboardPropals', - 'dashboardPropals', - 'dashboardCommercials', - 'dashboardOrders', - 'dashboardSpecialBills', 'dashboardAccountancy', + 'dashboardActivities', + 'dashboardCommercials', 'dashboardContracts', 'dashboardDonation', - 'dashboardWarehouseSendings', + 'dashboardEmailings', 'dashboardExpenseReport', - 'dashboardInterventions', - 'dashboardOrdersSuppliers', 'dashboardHRM', + 'dashboardInterventions', 'dashboardMRP', + 'dashboardMembers', 'dashboardOpensurvey', - 'dashboardWarehouse', + 'dashboardOrders', + 'dashboardOrdersSuppliers', 'dashboardProductServices', - 'dashboardActivities', 'dashboardProjects', - 'dashboardWarehouseReceptions', - 'dashboardThirdparties', + 'dashboardPropals', + 'dashboardPropals', + 'dashboardSpecialBills', 'dashboardSupplierProposal', + 'dashboardThirdparties', 'dashboardTickets', 'dashboardUsersGroups', + 'dashboardWarehouse', + 'dashboardWarehouseReceptions', + 'dashboardWarehouseSendings', 'insertExtraHeader', 'insertExtraFooter', 'printLeftBlock', From 6e3966abaeda0628503250c231c265fbb883ccc1 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Sun, 12 Feb 2023 20:21:11 +0100 Subject: [PATCH 074/108] Update hookmanager.class.php saw now 'dashboardPropals' was twice --- htdocs/core/class/hookmanager.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 0e679493ae8..f973bffba93 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -183,7 +183,6 @@ class HookManager 'dashboardProductServices', 'dashboardProjects', 'dashboardPropals', - 'dashboardPropals', 'dashboardSpecialBills', 'dashboardSupplierProposal', 'dashboardThirdparties', From ffa4e58addc09215dcbe79d540b41bd912acf2b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 20:26:40 +0100 Subject: [PATCH 075/108] fix warning listUsersForGroup with mode = 1 return array of user id --- htdocs/holiday/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 42c64613933..05568e08992 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -3,7 +3,7 @@ * Copyright (C) 2013-2020 Laurent Destailleur * Copyright (C) 2012-2016 Regis Houssin * Copyright (C) 2018 Charlene Benke - * Copyright (C) 2019-2022 Frédéric France + * Copyright (C) 2019-2023 Frédéric France * * 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 @@ -620,7 +620,7 @@ if ($resql) { $valideurobjects = $validator->listUsersForGroup($excludefilter, 1); $valideurarray = array(); foreach ($valideurobjects as $val) { - $valideurarray[$val->id] = $val->id; + $valideurarray[$val] = $val; } print $form->select_dolusers($search_valideur, "search_valideur", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125'); print ''; From 814075d36b943413bc244bfeffa7619a703203e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 20:28:39 +0100 Subject: [PATCH 076/108] Update view_log.php --- htdocs/holiday/view_log.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 4235b7261eb..d0ba35add68 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -336,7 +336,7 @@ if (!empty($arrayfields['cpl.fk_user_action']['checked'])) { $valideurobjects = $validator->listUsersForGroup($excludefilter, 1); $valideurarray = array(); foreach ($valideurobjects as $val) { - $valideurarray[$val->id] = $val->id; + $valideurarray[$val] = $val; } print ''; From af1b9d319474ce70fb1a3f100d4d2aa3c400e91d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 20:48:19 +0100 Subject: [PATCH 077/108] fix warnings --- htdocs/comm/mailing/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 32207425d2a..26e8e6ec63a 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -736,9 +736,9 @@ if ($action == 'create') { print ''.$langs->trans("MailTitle").''; - print ''.$langs->trans("MailFrom").''; + print ''.$langs->trans("MailFrom").''; - print ''.$langs->trans("MailErrorsTo").''; + print ''.$langs->trans("MailErrorsTo").''; // Other attributes $parameters = array(); From 4e00810ca63ab843495eb178a5341d8ce88ddcbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 20:54:28 +0100 Subject: [PATCH 078/108] fix warnings --- htdocs/hrm/evaluation_list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php index 999d6d0d44e..adf642597f2 100644 --- a/htdocs/hrm/evaluation_list.php +++ b/htdocs/hrm/evaluation_list.php @@ -134,13 +134,13 @@ $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); // Permissions -$permissiontoread = $user->rights->hrm->evaluation->read; -$permissiontoreadall = $user->rights->hrm->evaluation->readall; -$permissiontoadd = $user->rights->hrm->evaluation->write; -$permissiontodelete = $user->rights->hrm->evaluation->delete; +$permissiontoread = $user->hasRight('hrm', 'evaluation', 'read'); +$permissiontoreadall = $user->hasRight('hrm', 'evaluation', 'readall'); +$permissiontoadd = $user->hasRight('hrm', 'evaluation', 'write'); +$permissiontodelete = $user->hasRight('hrm', 'evaluation', 'delete'); // Security check -if (empty($conf->hrm->enabled)) { +if (!isModEnabled('hrm')) { accessforbidden('Module not enabled'); } From 85a594aa6130c3f97ac4018e7086e9d9274cd53d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 21:01:02 +0100 Subject: [PATCH 079/108] clean code --- htdocs/opensurvey/class/opensurveysondage.class.php | 5 +++++ htdocs/ticket/class/ticket.class.php | 4 ++-- htdocs/ticket/contact.php | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index e928c2f3cd6..b141da8d392 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -115,6 +115,11 @@ class Opensurveysondage extends CommonObject */ public $allow_spy; + /** + * @var array fields + */ + public $fields = array(); + /** * Draft status (not used) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 932ed171cea..6884d2e830d 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1440,10 +1440,10 @@ class Ticket extends CommonObject $datas['track_id'] = '
'.$langs->trans('TicketTrackId').': '.$this->track_id; $datas['subject'] = '
'.$langs->trans('Subject').': '.$this->subject; if ($this->date_creation) { - $datas['date_creation'] = '
'.$langs->trans('DateCreation').': '.$this->date_creation; + $datas['date_creation'] = '
'.$langs->trans('DateCreation').': '.dol_print_date($this->date_creation, 'dayhour'); } if ($this->date_modification) { - $datas['date_modification'] = '
'.$langs->trans('DateModification').': '.$this->date_modification; + $datas['date_modification'] = '
'.$langs->trans('DateModification').': '.dol_print_date($this->date_modification, 'dayhour'); } return $datas; diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index b5453ed638b..d858a4d7334 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -252,7 +252,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { $linkback = ''.$langs->trans("BackToList").' '; - dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, $param, 0, '', '', 1, ''); + dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1, ''); print dol_get_fiche_end(); From f043345706eb469d7277adf2233f811e330e2f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 21:06:39 +0100 Subject: [PATCH 080/108] clean code --- htdocs/societe/class/societe.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index bc0e8cff3bd..10c13d0313f 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2612,6 +2612,7 @@ class Societe extends CommonObject $datas = []; $option = $params['option'] ?? ''; + $nofetch = empty($params['nofetch']) ? false : true; $name = $this->name; if (!empty($this->name_alias) && empty($noaliasinname)) { @@ -2724,6 +2725,12 @@ class Societe extends CommonObject if (isModEnabled('accounting') && $this->fournisseur) { $datas['accountancysuppliercode'] = '
'.$langs->trans('SupplierAccountancyCode').': '.$this->code_compta_fournisseur; } + // show categories for this record only in ajax to not overload lists + if (isModEnabled('categorie') && !$nofetch) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $form = new Form($this->db); + $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1); + } $datas['divclose'] = '
'; @@ -2789,6 +2796,7 @@ class Societe extends CommonObject 'id' => $this->id, 'objecttype' => $this->element, 'option' => $option, + 'nofetch' => 1, ]; $classfortooltip = 'classfortooltip'; $dataparams = ''; From 0f4adbedab3466eacbe41296fd9a1ae9b69bec43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 21:15:16 +0100 Subject: [PATCH 081/108] clean code --- htdocs/product/class/product.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 9db4565ca49..c8b3104aed0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5012,6 +5012,7 @@ class Product extends CommonObject $langs->load('products'); $datas = []; + $nofetch = empty($params['nofetch']) ? false : true; if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { return ['optimize' => $langs->trans("ShowProduct")]; @@ -5103,6 +5104,12 @@ class Product extends CommonObject $datas['accountancybuy'] = $buylabel; } } + // show categories for this record only in ajax to not overload lists + if (isModEnabled('categorie') && !$nofetch) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $form = new Form($this->db); + $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_PRODUCT, 1); + } return $datas; } @@ -5135,6 +5142,7 @@ class Product extends CommonObject 'id' => $this->id, 'objecttype' => $this->element, 'option' => $option, + 'nofetch' => 1, ]; $classfortooltip = 'classfortooltip'; $dataparams = ''; From c17463d2f4ec4a1c8f419c511b04b7db9e2e41f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 22:03:39 +0100 Subject: [PATCH 082/108] clean code --- htdocs/societe/class/societe.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 10c13d0313f..ea99b9c9eef 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2729,7 +2729,12 @@ class Societe extends CommonObject if (isModEnabled('categorie') && !$nofetch) { require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $form = new Form($this->db); - $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1); + if ($this->client) { + $datas['categories_customer'] = '
' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1); + } + if ($this->fournisseur) { + $datas['categories_supplier'] = '
' . $form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1); + } } $datas['divclose'] = ''; From 43ac67c3d825dac14addf51a876ec0e7d67758ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 23:13:45 +0100 Subject: [PATCH 083/108] clean code --- htdocs/ticket/class/ticket.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 6884d2e830d..bc50c0e31f8 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1433,6 +1433,7 @@ class Ticket extends CommonObject $langs->load('ticket'); + $nofetch = empty($params['nofetch']) ? false : true; $datas = []; $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Ticket").''; $datas['picto'] .= ' '.$this->getLibStatut(4); @@ -1445,6 +1446,12 @@ class Ticket extends CommonObject if ($this->date_modification) { $datas['date_modification'] = '
'.$langs->trans('DateModification').': '.dol_print_date($this->date_modification, 'dayhour'); } + // show categories for this record only in ajax to not overload lists + if (isModEnabled('categorie') && !$nofetch) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $form = new Form($this->db); + $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_TICKET, 1); + } return $datas; } @@ -1474,6 +1481,8 @@ class Ticket extends CommonObject $params = [ 'id' => $this->id, 'objecttype' => $this->element, + 'option' => $option, + 'nofetch' => 1, ]; $classfortooltip = 'classfortooltip'; $dataparams = ''; From e1ca6ef019f19a7dc3c5f9b80470e4ce37676c7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 23:19:03 +0100 Subject: [PATCH 084/108] clean code --- htdocs/adherents/class/adherent.class.php | 8 ++++++++ htdocs/comm/action/class/actioncomm.class.php | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index b0ca0986ffb..6e77fd3fa95 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2288,6 +2288,7 @@ class Adherent extends CommonObject $datas = []; + $nofetch = empty($params['nofetch']) ? false : true; if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $langs->load("users"); return ['optimize' => $langs->trans("ShowUser")]; @@ -2318,6 +2319,12 @@ class Adherent extends CommonObject $datas['email'] = '
'.$langs->trans("EMail").': '.$this->email; } $datas['address'] = '
'.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); + // show categories for this record only in ajax to not overload lists + if (isModEnabled('categorie') && !$nofetch) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $form = new Form($this->db); + $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_MEMBER, 1); + } $datas['divclose'] = ''; return $datas; @@ -2353,6 +2360,7 @@ class Adherent extends CommonObject 'id' => $this->id, 'objecttype' => $this->element, 'option' => $option, + 'nofetch' => 1, ]; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index fd5b55e70fe..11cb4f98dbd 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1580,6 +1580,7 @@ class ActionComm extends CommonObject $langs->load('agenda'); $datas = []; + $nofetch = empty($params['nofetch']) ? false : true; // Set label of type $labeltype = ''; if ($this->type_code) { @@ -1631,6 +1632,12 @@ class ActionComm extends CommonObject $datas['note'] .= (dol_textishtml($texttoshow) ? str_replace(array("\r", "\n"), "", $texttoshow) : str_replace(array("\r", "\n"), '
', $texttoshow)); $datas['note'] .= ''; } + // show categories for this record only in ajax to not overload lists + if (isModEnabled('categorie') && !$nofetch) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $form = new Form($this->db); + $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_ACTIONCOMM, 1); + } return $datas; } @@ -1734,6 +1741,7 @@ class ActionComm extends CommonObject 'id' => $this->id, 'objecttype' => $this->element, 'option' => $option, + 'nofetch' => 1, ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); From b0a1d8058fb0c8a49323028ea945330cd558b79d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 12 Feb 2023 23:28:14 +0100 Subject: [PATCH 085/108] clean code --- htdocs/compta/bank/class/account.class.php | 43 ++++++++-------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 7032f9c40e2..4ccdf93cb58 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1417,6 +1417,7 @@ class Account extends CommonObject $datas = []; + $nofetch = empty($params['nofetch']) ? false : true; $pictos = img_picto('', $this->picto).' '.$langs->trans("BankAccount").''; if (isset($this->status)) { $pictos .= ' '.$this->getLibStatut(5); @@ -1434,6 +1435,12 @@ class Account extends CommonObject $datas['accountaccounting'] = '
'.$langs->trans('AccountAccounting').': '.length_accountg($this->account_number); $datas['accountancyjournal'] = '
'.$langs->trans('AccountancyJournal').': '.$this->accountancy_journal; } + // show categories for this record only in ajax to not overload lists + if (isModEnabled('categorie') && !$nofetch) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $form = new Form($this->db); + $datas['categories'] = '
' . $form->showCategories($this->id, Categorie::TYPE_ACCOUNT, 1); + } return $datas; } @@ -1454,38 +1461,20 @@ class Account extends CommonObject include_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; $result = ''; - $label = img_picto('', $this->picto).' '.$langs->trans("BankAccount").''; - if (isset($this->status)) { - $label .= ' '.$this->getLibStatut(5); - } - $label .= '
'.$langs->trans('Label').': '.$this->label; - $label .= '
'.$langs->trans('AccountNumber').': '.$this->number; - $label .= '
'.$langs->trans('IBAN').': '.getIbanHumanReadable($this); - $label .= '
'.$langs->trans('BIC').': '.$this->bic; - $label .= '
'.$langs->trans("AccountCurrency").': '.$this->currency_code; - - if (empty($user->rights->banque->lire) || !empty($user->socid)) { - $option = 'nolink'; - } - - if (isModEnabled('accounting')) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; - $langs->load("accountancy"); - $label .= '
'.$langs->trans('AccountAccounting').': '.length_accountg($this->account_number); - $label .= '
'.$langs->trans('AccountancyJournal').': '.$this->accountancy_journal; - } $classfortooltip = 'classfortooltip'; $dataparams = ''; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + 'nofetch' => 1, + ]; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { - $params = [ - 'id' => $this->id, - 'objecttype' => $this->element, - 'option' => $option, - ]; $classfortooltip = 'classforajaxtooltip'; $dataparams = ' data-params='.json_encode($params); - $label = $langs->trans('Loading'); } + $label = implode($this->getTooltipContentArray($params)); + $linkclose = '"'.$dataparams.' title="'.dol_escape_htmltag($label, 1).'" class="'.$classfortooltip.'">'; $url = DOL_URL_ROOT.'/compta/bank/card.php?id='.$this->id; @@ -1871,7 +1860,7 @@ class Account extends CommonObject /** * Class to manage bank transaction lines */ -class AccountLine extends CommonObject +class AccountLine extends CommonObjectLine { /** * @var string Error code (or message) From 30b81e2ac94fe4714af2a2574b5aebab81316e54 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Feb 2023 06:03:42 +0000 Subject: [PATCH 086/108] Bump JetBrains/qodana-action from 2022.3.2 to 2022.3.3 Bumps [JetBrains/qodana-action](https://github.com/JetBrains/qodana-action) from 2022.3.2 to 2022.3.3. - [Release notes](https://github.com/JetBrains/qodana-action/releases) - [Commits](https://github.com/JetBrains/qodana-action/compare/v2022.3.2...v2022.3.3) --- updated-dependencies: - dependency-name: JetBrains/qodana-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/code_quality.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index e5351acaf78..9b4fd68efe7 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -18,7 +18,7 @@ jobs: fetch-depth: 1 #php-version: '7.1' - name: 'Qodana Scan' - uses: JetBrains/qodana-action@v2022.3.2 + uses: JetBrains/qodana-action@v2022.3.3 #with: # php-version: '7.1' env: From c90e5094455511e5282ec3429741e8517ef1884b Mon Sep 17 00:00:00 2001 From: priojk Date: Mon, 13 Feb 2023 10:09:48 +0100 Subject: [PATCH 087/108] NEW: Possibility to link to German pages in help --- htdocs/main.inc.php | 17 ++++++++++++----- htdocs/mrp/mo_movements.php | 2 +- htdocs/mrp/mo_production.php | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 1ea68780746..dc9d9d90c02 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -15,6 +15,7 @@ * Copyright (C) 2020 Charlene Benke * Copyright (C) 2021 Frédéric France * Copyright (C) 2021 Alexandre Spangaro + * Copyright (C) 2023 Joachim Küter * * 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 @@ -1397,7 +1398,7 @@ if (!function_exists("llxHeader")) { * @param string $head Optionnal head lines * @param string $title HTML title * @param string $help_url Url links to help page - * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage + * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage|DE:GermanPage * For other external page: http://server/url * @param string $target Target to use on links * @param int $disablejs More content into html header @@ -1958,7 +1959,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr * @param array $arrayofcss Array of css files to add in header * @param string $morequerystring Query string to add to the link "print" to get same parameters (use only if autodetect fails) * @param string $helppagename Name of wiki page for help ('' by default). - * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage + * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage|DE:GermanPage * For other external page: http://server/url * @return void */ @@ -2091,7 +2092,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead $helppresent = ''; if (empty($helppagename)) { - $helppagename = 'EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios'; + $helppagename = 'EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios|DE:Benutzerdokumentation'; } else { $helppresent = 'helppresent'; } @@ -2888,7 +2889,7 @@ function top_menu_search() * * @param array $menu_array_before Table of menu entries to show before entries of menu handler. This param is deprectaed and must be provided to ''. * @param string $helppagename Name of wiki page for help ('' by default). - * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage + * Syntax is: For a wiki page: EN:EnglishPage|FR:FrenchPage|ES:SpanishPage|DE:GermanPage * For other external page: http://server/url * @param string $notused Deprecated. Used in past to add content into left menu. Hooks can be used now. * @param array $menu_array_after Table of menu entries to show after entries of menu handler @@ -3176,7 +3177,7 @@ function main_area($title = '') /** * Return helpbaseurl, helppage and mode * - * @param string $helppagename Page name ('EN:xxx,ES:eee,FR:fff...' or 'http://localpage') + * @param string $helppagename Page name ('EN:xxx,ES:eee,FR:fff,DE:ddd...' or 'http://localpage') * @param Translate $langs Language * @return array Array of help urls */ @@ -3206,6 +3207,12 @@ function getHelpParamFor($helppagename, $langs) $helppage = $reg[1]; } } + if (preg_match('/^de/i', $langs->defaultlang)) { + $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s'; + if (preg_match('/DE:([^|]+)/i', $helppagename, $reg)) { + $helppage = $reg[1]; + } + } if (empty($helppage)) { // If help page not already found $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s'; if (preg_match('/EN:([^|]+)/i', $helppagename, $reg)) { diff --git a/htdocs/mrp/mo_movements.php b/htdocs/mrp/mo_movements.php index c0357aa5e4b..a82f36c913e 100644 --- a/htdocs/mrp/mo_movements.php +++ b/htdocs/mrp/mo_movements.php @@ -257,7 +257,7 @@ $productlot = new ProductLot($db); $warehousestatic = new Entrepot($db); $userstatic = new User($db); -$help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication'; +$help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag'; llxHeader('', $langs->trans('Mo'), $help_url); diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index b274f4b89df..4e149201ba3 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -431,7 +431,7 @@ $tmpwarehouse = new Entrepot($db); $tmpbatch = new Productlot($db); $tmpstockmovement = new MouvementStock($db); -$help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication'; +$help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication|DE:Modul_Fertigungsauftrag'; llxHeader('', $langs->trans('Mo'), $help_url, '', 0, 0, array('/mrp/js/lib_dispatch.js.php')); $newToken = newToken(); From a34703532f3f6a476e9d1fc36a23f53b8324b7b7 Mon Sep 17 00:00:00 2001 From: jyhere Date: Mon, 13 Feb 2023 10:37:36 +0100 Subject: [PATCH 088/108] [FIX] extrafield with visibility '5' update bug When using a visibility = 5 (not editable extrafield, but visible on card and list), updating the object will result in an empty value in database for this extrafield. --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 71d5dfdb06d..be34ccd1a8b 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2114,7 +2114,7 @@ class ExtraFields ) { continue; } - if (empty($visibility)) { + if (empty($visibility) || $visibility == 5) { continue; } if (empty($perms)) { From 779a134022e4ccf80fa4cf03dae6880572ffaf7f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 12:27:23 +0100 Subject: [PATCH 089/108] Fix call of antivirus must be done using utils->executeCLI --- htdocs/core/class/antivir.class.php | 54 ++++++++--------------------- 1 file changed, 14 insertions(+), 40 deletions(-) diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php index dc38d38185e..cb195b58f5d 100644 --- a/htdocs/core/class/antivir.class.php +++ b/htdocs/core/class/antivir.class.php @@ -81,63 +81,37 @@ class AntiVir } $fullcommand = $this->getCliCommand($file); + //$fullcommand="/usr/bin/clamdscan --fdpass '/tmp/phpuxoAEo'" //$fullcommand='"c:\Program Files (x86)\ClamWin\bin\clamscan.exe" --database="C:\Program Files (x86)\ClamWin\lib" "c:\temp\aaa.txt"'; - $fullcommand .= ' 2>&1'; // This is to get error output - $output = array(); $return_var = 0; $safemode = ini_get("safe_mode"); // Create a clean fullcommand dol_syslog("AntiVir::dol_avscan_file Run command=".$fullcommand." with safe_mode ".($safemode ? "on" : "off")); - // Run CLI command. If run of Windows, you can get return with echo %ERRORLEVEL% - $lastline = exec($fullcommand, $output, $return_var); + // Run CLI command. + include_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php'; + $utils = new Utils($this->db); + $outputfile = $conf->user->dir_temp.'/antivir.tmp'; + $result = $utils->executeCLI($fullcommand, $outputfile); + + $return_var = $result['result']; + $output = $result['output']; + $errorstring = $result['error']; if (is_null($output)) { $output = array(); } - //print "x".$lastline." - ".join(',',$output)." - ".$return_var."y";exit; - - /* - $outputfile=$conf->admin->dir_temp.'/dol_avscan_file.out.'.session_id(); - $handle = fopen($outputfile, 'w'); - if ($handle) - { - $handlein = popen($fullcommand, 'r'); - while (!feof($handlein)) - { - $read = fgets($handlein); - fwrite($handle,$read); - } - pclose($handlein); - - $errormsg = fgets($handle,2048); - $this->output=$errormsg; - - fclose($handle); - - if (!empty($conf->global->MAIN_UMASK)) - @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); - } - else - { - $langs->load("errors"); - dol_syslog("Failed to open file ".$outputfile,LOG_ERR); - $this->error="ErrorFailedToWriteInDir"; - $return=-1; - } - */ - - dol_syslog("AntiVir::dol_avscan_file Result return_var=".$return_var." output=".join(',', $output)); + dol_syslog("AntiVir::dol_avscan_file Result return_var=".$return_var." output=".$output); $returncodevirus = 1; if ($return_var == $returncodevirus) { // Virus found - $this->errors = $output; + $this->errors = array($errorstring, $output); return -99; } if ($return_var > 0) { // If other error - $this->errors = $output; + $this->errors = array($errorstring, $output); return -98; } @@ -178,7 +152,7 @@ class AntiVir } if (preg_match("/\s/", $command)) { - $command = escapeshellarg($command); // Use quotes on command. Using escapeshellcmd fails. + $command = escapeshellarg($command); // Force use of quotes on command. Using escapeshellcmd fails. } $ret = $command.' '.$param; From 183ae35ab7c2f9eaeb9a619895c1ca8f0b3139fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 12:27:23 +0100 Subject: [PATCH 090/108] Fix #huntr10e423cd-7051-43fd-b736-4e18650d0172 --- htdocs/admin/system/security.php | 3 ++ htdocs/core/class/antivir.class.php | 61 +++++++++-------------------- htdocs/core/lib/functions.lib.php | 4 +- 3 files changed, 24 insertions(+), 44 deletions(-) diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index 99b0ec96b08..e1b47b5beaa 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -577,6 +577,9 @@ print '
'; print 'MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL = '.getDolGlobalString('MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL', ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)')."
"; print '
'; +print 'MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED = '.getDolGlobalString('MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED', ''.$langs->trans("Undefined").'   ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)')."
"; +print '
'; + print 'MAIN_SECURITY_FORCECSP = '.getDolGlobalString('MAIN_SECURITY_FORCECSP', ''.$langs->trans("Undefined").'').'   ('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self'; img-src *;\")
"; print '
'; diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php index dc38d38185e..f8391c7a512 100644 --- a/htdocs/core/class/antivir.class.php +++ b/htdocs/core/class/antivir.class.php @@ -81,63 +81,38 @@ class AntiVir } $fullcommand = $this->getCliCommand($file); + //$fullcommand="/usr/bin/clamdscan --fdpass '/tmp/phpuxoAEo'" //$fullcommand='"c:\Program Files (x86)\ClamWin\bin\clamscan.exe" --database="C:\Program Files (x86)\ClamWin\lib" "c:\temp\aaa.txt"'; - $fullcommand .= ' 2>&1'; // This is to get error output + //var_dump($fullcommand); - $output = array(); - $return_var = 0; $safemode = ini_get("safe_mode"); // Create a clean fullcommand dol_syslog("AntiVir::dol_avscan_file Run command=".$fullcommand." with safe_mode ".($safemode ? "on" : "off")); - // Run CLI command. If run of Windows, you can get return with echo %ERRORLEVEL% - $lastline = exec($fullcommand, $output, $return_var); + // Run CLI command. + include_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php'; + $utils = new Utils($this->db); + $outputfile = $conf->user->dir_temp.'/antivir.tmp'; + + $result = $utils->executeCLI($fullcommand, $outputfile); + + $return_var = $result['result']; + $output = $result['output']; + $errorstring = $result['error']; if (is_null($output)) { $output = array(); } - //print "x".$lastline." - ".join(',',$output)." - ".$return_var."y";exit; - - /* - $outputfile=$conf->admin->dir_temp.'/dol_avscan_file.out.'.session_id(); - $handle = fopen($outputfile, 'w'); - if ($handle) - { - $handlein = popen($fullcommand, 'r'); - while (!feof($handlein)) - { - $read = fgets($handlein); - fwrite($handle,$read); - } - pclose($handlein); - - $errormsg = fgets($handle,2048); - $this->output=$errormsg; - - fclose($handle); - - if (!empty($conf->global->MAIN_UMASK)) - @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); - } - else - { - $langs->load("errors"); - dol_syslog("Failed to open file ".$outputfile,LOG_ERR); - $this->error="ErrorFailedToWriteInDir"; - $return=-1; - } - */ - - dol_syslog("AntiVir::dol_avscan_file Result return_var=".$return_var." output=".join(',', $output)); + dol_syslog("AntiVir::dol_avscan_file Result return_var=".$return_var." output=".$output); $returncodevirus = 1; if ($return_var == $returncodevirus) { // Virus found - $this->errors = $output; + $this->errors = array($errorstring, $output); return -99; } if ($return_var > 0) { // If other error - $this->errors = $output; + $this->errors = array($errorstring, $output); return -98; } @@ -178,10 +153,12 @@ class AntiVir } if (preg_match("/\s/", $command)) { - $command = escapeshellarg($command); // Use quotes on command. Using escapeshellcmd fails. + $command = escapeshellarg($command); // Force use of quotes on command. Using escapeshellcmd fails. } - $ret = $command.' '.$param; + $forbidden_chars_to_replace = array("*", "?", "\"", "<", ">", "|", "[", "]", ";", '°', '$'); + $ret = dol_sanitizePathName($command).' '.dol_string_nospecial($param, '_', $forbidden_chars_to_replace); + //$ret=$command.' '.$param.' 2>&1'; //print "xx".$ret."xx";exit; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1913e7dc235..a73bf3e096f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1385,7 +1385,7 @@ function dol_string_unaccent($str) /** * Clean a string from all punctuation characters to use it as a ref or login. - * This is a more complete function than dol_sanitizeFileName. + * This is a more complete function than dol_sanitizeFileName(). * * @param string $str String to clean * @param string $newstr String to replace forbidden chars with @@ -1397,7 +1397,7 @@ function dol_string_unaccent($str) */ function dol_string_nospecial($str, $newstr = '_', $badcharstoreplace = '', $badcharstoremove = '') { - $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°'); // more complete than dol_sanitizeFileName + $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°', '$', ';'); // more complete than dol_sanitizeFileName $forbidden_chars_to_remove = array(); //$forbidden_chars_to_remove=array("(",")"); From 08838d4debdc817d0143a7511046ba42845aa54e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 13 Feb 2023 13:16:27 +0100 Subject: [PATCH 091/108] clean code --- htdocs/core/boxes/box_members_subscriptions_by_year.php | 2 +- htdocs/langs/en_US/members.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php index 716b8ed0482..228ba016ceb 100644 --- a/htdocs/core/boxes/box_members_subscriptions_by_year.php +++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php @@ -191,7 +191,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes if ($num == 0) { $this->info_box_contents[$line][0] = array( - 'td' => 'class="center"', + 'td' => 'class="left" colspan="4"', 'text' => $langs->trans("NoRecordedMembers"), ); } else { diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 5876a019d25..b0237c5578b 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -233,3 +233,4 @@ CreateDolibarrThirdPartyDesc=A thirdparty is the legal entity that will be used MemberFirstname=Member firstname MemberLastname=Member lastname MemberCodeDesc=Member Code, unique for all members +NoRecordedMembers=No registered member From cccd7494dfdfcce5017dcecb97166f3bf27bc4da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 13:29:30 +0100 Subject: [PATCH 092/108] Fix #huntr88841fe0-e332-49ce-a46b-36d4f091fd89 --- htdocs/core/lib/website.lib.php | 2 +- htdocs/core/lib/website2.lib.php | 1 + htdocs/website/index.php | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index de5779a3f51..61a894b2c96 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -69,7 +69,7 @@ function dolStripPhpCode($str, $replacewith = '') * * @param string $str String to clean * @return string Result string with php code only - * @see dolStripPhpCode() + * @see dolStripPhpCode(), checkPHPCode() */ function dolKeepOnlyPhpCode($str) { diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 768f735fe39..6d93d4391b2 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -680,6 +680,7 @@ function showWebsiteTemplates(Website $website) * @param string $phpfullcodestringold PHP old string. For exemple "" * @param string $phpfullcodestring PHP new string. For exemple "" * @return int Error or not + * @see dolKeepOnlyPhpCode() */ function checkPHPCode($phpfullcodestringold, $phpfullcodestring) { diff --git a/htdocs/website/index.php b/htdocs/website/index.php index b4262757bff..e585dd07bb2 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -806,6 +806,16 @@ if ($action == 'addcontainer' && $usercanedit) { // Remove comments $tmp['content'] = removeHtmlComment($tmp['content']); + // Check there is no PHP content into the imported file (must be only HTML + JS) + $phpcontent = dolKeepOnlyPhpCode('', $tmp['content']); + if ($phpcontent) { + $error++; + setEventMessages('Error getting '.$urltograb.': file that include PHP content is not allowed', null, 'errors'); + $action = 'createcontainer'; + } + } + + if (!$error) { $regs = array(); preg_match('/(.*)<\/head>/ims', $tmp['content'], $regs); From 4a49ca86c9fe7fbfa3f2cf5cc9ece6c4018fe756 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 13:29:30 +0100 Subject: [PATCH 093/108] Fix #huntr88841fe0-e332-49ce-a46b-36d4f091fd89 --- htdocs/core/lib/website.lib.php | 2 +- htdocs/core/lib/website2.lib.php | 1 + htdocs/website/index.php | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index c258e3198ce..d900b7718cf 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -69,7 +69,7 @@ function dolStripPhpCode($str, $replacewith = '') * * @param string $str String to clean * @return string Result string with php code only - * @see dolStripPhpCode() + * @see dolStripPhpCode(), checkPHPCode() */ function dolKeepOnlyPhpCode($str) { diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index e03f711c9c0..e619ab17a76 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -678,6 +678,7 @@ function showWebsiteTemplates(Website $website) * @param string $phpfullcodestringold PHP old string * @param string $phpfullcodestring PHP new string * @return int Error or not + * @see dolKeepOnlyPhpCode() */ function checkPHPCode($phpfullcodestringold, $phpfullcodestring) { diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 3a625818ba4..22e692ad824 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -806,6 +806,16 @@ if ($action == 'addcontainer' && $usercanedit) { // Remove comments $tmp['content'] = removeHtmlComment($tmp['content']); + // Check there is no PHP content into the imported file (must be only HTML + JS) + $phpcontent = dolKeepOnlyPhpCode('', $tmp['content']); + if ($phpcontent) { + $error++; + setEventMessages('Error getting '.$urltograb.': file that include PHP content is not allowed', null, 'errors'); + $action = 'createcontainer'; + } + } + + if (!$error) { $regs = array(); preg_match('/(.*)<\/head>/ims', $tmp['content'], $regs); From c1ee02c51059644dfcb0072e6280374897d509a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 13:33:48 +0100 Subject: [PATCH 094/108] Fix bad param --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 22e692ad824..271c139b667 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -807,7 +807,7 @@ if ($action == 'addcontainer' && $usercanedit) { $tmp['content'] = removeHtmlComment($tmp['content']); // Check there is no PHP content into the imported file (must be only HTML + JS) - $phpcontent = dolKeepOnlyPhpCode('', $tmp['content']); + $phpcontent = dolKeepOnlyPhpCode($tmp['content']); if ($phpcontent) { $error++; setEventMessages('Error getting '.$urltograb.': file that include PHP content is not allowed', null, 'errors'); From f569048eb2bd823525bce4ef52316e7a83e3345c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 11 Feb 2023 13:50:40 +0100 Subject: [PATCH 095/108] Fix #hunter7a048bb7-bfdd-4299-931e-9bc283e92bc8 --- htdocs/main.inc.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 98de8c12e5c..44ee262b700 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -167,16 +167,20 @@ function testSqlAndScriptInject($val, $type) $inj += preg_match('/on(lostpointercapture|offline|online|pagehide|pageshow)\s*=/i', $val); $inj += preg_match('/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)\s*=/i', $val); $inj += preg_match('/on(timeupdate|toggle|unload|volumechange|waiting|wheel)\s*=/i', $val); + // More not into the previous list + $inj += preg_match('/on(repeat|begin|finish|beforeinput)\s*=/i', $val); // We refuse html into html because some hacks try to obfuscate evil strings by inserting HTML into HTML. Example: error=alert(1) to bypass test on onerror $tmpval = preg_replace('/<[^<]+>/', '', $val); // List of dom events is on https://www.w3schools.com/jsref/dom_obj_event.asp and https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers - $inj += preg_match('/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $val); // onmousexxx can be set on img or any html tag like + $inj += preg_match('/on(mouse|drag|key|load|touch|pointer|select|transition)([a-z]*)\s*=/i', $tmpval); // onmousexxx can be set on img or any html tag like $inj += preg_match('/on(abort|afterprint|animation|auxclick|beforecopy|beforecut|beforeprint|beforeunload|blur|cancel|canplay|canplaythrough|change|click|close|contextmenu|cuechange|copy|cut)\s*=/i', $tmpval); $inj += preg_match('/on(dblclick|drop|durationchange|emptied|end|ended|error|focus|focusin|focusout|formdata|gotpointercapture|hashchange|input|invalid)\s*=/i', $tmpval); $inj += preg_match('/on(lostpointercapture|offline|online|pagehide|pageshow)\s*=/i', $tmpval); $inj += preg_match('/on(paste|pause|play|playing|progress|ratechange|reset|resize|scroll|search|seeked|seeking|show|stalled|start|submit|suspend)\s*=/i', $tmpval); $inj += preg_match('/on(timeupdate|toggle|unload|volumechange|waiting|wheel)\s*=/i', $tmpval); + // More not into the previous list + $inj += preg_match('/on(repeat|begin|finish|beforeinput)\s*=/i', $tmpval); //$inj += preg_match('/on[A-Z][a-z]+\*=/', $val); // To lock event handlers onAbort(), ... $inj += preg_match('/:|:|:/i', $val); // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...' From e9c5f515ced36ccdfd5312049d76d7dc3c1e68d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 14:35:02 +0100 Subject: [PATCH 096/108] Fix #huntrb1412070-740e-4119-8e4b-61bdc3af42aa --- htdocs/accountancy/admin/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 02b95cfd043..535463822db 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -41,7 +41,7 @@ $ref = GETPOST('ref', 'alpha'); $rowid = GETPOST('rowid', 'int'); $cancel = GETPOST('cancel', 'alpha'); -$account_number = GETPOST('account_number', 'string'); +$account_number = GETPOST('account_number', 'alphanohtml'); $label = GETPOST('label', 'alpha'); // Security check From c3fc14a45af041919c1098c06781a2727b430b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Fali=C3=A8re?= Date: Mon, 13 Feb 2023 16:05:12 +0100 Subject: [PATCH 097/108] FIX bad check on if in get_all_ways --- htdocs/categories/class/categorie.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 27a301776b8..23495e9c5c1 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018-2022 Frédéric France + * Copyright (C) 2023 Benjamin Falière * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1463,7 +1464,7 @@ class Categorie extends CommonObject $ways = array(); $parents = $this->get_meres(); - if (!empty($parents)) { + if (is_array($parents)) { foreach ($parents as $parent) { $allways = $parent->get_all_ways(); foreach ($allways as $way) { From 2dec660763e526b280e9379c0a7da499e8d86bbb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 16:12:38 +0100 Subject: [PATCH 098/108] Fix backto link --- htdocs/compta/bank/bankentries_list.php | 2 +- htdocs/compta/bank/line.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 6c961e85af9..a678c176ca7 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -175,7 +175,7 @@ $arrayfields = array( 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>120), 'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>130), 'b.conciliated'=>array('label'=>$langs->trans("BankLineReconciled"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile' ? 1 : 0), 'position'=>140), - 'b.fk_bordereau'=>array('label'=>$langs->trans("ChequeReceipt"), 'checked'=>0, 'position'=>150), + 'b.fk_bordereau'=>array('label'=>$langs->trans("ChequeNumber"), 'checked'=>0, 'position'=>150), ); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 7c775b6e95c..fd75c9ceaee 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -327,7 +327,7 @@ if ($result) { print dol_get_fiche_head($head, 'bankline', $langs->trans('LineRecord'), 0, 'accountline', 0); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($bankline, 'rowid', $linkback); From 83727d08bad9db0572c31732f5cbcea5830e3385 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Feb 2023 19:34:36 +0100 Subject: [PATCH 099/108] Enhance the virtual business card feature --- htdocs/admin/tools/dolibarr_export.php | 51 ++++++++++------- htdocs/langs/en_US/main.lang | 3 +- htdocs/public/users/view.php | 2 +- htdocs/theme/eldy/global.inc.php | 27 +++++++++ htdocs/theme/md/style.css.php | 27 +++++++++ htdocs/user/virtualcard.php | 76 ++++++++++++++++++++------ 6 files changed, 147 insertions(+), 39 deletions(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index d01efa0ea5b..8afd1f7e03c 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -202,45 +202,53 @@ print ''; print ''; print ''; -print ''; +print '
'; +print img_picto('', 'setup', 'class="pictofixedwidth"').''.$langs->trans("ShowAdvancedOptions").'...'; +print '
'; print ''; + print '