From 6de6782458094fdeed32243016a965f61c021088 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 5 Mar 2021 08:41:04 +0100 Subject: [PATCH 01/32] fix: set class at right place --- htdocs/core/class/html.formfile.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 46e85707497..974bdce6d26 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1382,7 +1382,7 @@ class FormFile // $section is inside $param $newparam.=preg_replace('/&file=.*$/', '', $param); // We don't need param file= $backtopage = DOL_URL_ROOT.'/ecm/index.php?§ion_dir='.urlencode($relativepath).$newparam; - print ''.img_edit('default', 0, 'class="paddingrightonly"').''; + print ''.img_edit('default', 0, 'class="paddingrightonly"').''; } if (empty($useinecm) || $useinecm == 2 || $useinecm == 6) // 6=Media file manager @@ -1408,7 +1408,7 @@ class FormFile if ($permtoeditline) { $paramsectiondir = (in_array($modulepart, array('medias', 'ecm')) ? '§ion_dir='.urlencode($relativepath) : ''); - print ''.img_edit('default', 0, 'class="paddingrightonly"').''; + print ''.img_edit('default', 0, 'class="paddingrightonly"').''; } } if ($permonobject) From 7543b63a6ed9ff214c92b5768ad948284416f59b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 5 Mar 2021 08:49:56 +0100 Subject: [PATCH 02/32] Fix #16544 --- htdocs/societe/consumption.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index e9514365c0f..4acf31c059e 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -422,6 +422,7 @@ if ($sql_select) $documentstatic->statut = $objp->status; $documentstatic->status = $objp->status; $documentstatic->paye = $objp->paid; + $documentstatic->alreadypaid = $objp->paid; if (is_object($documentstaticline)) $documentstaticline->statut = $objp->status; @@ -436,6 +437,8 @@ if ($sql_select) if ($type_element == 'contract') { print $documentstaticline->getLibStatut(2); + } elseif ($type_element == 'invoice') { + print $documentstatic->getLibStatut(5, $objp->paid); } else { From fee5bbf65b4346e40d8a67f84c287d4110945490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 7 Mar 2021 09:12:46 +0100 Subject: [PATCH 03/32] fix usage of else if --- htdocs/admin/tools/listevents.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 5e6667c58ad..3cfc3c74db9 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -68,7 +68,7 @@ $nowarray = dol_getdate($now); if (!GETPOSTISSET("date_startmonth")) { $date_start = dol_get_first_day($nowarray['year'], $nowarray['mon'], 'tzuserrel'); -} else if (GETPOST("date_startmonth") > 0) { +} elseif (GETPOST("date_startmonth") > 0) { $date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth", 'int'), GETPOST("date_startday", 'int'), GETPOST("date_startyear", 'int'), 'tzuserrel'); } else { $date_start = -1; From 4834f5fdf42986bdf402a29994cfd88a33aa5530 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 7 Mar 2021 17:32:43 +0100 Subject: [PATCH 04/32] Fix get thirdparties by barcode or email --- htdocs/societe/class/api_thirdparties.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 3e8a6c91f92..27493d14515 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1815,7 +1815,7 @@ class Thirdparties extends DolibarrApi if (!DolibarrApiAccess::$user->rights->societe->lire) { throw new RestException(401); } - if ($rowid == 0) { + if ($rowid == 0 && empty($email) && empty($barcode)) { $result = $this->company->initAsSpecimen(); } else { $result = $this->company->fetch($rowid, $ref, $ref_ext, $barcode, $idprof1, $idprof2, $idprof3, $idprof4, $idprof5, $idprof6, $email, $ref_alias); From c0c9ac439f340be36a41f2a3dbf47b2f3535d8d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 8 Mar 2021 00:23:05 +0100 Subject: [PATCH 05/32] Update api_agendaevents.class.php --- htdocs/comm/action/class/api_agendaevents.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index e09bc905b96..d9feb4472b6 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -66,7 +66,7 @@ class AgendaEvents extends DolibarrApi if (!DolibarrApiAccess::$user->rights->agenda->myactions->read) { throw new RestException(401, "Insufficient rights to read an event"); } - if ($id == 0) { + if ($id === 0) { $result = $this->actioncomm->initAsSpecimen(); } else { $result = $this->actioncomm->fetch($id); From ec8baa6bff9b921e3591036ac22d340017369e39 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Mon, 8 Mar 2021 10:00:19 +0100 Subject: [PATCH 06/32] Update commondocgenerator.class.php #16341 --- htdocs/core/class/commondocgenerator.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 03a5154f23f..ec05ad5d98d 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -798,6 +798,15 @@ abstract class CommonDocGenerator $resarray = $this->fill_substitutionarray_with_extrafields($line, $resarray, $extrafields, $array_key, $outputlangs); + // Load product data optional fields to the line -> enables to use "line_product_options_{extrafield}" + if (isset($line->fk_product) && $line->fk_product > 0) + { + $tmpproduct = new Product($this->db); + $result = $tmpproduct->fetch($line->fk_product); + foreach ($tmpproduct->array_options as $key=>$label) + $resarray["line_product_".$key] = $label; + } + return $resarray; } From cbb7751a157143f850e98c682bee61392e8bc4c4 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 8 Mar 2021 11:51:18 +0100 Subject: [PATCH 07/32] FIX : rounding amount on card updating --- 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 d7f20622a43..9aa17914828 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -546,7 +546,7 @@ if ($id > 0) if ($action == 'edit') { print ''.$langs->trans("AmountTTC").""; - print ''; + print ''; print ""; } else { From 67c6577177cf5e58f81c140ca6cb4d46e840a0f6 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Mon, 8 Mar 2021 15:47:02 +0100 Subject: [PATCH 08/32] FIX : Add "Now" link on social charges card creation --- 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 d7f20622a43..dd5869b47c9 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -343,7 +343,7 @@ if ($action == 'create') print $langs->trans("Date"); print ''; print ''; - print $form->selectDate(!empty($dateech) ? $dateech : '-1', 'ech', 0, 0, 0, 'charge', 1); + print $form->selectDate(!empty($dateech) ? $dateech : '-1', 'ech', 0, 0, 0, 'charge', 1, 1); print ''; print "\n"; From 77b60d4d1cca0452b368ad8a55bc21ed3489e97f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Mar 2021 16:20:15 +0100 Subject: [PATCH 09/32] Update api_thirdparties.class.php --- htdocs/societe/class/api_thirdparties.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 27493d14515..f88668524ac 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1815,7 +1815,7 @@ class Thirdparties extends DolibarrApi if (!DolibarrApiAccess::$user->rights->societe->lire) { throw new RestException(401); } - if ($rowid == 0 && empty($email) && empty($barcode)) { + if ($rowid === 0 && empty($email) && empty($barcode)) { $result = $this->company->initAsSpecimen(); } else { $result = $this->company->fetch($rowid, $ref, $ref_ext, $barcode, $idprof1, $idprof2, $idprof3, $idprof4, $idprof5, $idprof6, $email, $ref_alias); From 3b9f38caa1f74a00c80a206446eb9501899f531d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Mar 2021 16:22:26 +0100 Subject: [PATCH 10/32] Update api_thirdparties.class.php --- htdocs/societe/class/api_thirdparties.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index f88668524ac..492916935f8 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1793,7 +1793,7 @@ class Thirdparties extends DolibarrApi * * Return an array with thirdparty informations * - * @param int $rowid Id of third party to load + * @param int $rowid Id of third party to load (Use 0 to get a specimen record, use null to use other search criterias) * @param string $ref Reference of third party, name (Warning, this can return several records) * @param string $ref_ext External reference of third party (Warning, this information is a free field not provided by Dolibarr) * @param string $barcode Barcode of third party to load @@ -1815,7 +1815,7 @@ class Thirdparties extends DolibarrApi if (!DolibarrApiAccess::$user->rights->societe->lire) { throw new RestException(401); } - if ($rowid === 0 && empty($email) && empty($barcode)) { + if ($rowid === 0) { $result = $this->company->initAsSpecimen(); } else { $result = $this->company->fetch($rowid, $ref, $ref_ext, $barcode, $idprof1, $idprof2, $idprof3, $idprof4, $idprof5, $idprof6, $email, $ref_alias); From 20c30bade8cf1c229b1be855d7ca3700117a3b00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Mar 2021 16:30:32 +0100 Subject: [PATCH 11/32] Update card.php --- htdocs/compta/sociales/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 9aa17914828..e8697aedea8 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -546,11 +546,11 @@ if ($id > 0) if ($action == 'edit') { print ''.$langs->trans("AmountTTC").""; - print ''; + print ''; print ""; } else { - print ''.$langs->trans("AmountTTC").''.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).''; + print ''.$langs->trans("AmountTTC").''.price($object->amount).''; } // Mode of payment From 14d6893c63fa062a16b6221d823b79bdd5321973 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Mar 2021 18:56:32 +0100 Subject: [PATCH 12/32] Complete fields of product --- htdocs/product/class/product.class.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 97daf343d3f..9abd881eb05 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -421,9 +421,10 @@ class Product extends CommonObject public $fields = array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), - 'barcode' =>array('type'=>'varchar(255)', 'label'=>'Barcode', 'enabled'=>'!empty($conf->barcode->enabled)', 'visible'=>-1, 'showoncombobox'=>1), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), - 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>5), + 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15), + 'barcode' =>array('type'=>'varchar(255)', 'label'=>'Barcode', 'enabled'=>'!empty($conf->barcode->enabled)', 'position'=>20, 'visible'=>-1, 'showoncombobox'=>1), + 'fk_barcode_type' => array('type'=>'integer', 'label'=>'BarcodeType', 'enabled'=>'1', 'position'=>21, 'notnull'=>0, 'visible'=>-1,), 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61), 'note' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500), @@ -432,6 +433,10 @@ class Product extends CommonObject 'fk_user_author'=>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'llx_user.rowid'), 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), + 'localtax1_tx' => array('type'=>'double(6,3)', 'label'=>'Localtax1tx', 'enabled'=>'1', 'position'=>150, 'notnull'=>0, 'visible'=>-1,), + 'localtax1_type' => array('type'=>'varchar(10)', 'label'=>'Localtax1type', 'enabled'=>'1', 'position'=>155, 'notnull'=>1, 'visible'=>-1,), + 'localtax2_tx' => array('type'=>'double(6,3)', 'label'=>'Localtax2tx', 'enabled'=>'1', 'position'=>160, 'notnull'=>0, 'visible'=>-1,), + 'localtax2_type' => array('type'=>'varchar(10)', 'label'=>'Localtax2type', 'enabled'=>'1', 'position'=>165, 'notnull'=>1, 'visible'=>-1,), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), //'tosell' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), //'tobuy' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), From 28c04a684f7cd384a35608070aa505a3fbae27a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Mar 2021 19:09:02 +0100 Subject: [PATCH 13/32] Fix position of field --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 cc0bb4224b2..cc0386621a8 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 @@ -329,7 +329,7 @@ ALTER TABLE llx_product MODIFY COLUMN desiredstock float; ALTER TABLE llx_product_warehouse_properties MODIFY COLUMN seuil_stock_alerte float; ALTER TABLE llx_product_warehouse_properties MODIFY COLUMN desiredstock float; -ALTER TABLE llx_product ADD COLUMN fk_state integer DEFAULT NULL; +ALTER TABLE llx_product ADD COLUMN fk_state integer DEFAULT NULL AFTER fk_country; ALTER TABLE llx_projet ADD COLUMN email_msgid varchar(255); ALTER TABLE llx_ticket ADD COLUMN email_msgid varchar(255); From de1cf54e2f25cb691831c20862bcf880fd55642c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 9 Mar 2021 00:20:28 +0100 Subject: [PATCH 14/32] Update box_members_by_type.php --- htdocs/core/boxes/box_members_by_type.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php index 5d32f9663d5..cf81eaac57c 100644 --- a/htdocs/core/boxes/box_members_by_type.php +++ b/htdocs/core/boxes/box_members_by_type.php @@ -187,7 +187,7 @@ class box_members_by_type extends ModeleBoxes ); $line++; foreach ($AdherentType as $key => $adhtype) { - $SommeA += isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0; + $SommeA += isset($MembersToValidate[$key]) ? $MembersToValidate[$key] : 0; $SommeB += isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0; $SommeC += isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0; $SommeD += isset($MembersResiliated[$key]) ? $MembersResiliated[$key] : 0; @@ -198,7 +198,7 @@ class box_members_by_type extends ModeleBoxes ); $this->info_box_contents[$line][] = array( 'td' => 'class="right"', - 'text' => (isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0 ? $MemberToValidate[$key] : '') . ' ' . $staticmember->LibStatut(-1, $adhtype->subscription, 0, 3), + 'text' => (isset($MembersToValidate[$key]) && $MembersToValidate[$key] > 0 ? $MembersToValidate[$key] : '') . ' ' . $staticmember->LibStatut(-1, $adhtype->subscription, 0, 3), 'asis' => 1, ); $this->info_box_contents[$line][] = array( From bcbf8bb72a084f59c8285d5bb38737cba8ffed7b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 9 Mar 2021 10:21:32 +0100 Subject: [PATCH 15/32] allow table alias into commonObject getFieldList --- htdocs/core/class/commonobject.class.php | 30 ++++++++++++------- .../template/class/myobject.class.php | 2 +- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c7dbab57b31..353dbd7da33 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7467,12 +7467,22 @@ abstract class CommonObject /** * Function to concat keys of fields * + * @param array $alias content informations of field + * * @return string */ - protected function getFieldList() + protected function getFieldList($alias = 't') { $keys = array_keys($this->fields); - return implode(',', $keys); + if (!empty($alias)) { + $keys_with_alias = array(); + foreach ($keys as $fieldname) { + $keys_with_alias[] = $alias . '.' . $fieldname; + } + return implode(',', $keys_with_alias); + } else { + return implode(',', $keys); + } } /** @@ -7646,13 +7656,13 @@ abstract class CommonObject { if (empty($id) && empty($ref) && empty($morewhere)) return -1; - $sql = 'SELECT '.$this->getFieldList(); - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element; + $sql = 'SELECT '.$this->getFieldList('t'); + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; - if (!empty($id)) $sql .= ' WHERE rowid = '.$id; - elseif (!empty($ref)) $sql .= " WHERE ref = ".$this->quote($ref, $this->fields['ref']); + if (!empty($id)) $sql .= ' WHERE t.rowid = '.$id; + elseif (!empty($ref)) $sql .= " WHERE t.ref = ".$this->quote($ref, $this->fields['ref']); else $sql .= ' WHERE 1 = 1'; // usage with empty id and empty ref is very rare - if (empty($id) && isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' AND entity IN ('.getEntity($this->table_element).')'; + if (empty($id) && isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' AND t.entity IN ('.getEntity($this->table_element).')'; if ($morewhere) $sql .= $morewhere; $sql .= ' LIMIT 1'; // This is a fetch, to be sure to get only one record @@ -7695,9 +7705,9 @@ abstract class CommonObject $objectline = new $objectlineclassname($this->db); - $sql = 'SELECT '.$objectline->getFieldList(); - $sql .= ' FROM '.MAIN_DB_PREFIX.$objectline->table_element; - $sql .= ' WHERE fk_'.$this->element.' = '.$this->id; + $sql = 'SELECT '.$objectline->getFieldList('l'); + $sql .= ' FROM '.MAIN_DB_PREFIX.$objectline->table_element.' as l'; + $sql .= ' WHERE l.fk_'.$this->element.' = '.$this->id; if ($morewhere) $sql .= $morewhere; $resql = $this->db->query($sql); diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index fe4cc0931fd..6151a50db58 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -403,7 +403,7 @@ class MyObject extends CommonObject $records = array(); $sql = 'SELECT '; - $sql .= $this->getFieldList(); + $sql .= $this->getFieldList('t'); $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')'; else $sql .= ' WHERE 1 = 1'; From 53f8ff060a0b000225072127c8a4fab12633c13f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Mar 2021 10:40:22 +0100 Subject: [PATCH 16/32] Fix phpcs --- htdocs/core/class/commondocgenerator.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 8e2f78ca578..2541e10ab16 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -787,10 +787,9 @@ abstract class CommonDocGenerator $resarray = $this->fill_substitutionarray_with_extrafields($line, $resarray, $extrafields, $array_key, $outputlangs); // Load product data optional fields to the line -> enables to use "line_product_options_{extrafield}" - if (isset($line->fk_product) && $line->fk_product > 0) - { + if (isset($line->fk_product) && $line->fk_product > 0) { $tmpproduct = new Product($this->db); - $result = $tmpproduct->fetch($line->fk_product); + result = $tmpproduct->fetch($line->fk_product); foreach ($tmpproduct->array_options as $key=>$label) $resarray["line_product_".$key] = $label; } From 78588f24b9e19deea35eb388e91d52731d3b9959 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Mar 2021 10:42:59 +0100 Subject: [PATCH 17/32] Move git hooks pre-commit into dev/setup dir --- dev/{examples/git => setup/git/hooks}/pre-commit | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename dev/{examples/git => setup/git/hooks}/pre-commit (100%) diff --git a/dev/examples/git/pre-commit b/dev/setup/git/hooks/pre-commit similarity index 100% rename from dev/examples/git/pre-commit rename to dev/setup/git/hooks/pre-commit From 429992ee7f9d1d6a3550810855e92ca132216c54 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Tue, 9 Mar 2021 10:46:11 +0100 Subject: [PATCH 18/32] FIX #16590 --- htdocs/install/mysql/tables/llx_c_civility.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_c_civility.sql b/htdocs/install/mysql/tables/llx_c_civility.sql index 2084b876e7b..63fc8fca81f 100644 --- a/htdocs/install/mysql/tables/llx_c_civility.sql +++ b/htdocs/install/mysql/tables/llx_c_civility.sql @@ -19,7 +19,7 @@ create table llx_c_civility ( - rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL + rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, code varchar(6) NOT NULL, label varchar(50), active tinyint DEFAULT 1 NOT NULL, From 1b3aae1984424989e8c660129313afbe4dd9e2d7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Mar 2021 12:17:32 +0100 Subject: [PATCH 19/32] Fix regression --- htdocs/core/class/commondocgenerator.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 2541e10ab16..0f3865f54a7 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -789,7 +789,7 @@ abstract class CommonDocGenerator // Load product data optional fields to the line -> enables to use "line_product_options_{extrafield}" if (isset($line->fk_product) && $line->fk_product > 0) { $tmpproduct = new Product($this->db); - result = $tmpproduct->fetch($line->fk_product); + $tmpproduct->fetch($line->fk_product); foreach ($tmpproduct->array_options as $key=>$label) $resarray["line_product_".$key] = $label; } From 3cb072f67af69b980f8ef7650462c0039695fbb9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Mar 2021 15:13:20 +0100 Subject: [PATCH 20/32] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 42dac9b7d99..c324b2502c9 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8255,11 +8255,10 @@ abstract class CommonObject /** * Function to concat keys of fields * - * @param array $alias content informations of field - * - * @return string + * @param string $alias String of alias of table for fields. For example 't'. + * @return string list of alias fields */ - protected function getFieldList($alias = 't') + protected function getFieldList($alias = '') { $keys = array_keys($this->fields); if (!empty($alias)) { From cf30e90b935e2fa9aef0af87fc80604ffb05eb14 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Mar 2021 15:35:10 +0100 Subject: [PATCH 21/32] Work on inventory --- htdocs/core/lib/functions.lib.php | 8 ++++---- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/product/inventory/class/inventory.class.php | 2 +- htdocs/product/inventory/list.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f48d30d07c2..8978d373030 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3447,14 +3447,14 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'edit', 'ellipsis-h', 'email', 'eraser', 'external-link-alt', 'external-link-square-alt', 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'group', 'help', 'holiday', - 'intervention', 'label', 'language', 'link', 'list', 'listlight', 'loan', 'lot', 'long-arrow-alt-right', + 'intervention', 'inventory', 'label', 'language', 'link', 'list', 'listlight', 'loan', 'lot', 'long-arrow-alt-right', 'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next', 'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_asset', 'object_barcode', 'object_bill', 'object_billr', 'object_billa', 'object_billd', 'object_bom', 'object_category', 'object_conversation', 'object_bookmark', 'object_bug', 'object_clock', 'object_dolly', 'object_dollyrevert', 'object_folder', 'object_folder-open','object_generic', 'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser', 'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_donation', 'object_dynamicprice', - 'object_globe', 'object_holiday', 'object_hrm', 'object_invoice', 'object_intervention', 'object_label', + 'object_globe', 'object_holiday', 'object_hrm', 'object_invoice', 'object_intervention', 'object_inventory', 'object_label', 'object_margin', 'object_members', 'object_money-bill-alt', 'object_multicurrency', 'object_order', 'object_payment', 'object_lot', 'object_mrp', 'object_other', 'object_payment', 'object_pdf', 'object_product', 'object_propal', @@ -3500,7 +3500,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'hrm'=>'user-tie', 'margin'=>'calculator', 'members'=>'user-friends', 'ticket'=>'ticket-alt', 'globe'=>'external-link-alt', 'lot'=>'barcode', 'email'=>'at', 'edit'=>'pencil-alt', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'question-circle', - 'generic'=>'file', 'holiday'=>'umbrella-beach', 'label'=>'layer-group', 'loan'=>'money-bill-alt', + 'generic'=>'file', 'holiday'=>'umbrella-beach', 'inventory'=>'boxes', 'label'=>'layer-group', 'loan'=>'money-bill-alt', 'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right', 'trip'=>'wallet', 'group'=>'users', 'movement'=>'people-carry', 'sign-out'=>'sign-out-alt', @@ -3604,7 +3604,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'cog'=>'#999', 'companies'=>'#6c6aa8', 'company'=>'#6c6aa8', 'contact'=>'#6c6aa8', 'dynamicprice'=>'#a69944', 'edit'=>'#444', 'note'=>'#999', 'error'=>'', 'help'=>'#bbb', 'listlight'=>'#999', 'language'=>'#555', 'dolly'=>'#a69944', 'dollyrevert'=>'#a69944', 'lot'=>'#a69944', - 'map-marker-alt'=>'#aaa', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'stock'=>'#a69944', 'movement'=>'#a69944', + 'map-marker-alt'=>'#aaa', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'inventory'=>'#a69944', 'stock'=>'#a69944', 'movement'=>'#a69944', 'other'=>'#ddd', 'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'resize'=>'#444', 'rss'=>'#cba', 'shipment'=>'#a69944', 'stats'=>'#444', 'switch_off'=>'#999', 'technic'=>'#999', 'timespent'=>'#555', 'uparrow'=>'#555', 'user-cog'=>'#999', 'globe-americas'=>'#aaa', diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 14585b043b3..84a69b4a276 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1609,7 +1609,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->lire); } } else { - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->inventory_advance->read, '', $mainmenu, 'stock'); + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->inventory_advance->read, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->inventory_advance->write); $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->inventory_advance->read); diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index d7bd4956638..601a2f34759 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -57,7 +57,7 @@ class Inventory extends CommonObject /** * @var string String with name of icon for inventory */ - public $picto = 'stock'; + public $picto = 'inventory'; const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index 64c332fbe1b..3585b84547f 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -351,7 +351,7 @@ print ''; $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/inventory/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'product', 0, $newcardbutton, '', $limit); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit); // Add code for pre mass action (confirmation or email presend form) $topicmail = "Information"; From 9cb4dce48532ee91d36563636d6666e7530a5cb6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Mar 2021 16:12:30 +0100 Subject: [PATCH 22/32] Fix option MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN missing --- .../supplier_order/doc/pdf_cornas.modules.php | 12 +++++++++- .../doc/pdf_muscadet.modules.php | 22 +++++++++++-------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index bcb1fac88b3..9ebff653a56 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1534,13 +1534,18 @@ class pdf_cornas extends ModelePDFSuppliersOrders $this->cols['subprice'] = array( 'rank' => $rank, 'width' => 19, // in mm - 'status' => true, + 'status' => false, 'title' => array( 'textkey' => 'PriceUHT' ), 'border-left' => true, // add left line separator ); + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE)) + { + $this->cols['subprice']['status'] = true; + } + $rank = $rank + 10; $this->cols['qty'] = array( 'rank' => $rank, @@ -1591,6 +1596,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders 'border-left' => true, // add left line separator ); + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN)) + { + $this->cols['totalexcltax']['status'] = true; + } + // Add extrafields cols if (!empty($object->lines)) { $line = reset($object->lines); diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 5214ce47444..be195d923da 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -329,10 +329,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetDrawColor(128, 128, 128); $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); - $pdf->SetSubject($outputlangs->transnoentities("Order")); + $pdf->SetSubject($outputlangs->transnoentities("PurchaseOrder")); $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); - $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PurchaseOrder")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right @@ -510,7 +510,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut // VAT Rate - if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) { $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxtva, $curY); @@ -518,9 +518,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } // Unit price before discount - $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); - $pdf->SetXY($this->posxup, $curY); - $pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0, 'R', 0); + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE)) { + $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); + $pdf->SetXY($this->posxup, $curY); + $pdf->MultiCell($this->posxqty - $this->posxup - 0.8, 3, $up_excl_tax, 0, 'R', 0); + } // Quantity $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); @@ -544,9 +546,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } // Total HT line - $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs); - $pdf->SetXY($this->postotalht, $curY); - $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0); + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN)) { + $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs); + $pdf->SetXY($this->postotalht, $curY); + $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0); + } // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva; From 5e68eee407f55d0291418e2487c8243176b3982e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Mar 2021 16:47:38 +0100 Subject: [PATCH 23/32] Fix filter --- 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 76394916550..7c3500f7e78 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1076,7 +1076,7 @@ if (!empty($arrayfields['country.code_iso']['checked'])) { if (!empty($arrayfields['typent.code']['checked'])) { print ''; // We use showempty=0 here because there is already an unknown value into dictionary. - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'minwidth50 maxwidth100', 1); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'minwidth50 maxwidth100', 1); print ''; } // Multiprice level From 5b74fefb608b8977e5690fb99e6f59f1d005b3d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Mar 2021 17:01:20 +0100 Subject: [PATCH 24/32] Fix look and feel v13 --- htdocs/contact/card.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 0def459d444..e75908adc10 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -750,7 +750,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; print ''; - //Unsubscribe + // Unsubscribe if (!empty($conf->mailing->enabled)) { if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS==-1) { print "\n".'