From 96eb7a341a63d8e83f0eb92777fa25079463a330 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Mon, 1 Mar 2021 16:14:38 +0100 Subject: [PATCH 01/23] FIX: Bad project filter in ticket list --- htdocs/ticket/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 1a276c75f5f..5e8d9f640c5 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -362,7 +362,7 @@ foreach ($search as $key => $val) } if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); -//if ($search_fk_project) $sql .= natural_search('fk_project', $search_fk_project, 2); +if ($search_fk_project) $sql .= natural_search('fk_project', $search_fk_project, 2); if ($search_date_start) $sql .= " AND t.datec >= '".$db->idate($search_date_start)."'"; if ($search_date_end) $sql .= " AND t.datec <= '".$db->idate($search_date_end)."'"; if ($search_dateread_start) $sql .= " AND t.date_read >= '".$db->idate($search_dateread_start)."'"; From 861b583668ce9d881baee6b9508f409b728c66a3 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 1 Mar 2021 16:34:42 +0100 Subject: [PATCH 02/23] FIX : handling $heightforinfotot when he's superior to a page height on Supplier Invoice --- htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 26329ac889f..b5b93fec357 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -277,6 +277,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetAutoPageBreak(1, 0); $heightforinfotot = 50+(4*$nbpayments); // Height reserved to output the info and total part and payment part + if($heightforinfotot > 220) $heightforinfotot = 220; $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; From d20ba5a6657533d048d15553ed0c55334c404eb8 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 1 Mar 2021 15:38:15 +0000 Subject: [PATCH 03/23] Fixing style errors. --- .../core/modules/supplier_invoice/pdf/pdf_canelle.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index b5b93fec357..01f6369055b 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -277,7 +277,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetAutoPageBreak(1, 0); $heightforinfotot = 50+(4*$nbpayments); // Height reserved to output the info and total part and payment part - if($heightforinfotot > 220) $heightforinfotot = 220; + if($heightforinfotot > 220) $heightforinfotot = 220; $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS >0) $heightforfooter+= 6; From 0ac5e370669b6ebd62529384467825b6977d50c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 19:41:51 +0100 Subject: [PATCH 04/23] Update date of ticket in demo --- dev/initdemo/updatedemo.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/initdemo/updatedemo.php b/dev/initdemo/updatedemo.php index 5da0d4a2498..207cd07488c 100755 --- a/dev/initdemo/updatedemo.php +++ b/dev/initdemo/updatedemo.php @@ -73,7 +73,8 @@ $tables=array( 'commande_fournisseur'=>array(0=>'date_commande', 1=>'date_valid', 3=>'date_creation', 4=>'date_approve', 5=>'date_approve2', 6=>'date_livraison'), 'supplier_proposal'=>array(0=>'datec', 1=>'date_valid', 2=>'date_cloture'), 'expensereport'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 4=>'date_approve', 5=>'date_refuse', 6=>'date_cancel'), - 'holiday'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 5=>'date_refuse', 6=>'date_cancel') + 'holiday'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 5=>'date_refuse', 6=>'date_cancel'), + 'ticket'=>array(0=>'datec', 1=>'date_read', 2=>'date_close') ); $year=2010; From 6e61ae8e56696e100a324a74ea568355efe39fa3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 19:50:35 +0100 Subject: [PATCH 05/23] Fix responsive --- htdocs/ticket/class/ticket.class.php | 4 ++-- htdocs/ticket/list.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 306f861097b..4571cbd679c 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -254,7 +254,7 @@ class Ticket extends CommonObject 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'notnull'=>1, 'index'=>1), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''), 'track_id' => array('type'=>'varchar(255)', 'label'=>'TicketTrackId', 'visible'=>-2, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"), - 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), + 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'tdoverflowmax125 maxwidth150onsmartphone'), 'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>'tdoverflowmax150'), 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth200 tdoverflowmax200', 'autofocusoncreate'=>1), 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth125 tdoverflowmax50'), @@ -266,7 +266,7 @@ class Ticket extends CommonObject 'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1), 'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>-1, 'enabled'=>1, 'position'=>501, 'notnull'=>1), - 'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1, 'css'=>'tdoverflowmax150'), + 'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1, 'css'=>'tdoverflowmax125'), 'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1), 'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,), diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 5e8d9f640c5..e9b36a2d364 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -667,7 +667,7 @@ foreach ($object->fields as $key => $val) print ''; } elseif ($key == 'fk_user_assign' || $key == 'fk_user_create') { print ''; - print $form->select_dolusers($search[$key], 'search_'.$key, 1, null, 0, '', '', '0', 0, 0, '', 0, '', ($val['css'] ? $val['css'] : 'maxwidth150')); + print $form->select_dolusers($search[$key], 'search_'.$key, 1, null, 0, '', '', '0', 0, 0, '', 0, '', ($val['css'] ? $val['css'] : 'maxwidth125')); print ''; } elseif ($key == 'fk_statut') { $arrayofstatus = array(); @@ -681,7 +681,7 @@ foreach ($object->fields as $key => $val) //var_dump($arrayofstatus);var_dump($search['fk_statut']);var_dump(array_values($search[$key])); $selectedarray = null; if ($search[$key]) $selectedarray = array_values($search[$key]); - print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth150', 1, 0, '', '', ''); + print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth100 maxwidth150', 1, 0, '', '', ''); print ''; } elseif ($key == "fk_soc") { print ''; From 5b771eb798ad246c37bbef82182d5375f59186ca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 21:56:14 +0100 Subject: [PATCH 06/23] Fix merge of 2 record. --- htdocs/don/class/don.class.php | 17 +++++++++++++++++ htdocs/fourn/class/fournisseur.class.php | 17 +++++++++++++++++ htdocs/societe/card.php | 1 + 3 files changed, 35 insertions(+) diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index be9426415fe..0717870ac42 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -1090,4 +1090,21 @@ class Don extends CommonObject return 0; } } + + /** + * Function used to replace a thirdparty id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old third-party id + * @param int $dest_id New third-party id + * @return bool + */ + public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'don' + ); + + return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); + } } diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php index 4ca073a38c7..877f24803a5 100644 --- a/htdocs/fourn/class/fournisseur.class.php +++ b/htdocs/fourn/class/fournisseur.class.php @@ -204,4 +204,21 @@ class Fournisseur extends Societe } return $arr; } + + /** + * Function used to replace a thirdparty id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old third-party id + * @param int $dest_id New third-party id + * @return bool + */ + public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'facture_fourn' + ); + + return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); + } } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 4afb596fbda..43a976ba9b2 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -232,6 +232,7 @@ if (empty($reshook)) // TODO Mutualise the list into object societe.class.php $objects = array( 'Adherent' => '/adherents/class/adherent.class.php', + 'Don' => '/don/class/don.class.php', 'Societe' => '/societe/class/societe.class.php', //'Categorie' => '/categories/class/categorie.class.php', 'ActionComm' => '/comm/action/class/actioncomm.class.php', From f64f53e460599945b9c8ffca3620b4c0cbabb047 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 21:57:45 +0100 Subject: [PATCH 07/23] Reduce errors --- htdocs/societe/card.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 43a976ba9b2..66f82e4e7bb 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -266,6 +266,7 @@ if (empty($reshook)) { $error++; setEventMessages($db->lasterror(), null, 'errors'); + break; } } } @@ -282,6 +283,7 @@ if (empty($reshook)) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $error++; + break; } } From fb0eda446eb51c832b0879f1a0e725c03a3ca963 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 22:00:48 +0100 Subject: [PATCH 08/23] Fix bad break --- htdocs/societe/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 66f82e4e7bb..66b5f68564e 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -283,7 +283,6 @@ if (empty($reshook)) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $error++; - break; } } From b8bd5cd0ee40e493bee08bc0bc48cc6afce2ca5f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 1 Mar 2021 23:08:03 +0100 Subject: [PATCH 09/23] FIX Protection to avoid #16504 --- htdocs/product/class/product.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 3be810a2e8e..188bcbfd355 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4374,6 +4374,10 @@ class Product extends CommonObject { global $alreadyfound; + if (empty($id)) { + return array(); + } + $sql = "SELECT p.rowid, p.ref, p.label as label, p.fk_product_type,"; $sql .= " pa.qty as qty, pa.fk_product_fils as id, pa.incdec"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p,"; @@ -4387,7 +4391,8 @@ class Product extends CommonObject if ($level == 1) { $alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly } // Protection against infinite loop - if ($level > 30) { return array(); + if ($level > 30) { + return array(); } $res = $this->db->query($sql); From 15cc0f8775147ccc2db3a1f7a000218b27badace Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Mon, 1 Mar 2021 23:09:07 +0100 Subject: [PATCH 10/23] Avoid php errors if negative var in Receipt Module Solved in develop branch with PR https://github.com/Dolibarr/dolibarr/pull/15994/files After testing we introduce it in version 13 --- htdocs/core/class/dolreceiptprinter.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index e075005b437..b984f1ab2ce 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -634,7 +634,7 @@ class dolReceiptPrinter extends Printer if ($line->fk_product) { $spacestoadd = $nbcharactbyline - strlen($line->ref) - strlen($line->qty) - 10 - 1; - $spaces = str_repeat(' ', $spacestoadd); + $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0); $this->printer->text($line->ref.$spaces.$line->qty.' '.str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT)."\n"); $this->printer->text(strip_tags(htmlspecialchars_decode($line->product_label))."\n"); } From 5bb7c521aa2933c555926d563b5723a881e87464 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Mon, 1 Mar 2021 23:30:38 +0100 Subject: [PATCH 11/23] Update dolreceiptprinter.class.php --- htdocs/core/class/dolreceiptprinter.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index b984f1ab2ce..4dfca1186c0 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -640,7 +640,7 @@ class dolReceiptPrinter extends Printer } else { $spacestoadd = $nbcharactbyline - strlen($line->description) - strlen($line->qty) - 10 - 1; - $spaces = str_repeat(' ', $spacestoadd); + $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0); $this->printer->text($line->description.$spaces.$line->qty.' '.str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT)."\n"); } } @@ -653,7 +653,7 @@ class dolReceiptPrinter extends Printer } foreach ($vatarray as $vatkey => $vatvalue) { $spacestoadd = $nbcharactbyline - strlen($vatkey) - 12; - $spaces = str_repeat(' ', $spacestoadd); + $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0); $this->printer->text($spaces.$vatkey.'% '.str_pad(price($vatvalue), 10, ' ', STR_PAD_LEFT)."\n"); } break; @@ -680,15 +680,15 @@ class dolReceiptPrinter extends Printer case 'DOL_PRINT_OBJECT_TOTAL': $title = $langs->trans('TotalHT'); $spacestoadd = $nbcharactbyline - strlen($title) - 10; - $spaces = str_repeat(' ', $spacestoadd); + $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0); $this->printer->text($title.$spaces.str_pad(price($object->total_ht), 10, ' ', STR_PAD_LEFT)."\n"); $title = $langs->trans('TotalVAT'); $spacestoadd = $nbcharactbyline - strlen($title) - 10; - $spaces = str_repeat(' ', $spacestoadd); + $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0); $this->printer->text($title.$spaces.str_pad(price($object->total_tva), 10, ' ', STR_PAD_LEFT)."\n"); $title = $langs->trans('TotalTTC'); $spacestoadd = $nbcharactbyline - strlen($title) - 10; - $spaces = str_repeat(' ', $spacestoadd); + $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0); $this->printer->text($title.$spaces.str_pad(price($object->total_ttc), 10, ' ', STR_PAD_LEFT)."\n"); break; case 'DOL_LINE_FEED': @@ -778,7 +778,7 @@ class dolReceiptPrinter extends Printer if ($line->special_code == $this->orderprinter) { $spacestoadd = $nbcharactbyline - strlen($line->ref) - strlen($line->qty) - 10 - 1; - $spaces = str_repeat(' ', $spacestoadd); + $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0); $this->printer->text($line->ref.$spaces.$line->qty.' '.str_pad(price($line->total_ttc), 10, ' ', STR_PAD_LEFT)."\n"); $this->printer->text(strip_tags(htmlspecialchars_decode($line->desc))."\n"); } @@ -799,14 +799,14 @@ class dolReceiptPrinter extends Printer while ($i < $num) { $row = $this->db->fetch_object($resql); $spacestoadd = $nbcharactbyline - strlen($langs->transnoentitiesnoconv("PaymentTypeShort".$row->code)) - 12; - $spaces = str_repeat(' ', $spacestoadd); + $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0); $amount_payment = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount; if ($row->code == "LIQ") $amount_payment = $amount_payment + $row->pos_change; // Show amount with excess received if is cash payment $this->printer->text($spaces.$langs->transnoentitiesnoconv("PaymentTypeShort".$row->code).' '.str_pad(price($amount_payment), 10, ' ', STR_PAD_LEFT)."\n"); if ($row->code == "LIQ" && $row->pos_change > 0) // Print change only in cash payments { $spacestoadd = $nbcharactbyline - strlen($langs->trans("Change")) - 12; - $spaces = str_repeat(' ', $spacestoadd); + $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0); $this->printer->text($spaces.$langs->trans("Change").' '.str_pad(price($row->pos_change), 10, ' ', STR_PAD_LEFT)."\n"); } $i++; From 88a3454ba8cb9b9763569fb5b2020e70e0644903 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Mar 2021 00:48:02 +0100 Subject: [PATCH 12/23] FIX #16366 --- build/generate_filelist_xml.php | 7 ++++--- build/makepack-dolibarr.pl | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php index 6bfbb9c5c9c..0d9ced5756e 100755 --- a/build/generate_filelist_xml.php +++ b/build/generate_filelist_xml.php @@ -50,15 +50,16 @@ if (empty($argv[1])) { print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n"; exit -1; } + parse_str($argv[1]); $i=0; while ($i < $argc) { if (! empty($argv[$i])) parse_str($argv[$i]); if (preg_match('/includeconstant=/', $argv[$i])) { - $tmp=explode(':', $includeconstant, 3); + $tmp=explode(':', $includeconstant, 3); // $includeconstant has been set with previous parse_str() if (count($tmp) != 3) { - print "Error: Bad parameter includeconstant ".$includeconstant."\n"; + print "Error: Bad parameter includeconstant=".$includeconstant."\n"; exit -1; } $includeconstants[$tmp[0]][$tmp[1]] = $tmp[2]; @@ -151,7 +152,7 @@ $iterator1 = new RecursiveIteratorIterator($dir_iterator1); $files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom?'':'custom\/|').'documents\/|conf\/|install\/))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i'); */ $regextoinclude='\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$'; -$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs +$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs $files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname'); $dir=''; diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 0fe73fd9fb8..906601d94d4 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -390,6 +390,9 @@ if ($nboftargetok) { $olddir=getcwd(); chdir("$SOURCE"); + print "Clean $SOURCE/htdocs\n"; + $ret=`rm -f $SOURCE/htdocs/includes/autoload.php`; + $ret=`git ls-files . --exclude-standard --others`; if ($ret) { @@ -613,7 +616,6 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/parsedown/LICENSE.txt`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/tests`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/tests`; @@ -623,7 +625,6 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/webmozart`; From cffea1889f8936f941955c7ee48f3ff726e60c13 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Mar 2021 01:17:28 +0100 Subject: [PATCH 13/23] FIX #16325 --- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/compta/facture/card.php | 2 +- htdocs/core/class/html.form.class.php | 4 ++-- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- htdocs/langs/en_US/main.lang | 2 +- htdocs/langs/fr_FR/main.lang | 2 +- htdocs/supplier_proposal/card.php | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3d06d3cc0e0..eb3e3ef375a 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1313,7 +1313,7 @@ if (empty($reshook)) $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); } // Multicurrency rate elseif ($action == 'setmulticurrencyrate' && $usercancreate) { - $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int')); } // bank account elseif ($action == 'setbankaccount' && $usercancreate) { $result = $object->setBankAccount(GETPOST('fk_account', 'int')); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 3a519e9801a..eccb6cd4ca6 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -549,7 +549,7 @@ if (empty($reshook)) // Multicurrency rate elseif ($action == 'setmulticurrencyrate' && $usercancreate) { - $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int')); } elseif ($action == 'setavailability' && $usercancreate) { $result = $object->availability(GETPOST('availability_id')); if ($result < 0) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 77c64f26b72..9f7b9e77af3 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -377,7 +377,7 @@ if (empty($reshook)) } elseif ($action == 'setinvoicedate' && $usercancreate) { $object->fetch($id); $old_date_lim_reglement = $object->date_lim_reglement; - $date = dol_mktime(12, 0, 0, $_POST['invoicedatemonth'], $_POST['invoicedateday'], $_POST['invoicedateyear']); + $date = dol_mktime(12, 0, 0, GETPOST('invoicedatemonth', 'int'), GETPOST('invoicedateday', 'int'), GETPOST('invoicedateyear', 'int')); if (empty($date)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b7912e93dc4..0773e95f2a6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4892,8 +4892,8 @@ class Form print ''; print ' '; print ' '; print ''; print ''; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 520c8bc3c47..db5e906ec85 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -190,7 +190,7 @@ if (empty($reshook)) // Multicurrency rate elseif ($action == 'setmulticurrencyrate' && $usercancreate) { - $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int')); } // bank account diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 63557b91e05..eb6a87af040 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -366,7 +366,7 @@ if (empty($reshook)) // Multicurrency rate elseif ($action == 'setmulticurrencyrate' && $usercancreate) { - $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx', 'alpha'))); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx', 'alpha')), GETPOST('calculation_mode', 'int')); } // bank account diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 7a666acc146..5594c835ba8 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -361,7 +361,7 @@ UnitPriceHTCurrency=Unit price (excl.) (currency) UnitPriceTTC=Unit price PriceU=U.P. PriceUHT=U.P. (net) -PriceUHTCurrency=U.P (currency) +PriceUHTCurrency=U.P (net) (currency) PriceUTTC=U.P. (inc. tax) Amount=Amount AmountInvoice=Invoice amount diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index a862a1ecb9d..70f50c7eea3 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -361,7 +361,7 @@ UnitPriceHTCurrency=Prix ​​unitaire (HT) (devise) UnitPriceTTC=Prix unitaire TTC PriceU=P.U. PriceUHT=P.U. HT -PriceUHTCurrency=P.U. (devise) +PriceUHTCurrency=P.U. HT (devise) PriceUTTC=P.U TTC Amount=Montant AmountInvoice=Montant facture diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index e271a796585..cca21d3a305 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1037,7 +1037,7 @@ if (empty($reshook)) // Multicurrency rate elseif ($action == 'setmulticurrencyrate' && $usercancreate) { - $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int')); } elseif ($action == 'update_extras') { $object->oldcopy = dol_clone($object); From 23e8401e61de6d35675b0d97ba3b7c33ae6b85a4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Mar 2021 01:22:23 +0100 Subject: [PATCH 14/23] FIX #16296 --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index d8d9aa7a4a3..8b02edcbbe0 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1203,7 +1203,7 @@ class FactureFournisseur extends CommonInvoice include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $ref = dol_sanitizeFileName($this->ref); - $dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id, 2, 0, 0, $this, 'invoive_supplier').$ref; + $dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id, 2, 0, 0, $this, 'invoice_supplier').$ref; $file = $dir."/".$ref.".pdf"; if (file_exists($file)) { From d7500b16097ac6346d381cab3ff18bdee58e5813 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 2 Mar 2021 09:45:49 +0100 Subject: [PATCH 15/23] fix php warning --- htdocs/compta/facture/class/facture.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ef0962a0169..dd081a87870 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1217,8 +1217,9 @@ class Facture extends CommonInvoice $object->lines[$i]->date_end = $newLast; } } - - $object->lines[$i]->ref_ext = ''; // Do not clone ref_ext + if ($object->lines[$i]) { + $object->lines[$i]->ref_ext = ''; + }// Do not clone ref_ext } // Create clone From 593ae78761958c20148a9d3ead44cc34eeb7a7d3 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 2 Mar 2021 10:55:23 +0100 Subject: [PATCH 16/23] avoid php wrning --- htdocs/core/lib/modulebuilder.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index ff14ec56e18..375ec6f7ed5 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -51,7 +51,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = } // Check parameters - if (count($addfieldentry) > 0) + if (!empty($addfieldentry) && count($addfieldentry) > 0) { if (empty($addfieldentry['name'])) { From 1d642f49f7869ba78e56348dc5f3923d40016171 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Mar 2021 12:37:24 +0100 Subject: [PATCH 17/23] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index dd081a87870..40d220ac717 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1192,6 +1192,7 @@ class Facture extends CommonInvoice if (($object->lines[$i]->info_bits & 0x02) == 0x02) // We do not clone line of discounts { unset($object->lines[$i]); + continue; } // Bloc to update dates of service (month by month only if previously filled and similare to start and end of month) @@ -1217,9 +1218,8 @@ class Facture extends CommonInvoice $object->lines[$i]->date_end = $newLast; } } - if ($object->lines[$i]) { - $object->lines[$i]->ref_ext = ''; - }// Do not clone ref_ext + + $object->lines[$i]->ref_ext = ''; // Do not clone ref_ext } // Create clone From 35cb48d64976fa679dcd0c6ffce0f947234f77e0 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 2 Mar 2021 11:37:46 +0000 Subject: [PATCH 18/23] Fixing style errors. --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 40d220ac717..6656141593c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1218,7 +1218,7 @@ class Facture extends CommonInvoice $object->lines[$i]->date_end = $newLast; } } - + $object->lines[$i]->ref_ext = ''; // Do not clone ref_ext } From ef99b0f98c33ede42d80cf03264fadd73eea1f44 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 Mar 2021 12:38:17 +0100 Subject: [PATCH 19/23] Update modulebuilder.lib.php --- htdocs/core/lib/modulebuilder.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 375ec6f7ed5..f0da3bad3ea 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -51,7 +51,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = } // Check parameters - if (!empty($addfieldentry) && count($addfieldentry) > 0) + if (is_array($addfieldentry) && count($addfieldentry) > 0) { if (empty($addfieldentry['name'])) { From e1ff1c736c700455430b9cd92960bfaf1f2411d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 1 Mar 2021 18:06:03 +0100 Subject: [PATCH 20/23] fix typo Conflicts: htdocs/core/login/functions_openid.php --- htdocs/core/login/functions_openid.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/core/login/functions_openid.php b/htdocs/core/login/functions_openid.php index f0191da53c0..3819e3503dd 100644 --- a/htdocs/core/login/functions_openid.php +++ b/htdocs/core/login/functions_openid.php @@ -43,8 +43,7 @@ function check_user_password_openid($usertotest, $passwordtotest, $entitytotest) $login = ''; // Get identity from user and redirect browser to OpenID Server - if (GETPOSISSET('username')) - { + if (GETPOSTISSET('username')) { $openid = new SimpleOpenID(); $openid->SetIdentity($_POST['username']); $protocol = ($conf->file->main_force_https ? 'https://' : 'http://'); @@ -61,10 +60,8 @@ function check_user_password_openid($usertotest, $passwordtotest, $entitytotest) return false; } return false; - } - // Perform HTTP Request to OpenID server to validate key - elseif ($_GET['openid_mode'] == 'id_res') - { + } elseif ($_GET['openid_mode'] == 'id_res') { + // Perform HTTP Request to OpenID server to validate key $openid = new SimpleOpenID(); $openid->SetIdentity($_GET['openid_identity']); $openid_validation_result = $openid->ValidateWithServer(); From 27c354567ad04a6c1f45c3986d25fe8782ebf865 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 2 Mar 2021 14:06:11 +0100 Subject: [PATCH 21/23] FIX : select list dependencies now work for ModuleBuilder sellist field --- htdocs/core/class/commonobject.class.php | 45 ++++++++++++++++-------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4260bdc93dc..85789c98b24 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5878,6 +5878,7 @@ abstract class CommonObject $out = ''; $type = ''; + $isDependList=0; $param = array(); $param['options'] = array(); $reg = array(); @@ -5916,6 +5917,7 @@ abstract class CommonObject $type = $this->fields[$key]['type']; } + $label = $this->fields[$key]['label']; //$elementtype=$this->fields[$key]['elementtype']; // Seems not used $default = $this->fields[$key]['default']; @@ -6058,7 +6060,6 @@ abstract class CommonObject // 4 : where clause filter on column or table extrafield, syntax field='value' or extra.field=value $keyList = (empty($InfoFieldList[2]) ? 'rowid' : $InfoFieldList[2].' as rowid'); - if (count($InfoFieldList) > 4 && !empty($InfoFieldList[4])) { if (strpos($InfoFieldList[4], 'extra.') !== false) { $keyList = 'main.'.$InfoFieldList[2].' as rowid'; @@ -6172,6 +6173,7 @@ abstract class CommonObject if (!empty($InfoFieldList[3]) && $parentField) { $parent = $parentName.':'.$obj->{$parentField}; + $isDependList=1; } $out .= '