From 5bae9db0a82292d2eb2c01268cce2b738bc488e3 Mon Sep 17 00:00:00 2001 From: kamel Date: Tue, 2 Jun 2020 17:29:55 +0200 Subject: [PATCH 01/82] FIX: Fix detect distached product and set to received completely when the supplier order have services (support STOCK_SUPPORTS_SERVICES) --- htdocs/fourn/class/fournisseur.commande.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 092c3df8dc2..66788cdb126 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3063,6 +3063,7 @@ class CommandeFournisseur extends CommonOrder { if (is_array($supplierorderdispatch->lines) && count($supplierorderdispatch->lines)>0) { + require_once DOL_DOCUMENT_ROOT.'/htdocs/product/class/product.class.php'; $date_liv = dol_now(); // Build array with quantity deliverd by product @@ -3070,7 +3071,11 @@ class CommandeFournisseur extends CommonOrder $qtydelivered[$line->fk_product]+=$line->qty; } foreach($this->lines as $line) { - $qtywished[$line->fk_product]+=$line->qty; + if ($line->product_type == Product::TYPE_PRODUCT || + ($line->product_type == Product::TYPE_SERVICE && !empty($conf->global->STOCK_SUPPORTS_SERVICES)) + ) { + $qtywished[$line->fk_product] += $line->qty; + } } //Compare array $diff_array=array_diff_assoc($qtydelivered, $qtywished); // Warning: $diff_array is done only on common keys. From e2696d7718f4ef6e344c0c50ff7509af3996d262 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Fri, 15 Jan 2021 09:58:04 +0100 Subject: [PATCH 02/82] FIX Societe Merge : "unknow column fk_soc" + "Delivery" label --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_mrp_production.sql | 3 ++- htdocs/societe/card.php | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index 309d4d4b170..f1ea3d237a3 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -555,3 +555,6 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64); ALTER TABLE llx_projet ADD COLUMN fk_opp_status_end integer DEFAULT NULL; +ALTER TABLE llx_mrp_production ADD COLUMN fk_soc integer NOT NULL; + + diff --git a/htdocs/install/mysql/tables/llx_mrp_production.sql b/htdocs/install/mysql/tables/llx_mrp_production.sql index bd0cd722f1a..d2b44427f58 100644 --- a/htdocs/install/mysql/tables/llx_mrp_production.sql +++ b/htdocs/install/mysql/tables/llx_mrp_production.sql @@ -16,7 +16,8 @@ CREATE TABLE llx_mrp_production( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, - fk_mo integer NOT NULL, + fk_mo integer NOT NULL, + fk_soc integer NOT NULL, position integer NOT NULL DEFAULT 0, fk_product integer NOT NULL, fk_warehouse integer, diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 356c70baf3d..2f51995c785 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -249,7 +249,7 @@ if (empty($reshook)) 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', - 'Livraison' => '/delivery/class/delivery.class.php', + 'Delivery' => '/delivery/class/delivery.class.php', 'Product' => '/product/class/product.class.php', 'Project' => '/projet/class/project.class.php', 'Ticket' => '/ticket/class/ticket.class.php', From cd4225aee06fd8ec085a19d354eaa901acd2fd89 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 21 Jan 2021 09:45:09 +0100 Subject: [PATCH 03/82] Fix #16027 New Feature copy Code Client --- htdocs/societe/card.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 0d8a92c1cf3..342ee1b8ee3 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2423,8 +2423,29 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if ($object->client) { print ''; - print $langs->trans('CustomerCode').''; - print $object->code_client; + print $langs->trans('CustomerCode').''; + print ""; + print ''; + print $object->code_client .''; $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongCustomerCode").')'; From b2809e4ee25c671171b878eaa3abfc8f1d717181 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 21 Jan 2021 09:54:26 +0100 Subject: [PATCH 04/82] add trans to copied to clipboard text --- htdocs/langs/en_US/companies.lang | 1 + htdocs/societe/card.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 99bed13179f..e0381d6fdef 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -467,3 +467,4 @@ RestOfEurope=Rest of Europe (EEC) OutOfEurope=Out of Europe (EEC) CurrentOutstandingBillLate=Current outstanding bill late BecarefullChangeThirdpartyBeforeAddProductToInvoice=Be carefull, depending on your product price settings, you should change thirdparty before adding product to POS. +CopiedToClipboard = Copied to clipboard \ No newline at end of file diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 342ee1b8ee3..75771f3d419 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2438,10 +2438,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) selection.addRange( range ); } - + document.execCommand( 'copy' ); window.getSelection().removeAllRanges(); - document.getElementById( \"clipboardChar\" ).innerHTML = 'Copied to clipboard!'; + document.getElementById( \"clipboardChar\" ).innerHTML = '".$langs->trans("CopiedToClipboard")."'; } "; print ''; From 5e67e11eb3aa7e8afe04f9e2775c42c241a5d4b8 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 21 Jan 2021 17:15:32 +0100 Subject: [PATCH 05/82] update societe/card.php clipboard copy in fonction --- htdocs/societe/card.php | 68 ++++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 75771f3d419..511bde61bcf 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2408,7 +2408,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if (!empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled)) { print ''.$langs->trans('Supplier').''; - print yn($object->fournisseur); + print showValueWithCopyAndPasteButton(yn($object->fournisseur),'supplier',$langs); print ''; } @@ -2423,29 +2423,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if ($object->client) { print ''; - print $langs->trans('CustomerCode').''; - print ""; - print ''; - print $object->code_client .''; + print $langs->trans('CustomerCode'); + print ''; + print ''; + print showValueWithCopyAndPasteButton($object->code_client, 'code_client',$langs); + print ''; $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongCustomerCode").')'; @@ -2957,7 +2939,43 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } } - +/** + * @param string $valuetoprint the value to print + * @param string $spanid unique id for a span + * @param Translate $langs the $langs variable + * @return string the string to print for the button + */ +function showValueWithCopyAndPasteButton($valuetoprint,$spanid,$langs){ + $stringtoprint= ''; + $stringtoprint.= $valuetoprint .' '; + $stringtoprint.= ''; + $stringtoprint.=''; + $stringtoprint.=""; + return $stringtoprint; +} // End of page llxFooter(); $db->close(); + From 006fbb18588b11bdcb0bb50edfc2d5a8c68c4312 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 21 Jan 2021 16:16:14 +0000 Subject: [PATCH 06/82] Fixing style errors. --- htdocs/societe/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 511bde61bcf..567cd8483ba 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2408,7 +2408,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if (!empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled)) { print ''.$langs->trans('Supplier').''; - print showValueWithCopyAndPasteButton(yn($object->fournisseur),'supplier',$langs); + print showValueWithCopyAndPasteButton(yn($object->fournisseur), 'supplier', $langs); print ''; } @@ -2426,7 +2426,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print $langs->trans('CustomerCode'); print ''; print ''; - print showValueWithCopyAndPasteButton($object->code_client, 'code_client',$langs); + print showValueWithCopyAndPasteButton($object->code_client, 'code_client', $langs); print ''; $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { @@ -2945,7 +2945,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) * @param Translate $langs the $langs variable * @return string the string to print for the button */ -function showValueWithCopyAndPasteButton($valuetoprint,$spanid,$langs){ +function showValueWithCopyAndPasteButton($valuetoprint, $spanid, $langs) +{ $stringtoprint= ''; $stringtoprint.= $valuetoprint .' '; $stringtoprint.= ''; @@ -2978,4 +2979,3 @@ function showValueWithCopyAndPasteButton($valuetoprint,$spanid,$langs){ // End of page llxFooter(); $db->close(); - From 59d2d021514c66c6b09a0ad3a894255854b5b069 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 21 Jan 2021 17:17:10 +0100 Subject: [PATCH 07/82] removing my tests --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 511bde61bcf..bc4aaf3e864 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2408,7 +2408,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if (!empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled)) { print ''.$langs->trans('Supplier').''; - print showValueWithCopyAndPasteButton(yn($object->fournisseur),'supplier',$langs); + print yn($object->fournisseur); print ''; } From 64d08544b29323dc86b19303fe21a4cddac0aa1b Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 22 Jan 2021 09:09:46 +0100 Subject: [PATCH 08/82] move of function showValueWithCopyPasteButton in function.lib.php --- htdocs/core/lib/functions.lib.php | 39 +++++++++++++++++++++++++++++++ htdocs/societe/card.php | 37 ----------------------------- 2 files changed, 39 insertions(+), 37 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index c146f1f9a47..dcdff379cc0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9231,3 +9231,42 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1) fclose($handle2); } } + +/** + * Create a button to copy $valuetoprint in the clipboard + * @param string $valuetoprint the value to print + * @param string $spanid unique id for a span + * @param Translate $langs the $langs variable + * @return string the string to print for the button + */ +function showValueWithCopyAndPasteButton($valuetoprint, $spanid, $langs) +{ + $stringtoprint= ''; + $stringtoprint.= $valuetoprint .' '; + $stringtoprint.= ''; + $stringtoprint.=''; + $stringtoprint.=""; + return $stringtoprint; +} \ No newline at end of file diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index b25b7bf73b8..0014e4b8ebe 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2939,43 +2939,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } } -/** - * @param string $valuetoprint the value to print - * @param string $spanid unique id for a span - * @param Translate $langs the $langs variable - * @return string the string to print for the button - */ -function showValueWithCopyAndPasteButton($valuetoprint, $spanid, $langs) -{ - $stringtoprint= ''; - $stringtoprint.= $valuetoprint .' '; - $stringtoprint.= ''; - $stringtoprint.=''; - $stringtoprint.=""; - return $stringtoprint; -} // End of page llxFooter(); $db->close(); From 76ce77f7ba93867aa7fd61116be88769dc17837a Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 22 Jan 2021 09:13:04 +0100 Subject: [PATCH 09/82] stickler-ci edit --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index dcdff379cc0..d8a1614cfdc 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9269,4 +9269,4 @@ function showValueWithCopyAndPasteButton($valuetoprint, $spanid, $langs) } "; return $stringtoprint; -} \ No newline at end of file +} From 5a95cc16aa6edd8c219b2b74c2f104bc87546677 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 22 Jan 2021 16:58:47 +0100 Subject: [PATCH 10/82] update clipboardcopypaste with jquery --- htdocs/core/js/lib_foot.js.php | 22 +++++++++++++++++++++ htdocs/core/lib/functions.lib.php | 33 ++++--------------------------- htdocs/societe/card.php | 2 +- 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 9f4e69dcadf..66a57502bb1 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -210,3 +210,25 @@ print ' } }); });'."\n"; + +print "\n/* JS CODE TO ENABLE ClipBoard copy paste*/\n"; +print 'jQuery(\'.clipboardCopyPaste\').click(function() { + console.log(this.firstChild.innerText); + if ( window.getSelection ) { + + selection = window.getSelection(); + + range = document.createRange(); + range.selectNodeContents( this.firstChild ); + + selection.removeAllRanges(); + selection.addRange( range ); + + } + document.execCommand( \'copy\' ); + window.getSelection().removeAllRanges(); + var lastchild = this.lastChild + var tmp =lastchild.innerHTML + lastchild.innerHTML = \''.dol_escape_js($langs->trans('CopiedToClipboard')).'\'; + setTimeout(() => { lastchild.innerHTML = tmp; }, 1000); + })'."\n"; \ No newline at end of file diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d8a1614cfdc..d90e70a1e0c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9239,34 +9239,9 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1) * @param Translate $langs the $langs variable * @return string the string to print for the button */ -function showValueWithCopyAndPasteButton($valuetoprint, $spanid, $langs) +function showValueWithCopyAndPasteButton($valuetoprint) { - $stringtoprint= ''; - $stringtoprint.= $valuetoprint .' '; - $stringtoprint.= ''; - $stringtoprint.=''; - $stringtoprint.=""; - return $stringtoprint; + return ''.dol_escape_js($valuetoprint).' + '; + } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 0014e4b8ebe..caf3b62bd02 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2426,7 +2426,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print $langs->trans('CustomerCode'); print ''; print ''; - print showValueWithCopyAndPasteButton($object->code_client, 'code_client', $langs); + print showValueWithCopyAndPasteButton($object->code_client); print ''; $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { From 3de89be6911088382ea1dd0d128967c029641e69 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 22 Jan 2021 15:59:31 +0000 Subject: [PATCH 11/82] Fixing style errors. --- htdocs/core/js/lib_foot.js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 66a57502bb1..c277beefe70 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -231,4 +231,4 @@ print 'jQuery(\'.clipboardCopyPaste\').click(function() { var tmp =lastchild.innerHTML lastchild.innerHTML = \''.dol_escape_js($langs->trans('CopiedToClipboard')).'\'; setTimeout(() => { lastchild.innerHTML = tmp; }, 1000); - })'."\n"; \ No newline at end of file + })'."\n"; From 7685dee5f662b8a7c1afe4fe8f5ca4c962e6abe4 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 22 Jan 2021 16:59:34 +0100 Subject: [PATCH 12/82] style changes --- htdocs/core/js/lib_foot.js.php | 2 +- htdocs/core/lib/functions.lib.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 66a57502bb1..c277beefe70 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -231,4 +231,4 @@ print 'jQuery(\'.clipboardCopyPaste\').click(function() { var tmp =lastchild.innerHTML lastchild.innerHTML = \''.dol_escape_js($langs->trans('CopiedToClipboard')).'\'; setTimeout(() => { lastchild.innerHTML = tmp; }, 1000); - })'."\n"; \ No newline at end of file + })'."\n"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d90e70a1e0c..daa6d660f9f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9243,5 +9243,5 @@ function showValueWithCopyAndPasteButton($valuetoprint) { return ''.dol_escape_js($valuetoprint).' '; - + } From cfcd51f291b5fe5054898cbfab5ba7836db778c7 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 22 Jan 2021 17:03:39 +0100 Subject: [PATCH 13/82] style errors update --- htdocs/core/lib/functions.lib.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index daa6d660f9f..181e6b4c448 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9235,13 +9235,10 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1) /** * Create a button to copy $valuetoprint in the clipboard * @param string $valuetoprint the value to print - * @param string $spanid unique id for a span - * @param Translate $langs the $langs variable * @return string the string to print for the button */ function showValueWithCopyAndPasteButton($valuetoprint) { return ''.dol_escape_js($valuetoprint).' '; - } From 8dfe39258b856e91ee5d3b47c2bf230f323069f3 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Wed, 27 Jan 2021 23:46:09 +0100 Subject: [PATCH 14/82] FIX 11.0 - when a mandatory extrafield of type sellist contains '0' it should be considered empty and trigger an error message upon insertion --- htdocs/core/class/commonobject.class.php | 1 + htdocs/core/class/extrafields.class.php | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1ff633f46ce..f2c61bc86a3 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5238,6 +5238,7 @@ abstract class CommonObject $mandatorypb = false; if ($attributeType == 'link' && $this->array_options[$key] == '-1') $mandatorypb = true; if ($this->array_options[$key] === '') $mandatorypb = true; + if ($attributeType == 'sellist' && $this->array_options[$key] == '0') $mandatorypb = true; if ($mandatorypb) { dol_syslog("Mandatory extra field ".$key." is empty"); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 57e2bf4284a..ed85a328edc 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2060,9 +2060,12 @@ class ExtraFields if ($this->attributes[$object->table_element]['required'][$key]) // Value is required { - // Check if empty without using GETPOST, value can be alpha, int, array, etc... + // check if functionally empty without using GETPOST (depending on the type of extrafield, a + // technically non-empty value may be treated as empty functionally). + // value can be alpha, int, array, etc... if ((!is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] != 'select' && $_POST["options_".$key] != '0') || (!is_array($_POST["options_".$key]) && empty($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'select') + || (!is_array($_POST["options_".$key]) && isset($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'sellist' && $_POST['options_' . $key] == '0') || (is_array($_POST["options_".$key]) && empty($_POST["options_".$key]))) { //print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key]; From b488bca02016766462fe9042f94c374dc6038f69 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 08:53:13 +0100 Subject: [PATCH 15/82] FIX 16084 --- htdocs/core/lib/project.lib.php | 3 ++- htdocs/projet/index.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index d7c7c53f8de..aaa1e144202 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2183,7 +2183,8 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; $sql2 .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; $sql2 .= " WHERE p.rowid IN (".join(',', $arrayidofprojects).")"; - $sql2 .= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.nom, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_percent, p.opp_amount, p.dateo, p.datee"; + $sql2 .= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.rowid, s.nom, s.name_alias, s.code_client, s.code_compta, s.client, s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur,"; + $sql2 .= " s.logo, s.email, s.entity, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_percent, p.opp_amount, p.dateo, p.datee"; $sql2 .= " ORDER BY p.title, p.ref"; $resql = $db->query($sql2); diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 6c376fc35f3..f2b1820c019 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -322,7 +322,7 @@ $sql .= " WHERE p.entity IN (".getEntity('project').")"; $sql .= " AND p.fk_statut = 1"; if ($mine || empty($user->rights->projet->all->lire)) $sql .= " AND p.rowid IN (".$projectsListId.")"; // If we have this test true, it also means projectset is not 2 if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; -$sql .= " GROUP BY s.rowid, s.nom, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.canvas, s.status"; +$sql .= " GROUP BY s.rowid, s.nom, s.name_alias, s.code_client, s.code_compta, s.client, s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur, s.logo, s.email, s.entity, s.canvas, s.status"; $sql .= $db->order($sortfield, $sortorder); //$sql .= $db->plimit($max + 1, 0); From f024f06df7831c4456d4ae1bac635308ba1d1d1e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 09:23:28 +0100 Subject: [PATCH 16/82] Fix url --- build/debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/debian/control b/build/debian/control index 0ef5367072f..eed54669555 100755 --- a/build/debian/control +++ b/build/debian/control @@ -4,7 +4,7 @@ Priority: optional Maintainer: Laurent Destailleur (eldy) # Uploaders: Laurent Destailleur (eldy) # Only if differs from Maintainer Standards-Version: 3.9.6 -Homepage: http://www.dolibarr.org +Homepage: https://www.dolibarr.org Build-Depends: debhelper (>= 9), po-debconf # This package need at least debian 7 or ubuntu 13.04 or any distribution based on this version From ba3e90229214bb5cfcc5f88f2d0892a569571961 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 09:25:58 +0100 Subject: [PATCH 17/82] FIX #16080 --- htdocs/comm/mailing/list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 9da825e262e..8a005d2dc82 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -119,9 +119,8 @@ llxHeader('', $langs->trans("Mailing"), 'EN:Module_EMailing|FR:Module_Mailing|ES $form = new Form($db); -if ($filteremail) -{ - $sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi,"; +if ($filteremail) { + $sql = "SELECT m.rowid, m.titre as title, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi,"; $sql .= " mc.statut as sendstatut"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql .= " WHERE m.rowid = mc.fk_mailing AND m.entity = ".$conf->entity; @@ -131,7 +130,7 @@ if ($filteremail) if (!$sortorder) $sortorder = "ASC"; if (!$sortfield) $sortfield = "m.rowid"; } else { - $sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi"; + $sql = "SELECT m.rowid, m.titre as title, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m"; $sql .= " WHERE m.entity = ".$conf->entity; if ($search_ref) $sql .= " AND m.rowid = '".$db->escape($search_ref)."'"; @@ -238,9 +237,10 @@ if ($resql) print $email->getNomUrl(1); print ''; + // Title print ''.$obj->title.''; - // Date creation + // Date creation print ''; print dol_print_date($db->jdate($obj->datec), 'day'); print ''; From 0b393676e6816c5f4008125ac5594bb6224fdfec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 09:30:01 +0100 Subject: [PATCH 18/82] Fix group by --- htdocs/compta/index.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 5614659eac0..1d4d1a37354 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -161,8 +161,9 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) $sql .= $hookmanager->resPrint; $sql .= " GROUP BY f.rowid, f.ref, f.datef, f.total, f.tva, f.total_ttc, f.ref_client, f.type, f.fk_statut, f.paye,"; - $sql .= " s.email, s.nom, s.rowid, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,"; + $sql .= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, s.code_fournisseur, s.code_compta_fournisseur,"; $sql .= " cc.rowid, cc.code"; + if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user"; // Add Group from hooks $parameters = array(); From f462e353e92e0c268a12220760d5b14ab83c7762 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 09:59:13 +0100 Subject: [PATCH 19/82] FIX #16079 --- htdocs/compta/facture/class/facture.class.php | 18 +++++------ htdocs/core/lib/date.lib.php | 31 +++++++++++++------ 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 24f5b748e52..f036145161d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1191,23 +1191,23 @@ class Facture extends CommonInvoice { unset($object->lines[$i]); } - // Bloc to update dates of service (month by month only if previously filled at 1d near start or end of month) + + // Bloc to update dates of service (month by month only if previously filled and similare to start and end of month) // If it's a service with start and end dates - if (!empty($line->date_start) && !empty($line->date_end)) { + if (!empty($conf->global->INVOICE_AUTO_NEXT_MONTH_ON_LINES) && !empty($line->date_start) && !empty($line->date_end)) { // Get the dates $start = dol_getdate($line->date_start); $end = dol_getdate($line->date_end); // Get the first and last day of the month $first = dol_get_first_day($start['year'], $start['mon']); - $last = dol_get_first_day($end['year'], $end['mon']); + $last = dol_get_last_day($end['year'], $end['mon']); - // Get diff betweend start/end of month and previously filled - $diffFirst = num_between_day($first, dol_mktime($start['hours'], $start['minutes'], $start['seconds'], $start['mon'], $start['mday'], $start['year'], 'user')); - $diffLast = num_between_day(dol_mktime($end['hours'], $end['minutes'], $end['seconds'], $end['mon'], $end['mday'], $end['year'], 'user'), $last); - - // If there is <= 1d (or 2?) of start/or/end of month - if ($diffFirst <= 2 && $diffLast <= 2) { + //print dol_print_date(dol_mktime(0, 0, 0, $start['mon'], $start['mday'], $start['year'], 'gmt'), 'dayhour').' '.dol_print_date($first, 'dayhour').'
'; + //print dol_mktime(23, 59, 59, $end['mon'], $end['mday'], $end['year'], 'gmt').' '.$last.'
';exit; + // If start date is first date of month and end date is last date of month + if (dol_mktime(0, 0, 0, $start['mon'], $start['mday'], $start['year'], 'gmt') == $first + && dol_mktime(23, 59, 59, $end['mon'], $end['mday'], $end['year'], 'gmt') == $last) { $nextMonth = dol_get_next_month($end['mon'], $end['year']); $newFirst = dol_get_first_day($nextMonth['year'], $nextMonth['month']); $newLast = dol_get_last_day($nextMonth['year'], $nextMonth['month']); diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 3a889367dc1..74b091865ff 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -356,7 +356,8 @@ function dol_stringtotime($string, $gm = 1) } -/** Return previous day +/** + * Return previous day * * @param int $day Day * @param int $month Month @@ -371,7 +372,8 @@ function dol_get_prev_day($day, $month, $year) return array('year' => $tmparray['year'], 'month' => $tmparray['mon'], 'day' => $tmparray['mday']); } -/** Return next day +/** + * Return next day * * @param int $day Day * @param int $month Month @@ -386,7 +388,8 @@ function dol_get_next_day($day, $month, $year) return array('year' => $tmparray['year'], 'month' => $tmparray['mon'], 'day' => $tmparray['mday']); } -/** Return previous month +/** + * Return previous month * * @param int $month Month * @param int $year Year @@ -405,7 +408,8 @@ function dol_get_prev_month($month, $year) return array('year' => $prev_year, 'month' => $prev_month); } -/** Return next month +/** + * Return next month * * @param int $month Month * @param int $year Year @@ -424,7 +428,8 @@ function dol_get_next_month($month, $year) return array('year' => $next_year, 'month' => $next_month); } -/** Return previous week +/** + * Return previous week * * @param int $day Day * @param int $week Week @@ -442,7 +447,8 @@ function dol_get_prev_week($day, $week, $month, $year) return array('year' => $tmparray['year'], 'month' => $tmparray['mon'], 'day' => $tmparray['mday']); } -/** Return next week +/** + * Return next week * * @param int $day Day * @param int $week Week @@ -461,7 +467,8 @@ function dol_get_next_week($day, $week, $month, $year) return array('year' => $tmparray['year'], 'month' => $tmparray['mon'], 'day' => $tmparray['mday']); } -/** Return GMT time for first day of a month or year +/** + * Return GMT time for first day of a month or year * * @param int $year Year * @param int $month Month @@ -478,7 +485,9 @@ function dol_get_first_day($year, $month = 1, $gm = false) } -/** Return GMT time for last day of a month or year +/** + * Return GMT time for last day of a month or year. + * Note: The timestamp contains last day and last hours (23:59:59) * * @param int $year Year * @param int $month Month @@ -504,7 +513,8 @@ function dol_get_last_day($year, $month = 12, $gm = false) return $datelim; } -/** Return GMT time for last hour of a given GMT date (it removes hours, min and second part) +/** + * Return GMT time for last hour of a given GMT date (it removes hours, min and second part) * * @param int $date Date * @return int Date for last hour of a given date @@ -515,7 +525,8 @@ function dol_get_last_hour($date) return dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year'], false); } -/** Return GMT time for first hour of a given GMT date (it removes hours, min and second part) +/** + * Return GMT time for first hour of a given GMT date (it removes hours, min and second part) * * @param int $date Date * @return int Date for last hour of a given date From 9d0945bbe2bb892b198f824391190d51c74699a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 10:30:09 +0100 Subject: [PATCH 20/82] FIX #16077 --- htdocs/core/lib/functions.lib.php | 2 +- htdocs/fichinter/card.php | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 31939708663..26f62320b3b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1984,7 +1984,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = { global $conf, $langs; - if ($tzoutput == 'auto') { + if ($tzoutput === 'auto') { $tzoutput = (empty($conf) ? 'tzserver' : $conf->tzuserinputkey); } diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 2805089aaf3..a4fed934936 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -217,8 +217,9 @@ if (empty($reshook)) if (!empty($origin) && !empty($originid)) { // Parse element/subelement (ex: project_task) - $element = $subelement = $_POST['origin']; - if (preg_match('/^([^_]+)_([^_]+)/i', $_POST['origin'], $regs)) + $regs = array(); + $element = $subelement = GETPOST('origin', 'alphanohtml'); + if (preg_match('/^([^_]+)_([^_]+)/i', GETPOST('origin', 'alphanohtml'), $regs)) { $element = $regs[1]; $subelement = $regs[2]; @@ -478,8 +479,7 @@ if (empty($reshook)) $desc = GETPOST('np_desc', 'restricthtml'); $date_intervention = dol_mktime(GETPOST('dihour', 'int'), GETPOST('dimin', 'int'), 0, GETPOST('dimonth', 'int'), GETPOST('diday', 'int'), GETPOST('diyear', 'int')); - $duration = empty($conf->global->FICHINTER_WITHOUT_DURATION) ?convertTime2Seconds(GETPOST('durationhour', 'int'), GETPOST('durationmin', 'int')) : 0; - + $duration = empty($conf->global->FICHINTER_WITHOUT_DURATION) ? convertTime2Seconds(GETPOST('durationhour', 'int'), GETPOST('durationmin', 'int')) : 0; // Extrafields $extrafields->fetch_name_optionals_label($object->table_element_line); @@ -1335,8 +1335,7 @@ if ($action == 'create') print '
'; print ''; print ''; - if ($action == 'editline') - { + if ($action == 'editline') { print ''; print ''; } else { @@ -1348,8 +1347,9 @@ if ($action == 'create') $sql .= ' ft.date as date_intervention'; $sql .= ' FROM '.MAIN_DB_PREFIX.'fichinterdet as ft'; $sql .= ' WHERE ft.fk_fichinter = '.$object->id; - if (!empty($conf->global->FICHINTER_HIDE_EMPTY_DURATION)) + if (!empty($conf->global->FICHINTER_HIDE_EMPTY_DURATION)) { $sql .= ' AND ft.duree <> 0'; + } $sql .= ' ORDER BY ft.rang ASC, ft.date ASC, ft.rowid'; $resql = $db->query($sql); @@ -1376,13 +1376,11 @@ if ($action == 'create') print ' '; print "\n"; } - while ($i < $num) - { + while ($i < $num) { $objp = $db->fetch_object($resql); // Ligne en mode visu - if ($action != 'editline' || GETPOST('line_id', 'int') != $objp->rowid) - { + if ($action != 'editline' || GETPOST('line_id', 'int') != $objp->rowid) { print ''; // No. @@ -1402,8 +1400,7 @@ if ($action == 'create') print "\n"; - - // Econ to edit and delete + // Icon to edit and delete if ($object->statut == 0 && $user->rights->ficheinter->creer) { print ''; From 4d5cda20e73a6e8e0ebe9c87bdbbbee9a4990c72 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 11:15:11 +0100 Subject: [PATCH 21/82] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 181e6b4c448..9d888c56cc0 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9239,6 +9239,6 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1) */ function showValueWithCopyAndPasteButton($valuetoprint) { - return ''.dol_escape_js($valuetoprint).' - '; + $result = ''.$valuetoprint.''; + return $result; } From 1a7f3938f2ef43afdef4edfb2c3d3ae0aa9f0712 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 12:02:16 +0100 Subject: [PATCH 22/82] FIX Missing language ico --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 989609ba65c..ec866514272 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7399,6 +7399,7 @@ function picto_from_langcode($codelang, $moreatt = '') 'da_DA' => 'dk', 'fr_CA' => 'mq', 'sv_SV' => 'se', + 'sw_SW' => 'unknown', 'AQ' => 'unknown', 'CW' => 'unknown', 'IM' => 'unknown', @@ -9247,6 +9248,6 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1) */ function showValueWithCopyAndPasteButton($valuetoprint) { - $result = ''.$valuetoprint.''; + $result = ''.$valuetoprint.''; return $result; } From cf4a12d715bc316b9e9397b472cb21ba5a019e52 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 12:02:16 +0100 Subject: [PATCH 23/82] FIX Missing language ico Conflicts: htdocs/core/lib/functions.lib.php --- htdocs/core/lib/functions.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 26f62320b3b..a509d3bd7a6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7391,6 +7391,7 @@ function picto_from_langcode($codelang, $moreatt = '') 'da_DA' => 'dk', 'fr_CA' => 'mq', 'sv_SV' => 'se', + 'sw_SW' => 'unknown', 'AQ' => 'unknown', 'CW' => 'unknown', 'IM' => 'unknown', From ce3279c462eb14008810307648cd6eb6e151dd93 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 12:34:54 +0100 Subject: [PATCH 24/82] NEW Add function showValueWithCopyAndPasteButton() to add a copy/paste button on a text. --- htdocs/core/js/lib_foot.js.php | 31 +++++++++++++++++++++---------- htdocs/core/lib/functions.lib.php | 10 ++++++---- htdocs/langs/en_US/companies.lang | 1 - htdocs/langs/en_US/main.lang | 3 ++- htdocs/theme/eldy/global.inc.php | 9 +++++++++ 5 files changed, 38 insertions(+), 16 deletions(-) diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index c277beefe70..13e5226eaa6 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -212,23 +212,34 @@ print ' });'."\n"; print "\n/* JS CODE TO ENABLE ClipBoard copy paste*/\n"; -print 'jQuery(\'.clipboardCopyPaste\').click(function() { - console.log(this.firstChild.innerText); - if ( window.getSelection ) { - +print 'jQuery(\'.clipboardCPShowOnHover\').hover( + function() { + console.log("We hover a value with a copy paste feature"); + $(this).children(".clipboardCPButton, .clipboardCPText").show(); + }, + function() { + console.log("We hover out the value with a copy paste feature"); + $(this).children(".clipboardCPButton, .clipboardCPText").hide(); + } + );'; +print 'jQuery(\'.clipboardCPButton\').click(function() { + /* console.log(this.parentNode); */ + console.log("We click on a clipboardCPButton tag"); + if (window.getSelection) { selection = window.getSelection(); - + range = document.createRange(); - range.selectNodeContents( this.firstChild ); - + range.selectNodeContents(this.parentNode.firstChild); + selection.removeAllRanges(); selection.addRange( range ); - } document.execCommand( \'copy\' ); window.getSelection().removeAllRanges(); - var lastchild = this.lastChild - var tmp =lastchild.innerHTML + + /* Show message */ + var lastchild = this.parentNode.lastChild; + var tmp = lastchild.innerHTML lastchild.innerHTML = \''.dol_escape_js($langs->trans('CopiedToClipboard')).'\'; setTimeout(() => { lastchild.innerHTML = tmp; }, 1000); })'."\n"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ec866514272..1bdd1cd1d2f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9243,11 +9243,13 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1) /** * Create a button to copy $valuetoprint in the clipboard - * @param string $valuetoprint the value to print - * @return string the string to print for the button + * + * @param string $valuetoprint The value to print + * @param int $showonlyonhover Show the copypaste button only on hover + * @return string The string to print for the button */ -function showValueWithCopyAndPasteButton($valuetoprint) +function showValueWithCopyAndPasteButton($valuetoprint, $showonlyonhover = 1) { - $result = ''.$valuetoprint.''; + $result = ''.$valuetoprint.''; return $result; } diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index e0381d6fdef..99bed13179f 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -467,4 +467,3 @@ RestOfEurope=Rest of Europe (EEC) OutOfEurope=Out of Europe (EEC) CurrentOutstandingBillLate=Current outstanding bill late BecarefullChangeThirdpartyBeforeAddProductToInvoice=Be carefull, depending on your product price settings, you should change thirdparty before adding product to POS. -CopiedToClipboard = Copied to clipboard \ No newline at end of file diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 5cdb042f933..a5cd750e3d6 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1119,4 +1119,5 @@ Civility=Civility AffectTag=Affect Tag ConfirmAffectTag=Bulk Tag Affect ConfirmAffectTagQuestion=Are you sure you want to affect tags to the %s selected record(s)? -CategTypeNotFound=No tag type found for type of records \ No newline at end of file +CategTypeNotFound=No tag type found for type of records +CopiedToClipboard=Copied to clipboard diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index c4f862863e1..ee60348454e 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -6562,6 +6562,15 @@ div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before } +/* ============================================================================== */ +/* For copypaste feature */ +/* ============================================================================== */ + +.clipboardCPShowOnHover .clipboardCPButton { + display: none; +} + + /* ============================================================================== */ /* CSS style used for small screen */ /* ============================================================================== */ From 3eebbc6426250959f1442d1f5934d286c9bc545a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 12:44:45 +0100 Subject: [PATCH 25/82] NEW Add function showValueWithClipboardCPButton() to add a copy/paste button on a text. --- htdocs/core/lib/functions.lib.php | 2 +- htdocs/societe/card.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1bdd1cd1d2f..d0f3bb622b2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9248,7 +9248,7 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1) * @param int $showonlyonhover Show the copypaste button only on hover * @return string The string to print for the button */ -function showValueWithCopyAndPasteButton($valuetoprint, $showonlyonhover = 1) +function showValueWithClipboardCPButton($valuetoprint, $showonlyonhover = 1) { $result = ''.$valuetoprint.''; return $result; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 0347efa7411..260800a77f0 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2415,7 +2415,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // Prefix if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { - print ''.$langs->trans('Prefix').''.$object->prefix_comm.''; + print ''.$langs->trans('Prefix').''.dol_escape_htmltag($object->prefix_comm).''; print ''; } @@ -2426,7 +2426,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print $langs->trans('CustomerCode'); print ''; print ''; - print showValueWithCopyAndPasteButton($object->code_client); + print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client)); print ''; $tmpcheck = $object->check_codeclient(); if ($tmpcheck != 0 && $tmpcheck != -5) { @@ -2441,7 +2441,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print $langs->trans('SupplierCode').''; - print $object->code_fournisseur; + print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); $tmpcheck = $object->check_codefournisseur(); if ($tmpcheck != 0 && $tmpcheck != -5) { print ' ('.$langs->trans("WrongSupplierCode").')'; @@ -2454,7 +2454,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if (!empty($conf->barcode->enabled)) { print ''; - print $langs->trans('Gencod').''.dol_escape_htmltag($object->barcode); + print $langs->trans('Gencod').''.showValueWithClipboardCPButton(dol_escape_htmltag($object->barcode)); print ''; print ''; } @@ -2470,7 +2470,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; print ''.$idprof.''; $key = 'idprof'.$i; - print $object->$key; + print showValueWithClipboardCPButton(dol_escape_htmltag($object->$key)); if ($object->$key) { if ($object->id_prof_check($i, $object) > 0) print '   '.$object->id_prof_url($i, $object); From 2f98d8035c866cd93fa559d096fd55c6fa41e947 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Thu, 28 Jan 2021 13:37:43 +0100 Subject: [PATCH 26/82] Fix: Bad supplier price updater --- htdocs/fourn/commande/dispatch.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 2ada245ff8b..a47e544848d 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2010-2019 Juanjo Menent + * Copyright (C) 2010-2021 Juanjo Menent * Copyright (C) 2014 Cedric Gross * Copyright (C) 2016 Florian Henry * Copyright (C) 2017 Ferran Marcet @@ -268,12 +268,16 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) if (!$error && !empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) { if (empty($conf->multicurrency->enabled) && empty($conf->dynamicprices->enabled)) { $dto = GETPOST("dto_".$reg[1].'_'.$reg[2]); + if (empty($dto)) { + $dto = 0; + } + //update supplier price if (isset($_POST[$saveprice])) { // TODO Use class $sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price"; - $sql .= " SET unitprice='".GETPOST($pu)."'"; - $sql .= ", price=".GETPOST($pu)."*quantity"; + $sql .= " SET unitprice='".price2num(GETPOST($pu),'MT')."'"; + $sql .= ", price=".price2num(GETPOST($pu),'MT')."*quantity"; $sql .= ", remise_percent='".$dto."'"; $sql .= " WHERE fk_soc=".$object->socid; $sql .= " AND fk_product=".GETPOST($prod, 'int'); From c63a124d1c3813a4400b814bcc0c4e8f5c79c8b4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 14:13:29 +0100 Subject: [PATCH 27/82] More complete fix --- htdocs/fourn/commande/dispatch.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index a47e544848d..c6813af0eba 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -227,6 +227,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) foreach ($_POST as $key => $value) { // without batch module enabled + $reg = array(); if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $pos++; @@ -276,11 +277,11 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner) if (isset($_POST[$saveprice])) { // TODO Use class $sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price"; - $sql .= " SET unitprice='".price2num(GETPOST($pu),'MT')."'"; - $sql .= ", price=".price2num(GETPOST($pu),'MT')."*quantity"; + $sql .= " SET unitprice='".price2num(GETPOST($pu), 'MU')."'"; + $sql .= ", price=".price2num(GETPOST($pu), 'MU')."*quantity"; $sql .= ", remise_percent='".$dto."'"; - $sql .= " WHERE fk_soc=".$object->socid; - $sql .= " AND fk_product=".GETPOST($prod, 'int'); + $sql .= " WHERE fk_soc=".((int) $object->socid); + $sql .= " AND fk_product=".((int) GETPOST($prod, 'int')); $resql = $db->query($sql); } From f3c33be871a37a047b3b8accccfa0c89e5ac94ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 15:47:32 +0100 Subject: [PATCH 28/82] Fix css --- htdocs/societe/card.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 2f51995c785..7b997fbd613 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1199,9 +1199,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print ''; // Name, firstname - print '
'; - if ($object->particulier || $private) - { + print '
'; + if ($object->particulier || $private) { print ''.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName', 'name').''; } else { print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).''; From 745e2be67832e4b26f79ca0f255774af8d6de5c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 16:00:22 +0100 Subject: [PATCH 29/82] FIX encoding status in graph of vendor proposals --- .../class/supplier_proposal.class.php | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index a939b95ffca..890dff34812 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2183,16 +2183,16 @@ class SupplierProposal extends CommonObject { global $langs; $langs->load("supplier_proposal"); - $this->labelStatus[self::STATUS_DRAFT] = $langs->trans("SupplierProposalStatusDraft"); - $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans("SupplierProposalStatusValidated"); - $this->labelStatus[self::STATUS_SIGNED] = $langs->trans("SupplierProposalStatusSigned"); - $this->labelStatus[self::STATUS_NOTSIGNED] = $langs->trans("SupplierProposalStatusNotSigned"); - $this->labelStatus[self::STATUS_CLOSE] = $langs->trans("SupplierProposalStatusClosed"); - $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans("SupplierProposalStatusDraftShort"); - $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans("Opened"); - $this->labelStatusShort[self::STATUS_SIGNED] = $langs->trans("SupplierProposalStatusSignedShort"); - $this->labelStatusShort[self::STATUS_NOTSIGNED] = $langs->trans("SupplierProposalStatusNotSignedShort"); - $this->labelStatusShort[self::STATUS_CLOSE] = $langs->trans("SupplierProposalStatusClosedShort"); + $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv("SupplierProposalStatusDraft"); + $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv("SupplierProposalStatusValidated"); + $this->labelStatus[self::STATUS_SIGNED] = $langs->transnoentitiesnoconv("SupplierProposalStatusSigned"); + $this->labelStatus[self::STATUS_NOTSIGNED] = $langs->transnoentitiesnoconv("SupplierProposalStatusNotSigned"); + $this->labelStatus[self::STATUS_CLOSE] = $langs->transnoentitiesnoconv("SupplierProposalStatusClosed"); + $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv("SupplierProposalStatusDraftShort"); + $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv("Opened"); + $this->labelStatusShort[self::STATUS_SIGNED] = $langs->transnoentitiesnoconv("SupplierProposalStatusSignedShort"); + $this->labelStatusShort[self::STATUS_NOTSIGNED] = $langs->transnoentitiesnoconv("SupplierProposalStatusNotSignedShort"); + $this->labelStatusShort[self::STATUS_CLOSE] = $langs->transnoentitiesnoconv("SupplierProposalStatusClosedShort"); } $statusnew = ''; From 32c33b72d6df48fa03a7cf4ce4b3b643a3d3eaa5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 16:10:13 +0100 Subject: [PATCH 30/82] FIX Sql error in group by with postgresql --- htdocs/fourn/facture/list.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index b0c58572955..317def67098 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -497,7 +497,9 @@ if (!$search_all) $sql .= " GROUP BY f.rowid, f.ref, f.ref_supplier, f.type, f.datef, f.date_lim_reglement, f.fk_mode_reglement, f.fk_cond_reglement,"; $sql .= " f.total_ht, f.total_ttc, f.total_tva, f.paye, f.fk_statut, f.libelle, f.datec, f.tms,"; $sql .= " f.localtax1, f.localtax2,"; + $sql .= ' f.fk_multicurrency, f.multicurrency_code, f.multicurrency_tx, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc,'; $sql .= " f.note_public, f.note_private,"; + $sql .= " f.fk_user_author,"; $sql .= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,'; $sql .= " typent.code,"; $sql .= " state.code_departement, state.nom,"; From db9b6b53daf121ec8d463491fa3609314036ac0d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 16:31:32 +0100 Subject: [PATCH 31/82] NEW Can set a label as placeholder for combo lists. --- htdocs/admin/modules.php | 16 ++++++++++------ htdocs/core/class/html.form.class.php | 2 +- htdocs/core/lib/ajax.lib.php | 5 ++++- htdocs/theme/eldy/global.inc.php | 19 +++++++++++++++---- htdocs/theme/md/style.css.php | 7 +++++++ 5 files changed, 37 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 1cf784de3c5..78f06b0ee2e 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -523,10 +523,10 @@ if ($mode == 'common' || $mode == 'commonkanban') { $moreforfilter .= '
'; $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('Keyword').': '; + $moreforfilter .= img_picto($langs->trans("Filter"), 'filter', 'class="paddingright opacitymedium"').''; $moreforfilter .= '
'; $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('Origin').': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200', 1); + $moreforfilter .= $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), $langs->trans('Origin'), 0, 0, '', 0, 0, 0, '', 'maxwidth200', 1); $moreforfilter .= '
'; if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { $array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable")); @@ -540,11 +540,11 @@ if ($mode == 'common' || $mode == 'commonkanban') { $array_version['development'] = $langs->trans("Development"); } $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('Version').': '.$form->selectarray('search_version', $array_version, $search_version, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1); + $moreforfilter .= $form->selectarray('search_version', $array_version, $search_version, $langs->trans('Version'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1); $moreforfilter .= '
'; } $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('Status').': '.$form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1); + $moreforfilter .= $form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, $langs->trans('Status'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1); $moreforfilter .= '
'; $moreforfilter .= ' '; $moreforfilter .= '
'; @@ -937,6 +937,8 @@ if ($mode == 'common' || $mode == 'commonkanban') { if ($mode == 'marketplace') { print dol_get_fiche_head($head, $mode, '', -1); + print '
'; + // Marketplace print '
'; print ''."\n"; @@ -977,8 +979,8 @@ if ($mode == 'marketplace') { ?> -
trans('Keyword') ?>: -
+
+
@@ -1190,6 +1192,8 @@ if ($mode == 'deploy') { if ($mode == 'develop') { print dol_get_fiche_head($head, $mode, '', -1); + print '
'; + // Marketplace print "
\n"; print "\n"; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3bb3afae852..64996e4e6c2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6427,7 +6427,7 @@ class Form * @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect * @param array $array Array like array(key => value) or array(key=>array('label'=>..., 'data-...'=>..., 'disabled'=>..., 'css'=>...)) * @param string|string[] $id Preselected key or preselected keys for multiselect - * @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (key is -1 and value is '' or ' ' if 1, key is -1 and value is text if string), <0 to add an empty value with key that is this value. + * @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (key is -1 and value is '' or ' ' if 1, key is -1 and value is the text if it is a placeholder string), <0 to add an empty value with key that is this value. * @param int $key_in_label 1 to show key into label with format "[key] value" * @param int $value_as_key 1 to use value as key * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 92748f8e26f..24bf79143f3 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -434,14 +434,17 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = minimumInputLength: '.$minLengthToAutocomplete.', language: select2arrayoflanguage, containerCssClass: \':all:\', /* Line to add class of origin SELECT propagated to the new tag */ templateResult: function (data, container) { /* Format visible output into combo list */ /* Code to add class of origin OPTION propagated to the new select2
  • tag */ if (data.element) { $(container).addClass($(data.element).attr("class")); } //console.log(data.html); + if (data.id == -1) return \' \'; if ($(data.element).attr("data-html") != undefined) return htmlEntityDecodeJs($(data.element).attr("data-html")); // If property html set, we decode html entities and use this - return data.text; + return data.text; }, templateSelection: function (selection) { /* Format visible output of selected value */ + if (selection.id == -1) return \'\'+selection.text+\'\'; return selection.text; }, escapeMarkup: function(markup) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index ee60348454e..3b69dfbc0ba 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -125,6 +125,10 @@ th.liste_titre a div div:hover, th.liste_titre_sel a div div:hover { text-decora tr.liste_titre th.liste_titre_sel:not(.maxwidthsearch), tr.liste_titre td.liste_titre_sel:not(.maxwidthsearch), tr.liste_titre th.liste_titre:not(.maxwidthsearch), tr.liste_titre td.liste_titre:not(.maxwidthsearch) { opacity: 0.8; } /* th.liste_titre_sel a, th.liste_titre a, td.liste_titre_sel a, td.liste_titre a { color: #766; } */ + +input { + font-size: unset; +} input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { background-color: var(--inputbackgroundcolor); color: var(--colortext); @@ -174,9 +178,12 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla input { line-height: 1.3em; - padding: 5px; + padding: 4px; padding-left: 5px; } +.liste_titre input { + padding: 5px; +} select { padding-top: 5px; padding-right: 4px; @@ -440,8 +447,12 @@ input:-webkit-autofill { background-image:none !important; -webkit-box-shadow: 0 0 0 50px #FDFFF0 inset; } -::-webkit-input-placeholder { color:#ccc; } -input:-moz-placeholder { color:#ccc; } + +/* CSS for placeholder */ +.placeholder { color: #ccc; } +::-webkit-input-placeholder { color: #ccc; } +input:-moz-placeholder { color: #ccc; } + input[name=price], input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight], input[name=net_measure], select[name=incoterm_id] { margin-right: 6px; } fieldset { border: 1px solid #AAAAAA !important; } .legendforfieldsetstep { padding-bottom: 10px; } @@ -4139,7 +4150,7 @@ div.boximport { .fieldrequired { font-weight: bold; color: var(--fieldrequiredcolor) !important; } -td.widthpictotitle { width: 26px; text-align: ; } +td.widthpictotitle { width: 38px; text-align: ; } span.widthpictotitle { font-size: 1.7em; } table.titlemodulehelp tr td img.widthpictotitle { width: 80px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index a9fbc589a12..ae60254ea13 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -297,6 +297,9 @@ a:link, a:visited, a:hover, a:active { font-family: ; fo a:hover { text-decoration: underline; color: rgb(); } a.commonlink { color: rgb() !important; text-decoration: none; } +input { + font-size: unset; +} input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { background-color: #FDFDFD; } @@ -568,11 +571,15 @@ input:-webkit-autofill { background-image:none !important; -webkit-box-shadow: 0 0 0 50px #FBFFEA inset; } + +/* CSS for placeholder */ +.placeholder { color: #ccc; } ::-webkit-input-placeholder { color:#ccc; } :-moz-placeholder { color:#bbb; } /* firefox 18- */ ::-moz-placeholder { color:#bbb; } /* firefox 19+ */ :-ms-input-placeholder { color:#ccc; } /* ie */ input:-moz-placeholder { color:#ccc; } + input[name=price], input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight], input[name=net_measure], select[name=incoterm_id] { margin-right: 6px; } fieldset { border: 1px solid #AAAAAA !important; } .legendforfieldsetstep { padding-bottom: 10px; } From cce38a9e6d3e992439e265d4cc4bdc34d72ad18d Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 28 Jan 2021 16:58:55 +0100 Subject: [PATCH 32/82] NEW : fk_user on social charge --- htdocs/compta/sociales/card.php | 41 ++++++++++++++++++- .../sociales/class/chargesociales.class.php | 9 ++-- htdocs/compta/sociales/list.php | 34 +++++++++++++-- .../mysql/tables/llx_chargesociales.sql | 1 + 4 files changed, 77 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index d7f20622a43..486049159b2 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2016-2018 Frédéric France * Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2021 Gauthier VERDOL * * 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 @@ -27,9 +28,11 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; if (!empty($conf->projet->enabled)) { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -40,7 +43,7 @@ if (!empty($conf->accounting->enabled)) { } // Load translation files required by the page -$langs->loadLangs(array('compta', 'bills', 'banks')); +$langs->loadLangs(array('compta', 'bills', 'banks', 'hrm')); $id = GETPOST('id', 'int'); $action = GETPOST('action', 'aZ09'); @@ -51,6 +54,7 @@ $dateech = dol_mktime(GETPOST('echhour'), GETPOST('echmin'), GETPOST('echsec'), $dateperiod = dol_mktime(GETPOST('periodhour'), GETPOST('periodmin'), GETPOST('periodsec'), GETPOST('periodmonth'), GETPOST('periodday'), GETPOST('periodyear')); $label = GETPOST('label', 'alpha'); $actioncode = GETPOST('actioncode'); +$fk_user = GETPOST('userid', 'int'); // Security check $socid = GETPOST('socid', 'int'); @@ -94,6 +98,12 @@ if ($action == 'classin' && $user->rights->tax->charges->creer) $object->setProject(GETPOST('projectid')); } +if($action == 'setfk_user' && $user->rights->tax->charges->creer) { + $object->fetch($id); + $object->fk_user = $fk_user; + $object->update($user); +} + if ($action == 'setlib' && $user->rights->tax->charges->creer) { $object->fetch($id); @@ -173,6 +183,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer) $object->date_ech = $dateech; $object->periode = $dateperiod; $object->amount = $amount; + $object->fk_user = $fk_user; $object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->fk_account = GETPOST('fk_account', 'int'); $object->fk_project = GETPOST('fk_project'); @@ -218,6 +229,7 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->cre $object->date_ech = $dateech; $object->periode = $dateperiod; $object->amount = price2num($amount); + $object->fk_user = $fk_user; $result = $object->update($user); if ($result <= 0) @@ -365,6 +377,12 @@ if ($action == 'create') print '
  • '; print ''; + // Employee + print ''; + print ''; + // Project if (!empty($conf->projet->enabled)) { @@ -467,6 +485,26 @@ if ($id > 0) // Ref customer $morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); + + // Employee + if($action != 'editfk_user') { + $morehtmlref .= '
    ' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); + + if(!empty($object->fk_user)) { + $userstatic = new User($db); + $userstatic->fetch($object->fk_user); + $morehtmlref .= $userstatic->getNomUrl(1); + } + } else { + $morehtmlref .= '
    '.$langs->trans('Employee').' : '; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $form->select_dolusers($object->fk_user, 'userid', 1); + $morehtmlref .= ''; + $morehtmlref .= ''; + } + // Project if (!empty($conf->projet->enabled)) { @@ -553,6 +591,7 @@ if ($id > 0) print ''; } + // Mode of payment print '
    '; + print $langs->trans('Employee'); + print ''.$form->select_dolusers($fk_user, 'userid', 1).'
    '.$langs->trans("AmountTTC").''.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).'
    '; print ''; // Type print ''; // Ref Project if (!empty($conf->projet->enabled)) print ''; @@ -256,6 +267,7 @@ if ($resql) print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "id", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "cs.libelle", "", $param, 'class="left"', $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder); + print_liste_field_titre("Employee", $_SERVER["PHP_SELF"], "u.lastname", "", $param, 'class="left"', $sortfield, $sortorder); if (!empty($conf->projet->enabled)) print_liste_field_titre('ProjectRef', $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "periode", "", $param, 'align="center"', $sortfield, $sortorder); @@ -265,7 +277,7 @@ if ($resql) print "\n"; $i = 0; - $totalarray = array(); + $totalarray = $TLoadedUsers = array(); while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); @@ -294,6 +306,20 @@ if ($resql) print "\n"; if (!$i) $totalarray['nbfield']++; + // Employee + print "\n"; + if (!$i) $totalarray['nbfield']++; + // Project Ref if (!empty($conf->projet->enabled)) { print '"; if (!$i) $totalarray['nbfield']++; From 83dc1e8cd088313721487601a8abce3755c3eaea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 23:27:01 +0100 Subject: [PATCH 49/82] Fix responsive --- htdocs/societe/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index a4ad5ec590e..402e85d9b39 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1259,7 +1259,7 @@ while ($i < min($num, $limit)) if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) { // Prospect level - print '"; if (!$i) $totalarray['nbfield']++; From 4812dd27433d93cb7d2d9ed6ec5a1cea564d4461 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 23:28:33 +0100 Subject: [PATCH 50/82] Fix responsive --- htdocs/societe/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 714f376eb2d..2553179acb8 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1287,7 +1287,7 @@ while ($i < min($num, $limit)) if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) { // Prospect level - print '"; if (!$i) $totalarray['nbfield']++; @@ -1311,7 +1311,7 @@ while ($i < min($num, $limit)) // Parent company if (!empty($arrayfields['s2.nom']['checked'])) { - print '"; if (!$i) $totalarray['nbfield']++; @@ -1283,7 +1283,7 @@ while ($i < min($num, $limit)) // Parent company if (!empty($arrayfields['s2.nom']['checked'])) { - print '"; } - // Valeur CA du mois + // Value turnover of month print '"; - // Pourcentage du mois - if ($annee_decalage > $minyear && $case <= $casenow) - { - if ($cum[$caseprev] && $cum[$case]) + // Percentage of month + print ''; + if ($cum[$caseprev] && $cum[$case]) + { + $percent = (round(($cum[$case] - $cum[$caseprev]) / $cum[$caseprev], 4) * 100); + //print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X"; + print ($percent >= 0 ? "+$percent" : "$percent").'%'; + } + if ($cum[$caseprev] && !$cum[$case]) + { + print '-100%'; + } + if (!$cum[$caseprev] && $cum[$case]) + { + //print ''; + print '-'; + } + if (isset($cum[$caseprev]) && !$cum[$caseprev] && !$cum[$case]) + { + print '+0%'; + } + if (!isset($cum[$caseprev]) && !$cum[$case]) + { + print '-'; + } + } else { + if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print ' '; } } - if ($cum[$caseprev] && !$cum[$case]) - { - print ''; - } - if (!$cum[$caseprev] && $cum[$case]) - { - //print ''; - print ''; - } - if (isset($cum[$caseprev]) && !$cum[$caseprev] && !$cum[$case]) - { - print ''; - } - if (!isset($cum[$caseprev]) && !$cum[$case]) - { - print ''; - } - } else { - print ''; } + print ''; if ($annee_decalage < $year_end || ($annee_decalage == $year_end && $mois > 12 && $annee < $year_end)) print ''; } - $total_ht[$annee] += ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0); - $total[$annee] += $cum[$case]; + if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) { + $total_ht[$annee] += ((!empty($cum_ht[$case])) ? $cum_ht[$case] : 0); + $total[$annee] += $cum[$case]; + } } print ''; @@ -470,34 +479,37 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) } */ -// Affiche total +// Show total print ''; for ($annee = $year_start; $annee <= $year_end; $annee++) { if ($modecompta == 'CREANCES-DETTES') { // Montant total HT - if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) - { - print '"; + if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) { + print '"; } else { print ''; } } - // Montant total - if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) - { - print '"; + // Total amount + if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) { + print '"; } else { print ''; } // Pourcentage total - if ($annee > $minyear && $annee <= max($nowyear, $maxyear)) - { + if ($annee > $minyear && $annee <= max($nowyear, $maxyear)) { if ($total[$annee - 1] && $total[$annee]) { $percent = (round(($total[$annee] - $total[$annee - 1]) / $total[$annee - 1], 4) * 100); - print ''; + print ''; } if ($total[$annee - 1] && !$total[$annee]) { From 244ee05a9c3a07123b1805e4df0e2797b31fdcf1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Jan 2021 18:09:13 +0100 Subject: [PATCH 69/82] FIX #14290 #15900 --- htdocs/comm/propal/list.php | 2 +- htdocs/commande/list.php | 2 +- htdocs/compta/facture/list.php | 2 +- htdocs/expedition/list.php | 17 ++++++++++++----- htdocs/fourn/commande/list.php | 2 +- htdocs/supplier_proposal/list.php | 2 +- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 76914e2c13a..7a06f7f4a86 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -282,7 +282,7 @@ $help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos' //llxHeader('',$langs->trans('Proposal'),$help_url); $sql = 'SELECT'; -if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; +if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT'; $sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; $sql .= " typent.code as typent_code,"; $sql .= " ava.rowid as availability,"; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 1e7e0d1d9d7..ef10ffac25f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -263,7 +263,7 @@ $help_url = "EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_P // llxHeader('',$title,$help_url); $sql = 'SELECT'; -if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; +if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT'; $sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 71184d905b3..f655de32646 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -416,7 +416,7 @@ $formcompany = new FormCompany($db); $thirdpartystatic = new Societe($db); $sql = 'SELECT'; -if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; +if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT'; $sql .= ' f.rowid as id, f.ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.fk_cond_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,'; $sql .= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,'; $sql .= ' f.fk_user_author,'; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index a7f44bf483e..9bc0b6c0fac 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -213,8 +213,9 @@ $helpurl = 'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Ex llxHeader('', $langs->trans('ListOfSendings'), $helpurl); $sql = 'SELECT'; -if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; -$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed,"; +if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT'; +$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as date_livraison, e.fk_statut, e.billed,"; +$sql .= " l.date_delivery as date_reception,"; $sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, "; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; @@ -244,11 +245,12 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'shipping' AND ee.targettype = 'delivery'"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.rowid = ee.fk_target"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON e.fk_user_author = u.rowid'; - +if ($search_user > 0) { // Get link to order to get the order id in eesource.fk_source + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as eesource ON eesource.fk_target = e.rowid AND eesource.targettype = 'shipping' AND eesource.sourcetype = 'commande'"; +} // We'll need this table joined to the select in order to filter by sale if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -if ($search_user > 0) -{ +if ($search_user > 0) { $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; } @@ -275,6 +277,11 @@ if ($search_state) $sql .= natural_search("state.nom", $search_state); if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale; +if ($search_user > 0) +{ + // The contact on a shipment is also the contact of the order. + $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = eesource.fk_source AND ec.fk_socpeople = ".$db->escape($search_user); +} if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp); if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv); if ($search_company) $sql .= natural_search('s.nom', $search_company); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index ce638cdffcb..7b5fc220357 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -501,7 +501,7 @@ $help_url = ''; // llxHeader('',$title,$help_url); $sql = 'SELECT'; -if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; +if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT'; $sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, s.email,'; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index ded5d9ca2bf..662e0591611 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -255,7 +255,7 @@ $help_url = 'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur'; //llxHeader('',$langs->trans('CommRequest'),$help_url); $sql = 'SELECT'; -if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; +if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT'; $sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; From 80714d8d6d0deab3a7c13322b4bfadbb9fa954a3 Mon Sep 17 00:00:00 2001 From: "Paul Vincent M. Ancajas" Date: Sun, 31 Jan 2021 16:09:35 +0800 Subject: [PATCH 70/82] Fix/FIX: Show notification in Event box of user in his dashboard if assigned by others --- htdocs/comm/action/class/actioncomm.class.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 7355040e00c..a79060e6af8 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1201,14 +1201,21 @@ class ActionComm extends CommonObject } $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; + if (!$user->rights->agenda->allactions->read) { // If bloack Added by PV + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_resources AS ar ON a.id = ar.fk_actioncomm"; + } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql .= " WHERE 1 = 1"; if (empty($load_state_board)) $sql .= " AND a.percent >= 0 AND a.percent < 100"; $sql .= " AND a.entity IN (".getEntity('agenda').")"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND (a.fk_soc IS NULL OR sc.fk_user = ".$user->id.")"; if ($user->socid) $sql .= " AND a.fk_soc = ".$user->socid; - if (!$user->rights->agenda->allactions->read) $sql .= " AND (a.fk_user_author = ".$user->id." OR a.fk_user_action = ".$user->id." OR a.fk_user_done = ".$user->id.")"; - + if (!$user->rights->agenda->allactions->read) { + $sql .= " AND (a.fk_user_author = ".$user->id." OR a.fk_user_action = ".$user->id." OR a.fk_user_done = ".$user->id; + $sql .= " OR ar.fk_element = ".$user->id; // Added by PV + $sql .= ")"; + } + $resql = $this->db->query($sql); if ($resql) { From 726e0ceff043339ef56d479faedaaf48c4fc2c14 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 31 Jan 2021 08:16:59 +0000 Subject: [PATCH 71/82] Fixing style errors. --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index a79060e6af8..143dbf064a9 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1215,7 +1215,7 @@ class ActionComm extends CommonObject $sql .= " OR ar.fk_element = ".$user->id; // Added by PV $sql .= ")"; } - + $resql = $this->db->query($sql); if ($resql) { From 7887d4cc8e8f9e039d72621e472dc13ae957cbdc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Jan 2021 12:48:40 +0100 Subject: [PATCH 72/82] Fix price2num on all GETPOST('remise_percent') --- htdocs/comm/propal/card.php | 10 ++--- htdocs/commande/card.php | 10 ++--- htdocs/compta/facture/card-rec.php | 6 +-- htdocs/compta/facture/card.php | 63 ++++++++++++++---------------- htdocs/contrat/card.php | 12 +++--- htdocs/core/lib/date.lib.php | 4 +- htdocs/core/lib/functions.lib.php | 6 +-- htdocs/fourn/commande/card.php | 12 +++--- htdocs/fourn/facture/card.php | 8 ++-- htdocs/product/card.php | 18 ++++----- htdocs/product/fournisseurs.php | 6 +-- htdocs/product/price.php | 6 +-- htdocs/supplier_proposal/card.php | 18 ++++----- 13 files changed, 87 insertions(+), 92 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 8b5054afd7f..e823ec95cdc 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -354,8 +354,8 @@ if (empty($reshook)) $object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->fk_account = GETPOST('fk_account', 'int'); - $object->remise_percent = GETPOST('remise_percent'); - $object->remise_absolue = GETPOST('remise_absolue'); + $object->remise_percent = price2num(GETPOST('remise_percent'), 2); + $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU'); $object->socid = GETPOST('socid', 'int'); $object->contact_id = GETPOST('contactid', 'int'); $object->fk_project = GETPOST('projectid', 'int'); @@ -812,7 +812,7 @@ if (empty($reshook)) } $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); - $remise_percent = GETPOST('remise_percent'.$predef); + $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2); if (empty($remise_percent)) $remise_percent = 0; // Extrafields @@ -1210,7 +1210,7 @@ if (empty($reshook)) $price_min = $product->multiprices_min [$object->thirdparty->price_level]; $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); - if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) { + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) { setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); $error++; } @@ -1243,7 +1243,7 @@ if (empty($reshook)) $qty = price2num(GETPOST('qty', 'alpha'), 'MS'); - $result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, $_POST["units"], $pu_ht_devise); + $result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, price2num(GETPOST('remise_percent'), 2), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOST("units"), $pu_ht_devise); if ($result >= 0) { $db->commit(); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 287150e6ca2..1d2f12132e5 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -607,9 +607,9 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } elseif ($action == 'setremisepercent' && $usercancreate) { - $result = $object->set_remise($user, GETPOST('remise_percent')); + $result = $object->set_remise($user, price2num(GETPOST('remise_percent'), 2)); } elseif ($action == 'setremiseabsolue' && $usercancreate) { - $result = $object->set_remise_absolue($user, GETPOST('remise_absolue')); + $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU')); } elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha')) { // Define vat_rate $vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0); @@ -640,7 +640,7 @@ if (empty($reshook)) } $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); - $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef, 'alpha')) : 0); + $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef), 2) : 0); // Extrafields $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); @@ -1032,7 +1032,7 @@ if (empty($reshook)) $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); - if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) { + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) { setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); $error++; } @@ -1060,7 +1060,7 @@ if (empty($reshook)) } } } - $result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise); + $result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, price2num(GETPOST('qty'), 'MS'), price2num(GETPOST('remise_percent'), 2), $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $date_start, $date_end, $type, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('units'), $pu_ht_devise); if ($result >= 0) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 35d70e1edd6..1a125a38147 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -451,7 +451,7 @@ if (empty($reshook)) } $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); - $remise_percent = GETPOST('remise_percent'.$predef); + $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2); // Extrafields $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); @@ -801,7 +801,7 @@ if (empty($reshook)) $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); // Check price is not lower than minimum (check is done only for standard or replacement invoices) - if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent', 2)) / 100) < price2num($price_min)))) { setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); $error++; @@ -837,7 +837,7 @@ if (empty($reshook)) $localtax1_rate, $localtax1_rate, GETPOST('productid'), - GETPOST('remise_percent'), + price2num(GETPOST('remise_percent'), 2), 'HT', $info_bits, 0, diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 16a472d878c..f4f1c5cde1a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -476,19 +476,15 @@ if (empty($reshook)) } } } // Set incoterm - elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) - { + elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) { $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); } // bank account - elseif ($action == 'setbankaccount' && $usercancreate) - { + elseif ($action == 'setbankaccount' && $usercancreate) { $result = $object->setBankAccount(GETPOST('fk_account', 'int')); - } elseif ($action == 'setremisepercent' && $usercancreate) - { + } elseif ($action == 'setremisepercent' && $usercancreate) { $object->fetch($id); - $result = $object->set_remise($user, $_POST['remise_percent']); - } elseif ($action == "setabsolutediscount" && $usercancreate) - { + $result = $object->set_remise($user, price2num(GETPOST('remise_percent'), 2)); + } elseif ($action == "setabsolutediscount" && $usercancreate) { // POST[remise_id] or POST[remise_id_for_payment] // We use the credit to reduce amount of invoice @@ -981,7 +977,7 @@ if (empty($reshook)) $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = 'create'; - } elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -993,26 +989,25 @@ if (empty($reshook)) $action = 'create'; } - $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); + $date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); if (!$error) { // This is a replacement invoice - $result = $object->fetch($_POST['fac_replacement']); + $result = $object->fetch(GETPOST('fac_replacement', 'int')); $object->fetch_thirdparty(); $object->date = $dateinvoice; $object->date_pointoftax = $date_pointoftax; $object->note_public = trim(GETPOST('note_public', 'restricthtml')); // We do not copy the private note - $object->ref_client = $_POST['ref_client']; - $object->ref_int = $_POST['ref_int']; - $object->model_pdf = $_POST['model']; - $object->fk_project = $_POST['projectid']; - $object->cond_reglement_id = $_POST['cond_reglement_id']; - $object->mode_reglement_id = $_POST['mode_reglement_id']; + $object->ref_client = GETPOST('ref_client', 'alphanohtml'); + $object->model_pdf = GETPOST('model', 'alphanohtml'); + $object->fk_project = GETPOST('projectid', 'int'); + $object->cond_reglement_id = GETPOST('cond_reglement_id', 'int'); + $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int'); $object->fk_account = GETPOST('fk_account', 'int'); - $object->remise_absolue = $_POST['remise_absolue']; - $object->remise_percent = $_POST['remise_percent']; + $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU'); + $object->remise_percent = price2num(GETPOST('remise_percent'), 2); $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); @@ -1067,11 +1062,11 @@ if (empty($reshook)) $object->ref_client = GETPOST('ref_client'); $object->model_pdf = GETPOST('model'); $object->fk_project = GETPOST('projectid', 'int'); - $object->cond_reglement_id = 0; - $object->mode_reglement_id = GETPOST('mode_reglement_id'); + $object->cond_reglement_id = 0; // No payment term for a credit note + $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int'); $object->fk_account = GETPOST('fk_account', 'int'); - $object->remise_absolue = GETPOST('remise_absolue'); - $object->remise_percent = GETPOST('remise_percent'); + $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU'); + $object->remise_percent = price2num(GETPOST('remise_percent'), 2); $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); @@ -1289,8 +1284,8 @@ if (empty($reshook)) $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int'); $object->fk_account = GETPOST('fk_account', 'int'); $object->amount = price2num(GETPOST('amount')); - $object->remise_absolue = GETPOST('remise_absolue'); - $object->remise_percent = GETPOST('remise_percent'); + $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU'); + $object->remise_percent = price2num(GETPOST('remise_percent'), 2); $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); @@ -1343,8 +1338,8 @@ if (empty($reshook)) $object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->fk_account = GETPOST('fk_account', 'int'); $object->amount = price2num(GETPOST('amount')); - $object->remise_absolue = GETPOST('remise_absolue'); - $object->remise_percent = GETPOST('remise_percent'); + $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU'); + $object->remise_percent = price2num(GETPOST('remise_percent'), 2); $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); @@ -1837,8 +1832,8 @@ if (empty($reshook)) $object->fk_project = GETPOST('projectid', 'int'); $object->cond_reglement_id = GETPOST('cond_reglement_id', 'int'); $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int'); - $object->remise_absolue = GETPOST('remise_absolue', 'int'); - $object->remise_percent = GETPOST('remise_percent', 'int'); + $object->remise_absolue =price2num(GETPOST('remise_absolue'), 'MU'); + $object->remise_percent = price2num(GETPOST('remise_percent'), 2); // Proprietes particulieres a facture de remplacement @@ -1923,8 +1918,8 @@ if (empty($reshook)) $tva_tx = ''; } - $qty = GETPOST('qty'.$predef); - $remise_percent = GETPOST('remise_percent'.$predef); + $qty = price2num(GETPOST('qty'.$predef), 'MS'); + $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2); // Extrafields $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); @@ -2314,7 +2309,7 @@ if (empty($reshook)) $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); // Check price is not lower than minimum (check is done only for standard or replacement invoices) - if ($usercanproductignorepricemin && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) { + if ($usercanproductignorepricemin && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) { setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); $error++; } @@ -2367,7 +2362,7 @@ if (empty($reshook)) } } - $result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, $qty, price2num(GETPOST('remise_percent', 'alpha')), + $result = $object->updateline(GETPOST('lineid', 'int'), $description, $pu_ht, $qty, price2num(GETPOST('remise_percent'), 2), $date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type, GETPOST('fk_parent_line', 'int'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, price2num(GETPOST('progress', 'alpha')), GETPOST('units', 'alpha'), $pu_ht_devise); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index ca03905b834..8d78b410329 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -213,7 +213,7 @@ if (empty($reshook)) $object->note_private = GETPOST('note_private', 'alpha'); $object->note_public = GETPOST('note_public', 'alpha'); $object->fk_project = GETPOST('projectid', 'int'); - $object->remise_percent = GETPOST('remise_percent', 'alpha'); + $object->remise_percent = price2num(GETPOST('remise_percent'), 2); $object->ref = GETPOST('ref', 'alpha'); $object->ref_customer = GETPOST('ref_customer', 'alpha'); $object->ref_supplier = GETPOST('ref_supplier', 'alpha'); @@ -396,7 +396,7 @@ if (empty($reshook)) } $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); - $remise_percent = ((GETPOST('remise_percent'.$predef) != '') ? GETPOST('remise_percent'.$predef) : 0); + $remise_percent = (GETPOSTISSET('remise_percent'.$predef) ? price2num(GETPOST('remise_percent'.$predef), 2) : 0); if ($qty == '') { @@ -673,10 +673,10 @@ if (empty($reshook)) $objectline->fk_product = GETPOST('idprod', 'int'); $objectline->description = GETPOST('product_desc', 'restricthtml'); - $objectline->price_ht = GETPOST('elprice'); - $objectline->subprice = GETPOST('elprice'); - $objectline->qty = GETPOST('elqty'); - $objectline->remise_percent = GETPOST('elremise_percent'); + $objectline->price_ht = price2num(GETPOST('elprice'), 'MU'); + $objectline->subprice = price2num(GETPOST('elprice'), 'MU'); + $objectline->qty = price2num(GETPOST('elqty'), 'MS'); + $objectline->remise_percent = price2num(GETPOST('elremise_percent'), 2); $objectline->tva_tx = ($txtva ? $txtva : 0); // Field may be disabled, so we use vat rate 0 $objectline->vat_src_code = $vat_src_code; $objectline->localtax1_tx = is_numeric($localtax1_tx) ? $localtax1_tx : 0; diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 74b091865ff..b632bf44110 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -514,9 +514,9 @@ function dol_get_last_day($year, $month = 12, $gm = false) } /** - * Return GMT time for last hour of a given GMT date (it removes hours, min and second part) + * Return GMT time for last hour of a given GMT date (it replaces hours, min and second part to 23:59:59) * - * @param int $date Date + * @param int $date Date GMT * @return int Date for last hour of a given date */ function dol_get_last_hour($date) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 68941b92387..5e97eceaaea 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4830,13 +4830,13 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $ * should be roundtext2num(). * * @param string|float $amount Amount to convert/clean or round - * @param string $rounding ''=No rounding + * @param string|int $rounding ''=No rounding * 'MU'=Round to Max unit price (MAIN_MAX_DECIMALS_UNIT) * 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT) * 'MS'=Round to Max for stock quantity (MAIN_MAX_DECIMALS_STOCK) * 'CU'=Round to Max unit price of foreign currency accuracy * 'CT'=Round to Max for totals with Tax of foreign currency accuracy - * Numeric = Nb of digits for rounding + * Numeric = Nb of digits for rounding (For example 2 for a percentage) * @param int $option Put 1 if you know that content is already universal format number (so no correction on decimal will be done) * Put 2 if you know that number is a user input (so we know we don't have to fix decimal separator). * @return string Amount with universal numeric format (Example: '99.99999'). @@ -4911,7 +4911,7 @@ function price2num($amount, $rounding = '', $option = 0) elseif ($rounding == 'CT') { $nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_TOT, 8); // TODO Use param of currency } - elseif (is_numeric($rounding)) $nbofdectoround = $rounding; + elseif (is_numeric($rounding)) $nbofdectoround = (int) $rounding; //print "RR".$amount.' - '.$nbofdectoround.'
    '; if (dol_strlen($nbofdectoround)) $amount = round(is_string($amount) ? (float) $amount : $amount, $nbofdectoround); // $nbofdectoround can be 0. else return 'ErrorBadParameterProvidedToFunction'; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index c00e1d2d6e2..4238d0ee041 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -372,7 +372,7 @@ if (empty($reshook)) } $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); - $remise_percent = GETPOST('remise_percent'.$predef); + $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU'); // Extrafields @@ -721,21 +721,21 @@ if (empty($reshook)) $result = $object->updateline( $lineid, - $_POST['product_desc'], + GETPOST('product_desc', 'restricthtml'), $ht, - GETPOST('qty', 'int'), - $_POST['remise_percent'], + price2num(GETPOST('qty'), 'MS'), + price2num(GETPOST('remise_percent'), 2), $vat_rate, $localtax1_rate, $localtax2_rate, $price_base_type, 0, - isset($_POST["type"]) ? $_POST["type"] : $line->product_type, + GETPOSTISSET("type") ? GETPOST("type") : $line->product_type, false, $date_start, $date_end, $array_options, - $_POST['units'], + GETPOST('units'), $pu_ht_devise, GETPOST('fourn_ref', 'alpha') ); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index bfac45b15ac..9b8d0d959f3 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1137,8 +1137,8 @@ if (empty($reshook)) $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty); $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty); - $remise_percent = GETPOST('remise_percent'); - $pu_ht_devise = GETPOST('multicurrency_subprice'); + $remise_percent = price2num(GETPOST('remise_percent'), 2); + $pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), 'CU'); // Extrafields Lines $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); @@ -1150,7 +1150,7 @@ if (empty($reshook)) } } - $result = $object->updateline(GETPOST('lineid'), $label, $up, $tva_tx, $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('productid'), $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $_POST['units'], $pu_ht_devise, GETPOST('fourn_ref', 'alpha')); + $result = $object->updateline(GETPOST('lineid', 'int'), $label, $up, $tva_tx, $localtax1_tx, $localtax2_tx, price2num(GETPOST('qty'), 'MS'), GETPOST('productid', 'int'), $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, GETPOST('units'), $pu_ht_devise, GETPOST('fourn_ref', 'alpha')); if ($result >= 0) { unset($_POST['label']); @@ -1206,7 +1206,7 @@ if (empty($reshook)) } $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); - $remise_percent = GETPOST('remise_percent'.$predef); + $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU'); // Extrafields diff --git a/htdocs/product/card.php b/htdocs/product/card.php index c6dfd68d2c4..55c29aa1381 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -743,7 +743,7 @@ if (empty($reshook)) if (GETPOST('propalid') > 0) { // Define cost price for margin calculation $buyprice = 0; - if (($result = $propal->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0) + if (($result = $propal->defineBuyPrice($pu_ht, price2num(GETPOST('remise_percent'), 2), $object->id)) < 0) { dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); @@ -754,12 +754,12 @@ if (empty($reshook)) $result = $propal->addline( $desc, $pu_ht, - GETPOST('qty'), + price2num(GETPOST('qty'), 'MS'), $tva_tx, $localtax1_tx, // localtax1 $localtax2_tx, // localtax2 $object->id, - GETPOST('remise_percent'), + price2num(GETPOST('remise_percent'), 2), $price_base_type, $pu_ttc, 0, @@ -784,7 +784,7 @@ if (empty($reshook)) } elseif (GETPOST('commandeid') > 0) { // Define cost price for margin calculation $buyprice = 0; - if (($result = $commande->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0) + if (($result = $commande->defineBuyPrice($pu_ht, GETPOST('remise_percent', 2), $object->id)) < 0) { dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); @@ -795,12 +795,12 @@ if (empty($reshook)) $result = $commande->addline( $desc, $pu_ht, - GETPOST('qty'), + price2num(GETPOST('qty'), 'MS'), $tva_tx, $localtax1_tx, // localtax1 $localtax2_tx, // localtax2 $object->id, - GETPOST('remise_percent'), + price2num(GETPOST('remise_percent'), 2), '', '', $price_base_type, @@ -825,7 +825,7 @@ if (empty($reshook)) } elseif (GETPOST('factureid') > 0) { // Define cost price for margin calculation $buyprice = 0; - if (($result = $facture->defineBuyPrice($pu_ht, GETPOST('remise_percent'), $object->id)) < 0) + if (($result = $facture->defineBuyPrice($pu_ht, GETPOST('remise_percent', 2), $object->id)) < 0) { dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); @@ -836,12 +836,12 @@ if (empty($reshook)) $result = $facture->addline( $desc, $pu_ht, - GETPOST('qty'), + price2nm(GETPOST('qty'), 'MS'), $tva_tx, $localtax1_tx, $localtax2_tx, $object->id, - GETPOST('remise_percent'), + price2num(GETPOST('remise_percent'), 2), '', '', '', diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 2aadd4b3813..88c5259f48d 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -160,7 +160,7 @@ if (empty($reshook)) if (empty($ref_fourn_old)) $ref_fourn_old = $ref_fourn; $quantity = price2num(GETPOST("qty", 'nohtml'), 'MS'); $remise_percent = price2num(GETPOST('remise_percent', 'alpha')); - $npr = preg_match('/\*/', $_POST['tva_tx']) ? 1 : 0; + $npr = preg_match('/\*/', GETPOST('tva_tx', 'alpha')) ? 1 : 0; $tva_tx = str_replace('*', '', GETPOST('tva_tx', 'alpha')); $tva_tx = price2num($tva_tx); $price_expression = GETPOST('eid', 'int') ? GETPOST('eid', 'int') : ''; // Discard expression if not in expression mode @@ -697,14 +697,14 @@ END; print '
    '; print ''; } // Discount qty min print ''; - print ''; print ''; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 3785f50f213..89695690d38 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -419,10 +419,10 @@ if (empty($reshook)) // Récupération des variables $rowid = GETPOST('rowid', 'int'); $priceid = GETPOST('priceid', 'int'); - $newprice = price2num(GETPOST("price", 'alpha'), 'MU'); + $newprice = price2num(GETPOST("price"), 'MU'); // $newminprice=price2num(GETPOST("price_min"),'MU'); // TODO : Add min price management - $quantity = GETPOST('quantity', 'int'); - $remise_percent = price2num(GETPOST('remise_percent', 'alpha')); + $quantity = price2num(GETPOST('quantity'), 'MS'); + $remise_percent = price2num(GETPOST('remise_percent'), 2); $remise = 0; // TODO : allow discount by amount when available on documents if (empty($quantity)) { diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index d7ee97e1b9d..34f9ff78380 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -263,8 +263,8 @@ if (empty($reshook)) $object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->fk_account = GETPOST('fk_account', 'int'); - $object->remise_percent = GETPOST('remise_percent'); - $object->remise_absolue = GETPOST('remise_absolue'); + $object->remise_percent = price2num(GETPOST('remise_percent'), 2); + $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU'); $object->socid = GETPOST('socid'); $object->fk_project = GETPOST('projectid', 'int'); $object->model_pdf = GETPOST('model'); @@ -556,7 +556,7 @@ if (empty($reshook)) } $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); - $remise_percent = GETPOST('remise_percent'.$predef); + $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2); $price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU'); // Extrafields @@ -929,10 +929,10 @@ if (empty($reshook)) $fk_unit = GETPOST('units'); $result = $object->updateline( - GETPOST('lineid'), + GETPOST('lineid', 'int'), $ht, - GETPOST('qty'), - GETPOST('remise_percent'), + price2num(GETPOST('qty'), 'MS'), + price2num(GETPOST('remise_percent'), 2), $vat_rate, $localtax1_rate, $localtax2_rate, @@ -940,7 +940,7 @@ if (empty($reshook)) $price_base_type, $info_bits, $special_code, - GETPOST('fk_parent_line'), + GETPOST('fk_parent_line', 'int'), 0, $fournprice, $buyingprice, @@ -1018,9 +1018,9 @@ if (empty($reshook)) elseif ($action == 'setconditions' && $usercancreate) { $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); } elseif ($action == 'setremisepercent' && $usercancreate) { - $result = $object->set_remise_percent($user, GETPOST('remise_percent', 'alpha')); + $result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'), 2)); } elseif ($action == 'setremiseabsolue' && $usercancreate) { - $result = $object->set_remise_absolue($user, GETPOST('remise_absolue', 'alpha')); + $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 2)); } // Payment mode From d047cf488dc678c0404e894c3475db77786ed337 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Jan 2021 12:51:11 +0100 Subject: [PATCH 73/82] Fix price2num --- htdocs/supplier_proposal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 34f9ff78380..05bc3aec44d 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1020,7 +1020,7 @@ if (empty($reshook)) } elseif ($action == 'setremisepercent' && $usercancreate) { $result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'), 2)); } elseif ($action == 'setremiseabsolue' && $usercancreate) { - $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 2)); + $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU')); } // Payment mode From b349290cd1c515ff678be4202d5b2327023afc30 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Jan 2021 12:57:54 +0100 Subject: [PATCH 74/82] Fix test for date in future --- htdocs/compta/facture/card.php | 8 ++++---- htdocs/fourn/facture/card.php | 6 +++--- htdocs/langs/en_US/errors.lang | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f4f1c5cde1a..c0a9a15739a 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1040,7 +1040,7 @@ if (empty($reshook)) $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = 'create'; - } elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -1260,7 +1260,7 @@ if (empty($reshook)) $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = 'create'; - } elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -1313,7 +1313,7 @@ if (empty($reshook)) $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); $action = 'create'; - } elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -1737,7 +1737,7 @@ if (empty($reshook)) $error++; $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")); setEventMessages($mesg, null, 'errors'); - } elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 9b8d0d959f3..4d8d19e8bde 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -666,7 +666,7 @@ if (empty($reshook)) $action = 'create'; $_GET['socid'] = $_POST['socid']; $error++; - } elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -733,7 +733,7 @@ if (empty($reshook)) $action = 'create'; $_GET['socid'] = $_POST['socid']; $error++; - } elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; @@ -851,7 +851,7 @@ if (empty($reshook)) $action = 'create'; $_GET['socid'] = $_POST['socid']; $error++; - } elseif ($dateinvoice > (dol_now() + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { + } elseif ($dateinvoice > (dol_get_last_hour(dol_now()) + (empty($conf->global->INVOICE_MAX_FUTURE_DELAY) ? 0 : $conf->global->INVOICE_MAX_FUTURE_DELAY))) { $error++; setEventMessages($langs->trans("ErrorDateIsInFuture"), null, 'errors'); $action = 'create'; diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index a7a7e12db14..baf04bbe4b8 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -256,6 +256,7 @@ ErrorPublicInterfaceNotEnabled=Public interface was not enabled ErrorLanguageRequiredIfPageIsTranslationOfAnother=The language of new page must be defined if it is set as a translation of another page ErrorLanguageMustNotBeSourceLanguageIfPageIsTranslationOfAnother=The language of new page must not be the source language if it is set as a translation of another page ErrorAParameterIsRequiredForThisOperation=A parameter is mandatory for this operation +ErrorDateIsInFuture=Error, the date can't be in the future # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. From dad67785700bf8616d96830c0498478b912b5e0e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Jan 2021 13:07:41 +0100 Subject: [PATCH 75/82] Prepare removal of libelle and lib into label --- .../sociales/class/cchargesociales.class.php | 18 ++++++++++-------- .../sociales/class/chargesociales.class.php | 9 +++++++-- .../class/paymentsocialcontribution.class.php | 7 ++++++- htdocs/compta/sociales/list.php | 6 +++--- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php index ceace76bba9..c5ec3b24968 100644 --- a/htdocs/compta/sociales/class/cchargesociales.class.php +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -46,9 +46,15 @@ class Cchargesociales /** * @var string Label + * @deprecated */ public $libelle; + /** + * @var string Label + */ + public $label; + public $deductible; public $active; public $code; @@ -107,7 +113,6 @@ class Cchargesociales // Insert request $sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'('; - $sql .= 'libelle,'; $sql .= 'deductible,'; $sql .= 'active,'; @@ -115,10 +120,7 @@ class Cchargesociales $sql .= 'fk_pays,'; $sql .= 'module'; $sql .= 'accountancy_code'; - - $sql .= ') VALUES ('; - $sql .= ' '.(!isset($this->libelle) ? 'NULL' : "'".$this->db->escape($this->libelle)."'").','; $sql .= ' '.(!isset($this->deductible) ? 'NULL' : $this->deductible).','; $sql .= ' '.(!isset($this->active) ? 'NULL' : $this->active).','; @@ -126,8 +128,6 @@ class Cchargesociales $sql .= ' '.(!isset($this->fk_pays) ? 'NULL' : $this->fk_pays).','; $sql .= ' '.(!isset($this->module) ? 'NULL' : "'".$this->db->escape($this->module)."'").','; $sql .= ' '.(!isset($this->accountancy_code) ? 'NULL' : "'".$this->db->escape($this->accountancy_code)."'"); - - $sql .= ')'; $this->db->begin(); @@ -179,7 +179,7 @@ class Cchargesociales $sql = 'SELECT'; $sql .= " t.id,"; - $sql .= " t.libelle,"; + $sql .= " t.libelle as label,"; $sql .= " t.deductible,"; $sql .= " t.active,"; $sql .= " t.code,"; @@ -201,7 +201,8 @@ class Cchargesociales $this->id = $obj->id; - $this->libelle = $obj->libelle; + $this->libelle = $obj->label; + $this->label = $obj->label; $this->deductible = $obj->deductible; $this->active = $obj->active; $this->code = $obj->code; @@ -501,6 +502,7 @@ class Cchargesociales $this->id = 0; $this->libelle = ''; + $this->label = ''; $this->deductible = ''; $this->active = ''; $this->code = ''; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 95e4bd1df77..34f58969a46 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -108,6 +108,11 @@ class ChargeSociales extends CommonObject */ public $fk_project; + /** + * @var int ID + */ + public $fk_user; + const STATUS_UNPAID = 0; const STATUS_PAID = 1; @@ -135,7 +140,7 @@ class ChargeSociales extends CommonObject $sql = "SELECT cs.rowid, cs.date_ech"; $sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key"; $sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user"; - $sql .= ", c.libelle"; + $sql .= ", c.libelle as type_label"; $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as c ON cs.fk_type = c.id"; @@ -158,7 +163,7 @@ class ChargeSociales extends CommonObject $this->lib = $obj->label; $this->label = $obj->label; $this->type = $obj->fk_type; - $this->type_label = $obj->libelle; + $this->type_label = $obj->type_label; $this->fk_account = $obj->fk_account; $this->mode_reglement_id = $obj->fk_mode_reglement; $this->mode_reglement_code = $obj->mode_reglement_code; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 2f4f772fca0..78cf7e1c22f 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -46,6 +46,11 @@ class PaymentSocialContribution extends CommonObject */ public $picto = 'payment'; + /** + * @var string Label + */ + public $label; + /** * @var int ID */ @@ -679,7 +684,7 @@ class PaymentSocialContribution extends CommonObject $result = ''; - if (empty($this->ref)) $this->ref = $this->lib; + if (empty($this->ref)) $this->ref = $this->label; $label = img_picto('', $this->picto).' '.$langs->trans("SocialContributionPayment").''; $label .= '
    '.$langs->trans('Ref').': '.$this->ref; diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index a8a71e3e254..ce65dde989b 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -149,7 +149,7 @@ if (!empty($conf->projet->enabled)) $projectstatic = new Project($db); llxHeader('', $langs->trans("SocialContributions")); $sql = "SELECT cs.rowid, cs.fk_type as type, cs.fk_user, "; -$sql .= " cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode,"; +$sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,"; if (!empty($conf->projet->enabled)) $sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,"; $sql .= " c.libelle as type_label,"; $sql .= " SUM(pc.amount) as alreadypayed"; @@ -381,7 +381,7 @@ while ($i < min($num, $limit)) $chargesociale_static->id = $obj->rowid; $chargesociale_static->ref = $obj->rowid; - $chargesociale_static->label = $obj->libelle; + $chargesociale_static->label = $obj->label; $chargesociale_static->type_label = $obj->type_label; if (!empty($conf->projet->enabled)) { $projectstatic->id = $obj->project_id; @@ -405,7 +405,7 @@ while ($i < min($num, $limit)) // Label if (!empty($arrayfields['cs.libelle']['checked'])) { - print '
    '; + print ''; if (!$i) $totalarray['nbfield']++; } From 4c9bf1d97ea73127f9382490dd58921798e679e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Jan 2021 13:21:12 +0100 Subject: [PATCH 76/82] Advice for ajax services --- ChangeLog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f4afde7fb45..3a591059b36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -248,9 +248,9 @@ Following changes may create regressions for some external modules, but were nec * Function showStripePaymentUrl, getStripePaymentUrl, showPaypalPaymentUrl and getPaypalPaymentUrl has been removed. The generic one showOnlinePaymentUrl and getOnlinePaymentUrl are always used. * Context for hook showSocinfoOnPrint has been moved from "showsocinfoonprint" to "main" * Library htdocs/includes/phpoffice/phpexcel as been removed (replaced with htdocs/includes/phpoffice/PhpSpreadsheet) -* Databse transaction in your triggers must be correctly balanced (one close for one open). If not, an error will be returned by the trigger, even if trigger did return error code. +* Database transaction in your triggers must be correctly balanced (one close for one open). If not, an error will be returned by the trigger, even if trigger did return error code. * Dolibarr v13 is still compatible with any PHP version between 5.6.0 and 7.4.*; Unit tests are OK with PHP 8.0 but some warnings or troubles may appears with PHP 8.0. - +* All your Ajax services must contains such a line at begin of file: if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal ***** ChangeLog for 12.0.4 compared to 12.0.3 ***** FIX: make formConfirm an addreplace-type hook From f461bccc02c54cc72c23a8df4c6f545aeeb8bd3a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Jan 2021 17:06:42 +0100 Subject: [PATCH 77/82] Fix var not defined --- htdocs/projet/element.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index aa01ef5d3ef..6802d0e84a9 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -1361,7 +1361,6 @@ if ($conf->use_javascript_ajax) { include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; $comboenhancement = ajax_combobox('.elementselect'); - $out .= $comboenhancement; print $comboenhancement; } From 3473e0a5d0b246b04246980193aeef10efdb6ac1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Jan 2021 17:10:31 +0100 Subject: [PATCH 78/82] Exclude include if not required --- 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 e0055890152..370e7ac1278 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -386,7 +386,7 @@ if (!defined('NOLOGIN') && !defined('NOIPCHECK') && !empty($dolibarr_main_restri // Loading of additional presentation includes if (!defined('NOREQUIREHTML')) require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2) -require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; // Need 22ko memory +if (!defined('NOREQUIREAJAX')) require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; // Need 22ko memory // If install or upgrade process not done or not completely finished, we call the install page. if (!empty($conf->global->MAIN_NOT_INSTALLED) || !empty($conf->global->MAIN_NOT_UPGRADED)) From 18d222f32f97bd8a3fee6311cf40ebdd4952452f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Jan 2021 18:06:02 +0100 Subject: [PATCH 79/82] Fix code comment --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 64996e4e6c2..4ae71d46309 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1448,7 +1448,7 @@ class Form * @param string $htmlid Html id to use instead of htmlname * @param bool $multiple add [] in the name of element and add 'multiple' attribut * @param integer $disableifempty Set tag 'disabled' on select if there is no choice - * @return int <0 if KO, Nb of contact in list if OK + * @return int|string <0 if KO, HTML with select string if OK. */ public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0) { From d80709a7b9368b31651e5ef66bad49febc9685af Mon Sep 17 00:00:00 2001 From: "Paul Vincent M. Ancajas" Date: Mon, 1 Feb 2021 01:41:19 +0800 Subject: [PATCH 80/82] Fix/FIX: making sure the return agenda is only specific to user --- htdocs/comm/action/class/actioncomm.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 143dbf064a9..9e562173b04 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1201,8 +1201,8 @@ class ActionComm extends CommonObject } $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; - if (!$user->rights->agenda->allactions->read) { // If bloack Added by PV - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_resources AS ar ON a.id = ar.fk_actioncomm"; + if (!$user->rights->agenda->allactions->read) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_resources AS ar ON a.id = ar.fk_actioncomm AND ar.element_type ='user' AND ar.fk_element = ".$user->id; } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql .= " WHERE 1 = 1"; From 582c37c3782790f6968791ce9bf25c632cecdbbd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Jan 2021 18:52:11 +0100 Subject: [PATCH 81/82] Code comment --- .../interface_20_modWorkflow_WorkflowManager.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index d8eda6a8baf..dac1368b8f4 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -271,9 +271,10 @@ class InterfaceWorkflowManager extends DolibarrTriggers } } - //Build array of quantity ordered by product + //Build array of quantity ordered to be shipped if (is_array($order->lines) && count($order->lines) > 0) { foreach ($order->lines as $orderline) { + // Exclude lines not qualified for shipment, similar code is found into calcAndSetStatusDispatch() for vendors if (empty($conf->global->STOCK_SUPPORTS_SERVICES) && $orderline->product_type > 0) continue; $qtyordred[$orderline->fk_product] += $orderline->qty; } From ed258b95da6676d2e5fbfaf7963a48a56533e8bf Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 31 Jan 2021 22:33:07 +0100 Subject: [PATCH 82/82] Clean template code to create after edit in receipt printer module Cleaning template code is more clear to users --- htdocs/admin/receiptprinter.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 3c878c5c664..31f2228d401 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -443,7 +443,6 @@ if ($mode == 'template' && $user->admin) { print ''; print ''; print '';
    '; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 6d3f4dffa4a..7bee283fd2f 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -133,7 +133,7 @@ class ChargeSociales extends CommonObject { $sql = "SELECT cs.rowid, cs.date_ech"; $sql .= ", cs.libelle as label, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key"; - $sql .= ", cs.fk_account, cs.fk_mode_reglement"; + $sql .= ", cs.fk_account, cs.fk_mode_reglement, cs.fk_user"; $sql .= ", c.libelle"; $sql .= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; @@ -164,6 +164,7 @@ class ChargeSociales extends CommonObject $this->mode_reglement = $obj->mode_reglement_libelle; $this->amount = $obj->amount; $this->fk_project = $obj->fk_project; + $this->fk_user = $obj->fk_user; $this->paye = $obj->paye; $this->periode = $this->db->jdate($obj->periode); $this->import_key = $this->import_key; @@ -226,7 +227,7 @@ class ChargeSociales extends CommonObject $this->db->begin(); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, date_creation)"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, fk_user, date_creation)"; $sql .= " VALUES (".$this->type; $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); $sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : "NULL"); @@ -237,6 +238,7 @@ class ChargeSociales extends CommonObject $sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 'NULL'); $sql .= ", ".$conf->entity; $sql .= ", ".$user->id; + $sql .= ", ".($this->fk_user > 0 ? $this->db->escape($this->fk_user) : 'NULL'); $sql .= ", '".$this->db->idate($now)."'"; $sql .= ")"; @@ -354,7 +356,8 @@ class ChargeSociales extends CommonObject $sql .= ", date_ech='".$this->db->idate($this->date_ech)."'"; $sql .= ", periode='".$this->db->idate($this->periode)."'"; $sql .= ", amount='".price2num($this->amount, 'MT')."'"; - $sql .= ", fk_projet=".($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "NULL"); + $sql .= ", fk_projet=".($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "NULL"); + $sql .= ", fk_user=".($this->fk_user > 0 ? $this->db->escape($this->fk_user) : "NULL"); $sql .= ", fk_user_modif=".$user->id; $sql .= " WHERE rowid=".$this->id; diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 8ccd8aa35aa..50ac12e8517 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2016 Frédéric France * Copyright (C) 2020 Pierre Ardoin + * Copyright (C) 2021 Gauthier VERDOL * * 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 @@ -33,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; if (!empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Load translation files required by the page -$langs->loadLangs(array('compta', 'banks', 'bills')); +$langs->loadLangs(array('compta', 'banks', 'bills', 'hrm')); $action = GETPOST('action', 'alpha'); $massaction = GETPOST('massaction', 'alpha'); @@ -56,6 +57,7 @@ $search_month_lim = GETPOST('search_month_lim', 'int'); $search_year_lim = GETPOST('search_year_lim', 'int'); $search_project_ref = GETPOST('search_project_ref', 'alpha'); $search_project = GETPOST('search_project', 'alpha'); +$search_users = GETPOST('search_users'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); @@ -99,6 +101,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_month_lim = ''; $search_project_ref = ''; $search_project = ''; + $search_users = ''; $toselect = ''; $search_array_options = array(); } @@ -116,7 +119,7 @@ if (!empty($conf->projet->enabled)) $projectstatic = new Project($db); llxHeader('', $langs->trans("SocialContributions")); -$sql = "SELECT cs.rowid as id, cs.fk_type as type, "; +$sql = "SELECT cs.rowid as id, cs.fk_type as type, cs.fk_user, "; $sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,"; if (!empty($conf->projet->enabled)) $sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,"; $sql .= " c.libelle as type_label,"; @@ -125,12 +128,14 @@ $sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,"; $sql .= " ".MAIN_DB_PREFIX."chargesociales as cs"; if (!empty($conf->projet->enabled)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = cs.fk_projet"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid"; +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON (cs.fk_user = u.rowid)"; $sql .= " WHERE cs.fk_type = c.id"; $sql .= " AND cs.entity = ".$conf->entity; // Search criteria if ($search_ref) $sql .= " AND cs.rowid=".$db->escape($search_ref); if ($search_label) $sql .= natural_search("cs.libelle", $search_label); if (!empty($conf->projet->enabled)) if ($search_project_ref != '') $sql .= natural_search("p.ref", $search_project_ref); +if (!empty($search_users)) $sql .= ' AND cs.fk_user IN('.implode(', ', $search_users).')'; if ($search_amount) $sql .= natural_search("cs.amount", $search_amount, 1); if ($search_status != '' && $search_status >= 0) $sql .= " AND cs.paye = ".$db->escape($search_status); $sql .= dolSqlDateFilter("cs.periode", $search_day_lim, $search_month_lim, $search_year_lim); @@ -177,6 +182,9 @@ if ($resql) if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref); if ($search_amount) $param .= '&search_amount='.urlencode($search_amount); if ($search_typeid) $param .= '&search_typeid='.urlencode($search_typeid); + if ($search_users) { + foreach ($search_users as $id_user) $param .= '&search_users[]='.urlencode($id_user); + } if ($search_status != '' && $search_status != '-1') $param .= '&search_status='.urlencode($search_status); if ($year) $param .= '&year='.urlencode($year); @@ -224,7 +232,10 @@ if ($resql) print ''; - $formsocialcontrib->select_type_socialcontrib($search_typeid, 'search_typeid', 1, 0, 0, 'maxwidth100onsmartphone'); + $formsocialcontrib->select_type_socialcontrib($search_typeid, 'search_typeid', 1, 0, 0, 'maxwidth100onsmartphone'); + // Employee + print ''; + print $form->select_dolusers($search_users, 'search_users', 1, null, 0, '', '', '0', '0', 0, '', 0, '', '', 0, 0, true); print '
    ".$obj->type_label.""; + if(!empty($obj->fk_user)) { + if(!empty($TLoadedUsers[$obj->fk_user])) $ustatic = $TLoadedUsers[$obj->fk_user]; + else { + $ustatic = new User($db); + $ustatic->fetch($obj->fk_user); + $TLoadedUsers[$obj->fk_user] = $ustatic; + } + print $ustatic->getNomUrl(-1); + } + print "'; diff --git a/htdocs/install/mysql/tables/llx_chargesociales.sql b/htdocs/install/mysql/tables/llx_chargesociales.sql index 57434c93d98..720fd45a62d 100644 --- a/htdocs/install/mysql/tables/llx_chargesociales.sql +++ b/htdocs/install/mysql/tables/llx_chargesociales.sql @@ -28,6 +28,7 @@ create table llx_chargesociales tms timestamp, date_creation datetime, -- date de creation date_valid datetime, -- date de validation + fk_user integer DEFAULT NULL, -- utilisateur concerné fk_user_author integer, -- user making creation fk_user_modif integer, -- user making last change fk_user_valid integer, -- user validating From d3647557920af982753d03842b8a36b0dc86b562 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 28 Jan 2021 17:20:01 +0100 Subject: [PATCH 33/82] NEW : migration script --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 9e1e6a15866..bfdecd334b7 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -121,3 +121,4 @@ ALTER TABLE llx_societe ADD INDEX idx_societe_warehouse(fk_warehouse); ALTER TABLE llx_socpeople MODIFY poste varchar(255); +ALTER TABLE llx_chargesociales ADD COLUMN fk_user integer DEFAULT NULL; From 5adcc3361bfd885b769b3d2edb842c75b61e9f44 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 28 Jan 2021 17:24:47 +0100 Subject: [PATCH 34/82] FIX : credits --- htdocs/install/mysql/tables/llx_chargesociales.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/tables/llx_chargesociales.sql b/htdocs/install/mysql/tables/llx_chargesociales.sql index e6ade132f60..220c85410ce 100644 --- a/htdocs/install/mysql/tables/llx_chargesociales.sql +++ b/htdocs/install/mysql/tables/llx_chargesociales.sql @@ -2,6 +2,7 @@ -- Copyright (C) 2001-2002 Rodolphe Quiedeville -- Copyright (C) 2005-2009 Regis Houssin -- Copyright (C) 2017 Alexandre Spangaro +-- Copyright (C) 2021 Gauthier VERDOL -- -- 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 From b4d0668ceafe2ea19660cf7f92c28f29f4fd3e1e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 28 Jan 2021 16:27:55 +0000 Subject: [PATCH 35/82] Fixing style errors. --- htdocs/compta/sociales/card.php | 6 +++--- htdocs/compta/sociales/list.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 1775aa3efb9..d27155e572f 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -99,7 +99,7 @@ if ($action == 'classin' && $user->rights->tax->charges->creer) $object->setProject(GETPOST('projectid')); } -if($action == 'setfk_user' && $user->rights->tax->charges->creer) { +if ($action == 'setfk_user' && $user->rights->tax->charges->creer) { $object->fetch($id); $object->fk_user = $fk_user; $object->update($user); @@ -463,10 +463,10 @@ if ($id > 0) $morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); // Employee - if($action != 'editfk_user') { + if ($action != 'editfk_user') { $morehtmlref .= '
    ' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); - if(!empty($object->fk_user)) { + if (!empty($object->fk_user)) { $userstatic = new User($db); $userstatic->fetch($object->fk_user); $morehtmlref .= $userstatic->getNomUrl(1); diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 37383b633df..a8a71e3e254 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -418,8 +418,8 @@ while ($i < min($num, $limit)) if (!empty($arrayfields['cs.fk_user']['checked'])) { // Employee print "
    "; - if(!empty($obj->fk_user)) { - if(!empty($TLoadedUsers[$obj->fk_user])) $ustatic = $TLoadedUsers[$obj->fk_user]; + if (!empty($obj->fk_user)) { + if (!empty($TLoadedUsers[$obj->fk_user])) $ustatic = $TLoadedUsers[$obj->fk_user]; else { $ustatic = new User($db); $ustatic->fetch($obj->fk_user); From 4c3dc6be1bdfc9f2c4b27d518f0e82a3179a031b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 19:37:37 +0100 Subject: [PATCH 36/82] Fix can't use the link button twice. --- htdocs/admin/mails.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 08e7c2b5446..0d6a36e07b7 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -768,17 +768,17 @@ if ($action == 'edit') { if (function_exists('fsockopen') && $port && $server) { - print ''.$langs->trans("DoTestServerAvailability").''; + print ''.$langs->trans("DoTestServerAvailability").''; } } else { print ''.$langs->trans("DoTestServerAvailability").''; } - print ''.$langs->trans("DoTestSend").''; + print ''.$langs->trans("DoTestSend").''; if (!empty($conf->fckeditor->enabled)) { - print ''.$langs->trans("DoTestSendHTML").''; + print ''.$langs->trans("DoTestSendHTML").''; } } From e5b4c76a26f49c555272e6316613701d44dbdb6b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 19:38:47 +0100 Subject: [PATCH 37/82] Fix combo to select action status --- htdocs/comm/action/list.php | 2 +- htdocs/core/class/html.formactions.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 16c2a315cdd..a2e020fcb24 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -366,7 +366,7 @@ if ($socid > 0) $sql .= " AND s.rowid = ".$socid; if ($filtert > 0 || $usergroup > 0) $sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'"; if ($type) $sql .= " AND c.id = ".(int) $type; if ($search_status == '0') { $sql .= " AND a.percent = 0"; } -if ($search_status == '-1') { $sql .= " AND a.percent = -1"; } // Not applicable +if ($search_status == 'na') { $sql .= " AND a.percent = -1"; } // Not applicable if ($search_status == '50') { $sql .= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started if ($search_status == '100') { $sql .= " AND a.percent = 100"; } if ($search_status == 'done') { $sql .= " AND (a.percent = 100)"; } diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index cbd17b30568..34fd72e28b9 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -70,7 +70,7 @@ class FormActions global $langs, $conf; $listofstatus = array( - '-1' => $langs->trans("ActionNotApplicable"), + 'na' => $langs->trans("ActionNotApplicable"), '0' => $langs->trans("ActionsToDoShort"), '50' => $langs->trans("ActionRunningShort"), '100' => $langs->trans("ActionDoneShort") From 1764d3528bb43bb63c54d0899ea1265b3f60cc1b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 19:45:52 +0100 Subject: [PATCH 38/82] Fix test email --- htdocs/admin/mails.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 0d6a36e07b7..b0b18de20dc 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -768,17 +768,17 @@ if ($action == 'edit') { if (function_exists('fsockopen') && $port && $server) { - print ''.$langs->trans("DoTestServerAvailability").''; + print ''.$langs->trans("DoTestServerAvailability").''; } } else { print ''.$langs->trans("DoTestServerAvailability").''; } - print ''.$langs->trans("DoTestSend").''; + print ''.$langs->trans("DoTestSend").''; if (!empty($conf->fckeditor->enabled)) { - print ''.$langs->trans("DoTestSendHTML").''; + print ''.$langs->trans("DoTestSendHTML").''; } } @@ -844,6 +844,7 @@ if ($action == 'edit') // Run the test to connect if ($action == 'testconnect') { + print '
    '; print load_fiche_titre($langs->trans("DoTestServerAvailability")); include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; @@ -858,6 +859,7 @@ if ($action == 'edit') } setEventMessages($errormsg, null, 'errors'); + print $errormsg; } print '
    '; } From 099fcd7e4efe2b869e6eece3c6901fe1daeefef9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 19:45:52 +0100 Subject: [PATCH 39/82] Fix test email Conflicts: htdocs/admin/mails.php --- htdocs/admin/mails.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 00d954883f9..4b471263542 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -719,7 +719,7 @@ else { if (function_exists('fsockopen') && $port && $server) { - print ''.$langs->trans("DoTestServerAvailability").''; + print ''.$langs->trans("DoTestServerAvailability").''; } } else @@ -789,6 +789,7 @@ else // Run the test to connect if ($action == 'testconnect') { + print '
    '; print load_fiche_titre($langs->trans("DoTestServerAvailability")); include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; @@ -804,6 +805,7 @@ else } setEventMessages($errormsg, null, 'errors'); + print $errormsg; } print '
    '; } From 1a2748092714cb9be79298972c0fdef57b89c23c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 22:01:39 +0100 Subject: [PATCH 40/82] Test to fix a regression --- htdocs/stripe/class/stripe.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 97d45a49a1f..0912562c460 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -434,6 +434,7 @@ class Stripe extends CommonObject { unset($dataforintent['setup_future_usage']); $dataforintent["setup_future_usage"] = "off_session"; + $dataforintent["off_session"] = true; // Restore value to test if it solve a regression } if (!empty($conf->global->STRIPE_GIROPAY)) unset($dataforintent['setup_future_usage']); if (!is_null($payment_method)) From 1ea1dd9c330a70fb935674e3a7e4ca68fabe3da2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 22:06:13 +0100 Subject: [PATCH 41/82] Add doc --- htdocs/stripe/class/stripe.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 0912562c460..b3a0b7b1fad 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -397,6 +397,7 @@ class Stripe extends CommonObject if (empty($paymentintent)) { + // Try to create intent. See https://stripe.com/docs/api/payment_intents/create $ipaddress = getUserRemoteIP(); $metadata = array('dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress); if (is_object($object)) From 3571b868fe2a45cbdf16014ea25053350ec4254c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 22:10:38 +0100 Subject: [PATCH 42/82] Add log --- htdocs/stripe/class/stripe.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index b3a0b7b1fad..f280995de95 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -466,6 +466,9 @@ class Stripe extends CommonObject if (!empty($key)) { // If the Stripe connect account not set, we use common API usage $arrayofoptions["stripe_account"] = $key; } + + dol_syslog("dataforintent to create paymentintent = ".var_export($dataforintent, true)); + $paymentintent = \Stripe\PaymentIntent::create($dataforintent, $arrayofoptions); // Store the payment intent From f3af16f2080389143d5fb023b466877f50e46a11 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 22:30:13 +0100 Subject: [PATCH 43/82] Typo --- htdocs/stripe/admin/stripe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index efa8472ce78..6a52b57268b 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -538,7 +538,7 @@ $token = ''; include DOL_DOCUMENT_ROOT.'/core/tpl/onlinepaymentlinks.tpl.php'; -print info_admin($langs->trans("ExampleOfTestCreditCard", '4242424242424242 (no 3DSecure) or 4000000000003063 (3DSecure required) or 4000002760003184 (3DSecure2 required on all transaction) or 4000003800000446 (3DSecure2 required the off-seesion allowed)', '4000000000000101', '4000000000000069', '4000000000000341')); +print info_admin($langs->trans("ExampleOfTestCreditCard", '4242424242424242 (no 3DSecure) or 4000000000003063 (3DSecure required) or 4000002760003184 (3DSecure2 required on all transaction) or 4000003800000446 (3DSecure2 required, the off-session allowed)', '4000000000000101', '4000000000000069', '4000000000000341')); if (!empty($conf->use_javascript_ajax)) { From 616a66702c58af49cf8d93533b33703103721bc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 22:32:00 +0100 Subject: [PATCH 44/82] Try a fix to solve offline payment problems --- htdocs/stripe/class/stripe.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index f280995de95..793e370f634 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -434,10 +434,11 @@ class Stripe extends CommonObject if ($off_session) { unset($dataforintent['setup_future_usage']); - $dataforintent["setup_future_usage"] = "off_session"; + //$dataforintent["setup_future_usage"] = "off_session"; $dataforintent["off_session"] = true; // Restore value to test if it solve a regression } if (!empty($conf->global->STRIPE_GIROPAY)) unset($dataforintent['setup_future_usage']); + if (!is_null($payment_method)) { $dataforintent["payment_method"] = $payment_method; From 848b4db509c33ef7e0a43c8b8aca91e9726bba6a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 23:13:43 +0100 Subject: [PATCH 45/82] Fix regression: It was not more possible to create payment offline --- htdocs/stripe/class/stripe.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 4e534276c47..2198493d0fd 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -430,7 +430,8 @@ class Stripe extends CommonObject if ($off_session) { unset($dataforintent['setup_future_usage']); - $dataforintent["setup_future_usage"] = "off_session"; + //$dataforintent["setup_future_usage"] = "off_session"; + $dataforintent["off_session"] = true; } if (!is_null($payment_method)) { From 62622a206579ccdde1cfaf8d27d0684a4e12f63d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 23:16:24 +0100 Subject: [PATCH 46/82] Fix: It was no more possible to create paymentintent for offline payment --- htdocs/stripe/class/stripe.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index a691b7bff40..9f44645d3a0 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -431,7 +431,8 @@ class Stripe extends CommonObject if ($off_session) { unset($dataforintent['setup_future_usage']); - $dataforintent["setup_future_usage"] = "off_session"; + //$dataforintent["setup_future_usage"] = "off_session"; + $dataforintent["off_session"] = true; } if (!is_null($payment_method)) { From 6ed3a1c227a5c60cfb4e4a17fbb6a022a9850663 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 23:18:10 +0100 Subject: [PATCH 47/82] Fix idempotencey make stripe payment fails --- htdocs/stripe/class/stripe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 2198493d0fd..e1ee0138287 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -321,7 +321,7 @@ class Stripe extends CommonObject * @param string $noidempotency_key Do not use the idempotency_key when creating the PaymentIntent * @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found and failed to create */ - public function getPaymentIntent($amount, $currency_code, $tag, $description = '', $object = null, $customer = null, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic', $confirmnow = false, $payment_method = null, $off_session = 0, $noidempotency_key = 0) + public function getPaymentIntent($amount, $currency_code, $tag, $description = '', $object = null, $customer = null, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic', $confirmnow = false, $payment_method = null, $off_session = 0, $noidempotency_key = 1) { global $conf, $user; From 6544ba010e5ce7781b13b30c5c1e8f9ce494d9b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 23:27:01 +0100 Subject: [PATCH 48/82] Fix responsive --- htdocs/societe/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index d3991d06c0c..714f376eb2d 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1287,7 +1287,7 @@ while ($i < min($num, $limit)) if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) { // Prospect level - print '
    '; + print ''; print $companystatic->getLibProspLevel(); print "'; + print ''; print $companystatic->getLibProspLevel(); print "'; + print ''; print $companystatic->getLibProspLevel(); print "'; + print ''; if ($companystatic->fk_parent > 0) { $companyparent->fetch($companystatic->fk_parent); From 086b23f66c497e0177b658cde41ab12ed8282946 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Jan 2021 23:28:33 +0100 Subject: [PATCH 51/82] Fix responsive --- htdocs/societe/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 402e85d9b39..5b5e9685628 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1259,7 +1259,7 @@ while ($i < min($num, $limit)) if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) { // Prospect level - print ''; + print ''; print $companystatic->getLibProspLevel(); print "'; + print ''; if ($companystatic->fk_parent > 0) { $companyparent->fetch($companystatic->fk_parent); From 413fc95f9a3daec0924c5fcd52a8756fd6986cee Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 28 Jan 2021 23:40:15 +0100 Subject: [PATCH 52/82] FIX: Accountancy - label_operation is used instead of label_compte --- htdocs/accountancy/class/bookkeeping.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index a700ebecb1b..7e7cd787a56 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -365,7 +365,7 @@ class BookKeeping extends CommonObject $sql .= ", ".(!empty($this->subledger_account) ? ("'".$this->db->escape($this->subledger_account)."'") : "NULL"); $sql .= ", ".(!empty($this->subledger_label) ? ("'".$this->db->escape($this->subledger_label)."'") : "NULL"); $sql .= ", '".$this->db->escape($this->numero_compte)."'"; - $sql .= ", ".(!empty($this->label_operation) ? ("'".$this->db->escape($this->label_operation)."'") : "NULL"); + $sql .= ", ".(!empty($this->label_compte) ? ("'".$this->db->escape($this->label_compte)."'") : "NULL"); $sql .= ", '".$this->db->escape($this->label_operation)."'"; $sql .= ", ".$this->debit; $sql .= ", ".$this->credit; From 2915bf89d9c14c0121ca95eaf57a706a2a03c0d7 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 29 Jan 2021 09:32:00 +0100 Subject: [PATCH 53/82] FIX : stickler feedback on br tag --- htdocs/compta/sociales/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 1775aa3efb9..a900fe73d67 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -464,7 +464,7 @@ if ($id > 0) // Employee if($action != 'editfk_user') { - $morehtmlref .= '
    ' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); + $morehtmlref .= '
    ' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); if(!empty($object->fk_user)) { $userstatic = new User($db); From fcf72d5e5086d3ff42c33680488564f054c0db51 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Fri, 29 Jan 2021 10:35:48 +0100 Subject: [PATCH 54/82] Update pdf_azur.modules.php --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 3b09d639bf0..1be02c55180 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -243,7 +243,7 @@ class pdf_azur extends ModelePDFPropales $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; } else { - $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; // default + $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative } @@ -257,7 +257,7 @@ class pdf_azur extends ModelePDFPropales } else { $dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product } - +$dirphoto=$pdir[1]; foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) { if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo @@ -418,6 +418,7 @@ class pdf_azur extends ModelePDFPropales // Affiche notes $notetoshow = empty($object->note_public) ? '' : $object->note_public; + $notetoshow .= '
    photo'.$obj['photo'].'-'.$realpath.'-'.$dir.'-'.$filename.'-'.$dirphoto; if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) { // Get first sale rep From 400243a1579b409a14701aad222aea086e9a3d69 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 29 Jan 2021 09:41:05 +0000 Subject: [PATCH 55/82] Fixing style errors. --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 1be02c55180..1271be00dbe 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -257,7 +257,7 @@ class pdf_azur extends ModelePDFPropales } else { $dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product } -$dirphoto=$pdir[1]; + $dirphoto=$pdir[1]; foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) { if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo From 720a11877d296fb3f81ed076bbc57ed630f36b2f Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Fri, 29 Jan 2021 10:48:58 +0100 Subject: [PATCH 56/82] Update pdf_azur.modules.php --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 1271be00dbe..be3f53847bf 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -257,7 +257,6 @@ class pdf_azur extends ModelePDFPropales } else { $dir = $conf->product->dir_output.'/'.$midir; //Check repertory of the current product } - $dirphoto=$pdir[1]; foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) { if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo @@ -418,7 +417,6 @@ class pdf_azur extends ModelePDFPropales // Affiche notes $notetoshow = empty($object->note_public) ? '' : $object->note_public; - $notetoshow .= '
    photo'.$obj['photo'].'-'.$realpath.'-'.$dir.'-'.$filename.'-'.$dirphoto; if (!empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) { // Get first sale rep From 77b0075d71a32f44fcc06426cf4f63478e7c6c31 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Fri, 29 Jan 2021 10:50:11 +0100 Subject: [PATCH 57/82] Update pdf_azur.modules.php --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 3b09d639bf0..a17f8c9a8ac 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -243,7 +243,7 @@ class pdf_azur extends ModelePDFPropales $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; } else { - $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; // default + $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative } From 215e36bb2ef791d148e1e014c87f9021e983314f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Jan 2021 11:19:33 +0100 Subject: [PATCH 58/82] Fix typo --- htdocs/langs/en_US/errors.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 5634905da6e..a7a7e12db14 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -59,6 +59,7 @@ ErrorDirNotFound=Directory %s not found (Bad path, wrong permissions or a ErrorFunctionNotAvailableInPHP=Function %s is required for this feature but is not available in this version/setup of PHP. ErrorDirAlreadyExists=A directory with this name already exists. ErrorFileAlreadyExists=A file with this name already exists. +ErrorDestinationAlreadyExists=Another file with the name %s already exists. ErrorPartialFile=File not received completely by server. ErrorNoTmpDir=Temporary directy %s does not exists. ErrorUploadBlockedByAddon=Upload blocked by a PHP/Apache plugin. From e48fc6c3d05dcd9746373ea102be5aab87251ea2 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Fri, 29 Jan 2021 13:51:06 +0100 Subject: [PATCH 59/82] Update pdf_cyan.modules.php --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 80433eb2201..760e678e839 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -242,7 +242,7 @@ class pdf_cyan extends ModelePDFPropales $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; } else { - $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; // default + $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative } From 6b62d039930cc5727ade964461dab876de93f191 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Fri, 29 Jan 2021 13:56:04 +0100 Subject: [PATCH 60/82] Update pdf_cyan.modules.php --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 80433eb2201..760e678e839 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -242,7 +242,7 @@ class pdf_cyan extends ModelePDFPropales $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; } else { - $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; // default + $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative } From cfca26a727e1aac64e73cca026f31dc4385cd079 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Fri, 29 Jan 2021 16:20:43 +0100 Subject: [PATCH 61/82] Fix fix --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 4 ---- htdocs/install/mysql/tables/llx_mrp_production.sql | 1 - htdocs/mrp/class/mo.class.php | 2 +- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index f1ea3d237a3..31cdf9c8d62 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -554,7 +554,3 @@ INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64); ALTER TABLE llx_projet ADD COLUMN fk_opp_status_end integer DEFAULT NULL; - -ALTER TABLE llx_mrp_production ADD COLUMN fk_soc integer NOT NULL; - - diff --git a/htdocs/install/mysql/tables/llx_mrp_production.sql b/htdocs/install/mysql/tables/llx_mrp_production.sql index d2b44427f58..36129a54aea 100644 --- a/htdocs/install/mysql/tables/llx_mrp_production.sql +++ b/htdocs/install/mysql/tables/llx_mrp_production.sql @@ -17,7 +17,6 @@ CREATE TABLE llx_mrp_production( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, fk_mo integer NOT NULL, - fk_soc integer NOT NULL, position integer NOT NULL DEFAULT 0, fk_product integer NOT NULL, fk_warehouse integer, diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 274782a14ea..2de6aecc4bf 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1352,7 +1352,7 @@ class Mo extends CommonObject */ public static function replaceThirdparty($db, $origin_id, $dest_id) { - $tables = array('mrp_production'); + $tables = array('mrp_mo'); return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } From 2436e7c5b24dc9332e6208056ef3efa4ac0ab88f Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 29 Jan 2021 19:39:50 +0100 Subject: [PATCH 62/82] FIX: 13 create MO, Column 'tms' cannot be null --- htdocs/mrp/class/mo.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 274782a14ea..17d4217bbcd 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -106,7 +106,7 @@ class Mo extends CommonObject 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'notnull'=>-1,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'notnull'=>-1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>-1,), + 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,), 'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502,), 'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid',), 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), From ccf283293894a6277a2f51c835f25f43df6c2c75 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Jan 2021 12:45:43 +0100 Subject: [PATCH 63/82] Clean code --- htdocs/admin/tools/export.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 0c3679c62fa..b2fd7f5c2ee 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -80,7 +80,7 @@ $_SESSION["commandbackuptorun"] = ''; $_SESSION["commandbackupresult"] = ''; // Increase limit of time. Works only if we are not in safe mode -$ExecTimeLimit = 600; +$ExecTimeLimit = 600; // Set it to 0 to not use a forced time limit if (!empty($ExecTimeLimit)) { $err = error_reporting(); @@ -95,8 +95,6 @@ if (!empty($MemoryLimit)) @ini_set('memory_limit', $MemoryLimit); } -$form = new Form($db); -$formfile = new FormFile($db); //$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad'; //llxHeader('','',$help_url); @@ -222,16 +220,7 @@ if ($errormsg) } -/* -$filearray=dol_dir_list($conf->admin->dir_output.'/backup','files',0,'','',$sortfield,(strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC),1); -$result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'backup/',1,0,($langs->trans("NoBackupFileAvailable").'
    '.$langs->trans("ToBuildBackupFileClickHere",DOL_URL_ROOT.'/admin/tools/dolibarr_export.php')),0,$langs->trans("PreviousDumpFiles")); - -print '
    '; -*/ - // Redirect to backup page header("Location: dolibarr_export.php".(GETPOST('page_y', 'int') ? '?page_y='.GETPOST('page_y', 'int') : '')); -$time_end = time(); - $db->close(); From 0f19a11ebe91708492666658e9af83427ed601ca Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 30 Jan 2021 12:54:10 +0100 Subject: [PATCH 64/82] missing declaration --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 0b99583e08e..f02f04728cd 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -47,6 +47,11 @@ class pdf_einstein extends ModelePDFCommandes */ public $db; + /** + * @var int The environment ID when using a multicompany module + */ + public $entity; + /** * @var string model name */ From 1063b97c221bf02387edd8999a784d867c1b65dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Jan 2021 12:55:38 +0100 Subject: [PATCH 65/82] Close #16099 Close #16098 --- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 80433eb2201..760e678e839 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -242,7 +242,7 @@ class pdf_cyan extends ModelePDFPropales $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; } else { - $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; // default + $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product'); // default $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative } From e584792382c280c168347d107852c59d9faf324b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 30 Jan 2021 12:57:06 +0100 Subject: [PATCH 66/82] missing declaration --- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index d1492dbc5eb..9232797a008 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -47,6 +47,11 @@ class pdf_eratosthene extends ModelePDFCommandes */ public $db; + /** + * @var int The environment ID when using a multicompany module + */ + public $entity; + /** * @var string model name */ From ca7738c9b392128b872adb55f73536139e0c952e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Jan 2021 13:57:42 +0100 Subject: [PATCH 67/82] FIX #16107 --- htdocs/api/class/api_documents.class.php | 2 +- htdocs/core/lib/functions.lib.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 2d6a598398c..ebeeac5c5b9 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -425,7 +425,7 @@ class Documents extends DolibarrApi throw new RestException(500, 'Error while fetching object: '.$object->error); } - $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref); + $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'product'); } elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a509d3bd7a6..694612bde07 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5652,7 +5652,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart = ' $arrayforoldpath = array('cheque', 'category', 'holiday', 'supplier_invoice', 'invoice_supplier', 'mailing', 'supplier_payment'); if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[] = 'product'; if (!empty($level) && in_array($modulepart, $arrayforoldpath)) { - // This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided. + // This part should be removed once all code is using "get_exdir" to forge path, with parameter $object and $modulepart provided. if (empty($alpha)) $num = preg_replace('/([^0-9])/i', '', $num); else $num = preg_replace('/^.*\-/i', '', $num); $num = substr("000".$num, -$level); From 58dec39f94e2edef22855e2c19ccba19a65de196 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 30 Jan 2021 17:07:13 +0100 Subject: [PATCH 68/82] Fix start and end month for turnover report. --- htdocs/compta/stats/index.php | 138 ++++++++++++++++++---------------- 1 file changed, 75 insertions(+), 63 deletions(-) diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 0be6659f7b4..03c128e841f 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -44,12 +44,12 @@ $nbofyear = 4; $year = GETPOST('year', 'int'); if (empty($year)) { - $year_current = strftime("%Y", dol_now()); - $month_current = strftime("%m", dol_now()); + $year_current = dol_print_date(dol_now(), "%Y"); + $month_current = dol_print_date(dol_now(), "%m"); $year_start = $year_current - ($nbofyear - 1); } else { $year_current = $year; - $month_current = strftime("%m", dol_now()); + $month_current = dol_print_date(dol_now(), "%m"); $year_start = $year - ($nbofyear - 1); } $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); @@ -58,12 +58,12 @@ $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); // We define date_start and date_end if (empty($date_start) || empty($date_end)) // We define date_start and date_end { - $q = GETPOST("q") ?GETPOST("q") : 0; + $q = GETPOST("q") ? GETPOST("q") : 0; if ($q == 0) { // We define date_start and date_end $year_end = $year_start + ($nbofyear - 1); - $month_start = GETPOST("month") ?GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); + $month_start = GETPOSTISSET("month") ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1); if (!GETPOST('month')) { if (!GETPOST("year") && $month_start > $month_current) @@ -86,8 +86,10 @@ $userid = GETPOST('userid', 'int'); $socid = GETPOST('socid', 'int'); $tmps = dol_getdate($date_start); +$mothn_start = $tmps['mon']; $year_start = $tmps['year']; $tmpe = dol_getdate($date_end); +$month_end = $tmpe['mon']; $year_end = $tmpe['year']; $nbofyear = ($year_end - $year_start) + 1; @@ -306,7 +308,7 @@ $now = dol_now(); $casenow = dol_print_date($now, "%Y-%m"); // Loop on each month -$nb_mois_decalage = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START - 1) : 0; +$nb_mois_decalage = GETPOSTISSET('date_startmonth') ? (GETPOST('date_startmonth', 'int') - 1) : (empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 0 : ($conf->global->SOCIETE_FISCAL_MONTH_START - 1)); for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { $mois_modulo = $mois; // ajout @@ -338,68 +340,75 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) if ($annee >= $year_start) // We ignore $annee < $year_start, we loop on it to be able to make delta, nothing is output. { if ($modecompta == 'CREANCES-DETTES') { - // Valeur CA du mois w/o VAT + // Value turnover of month w/o VAT print '
    '; - if ($cum_ht[$case]) - { - $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre. - print ''.price($cum_ht[$case], 1).''; - } else { - if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; } + if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) { + if ($cum_ht[$case]) { + $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre. + print ''.price($cum_ht[$case], 1).''; + } else { + if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; } + } } print "'; - if ($cum[$case]) - { - $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre. - if ($modecompta != 'BOOKKEEPING') print ''; - print price($cum[$case], 1); - if ($modecompta != 'BOOKKEEPING') print ''; - } else { - if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; } + if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) { + if ($cum[$case]) { + $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre. + if ($modecompta != 'BOOKKEEPING') print ''; + print price($cum[$case], 1); + if ($modecompta != 'BOOKKEEPING') print ''; + } else { + if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; } + } } print "'; + //var_dump($annee.' '.$year_end.' '.$mois.' '.$month_end); + if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) { + if ($annee_decalage > $minyear && $case <= $casenow) { - $percent = (round(($cum[$case] - $cum[$caseprev]) / $cum[$caseprev], 4) * 100); - //print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X"; - print ''.($percent >= 0 ? "+$percent" : "$percent").'%+Inf%-100%+Inf%-+0%-'; - if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print ' '; } - print ' 
    '.$langs->trans("Total").''.($total_ht[$annee] ?price($total_ht[$annee]) : "0")."'; + print ($total_ht[$annee] ?price($total_ht[$annee]) : "0"); + print " '.($total[$annee] ?price($total[$annee]) : "0")."'; + print ($total[$annee] ?price($total[$annee]) : "0"); + print " '.($percent >= 0 ? "+$percent" : "$percent").'%'; + print ($percent >= 0 ? "+$percent" : "$percent").'%'; + print '
    '.$langs->trans("PriceQtyMin").''; print ' '; - print $form->selectPriceBaseType((GETPOST('price_base_type') ? GETPOST('price_base_type') : 'HT'), "price_base_type"); // We keep 'HT' here, price_base_type is not yet supported for supplier prices + print $form->selectPriceBaseType((GETPOSTISSET('price_base_type') ? GETPOST('price_base_type') : 'HT'), "price_base_type"); // We keep 'HT' here, price_base_type is not yet supported for supplier prices print '
    '.$langs->trans("DiscountQtyMin").' %'; + print ' %'; print '
    '.dol_trunc($obj->libelle, 42).''.dol_trunc($obj->label, 42).''; print ''; print '