From fed049e93e2bccf66bed6416e04bf0fa46e49768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20PASCAL?= Date: Tue, 24 Dec 2024 10:36:53 +0100 Subject: [PATCH 01/77] feat: add function to get public holidays list within period --- htdocs/core/lib/date.lib.php | 268 +++++++++++++++++++++++++++++++++++ 1 file changed, 268 insertions(+) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 1005cc70941..77fbf7944e2 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -1013,6 +1013,274 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', return $nbFerie; } +/** + * Return the list of public holidays including Friday, Saturday and Sunday (or not) between 2 dates in timestamp. + * Dates must be UTC with hour, min, sec to 0. + * Called by function num_open_day() + * + * @param int $timestampStart Timestamp start (UTC with hour, min, sec = 0) + * @param int $timestampEnd Timestamp end (UTC with hour, min, sec = 0) + * @param string $country_code Country code + * @param int $lastday Last day is included, 0: no, 1:yes + * @param int $excludesaturday Exclude saturday as non working day (-1=use setup, 0=no, 1=yes) + * @param int $excludesunday Exclude sunday as non working day (-1=use setup, 0=no, 1=yes) + * @param int $excludefriday Exclude friday as non working day (-1=use setup, 0=no, 1=yes) + * @param int $excludemonday Exclude monday as non working day (-1=use setup, 0=no, 1=yes) + * @return int|array List of public holidays or error message string if error + * @see num_between_day(), num_open_day() + */ +function list_public_holiday($timestampStart, $timestampEnd, $country_code = '', $lastday = 0, $excludesaturday = -1, $excludesunday = -1, $excludefriday = -1, $excludemonday = -1) +{ + global $conf, $db, $mysoc; + + // Check to ensure we use correct parameters + if (($timestampEnd - $timestampStart) % 86400 != 0) { + return 'Error Dates must use same hours and must be GMT dates'; + } + + if (empty($country_code)) { + $country_code = $mysoc->country_code; + } + if ($excludemonday < 0) { + $excludemonday = getDolGlobalInt('MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY', 0); + } + if ($excludefriday < 0) { + $excludefriday = getDolGlobalInt('MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY', 0); + } + if ($excludesaturday < 0) { + $excludesaturday = getDolGlobalInt('MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', 1); + } + if ($excludesunday < 0) { + $excludesunday = getDolGlobalInt('MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', 1); + } + + $country_id = dol_getIdFromCode($db, $country_code, 'c_country', 'code', 'rowid'); + + if (empty($conf->cache['arrayOfActivePublicHolidays_' . $country_id])) { + // Loop on public holiday defined into hrm_public_holiday for the day, month and year analyzed + $tmpArrayOfPublicHolidays = array(); + $sql = "SELECT id, code, entity, fk_country, dayrule, year, month, day, active"; + $sql .= " FROM " . MAIN_DB_PREFIX . "c_hrm_public_holiday"; + $sql .= " WHERE active = 1 and fk_country IN (0" . ($country_id > 0 ? ", " . $country_id : 0) . ")"; + $sql .= " AND entity IN (0," . getEntity('holiday') . ")"; + + $resql = $db->query($sql); + if ($resql) { + $num_rows = $db->num_rows($resql); + $i = 0; + while ($i < $num_rows) { + $obj = $db->fetch_object($resql); + $tmpArrayOfPublicHolidays[$obj->id] = array('dayrule' => $obj->dayrule, 'year' => $obj->year, 'month' => $obj->month, 'day' => $obj->day); + $i++; + } + } else { + dol_syslog($db->lasterror(), LOG_ERR); + return 'Error sql ' . $db->lasterror(); + } + + //var_dump($tmpArrayOfPublicHolidays); + $conf->cache['arrayOfActivePublicHolidays_' . $country_id] = $tmpArrayOfPublicHolidays; + } + + $arrayOfPublicHolidays = $conf->cache['arrayOfActivePublicHolidays_' . $country_id]; + $listFeries = []; + $i = 0; + while ((($lastday == 0 && $timestampStart < $timestampEnd) || ($lastday && $timestampStart <= $timestampEnd)) + && ($i < 50000)) { // Loop end when equals (Test on i is a security loop to avoid infinite loop) + $nonWorkingDay = false; + $ferie = false; + $specialdayrule = array(); + + $jour = (int) gmdate("d", $timestampStart); + $mois = (int) gmdate("m", $timestampStart); + $annee = (int) gmdate("Y", $timestampStart); + + // If we have to exclude Friday, Saturday and Sunday + if ($excludefriday || $excludesaturday || $excludesunday) { + $jour_julien = unixtojd($timestampStart); + $jour_semaine = jddayofweek($jour_julien, 0); + if ($excludefriday) { //Friday (5), Saturday (6) and Sunday (0) + if ($jour_semaine == 5) { + $nonWorkingDay = true; + } + } + if ($excludesaturday) { //Friday (5), Saturday (6) and Sunday (0) + if ($jour_semaine == 6) { + $nonWorkingDay = true; + } + } + if ($excludesunday) { //Friday (5), Saturday (6) and Sunday (0) + if ($jour_semaine == 0) { + $nonWorkingDay = true; + } + } + } + //print "ferie=".$nonWorkingDay."\n"; + + if (!$nonWorkingDay) { + //print "jour=".$jour." month=".$mois." year=".$annee." includesaturday=".$excludesaturday." includesunday=".$excludesunday."\n"; + foreach ($arrayOfPublicHolidays as $entrypublicholiday) { + if (!empty($entrypublicholiday['dayrule']) && $entrypublicholiday['dayrule'] != 'date') { // For example 'easter', '...' + $specialdayrule[$entrypublicholiday['dayrule']] = $entrypublicholiday['dayrule']; + } else { + $match = 1; + if (!empty($entrypublicholiday['year']) && $entrypublicholiday['year'] != $annee) { + $match = 0; + } + if ($entrypublicholiday['month'] != $mois) { + $match = 0; + } + if ($entrypublicholiday['day'] != $jour) { + $match = 0; + } + + if ($match) { + $ferie = true; + $listFeries[] = $timestampStart; + } + } + + $i++; + } + //var_dump($specialdayrule)."\n"; + //print "ferie=".$nonWorkingDay."\n"; + } + + if (!$nonWorkingDay && !$ferie) { + // Special dayrules + if (in_array('easter', $specialdayrule)) { + // Calculation for easter date + $date_paques = getGMTEasterDatetime($annee); + $jour_paques = gmdate("d", $date_paques); + $mois_paques = gmdate("m", $date_paques); + if ($jour_paques == $jour && $mois_paques == $mois) { + $ferie = true; + $listFeries[] = $timestampStart; + } + // Easter (sunday) + } + + if (in_array('eastermonday', $specialdayrule)) { + // Calculation for the monday of easter date + $date_paques = getGMTEasterDatetime($annee); + //print 'PPP'.$date_paques.' '.dol_print_date($date_paques, 'dayhour', 'gmt')." "; + $date_lundi_paques = $date_paques + (3600 * 24); + $jour_lundi_paques = gmdate("d", $date_lundi_paques); + $mois_lundi_paques = gmdate("m", $date_lundi_paques); + if ($jour_lundi_paques == $jour && $mois_lundi_paques == $mois) { + $ferie = true; + $listFeries[] = $timestampStart; + } + // Easter (monday) + //print 'annee='.$annee.' $jour='.$jour.' $mois='.$mois.' $jour_lundi_paques='.$jour_lundi_paques.' $mois_lundi_paques='.$mois_lundi_paques."\n"; + } + + //Good Friday + if (in_array('goodfriday', $specialdayrule)) { + // Pulls the date of Easter + $easter = getGMTEasterDatetime($annee); + + // Calculates the date of Good Friday based on Easter + $date_good_friday = $easter - (2 * 3600 * 24); + $dom_good_friday = gmdate("d", $date_good_friday); + $month_good_friday = gmdate("m", $date_good_friday); + + if ($dom_good_friday == $jour && $month_good_friday == $mois) { + $ferie = true; + $listFeries[] = $timestampStart; + } + } + + if (in_array('ascension', $specialdayrule)) { + // Calcul du jour de l'ascension (39 days after easter day) + $date_paques = getGMTEasterDatetime($annee); + $date_ascension = $date_paques + (3600 * 24 * 39); + $jour_ascension = gmdate("d", $date_ascension); + $mois_ascension = gmdate("m", $date_ascension); + if ($jour_ascension == $jour && $mois_ascension == $mois) { + $ferie = true; + $listFeries[] = $timestampStart; + } + // Ascension (thursday) + } + + if (in_array('pentecost', $specialdayrule)) { + // Calculation of "Pentecote" (49 days after easter day) + $date_paques = getGMTEasterDatetime($annee); + $date_pentecote = $date_paques + (3600 * 24 * 49); + $jour_pentecote = gmdate("d", $date_pentecote); + $mois_pentecote = gmdate("m", $date_pentecote); + if ($jour_pentecote == $jour && $mois_pentecote == $mois) { + $ferie = true; + $listFeries[] = $timestampStart; + } + // "Pentecote" (sunday) + } + + if (in_array('pentecotemonday', $specialdayrule)) { + // Calculation of "Pentecote" (49 days after easter day) + $date_paques = getGMTEasterDatetime($annee); + $date_pentecote = $date_paques + (3600 * 24 * 50); + $jour_pentecote = gmdate("d", $date_pentecote); + $mois_pentecote = gmdate("m", $date_pentecote); + if ($jour_pentecote == $jour && $mois_pentecote == $mois) { + $ferie = true; + $listFeries[] = $timestampStart; + } + // "Pentecote" (monday) + } + + if (in_array('viernessanto', $specialdayrule)) { + // Viernes Santo + $date_paques = getGMTEasterDatetime($annee); + $date_viernes = $date_paques - (3600 * 24 * 2); + $jour_viernes = gmdate("d", $date_viernes); + $mois_viernes = gmdate("m", $date_viernes); + if ($jour_viernes == $jour && $mois_viernes == $mois) { + $ferie = true; + $listFeries[] = $timestampStart; + } + //Viernes Santo + } + + if (in_array('fronleichnam', $specialdayrule)) { + // Fronleichnam (60 days after easter sunday) + $date_paques = getGMTEasterDatetime($annee); + $date_fronleichnam = $date_paques + (3600 * 24 * 60); + $jour_fronleichnam = gmdate("d", $date_fronleichnam); + $mois_fronleichnam = gmdate("m", $date_fronleichnam); + if ($jour_fronleichnam == $jour && $mois_fronleichnam == $mois) { + $ferie = true; + $listFeries[] = $timestampStart; + } + // Fronleichnam + } + + if (in_array('genevafast', $specialdayrule)) { + // Geneva fast in Switzerland (Thursday after the first sunday in September) + $date_1sunsept = strtotime('next thursday', strtotime('next sunday', mktime(0, 0, 0, 9, 1, $annee))); + $jour_1sunsept = date("d", $date_1sunsept); + $mois_1sunsept = date("m", $date_1sunsept); + if ($jour_1sunsept == $jour && $mois_1sunsept == $mois) { + $ferie = true; + $listFeries[] = $timestampStart; + } + // Geneva fast in Switzerland + } + } + //print "ferie=".$nonWorkingDay."\n"; + + // Increase number of days (on go up into loop) + $timestampStart = dol_time_plus_duree($timestampStart, 1, 'd'); + //var_dump($jour.' '.$mois.' '.$annee.' '.$timestampStart); + + $i++; + } + + //print "nbFerie=".$nbFerie."\n"; + return $listFeries; +} + /** * Function to return number of days between two dates (date must be UTC date !) * Example: 2012-01-01 2012-01-02 => 1 if lastday=0, 2 if lastday=1 From 39e509f3809ee47d40cefe2c7977b7b34bff53b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9?= Date: Tue, 24 Dec 2024 10:50:29 +0100 Subject: [PATCH 02/77] fix: list_public_holiday function return type --- htdocs/core/lib/date.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 77fbf7944e2..87ad6a3a213 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -1026,7 +1026,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', * @param int $excludesunday Exclude sunday as non working day (-1=use setup, 0=no, 1=yes) * @param int $excludefriday Exclude friday as non working day (-1=use setup, 0=no, 1=yes) * @param int $excludemonday Exclude monday as non working day (-1=use setup, 0=no, 1=yes) - * @return int|array List of public holidays or error message string if error + * @return string|array List of public holidays or error message string if error * @see num_between_day(), num_open_day() */ function list_public_holiday($timestampStart, $timestampEnd, $country_code = '', $lastday = 0, $excludesaturday = -1, $excludesunday = -1, $excludefriday = -1, $excludemonday = -1) From 303b7423f350590e7046b5ef11de4c19964b2144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9?= Date: Tue, 24 Dec 2024 11:01:15 +0100 Subject: [PATCH 03/77] fix: update list_public_holiday return type --- htdocs/core/lib/date.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 87ad6a3a213..956a3f2d2a5 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -1026,7 +1026,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '', * @param int $excludesunday Exclude sunday as non working day (-1=use setup, 0=no, 1=yes) * @param int $excludefriday Exclude friday as non working day (-1=use setup, 0=no, 1=yes) * @param int $excludemonday Exclude monday as non working day (-1=use setup, 0=no, 1=yes) - * @return string|array List of public holidays or error message string if error + * @return string|int[] List of public holidays timestamps or error message string if error * @see num_between_day(), num_open_day() */ function list_public_holiday($timestampStart, $timestampEnd, $country_code = '', $lastday = 0, $excludesaturday = -1, $excludesunday = -1, $excludefriday = -1, $excludemonday = -1) From 426f4305b05c6696994a8ebce17b4c4b7d6b6ac2 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 20 Jan 2025 11:48:37 +0100 Subject: [PATCH 04/77] FIX delete supplier order when at least one line linked to customer order line --- htdocs/fourn/class/fournisseur.commande.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index b98f14aa074..60b6f98f0cf 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2312,6 +2312,16 @@ class CommandeFournisseur extends CommonOrder $error++; } + if (!$error) { + $sql1 = 'UPDATE '.$this->db->prefix()."commandedet SET fk_commandefourndet = NULL WHERE fk_commandefourndet IN (SELECT rowid FROM ".$main." WHERE fk_commande = ".((int) $this->id).")"; + dol_syslog(__METHOD__." linked order lines", LOG_DEBUG); + if (!$this->db->query($sql1)) { + $error++; + $this->error = $this->db->lasterror(); + $this->errors[] = $this->db->lasterror(); + } + } + $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande =".((int) $this->id); dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (!$this->db->query($sql)) { From 7f2a253625148d02dc94a2513e2a8251020e8c3f Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 20 Jan 2025 12:17:12 +0100 Subject: [PATCH 05/77] Uniformize SQL concat char --- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 60b6f98f0cf..6ad989bceb5 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2313,7 +2313,7 @@ class CommandeFournisseur extends CommonOrder } if (!$error) { - $sql1 = 'UPDATE '.$this->db->prefix()."commandedet SET fk_commandefourndet = NULL WHERE fk_commandefourndet IN (SELECT rowid FROM ".$main." WHERE fk_commande = ".((int) $this->id).")"; + $sql1 = "UPDATE ".$this->db->prefix()."commandedet SET fk_commandefourndet = NULL WHERE fk_commandefourndet IN (SELECT rowid FROM ".$main." WHERE fk_commande = ".((int) $this->id).")"; dol_syslog(__METHOD__." linked order lines", LOG_DEBUG); if (!$this->db->query($sql1)) { $error++; @@ -4147,7 +4147,7 @@ class CommandeFournisseurLigne extends CommonOrderLine return -1; } - $sql1 = 'UPDATE '.MAIN_DB_PREFIX."commandedet SET fk_commandefourndet = NULL WHERE fk_commandefourndet=".((int) $this->id); + $sql1 = "UPDATE ".MAIN_DB_PREFIX."commandedet SET fk_commandefourndet = NULL WHERE fk_commandefourndet=".((int) $this->id); $resql = $this->db->query($sql1); if (!$resql) { $this->db->rollback(); From 576e70c3ce95da7511ce3c13f6b501c7a56d3d4c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 20 Jan 2025 22:32:30 +0100 Subject: [PATCH 06/77] FIX wrong update function parameter --- htdocs/fourn/class/api_supplier_invoices.class.php | 2 +- htdocs/ticket/class/api_tickets.class.php | 2 +- htdocs/zapier/class/api_zapier.class.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 13dc0e8b094..1614552ee5c 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -272,7 +272,7 @@ class SupplierInvoices extends DolibarrApi $this->invoice->$field = $value; } - if ($this->invoice->update($id, DolibarrApiAccess::$user)) { + if ($this->invoice->update(DolibarrApiAccess::$user)) { return $this->get($id); } diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 62f94b2491b..a40e54934a1 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -389,7 +389,7 @@ class Tickets extends DolibarrApi $this->ticket->$field = $value; } - if ($this->ticket->update($id, DolibarrApiAccess::$user)) { + if ($this->ticket->update(DolibarrApiAccess::$user)) { return $this->get($id); } diff --git a/htdocs/zapier/class/api_zapier.class.php b/htdocs/zapier/class/api_zapier.class.php index 5ff155aebf0..2ed4e984126 100644 --- a/htdocs/zapier/class/api_zapier.class.php +++ b/htdocs/zapier/class/api_zapier.class.php @@ -300,7 +300,7 @@ class Zapier extends DolibarrApi $this->hook->$field = $value; } - if ($this->hook->update($id, DolibarrApiAccess::$user) > 0) { + if ($this->hook->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); } else { throw new RestException(500, $this->hook->error); From cbe15c7c71059ad25315533d60d52dc973e93bba Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Wed, 22 Jan 2025 23:53:16 +0100 Subject: [PATCH 07/77] missing hookmanager like others doc_generic*odt modules --- .../project/task/doc/doc_generic_task_odt.modules.php | 8 ++++++++ .../core/modules/societe/doc/doc_generic_odt.modules.php | 1 + .../mymodule/doc/doc_generic_myobject_odt.modules.php | 5 +++++ .../doc_generic_recruitmentjobposition_odt.modules.php | 5 +++++ 4 files changed, 19 insertions(+) diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 51e53e21d3f..f2cb1eddb78 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -469,6 +469,14 @@ class doc_generic_task_odt extends ModelePDFTask return -1; } + // Add odtgeneration hook + if (!is_object($hookmanager)) { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } + $hookmanager->initHooks(array('odtgeneration')); + global $action; + if (!is_object($outputlangs)) { $outputlangs = $langs; } diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 374c44c7a25..49ce657fce7 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -216,6 +216,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('odtgeneration')); + global $action; if (!is_object($outputlangs)) { $outputlangs = $langs; diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index e35fb604cec..680cf49de6b 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -233,7 +233,12 @@ class doc_generic_myobject_odt extends ModelePDFMyObject } // Add odtgeneration hook + if (!is_object($hookmanager)) { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } $hookmanager->initHooks(array('odtgeneration')); + global $action; if (!is_object($outputlangs)) { $outputlangs = $langs; diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php index da7640d708a..128293c9d85 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -221,7 +221,12 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi } // Add odtgeneration hook + if (!is_object($hookmanager)) { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } $hookmanager->initHooks(array('odtgeneration')); + global $action; if (!is_object($outputlangs)) { $outputlangs = $langs; From 806b01c0a6de7cc1e3a550f4457b38fbf31a2de0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Champlon?= Date: Mon, 27 Jan 2025 11:54:02 +0100 Subject: [PATCH 08/77] fix --- htdocs/core/lib/files.lib.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index b6eb5421d53..684bc3bb9fa 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3564,9 +3564,19 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, dol_print_error(null, 'Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')'); exit; } - if ($fuser->hasRight($tmpmodule, $lire) || preg_match('/^specimen/i', $original_file)) { - $accessallowed = 1; - } + + // Check fuser->rights->modulepart->myobject->read and fuser->rights->modulepart->read + $partsofdirinoriginalfile = explode('/', $original_file); + if (!empty($partsofdirinoriginalfile[1])) { // If original_file is xxx/filename (xxx is a part we will use) + $partofdirinoriginalfile = $partsofdirinoriginalfile[0]; + if ($partofdirinoriginalfile && ($fuser->hasRight($tmpmodule, $partofdirinoriginalfile, 'lire') || $fuser->hasRight($tmpmodule, $partofdirinoriginalfile, 'read'))) { + $accessallowed = 1; + } + } + if ($fuser->hasRight($tmpmodule, $lire) || $fuser->hasRight($tmpmodule, $read)) { + $accessallowed = 1; + } + $original_file = $conf->$tmpmodule->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; } else { if (empty($conf->$modulepart->dir_output)) { // modulepart not supported From 180366a2cac5cf2f90c6efe82b5b707c13482abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Champlon?= Date: Mon, 27 Jan 2025 11:56:47 +0100 Subject: [PATCH 09/77] fix --- htdocs/core/lib/files.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 684bc3bb9fa..44f95d9e9f4 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3569,11 +3569,11 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $partsofdirinoriginalfile = explode('/', $original_file); if (!empty($partsofdirinoriginalfile[1])) { // If original_file is xxx/filename (xxx is a part we will use) $partofdirinoriginalfile = $partsofdirinoriginalfile[0]; - if ($partofdirinoriginalfile && ($fuser->hasRight($tmpmodule, $partofdirinoriginalfile, 'lire') || $fuser->hasRight($tmpmodule, $partofdirinoriginalfile, 'read'))) { + if (($partofdirinoriginalfile && ($fuser->hasRight($tmpmodule, $partofdirinoriginalfile, 'lire') || $fuser->hasRight($tmpmodule, $partofdirinoriginalfile, 'read'))) || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } } - if ($fuser->hasRight($tmpmodule, $lire) || $fuser->hasRight($tmpmodule, $read)) { + if (($fuser->hasRight($tmpmodule, $lire) || $fuser->hasRight($tmpmodule, $read)) || || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } From da1bee6872cd47c03ca2e2105130ace14c2f592c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Champlon?= Date: Mon, 27 Jan 2025 11:57:07 +0100 Subject: [PATCH 10/77] re fix --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 44f95d9e9f4..20edbd73a1c 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3573,7 +3573,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } } - if (($fuser->hasRight($tmpmodule, $lire) || $fuser->hasRight($tmpmodule, $read)) || || preg_match('/^specimen/i', $original_file)) { + if (($fuser->hasRight($tmpmodule, $lire) || $fuser->hasRight($tmpmodule, $read)) || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } From 97af0975bc710943374ab1b57b34efee40337c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Champlon?= Date: Mon, 27 Jan 2025 11:58:33 +0100 Subject: [PATCH 11/77] indent --- htdocs/core/lib/files.lib.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 20edbd73a1c..030d29cd9e7 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3565,17 +3565,17 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, exit; } - // Check fuser->rights->modulepart->myobject->read and fuser->rights->modulepart->read - $partsofdirinoriginalfile = explode('/', $original_file); - if (!empty($partsofdirinoriginalfile[1])) { // If original_file is xxx/filename (xxx is a part we will use) - $partofdirinoriginalfile = $partsofdirinoriginalfile[0]; - if (($partofdirinoriginalfile && ($fuser->hasRight($tmpmodule, $partofdirinoriginalfile, 'lire') || $fuser->hasRight($tmpmodule, $partofdirinoriginalfile, 'read'))) || preg_match('/^specimen/i', $original_file)) { - $accessallowed = 1; - } - } - if (($fuser->hasRight($tmpmodule, $lire) || $fuser->hasRight($tmpmodule, $read)) || preg_match('/^specimen/i', $original_file)) { - $accessallowed = 1; - } + // Check fuser->rights->modulepart->myobject->read and fuser->rights->modulepart->read + $partsofdirinoriginalfile = explode('/', $original_file); + if (!empty($partsofdirinoriginalfile[1])) { // If original_file is xxx/filename (xxx is a part we will use) + $partofdirinoriginalfile = $partsofdirinoriginalfile[0]; + if (($partofdirinoriginalfile && ($fuser->hasRight($tmpmodule, $partofdirinoriginalfile, 'lire') || $fuser->hasRight($tmpmodule, $partofdirinoriginalfile, 'read'))) || preg_match('/^specimen/i', $original_file)) { + $accessallowed = 1; + } + } + if (($fuser->hasRight($tmpmodule, $lire) || $fuser->hasRight($tmpmodule, $read)) || preg_match('/^specimen/i', $original_file)) { + $accessallowed = 1; + } $original_file = $conf->$tmpmodule->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; } else { From c7ee83b3b9164e33288ee0c925c054c5496c7adc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Jan 2025 10:33:38 +0100 Subject: [PATCH 12/77] FIX can not delete files in task card --- htdocs/core/lib/files.lib.php | 1 + htdocs/projet/tasks/task.php | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 2ed990205ad..ee9b55b21c3 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1448,6 +1448,7 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0, } } } else { + $ok = false; // to avoid false positive dol_syslog("No files to delete found", LOG_DEBUG); } } else { diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index b8ff5a6f9bc..4f1ca11848b 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -65,7 +65,10 @@ if ($reshook < 0) { } if ($id > 0 || $ref) { - $object->fetch($id, $ref); + $ret = $object->fetch($id, $ref); + if ($ret > 0) { + $projectstatic->fetch($object->fk_project); + } } // Security check @@ -204,14 +207,14 @@ if ($action == 'remove_file' && $user->rights->projet->creer) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $langs->load("other"); - $upload_dir = $conf->project->dir_output; + $upload_dir = $conf->project->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref); $file = $upload_dir.'/'.dol_sanitizeFileName(GETPOST('file')); $ret = dol_delete_file($file); if ($ret) { - setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); + setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); } else { - setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); + setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors'); } } @@ -222,7 +225,6 @@ if ($action == 'remove_file' && $user->rights->projet->creer) { $form = new Form($db); $formother = new FormOther($db); $formfile = new FormFile($db); -$result = $projectstatic->fetch($object->fk_project); $title = $object->ref; if (!empty($withproject)) { @@ -692,7 +694,7 @@ if ($id > 0 || !empty($ref)) { /* * Generated documents */ - $filename = dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref); + $filename = ''; $filedir = $conf->project->dir_output."/".dol_sanitizeFileName($projectstatic->ref)."/".dol_sanitizeFileName($object->ref); $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = ($user->rights->projet->lire); From 837b2ff06079da158c049a72d583e0879e858a02 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 27 Jan 2025 13:59:12 +0100 Subject: [PATCH 13/77] FIX wrong left margin (v18 to develop ?) --- htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 555079ad3bc..a56088b5a40 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -317,7 +317,7 @@ class pdf_soleil extends ModelePDFFicheinter $desc = dol_htmlentitiesbr($text, 1); //print $outputlangs->convToOutputCharset($desc); exit; - $pdf->writeHTMLCell(180, 3, 10, $tab_top + 5, $outputlangs->convToOutputCharset($desc), 0, 1); + $pdf->writeHTMLCell(180, 3, $this->posxdesc - 1, $tab_top + 5, $outputlangs->convToOutputCharset($desc), 0, 1); $nexY = $pdf->GetY(); $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY); From 87e6d267e6f7b1cd7452daa7c0c57f313730bef6 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 27 Jan 2025 16:47:39 +0100 Subject: [PATCH 14/77] fix php warning in dol_convertToWord when negative numbers --- htdocs/core/lib/functionsnumtoword.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php index f349368078a..b724ef34594 100644 --- a/htdocs/core/lib/functionsnumtoword.lib.php +++ b/htdocs/core/lib/functionsnumtoword.lib.php @@ -51,7 +51,7 @@ function dol_convertToWord($num, $langs, $currency = '', $centimes = false) } else { $TNum = explode('.', (string) $num); - $num = (int) $TNum[0]; + $num = abs((int) $TNum[0]); $words = array(); $list1 = array( '', From 9bb9ecd304ba00e5a52c0eeb43d5719597855a69 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 27 Jan 2025 17:20:55 +0100 Subject: [PATCH 15/77] fix: phpwarning version 8.0 for TVA calulation --- htdocs/compta/facture/card.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 6c670b38406..c8c5822bb19 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -875,11 +875,29 @@ if (empty($reshook)) { if ($line->product_type < 9 && $line->total_ht != 0) { // Remove lines with product_type greater than or equal to 9 and no need to create discount if amount is null $keyforvatrate = $line->tva_tx.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''); + if (!isset($amount_ht[$keyforvatrate])) { + $amount_ht[$keyforvatrate]=0; + } $amount_ht[$keyforvatrate] += $line->total_ht; + if (!isset($amount_tva[$keyforvatrate])) { + $amount_tva[$keyforvatrate]=0; + } $amount_tva[$keyforvatrate] += $line->total_tva; + if (!isset($amount_ttc[$keyforvatrate])) { + $amount_ttc[$keyforvatrate]=0; + } $amount_ttc[$keyforvatrate] += $line->total_ttc; + if (!isset($multicurrency_amount_ht[$keyforvatrate])) { + $multicurrency_amount_ht[$keyforvatrate]=0; + } $multicurrency_amount_ht[$keyforvatrate] += $line->multicurrency_total_ht; + if (!isset($multicurrency_amount_tva[$keyforvatrate])) { + $multicurrency_amount_tva[$keyforvatrate]=0; + } $multicurrency_amount_tva[$keyforvatrate] += $line->multicurrency_total_tva; + if (!isset($multicurrency_amount_ttc[$keyforvatrate])) { + $multicurrency_amount_ttc[$keyforvatrate]=0; + } $multicurrency_amount_ttc[$keyforvatrate] += $line->multicurrency_total_ttc; $i++; } From 83bc7b70a04546876a93ef519b988421d3a54c71 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 28 Jan 2025 13:34:49 +0100 Subject: [PATCH 16/77] Backport from v20 missing executeHooks printFieldListFrom in product list page --- htdocs/product/list.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index e99857ee454..9e5c8772293 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -484,6 +484,11 @@ if (!empty($conf->global->PRODUCT_USE_UNITS)) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_units cu ON cu.rowid = p.fk_unit"; } +// Add table from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; if ($sall) { // Clean $fieldstosearchall From b647b4dc3fffc5e0b650ed00b6bf41c3cee01bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 28 Jan 2025 14:29:48 +0100 Subject: [PATCH 17/77] Update llx_c_type_contact.sql --- htdocs/install/mysql/data/llx_c_type_contact.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/data/llx_c_type_contact.sql b/htdocs/install/mysql/data/llx_c_type_contact.sql index 39813dfb70f..15987bf45ab 100644 --- a/htdocs/install/mysql/data/llx_c_type_contact.sql +++ b/htdocs/install/mysql/data/llx_c_type_contact.sql @@ -74,6 +74,7 @@ insert into llx_c_type_contact (element, source, code, libelle, active ) values insert into llx_c_type_contact (element, source, code, libelle, active ) values ('commande', 'external', 'SHIPPING', 'Contact client livraison commande', 1); -- Shipment / Expedition +insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'internal', 'SALESREPFOLL', 'Responsable suivi de l\'expédition', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'CUSTOMER', 'Customer shipping contact', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'SHIPPING', 'Loading facility', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'DELIVERY', 'Delivery facility', 1); From 4b23a78f7f96ce6067f7150fa11f085b99d6bd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 28 Jan 2025 14:32:09 +0100 Subject: [PATCH 18/77] Update expedition.class.php --- htdocs/expedition/class/expedition.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 10f7f21e68e..2cab8ad7e33 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1609,6 +1609,13 @@ class Expedition extends CommonObject $error++; } + if (!$error) { + // Delete linked contacts + $res = $this->delete_linked_contact(); + if ($res < 0) { + $error++; + } + } if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."expedition"; $sql .= " WHERE rowid = ".((int) $this->id); From 17d1c279abfcb64b1fda7b88615d6c27f359a2c1 Mon Sep 17 00:00:00 2001 From: tnegre Date: Tue, 28 Jan 2025 14:44:10 +0100 Subject: [PATCH 19/77] action/list.php : replace comma-joins by INNER JOIN --- htdocs/comm/action/list.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index d3d1ecfb833..cbe3f8b94ee 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -442,20 +442,19 @@ if (empty($user->rights->societe->client->voir) && !$socid) { } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; -$sql .= " ,".MAIN_DB_PREFIX."c_actioncomm as c"; +$sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action"; // We must filter on resource table if ($resourceid > 0) { - $sql .= ", ".MAIN_DB_PREFIX."element_resources as r"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as r ON r.element_type = 'action' AND r.element_id = a.id"; } // We must filter on assignement table if ($filtert > 0 || $usergroup > 0) { - $sql .= ", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar ON ar.fk_actioncomm = a.id AND ar.element_type='user'"; } if ($usergroup > 0) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; } -$sql .= " WHERE c.id = a.fk_action"; -$sql .= ' AND a.entity IN ('.getEntity('agenda').')'; +$sql .= " WHERE a.entity IN (".getEntity('agenda').")"; // Condition on actioncode if (!empty($actioncode)) { if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { @@ -486,7 +485,7 @@ if (!empty($actioncode)) { } } if ($resourceid > 0) { - $sql .= " AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".((int) $resourceid); + $sql .= " AND r.resource_id = ".((int) $resourceid); } if ($pid) { $sql .= " AND a.fk_project=".((int) $pid); @@ -497,10 +496,6 @@ if (empty($user->rights->societe->client->voir) && !$socid) { if ($socid > 0) { $sql .= " AND s.rowid = ".((int) $socid); } -// We must filter on assignement table -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); } From bdcd7b5ef399ab26c6774119d28ce7ba572e7012 Mon Sep 17 00:00:00 2001 From: Irvine Fleith Date: Tue, 28 Jan 2025 14:47:10 +0100 Subject: [PATCH 20/77] fix(services-list): added missing hook printFieldListWhere --- htdocs/contrat/services_list.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 7b75c4aa9d3..0b3666a295e 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -348,6 +348,11 @@ if (!empty($filter_opcloture) && $filter_opcloture == ' BETWEEN ') { } // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; +// Add where from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sql .= $db->order($sortfield, $sortorder); //print $sql; From 8d39020f2a0f223ed21d049d19e0de42eefa1a39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 28 Jan 2025 14:55:43 +0100 Subject: [PATCH 21/77] Update llx_c_type_contact.sql --- htdocs/install/mysql/data/llx_c_type_contact.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_type_contact.sql b/htdocs/install/mysql/data/llx_c_type_contact.sql index 15987bf45ab..d7bbbf77cf2 100644 --- a/htdocs/install/mysql/data/llx_c_type_contact.sql +++ b/htdocs/install/mysql/data/llx_c_type_contact.sql @@ -74,10 +74,10 @@ insert into llx_c_type_contact (element, source, code, libelle, active ) values insert into llx_c_type_contact (element, source, code, libelle, active ) values ('commande', 'external', 'SHIPPING', 'Contact client livraison commande', 1); -- Shipment / Expedition -insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'internal', 'SALESREPFOLL', 'Responsable suivi de l\'expédition', 1); -insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'CUSTOMER', 'Customer shipping contact', 1); -insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'SHIPPING', 'Loading facility', 1); -insert into llx_c_type_contact (element, source, code, libelle, active ) values ('expedition', 'external', 'DELIVERY', 'Delivery facility', 1); +insert into llx_c_type_contact (element, source, code, libelle, active ) values ('shipping', 'internal', 'SALESREPFOLL', 'Responsable suivi de l''expédition', 1); +insert into llx_c_type_contact (element, source, code, libelle, active ) values ('shipping', 'external', 'CUSTOMER', 'Customer shipping contact', 1); +insert into llx_c_type_contact (element, source, code, libelle, active ) values ('shipping', 'external', 'SHIPPING', 'Loading facility', 1); +insert into llx_c_type_contact (element, source, code, libelle, active ) values ('shipping', 'external', 'DELIVERY', 'Delivery facility', 1); -- Intervention / Fichinter insert into llx_c_type_contact (element, source, code, libelle, active ) values ('fichinter', 'internal', 'INTERREPFOLL', 'Responsable suivi de l''intervention', 1); From 632ccfdbf085987748fb24989d601ca6371b6126 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 28 Jan 2025 19:04:24 +0100 Subject: [PATCH 22/77] FIX if $force_entity = 0 ($force_entity != 'default') = false --- 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 31c5c5521ee..ad27dc50266 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2195,7 +2195,7 @@ class Form $sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity"; } // Condition here should be the same than into societe->getSalesRepresentatives(). - if ($userissuperadminentityone && $force_entity != 'default') { + if ($userissuperadminentityone && $force_entity !== 'default') { if (!empty($force_entity)) { $sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")"; } else { From 995e0792e5872d075059b2aa3f5979512878ba42 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Jan 2025 00:44:39 +0100 Subject: [PATCH 23/77] Fix escaping var --- htdocs/product/class/product.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 0a9b0206f54..0f368838f0f 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1311,12 +1311,12 @@ class Product extends CommonObject $sql .= ", accountancy_code_sell_export= '" . $this->db->escape($this->accountancy_code_sell_export) . "'"; } $sql .= ", desiredstock = ".((isset($this->desiredstock) && is_numeric($this->desiredstock)) ? (float) $this->desiredstock : "null"); - $sql .= ", cost_price = ".($this->cost_price != '' ? $this->db->escape($this->cost_price) : 'null'); + $sql .= ", cost_price = ".($this->cost_price != '' ? ((float) $this->cost_price) : 'null'); $sql .= ", fk_unit= ".(!$this->fk_unit ? 'NULL' : (int) $this->fk_unit); $sql .= ", price_autogen = ".(!$this->price_autogen ? 0 : 1); $sql .= ", fk_price_expression = ".($this->fk_price_expression != 0 ? (int) $this->fk_price_expression : 'NULL'); - $sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL'); - $sql .= ", mandatory_period = ".($this->mandatory_period); + $sql .= ", fk_user_modif = ".($user->id > 0 ? (int) $user->id : 'NULL'); + $sql .= ", mandatory_period = ".((int) $this->mandatory_period); // stock field is not here because it is a denormalized value from product_stock. $sql .= " WHERE rowid = ".((int) $id); From e5c385999d73490e1b0ab68477444178b2984f88 Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 19 Jan 2025 02:30:36 +0100 Subject: [PATCH 24/77] Qual: Fix multiple phan notices # Qual: Fix multiple phan notices Fix multiple phan notices --- htdocs/comm/propal/class/propal.class.php | 14 +++---- htdocs/commande/class/commande.class.php | 38 +++++++++--------- htdocs/compta/facture/class/facture.class.php | 7 ++-- htdocs/core/class/html.form.class.php | 38 +++++++++--------- htdocs/ecm/dir_card.php | 4 +- htdocs/ecm/index.php | 14 ++++--- .../conferenceorbooth_card.php | 10 ++--- .../conferenceorbooth_list.php | 7 ++-- .../conferenceorboothattendee_card.php | 18 +++++---- .../conferenceorboothattendee_list.php | 37 ++++++++--------- htdocs/expedition/card.php | 40 +++++++++---------- htdocs/expedition/class/expedition.class.php | 12 +++--- htdocs/expedition/contact.php | 6 ++- htdocs/expedition/dispatch.php | 18 +++++---- htdocs/expedition/document.php | 4 +- htdocs/expedition/list.php | 19 ++++----- htdocs/expedition/note.php | 4 +- htdocs/expedition/shipment.php | 33 +++++++-------- htdocs/expensereport/card.php | 35 ++++++++-------- 19 files changed, 187 insertions(+), 171 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index eb81c4c084e..ecd6898734c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -19,7 +19,7 @@ * Copyright (C) 2022 OpenDSI * Copyright (C) 2022 Gauthier VERDOL * Copyright (C) 2023 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * 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 @@ -146,23 +146,23 @@ class Propal extends CommonObject /** * @var int|'' - * @deprecated + * @deprecated Use $date_validation * @see $date_validation */ public $datev; /** - * @var integer|'' $date_validation; + * @var int|'' */ public $date_validation; /** - * @var integer|'' $date_signature; + * @var int|'' */ public $date_signature; /** - * @var User $user_signature + * @var User */ public $user_signature; @@ -715,7 +715,7 @@ class Propal extends CommonObject if ($qty < $product->packaging) { $qty = $product->packaging; } else { - if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) { + if (!empty($product->packaging) && (fmod((float) $qty, (float) $product->packaging) > 0.000001)) { $coeff = intval((float) $qty / $product->packaging) + 1; $qty = (float) $product->packaging * $coeff; setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); @@ -772,7 +772,7 @@ class Propal extends CommonObject $this->line->fk_propal = $this->id; $this->line->label = $label; $this->line->desc = $desc; - $this->line->qty = $qty; + $this->line->qty = (float) $qty; $this->line->vat_src_code = $vat_src_code; $this->line->tva_tx = $txtva; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 71e03085f69..6c747d2602b 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -13,7 +13,7 @@ * Copyright (C) 2016-2022 Ferran Marcet * Copyright (C) 2021-2025 Frédéric France * Copyright (C) 2022 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 William Mead * * This program is free software; you can redistribute it and/or modify @@ -1637,10 +1637,10 @@ class Commande extends CommonOrder if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { $product = new Product($this->db); $result = $product->fetch($fk_product); - if ($qty < $product->packaging) { + if ($qty < (float) $product->packaging) { $qty = $product->packaging; } else { - if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) { + if (!empty($product->packaging) && (fmod((float) $qty, (float) $product->packaging) > 0.000001)) { $coeff = intval((float) $qty / $product->packaging) + 1; $qty = (float) $product->packaging * $coeff; setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); @@ -1703,7 +1703,7 @@ class Commande extends CommonOrder $this->line->fk_commande = $this->id; $this->line->label = $label; $this->line->desc = $desc; - $this->line->qty = $qty; + $this->line->qty = (float) $qty; $this->line->ref_ext = $ref_ext; $this->line->vat_src_code = $vat_src_code; @@ -1863,21 +1863,21 @@ class Commande extends CommonOrder $this->lines[] = $line; /** POUR AJOUTER AUTOMATIQUEMENT LES SOUSPRODUITS a LA COMMANDE - if (getDolGlobalString('PRODUIT_SOUSPRODUITS')) { - $prod = new Product($this->db); - $prod->fetch($idproduct); - $prod -> get_sousproduits_arbo(); - $prods_arbo = $prod->get_arbo_each_prod(); - if(count($prods_arbo) > 0) - { - foreach($prods_arbo as $key => $value) - { - // print "id : ".$value[1].' :qty: '.$value[0].'
'; - if not in lines { - $this->add_product($value[1], $value[0]); - } - } - } + * if (getDolGlobalString('PRODUIT_SOUSPRODUITS')) { + * $prod = new Product($this->db); + * $prod->fetch($idproduct); + * $prod -> get_sousproduits_arbo(); + * $prods_arbo = $prod->get_arbo_each_prod(); + * if(count($prods_arbo) > 0) + * { + * foreach($prods_arbo as $key => $value) + * { + * // print "id : ".$value[1].' :qty: '.$value[0].'
'; + * if not in lines { + * $this->add_product($value[1], $value[0]); + * } + * } + * } **/ } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 09dddafbbd5..88430241586 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -20,7 +20,7 @@ * Copyright (C) 2022 Sylvain Legrand * Copyright (C) 2023 Gauthier VERDOL * Copyright (C) 2023 Nick Fragoulis - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -174,7 +174,6 @@ class Facture extends CommonInvoice public $resteapayer; /** - * * @var int<0,1> 1 if invoice paid COMPLETELY, 0 otherwise * @deprecated * Use statut and close_code) */ @@ -4002,10 +4001,10 @@ class Facture extends CommonInvoice if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { $product = new Product($this->db); $result = $product->fetch($fk_product); - if ($qty < $product->packaging) { + if ($qty < (float) $product->packaging) { $qty = $product->packaging; } else { - if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) { + if (!empty($product->packaging) && (fmod((float) $qty, (float) $product->packaging) > 0.000001)) { $coeff = intval((float) $qty / $product->packaging) + 1; $qty = (float) $product->packaging * $coeff; setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e374296cf13..143cc1a07d9 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -107,9 +107,9 @@ class Form * @param object $object Object (on the page we show) * @param int<0,1> $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field. * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'dayhour' or 'datehourpicker' 'checkbox:ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) - * @param string $moreparam More param to add on a href URL. - * @param int $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS. - * @param int<0,3> $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' ' + * @param string $moreparam More param to add on a href URL. + * @param int<0,1> $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS. + * @param int<0,3> $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' ' * @param string $paramid Key of parameter for id ('id', 'socid') * @param string $help Tooltip help * @return string HTML edit field @@ -624,19 +624,19 @@ class Form * Show a text and picto with tooltip on text or picto. * Can be called by an instancied $form->textwithtooltip or by a static call Form::textwithtooltip * - * @param string $text Text to show - * @param string $htmltext HTML content of tooltip. Must be HTML/UTF8 encoded. - * @param int $tooltipon 1=tooltip on text, 2=tooltip on image, 3=tooltip on both - * @param int $direction -1=image is before, 0=no image, 1=image is after - * @param string $img Html code for image (use img_xxx() function to get it) - * @param string $extracss Add a CSS style to td tags - * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span - * @param string $incbefore Include code before the text - * @param int $noencodehtmltext Do not encode into html entity the htmltext - * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) - * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only) - * @return string Code html du tooltip (texte+picto) - * @see textwithpicto() Use textwithpicto() instead of textwithtooltip if you can. + * @param string $text Text to show + * @param string $htmltext HTML content of tooltip. Must be HTML/UTF8 encoded. + * @param int<0,3> $tooltipon 1=tooltip on text, 2=tooltip on image, 3=tooltip on both + * @param int<-1,1> $direction -1=image is before, 0=no image, 1=image is after + * @param string $img Html code for image (use img_xxx() function to get it) + * @param string $extracss Add a CSS style to td tags + * @param int<0,3> $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span + * @param string $incbefore Include code before the text + * @param int<0,1> $noencodehtmltext Do not encode into html entity the htmltext + * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) + * @param int<0,1> $forcenowrap Force no wrap between text and picto (works with notabs=2 only) + * @return string Code html du tooltip (texte+picto) + * @see textwithpicto() Use textwithpicto() instead of textwithtooltip if you can. */ public function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 3, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0) { @@ -5645,9 +5645,9 @@ class Form * @param string $title Title * @param string $question Question * @param string $action Action - * @param array}>|string|null $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) - * 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss', - * 'other', 'onecolumn' or 'hidden'... + * @param array}>|string|null $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) + * 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss', + * 'other', 'onecolumn' or 'hidden'... * @param int<0,1>|''|'no'|'yes'|'1'|'0' $selectedchoice '' or 'no', or 'yes' or '1', 1, '0' or 0 * @param int<0,2>|string $useajax 0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx * @param int|string $height Force height of box (0 = auto) diff --git a/htdocs/ecm/dir_card.php b/htdocs/ecm/dir_card.php index fcfff57f74a..cf7d8c159c9 100644 --- a/htdocs/ecm/dir_card.php +++ b/htdocs/ecm/dir_card.php @@ -1,6 +1,7 @@ * Copyright (C) 2024-2025 Frédéric France + * Copyright (C) 2025 MDW * * 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 @@ -85,7 +86,7 @@ $ecmdir = new EcmDirectory($db); if ($module == 'ecm') { // $section should be an int except if it is dir not yet created into EcmDirectory - $result = $ecmdir->fetch($section); + $result = preg_match('/^\d+$/', $section) ? $ecmdir->fetch((int) $section) : 0; if ($result > 0) { $relativepath = $ecmdir->getRelativePath(); $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; @@ -199,6 +200,7 @@ if ($action == 'confirm_deletedir' && $confirm == 'yes' && $permissiontoupload) // Update dirname or description if ($action == 'update' && !GETPOST('cancel', 'alpha') && $permissiontoadd) { $error = 0; + $oldlabel = ''; if ($module == 'ecm') { $oldlabel = $ecmdir->label; diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 0f3e5cd7c24..213d60c4a17 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2008-2017 Laurent Destailleur * Copyright (C) 2008-2010 Regis Houssin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * 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 @@ -109,10 +110,11 @@ $permissiontodeletedir = $user->hasRight('ecm', 'setup'); //$backtopage = $_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid; // used after a confirm_deletefile into actions_linkedfiles.inc.php //include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; +$relativepath = ''; + // Upload file (code similar but different than actions_linkedfiles.inc.php) if (GETPOST("sendit", 'alphanohtml') && getDolGlobalString('MAIN_UPLOAD_DOC') && $permissiontocreate) { // Define relativepath and upload_dir - $relativepath = ''; if ($ecmdir->id) { $relativepath = $ecmdir->getRelativePath(); } else { @@ -277,11 +279,11 @@ if ($action == 'refreshmanual' && $permissiontoread) { //print $ecmdirtmp->cachenbofdoc."
\n";exit; $id = $ecmdirtmp->create($user); if ($id > 0) { - $newdirsql = array('id'=>$id, - 'id_mere'=>$ecmdirtmp->fk_parent, - 'label'=>$ecmdirtmp->label, - 'description'=>$ecmdirtmp->description, - 'fullrelativename'=>$relativepathmissing); + $newdirsql = array('id' => $id, + 'id_mere' => $ecmdirtmp->fk_parent, + 'label' => $ecmdirtmp->label, + 'description' => $ecmdirtmp->description, + 'fullrelativename' => $relativepathmissing); $sqltree[] = $newdirsql; // We complete fulltree for following loops //var_dump($sqltree); $adirwascreated = 1; diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index 69162c5fca8..ff6d66b04f3 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -3,7 +3,7 @@ * Copyright (C) 2021 Florian Henry * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * 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 @@ -187,7 +187,7 @@ $help_url = 'EN:Module_Event_Organization'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-eventorganization page-card'); if ($action == 'create') { - $result = $projectstatic->fetch(GETPOST('fk_project')); + $result = $projectstatic->fetch(GETPOSTINT('fk_project')); } else { $result = $projectstatic->fetch($object->fk_project); } @@ -351,7 +351,7 @@ if (!empty($withproject)) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; @@ -359,7 +359,7 @@ if (!empty($withproject)) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; @@ -377,7 +377,7 @@ if (!empty($withproject)) { print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', '', $projectstatic, $permissiontoadd, 'integer:3', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $projectstatic->max_attendees, $projectstatic, $permissiontoadd, 'integer:3', '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $projectstatic->max_attendees, $projectstatic, $permissiontoadd, 'integer:3', '', null, null, '', 0, '', 'projectid'); print ""; print ''.$langs->trans("EventOrganizationICSLink").''; diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 46bb260a6be..dcaecaf7f4e 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -3,6 +3,7 @@ * Copyright (C) 2021 Florian Henry * Copyright (C) 2023-2024 Frédéric France * Copyright (C) 2024 Alexandre Spangaro + * Copyright (C) 2025 MDW * * 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 @@ -880,7 +881,7 @@ foreach ($object->fields as $key => $val) { } elseif ($key == 'lang') { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($db); - print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2); + print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2); } else { print ''; } @@ -1032,7 +1033,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key)) { - print ' title="'.dol_escape_htmltag($object->$key).'"'; + print ' title="'.dol_escape_htmltag((string) $object->$key).'"'; } print '>'; if ($key == 'status') { @@ -1040,7 +1041,7 @@ while ($i < $imaxinloop) { } elseif ($key == 'ref') { print $object->getNomUrl(1, 0, '', (($projectid > 0) ? 'withproject' : '')); } else { - print $object->showOutputField($val, $key, $object->$key, ''); + print $object->showOutputField($val, $key, (string) $object->$key, ''); } print ''; if (!$i) { diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index b7010dadaf5..041e671a8f0 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -1,7 +1,7 @@ * Copyright (C) 2024 Alexandre Spangaro - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -75,6 +75,8 @@ $diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneratio $hookmanager->initHooks(array('conferenceorboothattendeecard', 'globalcard')); // Note that conf->hooks_modules contains array +$confOrBooth = null; + if ($conf_or_booth_id > 0) { $confOrBooth = new ConferenceOrBooth($db); $result = $confOrBooth->fetch($id > 0 ? $id : $conf_or_booth_id); @@ -221,7 +223,7 @@ $help_url = 'EN:Module_Event_Organization'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-eventorganization page-attendee-card'); -$result = $projectstatic->fetch(empty($confOrBooth->fk_project) ? $fk_project : $confOrBooth->fk_project); +$result = $projectstatic->fetch(($confOrBooth === null || empty($confOrBooth->fk_project)) ? $fk_project : $confOrBooth->fk_project); if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) { $projectstatic->fetchComments(); } @@ -357,7 +359,7 @@ if (!empty($withproject)) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; @@ -365,7 +367,7 @@ if (!empty($withproject)) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; @@ -377,7 +379,7 @@ if (!empty($withproject)) { print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid'); print ""; print ''.$langs->trans("EventOrganizationICSLink").''; @@ -439,7 +441,7 @@ if (!empty($withproject)) { } // Part to create -if ($action == 'create') { +if ($action == 'create' && $confOrBooth !== null) { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("ConferenceOrBoothAttendee")), '', 'object_'.$object->picto); @@ -484,7 +486,7 @@ if ($action == 'create') { } // Part to edit record -if (($id || $ref) && $action == 'edit') { +if (($id || $ref) && $action == 'edit' && $confOrBooth !== null) { print load_fiche_titre($langs->trans("ConferenceOrBoothAttendee"), '', 'object_'.$object->picto); print '
'; @@ -527,7 +529,7 @@ if (($id || $ref) && $action == 'edit') { } // Part to show record -if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { +if ($confOrBooth !== null && $object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { $object->fetch_optionals(); $moreparam = ''; diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index c5934e13ecd..3cabcb13528 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -3,6 +3,7 @@ * Copyright (C) 2021 Florian Henry * Copyright (C) 2024 Alexandre Spangaro * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * 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 @@ -564,7 +565,7 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', $projectstatic->accept_conference_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', $projectstatic->accept_conference_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', $projectstatic->accept_conference_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; @@ -572,39 +573,39 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', $projectstatic->accept_booth_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', $projectstatic->accept_booth_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', $projectstatic->accept_booth_suggestions ? 1 : 0, $projectstatic, 0, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid'); print ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', '', $projectstatic, $permissiontoadd, 'integer:3', '&withproject=1', 0, 0, 'projectid'); print ''; - print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $projectstatic->max_attendees, $projectstatic, $permissiontoadd, 'integer:3', '', null, 0, '&withproject=1', 0, '', 'projectid'); + print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $projectstatic->max_attendees, $projectstatic, $permissiontoadd, 'integer:3', '', null, null, '&withproject=1', 0, '', 'projectid'); print ""; - // Link to ICS for the event - print ''.$langs->trans("EventOrganizationICSLinkProject").''; + // Link to ICS for the event + print ''.$langs->trans("EventOrganizationICSLinkProject").''; // Define $urlwithroot - $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); - $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; - // Show message - $message = ''.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').''; - print $message; - print ""; + // Show message + $message = ''.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').''; + print $message; + print ""; print ''.$langs->trans("EventOrganizationICSLink").''; // Define $urlwithroot @@ -870,7 +871,7 @@ foreach ($object->fields as $key => $val) { } elseif ($key == 'lang') { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($db); - print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth100imp maxwidth125', 2); + print $formadmin->select_language($search[$key], 'search_lang', 0, array(), 1, 0, 0, 'minwidth100imp maxwidth125', 2); } else { print ''; } @@ -1021,7 +1022,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['t.'.$key]['checked'])) { print '$key)) { - print ' title="'.dol_escape_htmltag($object->$key).'"'; + print ' title="'.dol_escape_htmltag((string) $object->$key).'"'; } print '>'; if ($key == 'status') { @@ -1033,7 +1034,7 @@ while ($i < $imaxinloop) { } print $object->getNomUrl(1, $optionLink); } else { - print $object->showOutputField($val, $key, $object->$key, ''); + print $object->showOutputField($val, $key, (string) $object->$key, ''); } print ''; if (!$i) { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 1b74583596c..a19523f9d7b 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -14,7 +14,7 @@ * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2020 Lenin Rivas * Copyright (C) 2022 Josep Lluís Amador - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * 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 @@ -388,7 +388,7 @@ if (empty($reshook)) { } // Extrafields - $array_options[$i] = $extrafields->getOptionalsFromPost($object->table_element_line, $i); + $array_options[$i] = $extrafields->getOptionalsFromPost($object->table_element_line, (string) $i); // Unset extrafield if (isset($extrafields->attributes[$object->table_element_line]['label']) && is_array($extrafields->attributes[$object->table_element_line]['label'])) { // Get extra fields @@ -528,7 +528,7 @@ if (empty($reshook)) { } } elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $user->hasRight('expedition', 'supprimer')) { $also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0); - $result = $object->cancel(0, $also_update_stock); + $result = $object->cancel(0, (bool) $also_update_stock); if ($result > 0) { $result = $object->setStatut(-1); } else { @@ -536,7 +536,7 @@ if (empty($reshook)) { } } elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('expedition', 'supprimer')) { $also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0); - $result = $object->delete($user, 0, $also_update_stock); + $result = $object->delete($user, 0, (bool) $also_update_stock); if ($result > 0) { header("Location: ".DOL_URL_ROOT.'/expedition/index.php'); exit; @@ -1035,7 +1035,7 @@ if ($action == 'create') { print ''; print ''.$langs->trans("Project").''; print img_picto('', 'project', 'class="pictofixedwidth"'); - $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); + $numprojet = $formproject->select_projects($soc->id, (string) $projectid, 'projectid', 0); print ' id).'">'; print ''; print ''; @@ -1081,7 +1081,7 @@ if ($action == 'create') { print ''; print img_picto('', 'fa-balance-scale', 'class="pictofixedwidth"'); print ' '; - $text = $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTINT('weight_units'), 0, 2); + $text = $formproduct->selectMeasuringUnits("weight_units", "weight", (string) GETPOSTINT('weight_units'), 0, 2); $htmltext = $langs->trans("KeepEmptyForAutoCalculation"); print $form->textwithpicto($text, $htmltext); print ''; @@ -1094,7 +1094,7 @@ if ($action == 'create') { print ' x '; print ' x '; print ' '; - $text = $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTINT('size_units'), 0, 2); + $text = $formproduct->selectMeasuringUnits("size_units", "size", (string) GETPOSTINT('size_units'), 0, 2); $htmltext = $langs->trans("KeepEmptyForAutoCalculation"); print $form->textwithpicto($text, $htmltext); print ''; @@ -1277,7 +1277,7 @@ if ($action == 'create') { $text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label); $description = ($showdescinproductdesc ? '' : dol_htmlentitiesbr($line->desc)); - print $form->textwithtooltip($text, $description, 3, 0, '', $i); + print $form->textwithtooltip($text, $description, 3, 0, '', (string) $i); // Show range print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end)); @@ -1298,7 +1298,7 @@ if ($action == 'create') { if (!empty($line->label)) { $text .= ' '.$line->label.''; - print $form->textwithtooltip($text, $line->desc, 3, 0, '', $i); + print $form->textwithtooltip($text, $line->desc, 3, 0, '', (string) $i); } else { print $text.' '.nl2br($line->desc); } @@ -1856,7 +1856,7 @@ if ($action == 'create') { $expLine->array_options = array_merge($expLine->array_options, $srcLine->array_options); - print $expLine->showOptionals($extrafields, 'edit', array('style' => 'class="drag drop oddeven"', 'colspan' => $colspan), $indiceAsked, '', 1); + print $expLine->showOptionals($extrafields, 'edit', array('style' => 'class="drag drop oddeven"', 'colspan' => $colspan), (string) $indiceAsked, '', '1'); } } @@ -2003,7 +2003,7 @@ if ($action == 'create') { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, (string) $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); @@ -2107,13 +2107,13 @@ if ($action == 'create') { print ''; print ''; print ''; - print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2, 'maxwidth125 valignmiddle'); + print $formproduct->selectMeasuringUnits("weight_units", "weight", (string) $object->weight_units, 0, 2, 'maxwidth125 valignmiddle'); print ' '; print ' '; print ''; } else { print $object->trueWeight; - print ($object->trueWeight && $object->weight_units != '') ? ' '.measuringUnitString(0, "weight", $object->weight_units) : ''; + print ($object->trueWeight && $object->weight_units != '') ? ' '.measuringUnitString(0, "weight", (string) $object->weight_units) : ''; } // Calculated @@ -2228,7 +2228,7 @@ if ($action == 'create') { } else { if ($object->shipping_method_id > 0) { // Get code using getLabelFromKey - $code = $langs->getLabelFromKey($db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); + $code = $langs->getLabelFromKey($db, (string) $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); print $langs->trans("SendingMethod".strtoupper($code)); } } @@ -2462,7 +2462,7 @@ if ($action == 'create') { $text = $product_static->getNomUrl(1); $text .= ' - '.$label; $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($lines[$i]->description)); - print $form->textwithtooltip($text, $description, 3, 0, '', $i); + print $form->textwithtooltip($text, $description, 3, 0, '', (string) $i); print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : '', !empty($lines[$i]->date_end) ? $lines[$i]->date_end : ''); if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) { print (!empty($lines[$i]->description) && $lines[$i]->description != $lines[$i]->product) ? '
'.dol_htmlentitiesbr($lines[$i]->description) : ''; @@ -2478,7 +2478,7 @@ if ($action == 'create') { if (!empty($lines[$i]->label)) { $text .= ' '.$lines[$i]->label.''; - print $form->textwithtooltip($text, $lines[$i]->description, 3, 0, '', $i); + print $form->textwithtooltip($text, $lines[$i]->description, 3, 0, '', (string) $i); } else { print $text.' '.nl2br($lines[$i]->description); } @@ -2489,7 +2489,7 @@ if ($action == 'create') { $unit_order = ''; if (getDolGlobalString('PRODUCT_USE_UNITS')) { - $unit_order = measuringUnitString($lines[$i]->fk_unit); + $unit_order = measuringUnitString((int) $lines[$i]->fk_unit); } // Qty ordered @@ -2529,7 +2529,7 @@ if ($action == 'create') { } } } - print $form->textwithpicto($qtyalreadysent, $htmltooltip, 1, 'info', '', 0, 3, 'tooltip'.$lines[$i]->id); + print $form->textwithpicto((string) $qtyalreadysent, $htmltooltip, 1, 'info', '', 0, 3, 'tooltip'.$lines[$i]->id); print ''; } @@ -2738,9 +2738,9 @@ if ($action == 'create') { // TODO Show all in same line by setting $display_type = 'line' if ($action == 'editline' && $line->id == $line_id) { - print $lines[$i]->showOptionals($extrafields, 'edit', array('colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked : '', '', 0, 'card'); + print $lines[$i]->showOptionals($extrafields, 'edit', array('colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked : '', '', '', 'card'); } else { - print $lines[$i]->showOptionals($extrafields, 'view', array('colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked : '', '', 0, 'card'); + print $lines[$i]->showOptionals($extrafields, 'view', array('colspan' => $colspan), !empty($indiceAsked) ? $indiceAsked : '', '', '', 'card'); } } } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 61e50c14373..d3ecb5adad9 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -13,7 +13,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2025 Frédéric France * Copyright (C) 2020 Lenin Rivas - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 William Mead * * This program is free software; you can redistribute it and/or modify @@ -306,7 +306,6 @@ class Expedition extends CommonObject * Closed status * -> parcel was received by customer / end of process * prev status : validated or shipment_in_progress - * */ const STATUS_CLOSED = 2; @@ -1476,10 +1475,10 @@ class Expedition extends CommonObject * Delete shipment. * Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element) * - * @param User $user User making the deletion - * @param int $notrigger Disable triggers - * @param bool $also_update_stock true if the stock should be increased back (false by default) - * @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO + * @param ?User $user User making the deletion + * @param int<0,1> $notrigger Disable triggers + * @param bool $also_update_stock true if the stock should be increased back (false by default) + * @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO */ public function delete($user = null, $notrigger = 0, $also_update_stock = false) { @@ -2437,7 +2436,6 @@ class Expedition extends CommonObject * @param string $labelmovement Label of movement * @return int Return integer <0 if KO, >0 if OK * @throws Exception - * */ private function manageStockMvtOnEvt($user, $labelmovement = 'ShipmentClassifyClosedInDolibarr') { diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index 3818847e84e..534515a84f6 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2023 Christian Foellmann * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * 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 @@ -52,6 +53,7 @@ $id = GETPOSTINT('id'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); +$typeobject = null; $object = new Expedition($db); if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); @@ -85,7 +87,7 @@ $result = restrictedArea($user, 'expedition', $object->id, ''); * Actions */ -$parameters = array('id'=>$id); +$parameters = array('id' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -172,7 +174,7 @@ if ($id > 0 || !empty($ref)) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, (string) $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index e1340a8b0d7..67c30c5ff95 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -9,7 +9,7 @@ * Copyright (C) 2017-2022 Ferran Marcet * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2019-2020 Christophe Battarel - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * 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 @@ -141,6 +141,7 @@ if ($action == 'updatelines' && $usercancreate) { $reg = array(); if (preg_match('/^product_.*([0-9]+)_([0-9]+)$/i', $key, $reg)) { $pos++; + $modebatch = null; if (preg_match('/^product_([0-9]+)_([0-9]+)$/i', $key, $reg)) { $modebatch = "barcode"; } elseif (preg_match('/^product_batch_([0-9]+)_([0-9]+)$/i', $key, $reg)) { // With batchmode enabled @@ -156,7 +157,7 @@ if ($action == 'updatelines' && $usercancreate) { $qty = "qty_".$reg[1].'_'.$reg[2]; $ent = "entrepot_".$reg[1].'_'.$reg[2]; $fk_commandedet = "fk_commandedet_".$reg[1].'_'.$reg[2]; - $idline = GETPOST("idline_".$reg[1].'_'.$reg[2]); + $idline = GETPOSTINT("idline_".$reg[1].'_'.$reg[2]); $warehouse_id = GETPOSTINT($ent); $prod_id = GETPOSTINT($prod); //$pu = "pu_".$reg[1].'_'.$reg[2]; // This is unit price including discount @@ -245,6 +246,7 @@ if ($action == 'updatelines' && $usercancreate) { $sqlsearchdet .= " AND batch = '".$db->escape($lot)."'"; $resqlsearchdet = $db->query($sqlsearchdet); + $objsearchdet = null; if ($resqlsearchdet) { $objsearchdet = $db->fetch_object($resqlsearchdet); } else { @@ -384,6 +386,7 @@ $warehouse_static = new Entrepot($db); $title = $object->ref." - ".$langs->trans('ShipmentDistribution'); $help_url = 'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones|DE:Modul_Lieferungen'; $morejs = array('/expedition/js/lib_dispatch.js.php'); +$typeobject = null; llxHeader('', $title, $help_url, '', 0, 0, $morejs, '', '', 'mod-expedition page-card_dispatch'); @@ -459,7 +462,7 @@ if ($object->id > 0 || !empty($object->ref)) { if ($action != 'classify' && $permissiontoadd) { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ? $object->socid : -1), (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); @@ -546,6 +549,11 @@ if ($object->id > 0 || !empty($object->ref)) { $entrepot = new Entrepot($db); $listwarehouses = $entrepot->list_array(1); + $nbfreeproduct = 0; // Nb of lines of free products/services + $nbproduct = 0; // Nb of predefined product lines to dispatch (already done or not) if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is off (default) + // or nb of line that remain to dispatch if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is on. + + print '
'; @@ -683,10 +691,6 @@ if ($object->id > 0 || !empty($object->ref)) { print "\n"; } - $nbfreeproduct = 0; // Nb of lines of free products/services - $nbproduct = 0; // Nb of predefined product lines to dispatch (already done or not) if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is off (default) - // or nb of line that remain to dispatch if SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED is on. - $conf->cache['product'] = array(); // Loop on each line of origin order diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php index f8b1cc3ad85..4dc74e52a72 100644 --- a/htdocs/expedition/document.php +++ b/htdocs/expedition/document.php @@ -6,6 +6,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * 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 @@ -79,6 +80,7 @@ if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); $object->fetch_thirdparty(); + $typeobject = null; if (!empty($object->origin)) { $typeobject = $object->origin; $origin = $object->origin; @@ -159,7 +161,7 @@ if ($id > 0 || !empty($ref)) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, (string) $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($objectsrc->fk_project)) { $proj = new Project($db); diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index b45450396bc..03a6a11db5d 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -6,7 +6,7 @@ * Copyright (C) 2019 Nicolas ZABOURI * Copyright (C) 2020 Thibault FOUCART * Copyright (C) 2023 Christophe Battarel - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Benjamin Falière * Copyright (C) 2024 Vincent Maury * Copyright (C) 2024 William Mead @@ -557,9 +557,6 @@ if (empty($reshook)) { if ($search_company) { $param .= "&search_company=".urlencode($search_company); } - if ($search_shipping_method_id) { - $param .= "&search_shipping_method_id=".urlencode($search_shipping_method_id); - } if ($search_tracking) { $param .= "&search_tracking=".urlencode($search_tracking); } @@ -1089,7 +1086,7 @@ if ($massaction == 'createbills') { print $langs->trans('DateInvoice'); print ''; print ''; - print $form->selectDate('', '', '', '', '', '', 1, 1); + print $form->selectDate('', '', 0, 0, 0, '', 1, 1); print ''; print ''; print ''; @@ -1106,7 +1103,7 @@ if ($massaction == 'createbills') { print ''; print ''; if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) { - print $form->selectyesno('validate_invoices', 0, 1, 1); + print $form->selectyesno('validate_invoices', 0, 1, true); $langs->load("errors"); print ' ('.$langs->trans("WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal").')'; } else { @@ -1152,7 +1149,7 @@ if ($user->hasRight('user', 'user', 'lire')) { $moreforfilter .= '
'; $tmptitle = $langs->trans('LinkedToSpecificUsers'); $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"'); - $moreforfilter .= $form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200'); + $moreforfilter .= $form->select_dolusers($search_user, 'search_user', $tmptitle, null, 0, '', '', '0', 0, 0, '', 0, '', 'maxwidth200'); $moreforfilter .= '
'; } // If the user can view prospects other than his' @@ -1190,7 +1187,7 @@ if (!empty($moreforfilter)) { } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // @phan-suppress-current-line PhanTypeMismatchArgument if ($massactionbutton) { $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); // This also change content of $arrayfields } @@ -1223,7 +1220,7 @@ if (!empty($arrayfields['e.ref_customer']['checked'])) { // Thirdparty if (!empty($arrayfields['s.nom']['checked'])) { print ''; - print ''; + print ''; print ''; } // Town @@ -1353,7 +1350,7 @@ if (!empty($arrayfields['e.signed_status']['checked'])) { // Status billed if (!empty($arrayfields['e.billed']['checked'])) { print ''; - print $form->selectyesno('search_billed', $search_billed, 1, 0, 1); + print $form->selectyesno('search_billed', $search_billed, 1, false, 1); print ''; } // Action column @@ -1649,7 +1646,7 @@ while ($i < $imaxinloop) { } if (!empty($arrayfields['e.fk_shipping_method']['checked'])) { // Get code using getLabelFromKey - $code = $langs->getLabelFromKey($db, $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); + $code = $langs->getLabelFromKey($db, (string) $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); print ''; if ($object->shipping_method_id > 0) { print $langs->trans("SendingMethod".strtoupper($code)); diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index 862253ba2ce..f2186c1be04 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * 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 @@ -54,6 +55,7 @@ if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); $object->fetch_thirdparty(); + $typeobject = null; if (!empty($object->origin)) { $typeobject = $object->origin; $origin = $object->origin; @@ -128,7 +130,7 @@ if ($id > 0 || !empty($ref)) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, (string) $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 89930ef944c..e7ecf387ec1 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -5,7 +5,7 @@ * Copyright (C) 2012-2015 Juanjo Menent * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2018-2022 Philippe Grand - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * 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 @@ -146,7 +146,7 @@ if (empty($reshook)) { if ($action == 'setavailability' && $permissiontoadd) { $object->fetch($id); - $result = $object->availability(GETPOST('availability_id')); + $result = $object->availability(GETPOSTINT('availability_id')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -154,7 +154,7 @@ if (empty($reshook)) { if ($action == 'setdemandreason' && $permissiontoadd) { $object->fetch($id); - $result = $object->demand_reason(GETPOST('demand_reason_id')); + $result = $object->demand_reason(GETPOSTINT('demand_reason_id')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -301,7 +301,7 @@ if ($id > 0 || !empty($ref)) { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, (string) $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); } else { if (!empty($objectsrc) && !empty($objectsrc->fk_project)) { $proj = new Project($db); @@ -336,8 +336,8 @@ if ($id > 0 || !empty($ref)) { print ''.$langs->trans('Discounts').''; - $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount); - $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote); + $absolute_discount = $soc->getAvailableDiscounts(null, $filterabsolutediscount); + $absolute_creditnote = $soc->getAvailableDiscounts(null, $filtercreditnote); $absolute_discount = price2num($absolute_discount, 'MT'); $absolute_creditnote = price2num($absolute_creditnote, 'MT'); @@ -396,9 +396,9 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; if ($action == 'editavailability') { - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1); + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->availability_id, 'availability_id', 1); } else { - $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1); + $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->availability_id, 'none', 1); } print ''; @@ -413,9 +413,9 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; if ($action == 'editshippingmethod') { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->shipping_method_id, 'shipping_method_id', 1); } else { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none'); + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->shipping_method_id, 'none'); } print ''; print ''; @@ -453,9 +453,9 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; if ($action == 'editdemandreason') { - $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1); + $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->demand_reason_id, 'demand_reason_id', 1); } else { - $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none'); + $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->demand_reason_id, 'none'); } // Terms of payment @@ -620,6 +620,9 @@ if ($id > 0 || !empty($ref)) { $sql .= " WHERE cd.fk_commande = ".((int) $object->id); $sql .= " ORDER BY cd.rang, cd.rowid"; + $toBeShipped = array(); + $toBeShippedTotal = 0; + //print $sql; dol_syslog("shipment.php", LOG_DEBUG); $resql = $db->query($sql); @@ -643,8 +646,6 @@ if ($id > 0 || !empty($ref)) { print "\n"; print ''; - $toBeShipped = array(); - $toBeShippedTotal = 0; while ($i < $num) { $objp = $db->fetch_object($resql); @@ -733,7 +734,7 @@ if ($id > 0 || !empty($ref)) { $text .= ' - '.$label; $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description)).'
'; $description .= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80); - print $form->textwithtooltip($text, $description, 3, '', '', $i); + print $form->textwithtooltip($text, $description, 3, '', 0, (string) $i); // Show range print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end)); @@ -754,7 +755,7 @@ if ($id > 0 || !empty($ref)) { if (!empty($objp->label)) { $text .= ' '.$objp->label.''; - print $form->textwithtooltip($text, $objp->description, 3, '', '', $i); + print $form->textwithtooltip($text, $objp->description, 3, 0, '', (string) $i); } else { print $text.' '.nl2br($objp->description); } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index e0cd273c028..d931c854afb 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2015-2023 Alexandre Spangaro * Copyright (C) 2017 Ferran Marcet * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * 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 @@ -234,6 +234,7 @@ if (empty($reshook)) { // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd) { + // @phan-suppress-next-line PhanPluginBothLiteralsBinaryOp if (1 == 0 && !GETPOST('clone_content', 'alpha') && !GETPOST('clone_receivers', 'alpha')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); } else { @@ -1358,7 +1359,7 @@ if (empty($reshook)) { if (!$error) { // TODO Use update method of ExpenseReportLine - $result = $object->updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $id, $fk_c_exp_tax_cat, $fk_ecm_files); + $result = $object->updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, (float) $qty, (float) $value_unit, $date, $id, $fk_c_exp_tax_cat, $fk_ecm_files); if ($result >= 0) { if ($result > 0) { // Define output language @@ -1431,6 +1432,7 @@ $paymentexpensereportstatic = new PaymentExpenseReport($db); $bankaccountstatic = new Account($db); $ecmfilesstatic = new EcmFiles($db); $formexpensereport = new FormExpenseReport($db); +$remaintopay = 0; // Create if ($action == 'create') { @@ -1474,7 +1476,7 @@ if ($action == 'create') { if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('expensereport', 'writeall_advance')) { $include_users = array(); } - $s = $form->select_dolusers($defaultselectuser, "fk_user_author", 0, "", 0, $include_users, '', '0,'.$conf->entity); + $s = $form->select_dolusers($defaultselectuser, "fk_user_author", 0, null, 0, $include_users, '', '0,'.$conf->entity); print $s; print ''; print ''; @@ -1495,7 +1497,7 @@ if ($action == 'create') { if (GETPOSTINT('fk_user_validator') > 0) { $defaultselectuser = GETPOSTINT('fk_user_validator'); } - $s = $form->select_dolusers($defaultselectuser, "fk_user_validator", 1, "", ((empty($defaultselectuser) || !getDolGlobalString('EXPENSEREPORT_DEFAULT_VALIDATOR_UNCHANGEABLE')) ? 0 : 1), $include_users); + $s = $form->select_dolusers($defaultselectuser, "fk_user_validator", 1, null, ((empty($defaultselectuser) || !getDolGlobalString('EXPENSEREPORT_DEFAULT_VALIDATOR_UNCHANGEABLE')) ? 0 : 1), $include_users); print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate")); } print ''; @@ -1552,6 +1554,7 @@ if ($action == 'create') { print ''; } elseif ($id > 0 || $ref) { + $userauthor = null; $result = $object->fetch($id, $ref); if ($result > 0) { @@ -1624,7 +1627,7 @@ if ($action == 'create') { print ''; print ''.$langs->trans("ModePaiement").''; print ''; - $form->select_types_paiements($object->fk_c_paiement, 'fk_c_paiement'); + $form->select_types_paiements((string) $object->fk_c_paiement, 'fk_c_paiement'); print ''; print ''; } @@ -1634,7 +1637,7 @@ if ($action == 'create') { print ''.$langs->trans("VALIDATOR").''; // Approbator print ''; $include_users = $object->fetch_users_approver_expensereport(); - $s = $form->select_dolusers($object->fk_user_validator, "fk_user_validator", 1, "", 0, $include_users); + $s = $form->select_dolusers($object->fk_user_validator, "fk_user_validator", 1, null, 0, $include_users); print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate")); print ''; print ''; @@ -2225,7 +2228,7 @@ if ($action == 'create') { print ''.price($line->value_unit).''; - print ''.dol_escape_htmltag($line->qty).''; + print ''.dol_escape_htmltag((string) $line->qty).''; if ($action != 'editline') { print ''.price($line->total_ht).''; @@ -2400,7 +2403,7 @@ if ($action == 'create') { // Select project if (isModEnabled('project')) { print ''; - $formproject->select_projects(-1, $line->fk_project, 'fk_project', 0, 0, $projectRequired ? 0 : 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300'); + $formproject->select_projects(-1, (string) $line->fk_project, 'fk_project', 0, 0, $projectRequired ? 0 : 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300'); print ''; } @@ -2412,7 +2415,7 @@ if ($action == 'create') { if (getDolGlobalString('MAIN_USE_EXPENSE_IK')) { print ''; $params = array('fk_expense' => $object->id, 'fk_expense_det' => $line->id, 'date' => $line->date); - print $form->selectExpenseCategories($line->fk_c_exp_tax_cat, 'fk_c_exp_tax_cat', 1, array(), 'fk_c_type_fees', $userauthor->default_c_exp_tax_cat, $params); + print $form->selectExpenseCategories($line->fk_c_exp_tax_cat, 'fk_c_exp_tax_cat', 1, array(), 'fk_c_type_fees', (string) $userauthor->default_c_exp_tax_cat, $params); print ''; } @@ -2424,7 +2427,7 @@ if ($action == 'create') { // VAT $selectedvat = price2num($line->vatrate).(!empty($line->vat_src_code) ? ' ('.$line->vat_src_code.')' : ''); print ''; - print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $selectedvat), $mysoc, '', 0, 0, '', false, 1, 2); + print $form->load_tva('vatrate', (GETPOSTISSET("vatrate") ? GETPOST("vatrate") : $selectedvat), $mysoc, null, 0, 0, '', false, 1, 2); print ''; // Unit price @@ -2439,7 +2442,7 @@ if ($action == 'create') { // Quantity print ''; - print ''; // We must be able to enter decimal qty + print ''; // We must be able to enter decimal qty print ''; //print ''.$langs->trans('AmountHT').''; @@ -2455,7 +2458,7 @@ if ($action == 'create') { print ''; print ''; - print $form->buttonsSaveCancel('Save', 'Cancel', array(), 0, 'small'); + print $form->buttonsSaveCancel('Save', 'Cancel', array(), false, 'small'); print ''; print ''; @@ -2582,7 +2585,7 @@ if ($action == 'create') { // Select project if (isModEnabled('project')) { print ''; - $formproject->select_projects(-1, !empty($fk_project) ? $fk_project : 0, 'fk_project', 0, 0, $projectRequired ? 0 : 1, -1, 0, 0, 0, '', 0, 0, 'maxwidth300'); + $formproject->select_projects(-1, !empty($fk_project) ? (string) $fk_project : '0', 'fk_project', 0, 0, $projectRequired ? 0 : 1, -1, 0, 0, 0, '', 0, 0, 'maxwidth300'); print ''; } @@ -2610,7 +2613,7 @@ if ($action == 'create') { // If option to have no default VAT on expense report is on, we force MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none'; } - print $form->load_tva('vatrate', (!empty($vatrate) ? $vatrate : $defaultvat), $mysoc, '', 0, 0, '', false, 1); + print $form->load_tva('vatrate', (!empty($vatrate) ? $vatrate : $defaultvat), $mysoc, null, 0, 0, '', false, 1); print ''; // Unit price net @@ -2638,7 +2641,7 @@ if ($action == 'create') { } print ''; - print $form->buttonsSaveCancel("Add", '', '', 1, 'reposition'); + print $form->buttonsSaveCancel("Add", '', array(), true, 'reposition'); print ''; print ''; @@ -2938,7 +2941,7 @@ if ($action != 'presend') { // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, 'expensereport', null); + $somethingshown = $formactions->showactions($object, 'expensereport', 0); print ''; } From 0438db7747cbcfd8fca449e3908ba5316b32a4a5 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Jan 2025 07:10:41 +0100 Subject: [PATCH 25/77] FIX wrong table name --- htdocs/accountancy/class/accountancycategory.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 379e2b802e1..fbbdb35e7a8 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -439,7 +439,7 @@ class AccountancyCategory // extends CommonObject { global $conf; $sql = "SELECT t.rowid, t.account_number, t.label"; - $sql .= " FROM ".$this->db->prefix().$this->table_element." as t"; + $sql .= " FROM ".$this->db->prefix()."accounting_account as t"; $sql .= " WHERE t.fk_accounting_category = ".((int) $id); $sql .= " AND t.entity = ".$conf->entity; From c43f74687a6aa19318d09435db5c673d2300e9dc Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Jan 2025 07:32:22 +0100 Subject: [PATCH 26/77] FIX #32843 --- htdocs/bom/bom_card.php | 2 +- htdocs/mrp/mo_card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index c5456de0a21..0656d9d1e31 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -800,7 +800,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = $user->hasRight('bom', 'read'); // If you can read, you can build the PDF to read content $delallowed = $user->hasRight('bom', 'write'); // If you can create/edit, you can remove a file on card - print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); + print $formfile->showdocuments('bom', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang, '', $object); // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, array('bom')); diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 17f5aefcb62..7f1ccf1729e 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -853,7 +853,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = $user->hasRight('mrp', 'read'); // If you can read, you can build the PDF to read content $delallowed = $user->hasRight("mrp", "creer"); // If you can create/edit, you can remove a file on card - print $formfile->showdocuments('mrp:mo', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang); + print $formfile->showdocuments('mrp:mo', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang, '', $object); // Show links to link elements $linktoelem = $form->showLinkToObjectBlock($object, null, array('mo')); From 510da33c338f3f6be53cb9ec90626bcb404aeab7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Jan 2025 08:35:55 +0100 Subject: [PATCH 27/77] FIX #32840 --- htdocs/categories/class/categorie.class.php | 35 ++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 330baf65469..b3721d1bee7 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -285,6 +285,38 @@ class Categorie extends CommonObject */ public $imgHeight; + /** + * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') + * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" + * 'label' the translation key. + * 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalString("MY_SETUP_PARAM")' + * 'position' is the sort order of field. + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) + * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommended to name the field fk_...). + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' is the CSS style to use on field. For example: 'maxwidth200' + * 'help' is a string visible as a tooltip on field + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. + * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * + * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. + */ + + /** + * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ + public $fields = array( + 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'visible' => 1, 'showoncombobox' => 1), + ); + /** * Constructor * @@ -1751,7 +1783,8 @@ class Categorie extends CommonObject } // Check contrast with background and correct text color - $forced_color = 'categtextwhite'; + //$forced_color = 'categtextwhite'; // TODO This css class hide the link + $forced_color = 'categtextblack'; if ($this->color) { if (colorIsLight($this->color)) { $forced_color = 'categtextblack'; From 3f1efcfb53a5d9bb58800aed0f3f27574d0fb3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2025 09:01:32 +0100 Subject: [PATCH 28/77] dict type contact --- htdocs/admin/dict.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index c201ca97b73..d96d7ce0e4f 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -11,7 +11,7 @@ * Copyright (C) 2011-2024 Alexandre Spangaro * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Raphaël Doursenaud - * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2019-2025 Frédéric France * Copyright (C) 2020-2022 Open-Dsi * Copyright (C) 2024 Charlene Benke * Copyright (C) 2024 MDW @@ -716,6 +716,7 @@ if ($id == DICT_TYPE_CONTACT) { 'project_task' => img_picto('', 'projecttask', 'class="pictofixedwidth"').$langs->trans('Task'), 'propal' => img_picto('', 'propal', 'class="pictofixedwidth"').$langs->trans('Proposal'), 'commande' => img_picto('', 'order', 'class="pictofixedwidth"').$langs->trans('Order'), + 'shipping' => img_picto('', 'dolly', 'class="pictofixedwidth"') . $langs->trans('Shipment'), 'facture' => img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans('Bill'), 'fichinter' => img_picto('', 'intervention', 'class="pictofixedwidth"').$langs->trans('InterventionCard'), 'contrat' => img_picto('', 'contract', 'class="pictofixedwidth"').$langs->trans('Contract'), From 40d8bea77e2133335de16b8336e66b074a96e205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2025 09:14:13 +0100 Subject: [PATCH 29/77] dict type contact --- htdocs/commande/class/commande.class.php | 4 ++-- htdocs/install/mysql/migration/21.0.0-22.0.0.sql | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 71e03085f69..ccce40846ce 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1638,9 +1638,9 @@ class Commande extends CommonOrder $product = new Product($this->db); $result = $product->fetch($fk_product); if ($qty < $product->packaging) { - $qty = $product->packaging; + $qty = (float) $product->packaging; } else { - if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) { + if (!empty($product->packaging) && (fmod((float) $qty, (float) $product->packaging) > 0.000001)) { $coeff = intval((float) $qty / $product->packaging) + 1; $qty = (float) $product->packaging * $coeff; setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); diff --git a/htdocs/install/mysql/migration/21.0.0-22.0.0.sql b/htdocs/install/mysql/migration/21.0.0-22.0.0.sql index 0837bdb61a8..0aef3f65cc8 100644 --- a/htdocs/install/mysql/migration/21.0.0-22.0.0.sql +++ b/htdocs/install/mysql/migration/21.0.0-22.0.0.sql @@ -42,6 +42,13 @@ ALTER TABLE llx_societe_account ADD UNIQUE INDEX uk_societe_account_login_websit -- V22 migration +-- fix element +UPDATE llx_c_type_contact set element='shipping' WHERE element='expedition'; +-- Shipment / Expedition +insert into llx_c_type_contact (element, source, code, libelle, active ) values ('shipping', 'internal', 'SALESREPFOLL', 'Responsable suivi de l''expédition', 1); +insert into llx_c_type_contact (element, source, code, libelle, active ) values ('shipping', 'external', 'CUSTOMER', 'Customer shipping contact', 1); +insert into llx_c_type_contact (element, source, code, libelle, active ) values ('shipping', 'external', 'SHIPPING', 'Loading facility', 1); +insert into llx_c_type_contact (element, source, code, libelle, active ) values ('shipping', 'external', 'DELIVERY', 'Delivery facility', 1); ALTER TABLE llx_holiday_config DROP INDEX idx_holiday_config; ALTER TABLE llx_holiday_config ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid; @@ -49,4 +56,4 @@ ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (entity, name ALTER TABLE llx_societe_account ADD COLUMN ip varchar(250); -ALTER TABLE llx_product ADD COLUMN packaging float(24,8) DEFAULT NULL; \ No newline at end of file +ALTER TABLE llx_product ADD COLUMN packaging float(24,8) DEFAULT NULL; From e7088d779415b158720aa3081ca01a44f30ec31c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Jan 2025 09:14:37 +0100 Subject: [PATCH 30/77] FIX add other fields --- htdocs/categories/class/categorie.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index b3721d1bee7..305649da4e4 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -314,7 +314,9 @@ class Categorie extends CommonObject * @var array|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields = array( - 'label' => array('type' => 'varchar(255)', 'label' => 'Label', 'enabled' => 1, 'visible' => 1, 'showoncombobox' => 1), + 'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'index' => 1, 'position' => 1, 'comment' => 'Id'), + '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, 'showoncombobox' => 1, 'position' => 15, 'csslist' => 'tdoverflowmax250'), ); /** From 262a07f5fa43a0a6418579d1eb42034583977471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2025 09:25:23 +0100 Subject: [PATCH 31/77] dict type contact --- htdocs/compta/facture/class/facture.class.php | 4 ++-- htdocs/install/mysql/migration/21.0.0-22.0.0.sql | 9 +++++---- htdocs/langs/en_US/propal.lang | 2 +- htdocs/langs/en_US/sendings.lang | 6 ++++++ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 09dddafbbd5..68a019043d5 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4003,9 +4003,9 @@ class Facture extends CommonInvoice $product = new Product($this->db); $result = $product->fetch($fk_product); if ($qty < $product->packaging) { - $qty = $product->packaging; + $qty = (float) $product->packaging; } else { - if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) { + if (!empty($product->packaging) && (fmod((float) $qty, (float) $product->packaging) > 0.000001)) { $coeff = intval((float) $qty / $product->packaging) + 1; $qty = (float) $product->packaging * $coeff; setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); diff --git a/htdocs/install/mysql/migration/21.0.0-22.0.0.sql b/htdocs/install/mysql/migration/21.0.0-22.0.0.sql index 0aef3f65cc8..4cf68ce85ad 100644 --- a/htdocs/install/mysql/migration/21.0.0-22.0.0.sql +++ b/htdocs/install/mysql/migration/21.0.0-22.0.0.sql @@ -45,10 +45,11 @@ ALTER TABLE llx_societe_account ADD UNIQUE INDEX uk_societe_account_login_websit -- fix element UPDATE llx_c_type_contact set element='shipping' WHERE element='expedition'; -- Shipment / Expedition -insert into llx_c_type_contact (element, source, code, libelle, active ) values ('shipping', 'internal', 'SALESREPFOLL', 'Responsable suivi de l''expédition', 1); -insert into llx_c_type_contact (element, source, code, libelle, active ) values ('shipping', 'external', 'CUSTOMER', 'Customer shipping contact', 1); -insert into llx_c_type_contact (element, source, code, libelle, active ) values ('shipping', 'external', 'SHIPPING', 'Loading facility', 1); -insert into llx_c_type_contact (element, source, code, libelle, active ) values ('shipping', 'external', 'DELIVERY', 'Delivery facility', 1); +INSERT INTO llx_c_type_contact (element, source, code, libelle, active ) VALUES ('shipping', 'internal', 'SALESREPFOLL', 'Representative following-up shipping', 1); +INSERT INTO llx_c_type_contact (element, source, code, libelle, active ) VALUES ('shipping', 'external', 'BILLING', 'Customer invoice contact', 1); +INSERT INTO llx_c_type_contact (element, source, code, libelle, active ) VALUES ('shipping', 'external', 'CUSTOMER', 'Customer shipping contact', 1); +INSERT INTO llx_c_type_contact (element, source, code, libelle, active ) VALUES ('shipping', 'external', 'SHIPPING', 'Loading facility', 1); +INSERT INTO llx_c_type_contact (element, source, code, libelle, active ) VALUES ('shipping', 'external', 'DELIVERY', 'Delivery facility', 1); ALTER TABLE llx_holiday_config DROP INDEX idx_holiday_config; ALTER TABLE llx_holiday_config ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid; diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index 1b4f57d49c9..e08c7fbb26d 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -77,7 +77,7 @@ AvailabilityTypeAV_1W=1 week AvailabilityTypeAV_2W=2 weeks AvailabilityTypeAV_3W=3 weeks AvailabilityTypeAV_1M=1 month -##### Types ofe contacts ##### +##### Types of contacts ##### TypeContact_propal_internal_SALESREPFOLL=Representative following-up proposal TypeContact_propal_external_BILLING=Customer invoice contact TypeContact_propal_external_CUSTOMER=Customer contact following-up proposal diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index 95406dcc87e..fe9fdc20532 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -83,3 +83,9 @@ ShipmentDistribution=Shipment distribution ErrorTooManyCombinationBatchcode=No dispatch for line %s as too many combinations of warehouse, product, batch code was found (%s). ErrorNoCombinationBatchcode=Could not save the line %s as the combination of warehouse-product-lot/serial (%s, %s, %s) was not found in stock. ErrorTooMuchShipped=Quantity shipped should not be greater than quantity ordered for line %s +##### Types of contacts ##### +TypeContact_shipping_internal_SALESREPFOLL=Representative following-up shipping +TypeContact_shipping_external_BILLING=Customer invoice contact +TypeContact_shipping_external_CUSTOMER=Customer contact following-up shipping +TypeContact_shipping_external_SHIPPING=Customer contact for shipping +TypeContact_shipping_external_DELIVERY=Customer contact for delivery From 0eb75b7e4fc3004d3cccaf82953becfe10c124dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2025 09:28:36 +0100 Subject: [PATCH 32/77] dict type contact --- htdocs/comm/propal/class/propal.class.php | 4 ++-- htdocs/install/mysql/data/llx_c_type_contact.sql | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index eb81c4c084e..070f9914417 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -713,9 +713,9 @@ class Propal extends CommonObject $product = new Product($this->db); $result = $product->fetch($fk_product); if ($qty < $product->packaging) { - $qty = $product->packaging; + $qty = (float) $product->packaging; } else { - if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) { + if (!empty($product->packaging) && (fmod((float) $qty, (float) $product->packaging) > 0.000001)) { $coeff = intval((float) $qty / $product->packaging) + 1; $qty = (float) $product->packaging * $coeff; setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); diff --git a/htdocs/install/mysql/data/llx_c_type_contact.sql b/htdocs/install/mysql/data/llx_c_type_contact.sql index d7bbbf77cf2..6611bd3b5aa 100644 --- a/htdocs/install/mysql/data/llx_c_type_contact.sql +++ b/htdocs/install/mysql/data/llx_c_type_contact.sql @@ -74,7 +74,8 @@ insert into llx_c_type_contact (element, source, code, libelle, active ) values insert into llx_c_type_contact (element, source, code, libelle, active ) values ('commande', 'external', 'SHIPPING', 'Contact client livraison commande', 1); -- Shipment / Expedition -insert into llx_c_type_contact (element, source, code, libelle, active ) values ('shipping', 'internal', 'SALESREPFOLL', 'Responsable suivi de l''expédition', 1); +insert into llx_c_type_contact (element, source, code, libelle, active ) values ('shipping', 'internal', 'SALESREPFOLL', 'Representative following-up shipping', 1); +INSERT INTO llx_c_type_contact (element, source, code, libelle, active ) VALUES ('shipping', 'external', 'BILLING', 'Customer invoice contact', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('shipping', 'external', 'CUSTOMER', 'Customer shipping contact', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('shipping', 'external', 'SHIPPING', 'Loading facility', 1); insert into llx_c_type_contact (element, source, code, libelle, active ) values ('shipping', 'external', 'DELIVERY', 'Delivery facility', 1); From 7bd2bb6efc7071ee2f4f74d1663865df14c04b4d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Jan 2025 09:35:37 +0100 Subject: [PATCH 33/77] FIX DROP INDEX IF EXISTS is not possible ! --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 4cfb2fed5db..9b1f5921740 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -749,7 +749,7 @@ class ExtraFields $sql = "ALTER TABLE ".$this->db->prefix().$table." ADD UNIQUE INDEX uk_".$table."_".$this->db->sanitize($attrname)." (".$this->db->sanitize($attrname).")"; } else { dol_syslog(get_class($this).'::update_common', LOG_DEBUG); - $sql = "ALTER TABLE ".$this->db->prefix().$table." DROP INDEX IF EXISTS uk_".$table."_".$this->db->sanitize($attrname); + $sql = "ALTER TABLE ".$this->db->prefix().$table." DROP INDEX uk_".$table."_".$this->db->sanitize($attrname); } dol_syslog(get_class($this).'::update', LOG_DEBUG); $resql = $this->db->query($sql, 1, 'dml'); From f3dc94d3345867b732fcb17a712b043f931a0c44 Mon Sep 17 00:00:00 2001 From: Irvine Fleith Date: Wed, 29 Jan 2025 10:14:46 +0100 Subject: [PATCH 34/77] fix(services-list): added missing hook printFieldListSearchParam --- htdocs/contrat/services_list.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 0b3666a295e..70dc312c2be 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -442,6 +442,10 @@ if ($optioncss != '') { } // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +// Add $param from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$param .= $hookmanager->resPrint; // List of mass actions available $arrayofmassactions = array( From 3c7327a457738acfe503bf4afad0675c8332ee68 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 29 Jan 2025 12:35:27 +0100 Subject: [PATCH 35/77] Missing notes --- htdocs/core/modules/modProjet.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index d58edcf7de2..bed2e414cc6 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -231,6 +231,7 @@ class modProjet extends DolibarrModules 'p.rowid'=>"Numeric", 'p.ref'=>"Text", 'p.title'=>"Text", 'p.usage_opportunity'=>'Boolean', 'p.usage_task'=>'Boolean', 'p.usage_bill_time'=>'Boolean', 'p.datec'=>"Date", 'p.dateo'=>"Date", 'p.datee'=>"Date", 'p.fk_statut'=>'Status', 'cls.code'=>"Text", 'p.opp_percent'=>'Numeric', 'p.opp_amount'=>'Numeric', 'p.description'=>"Text", 'p.entity'=>'Numeric', 'p.budget_amount'=>'Numeric', + 'p.note_public'=>'Text', 'p.note_private'=>'Text', 'pt.rowid'=>'Numeric', 'pt.ref'=>'Text', 'pt.label'=>'Text', 'pt.dateo'=>"Date", 'pt.datee'=>"Date", 'pt.duration_effective'=>"Duree", 'pt.planned_workload'=>"Numeric", 'pt.progress'=>"Numeric", 'pt.description'=>"Text", 'ptt.rowid'=>'Numeric', 'ptt.element_date'=>'Date', 'ptt.element_duration'=>"Duree", 'ptt.fk_user'=>"FormSelect:select_dolusers", 'ptt.note'=>"Text" ); @@ -243,7 +244,8 @@ class modProjet extends DolibarrModules 's.phone'=>'Phone', 's.email'=>'Email', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode', 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 'p.rowid'=>"ProjectId", 'p.ref'=>"RefProject", 'p.title'=>'ProjectLabel', 'p.usage_opportunity'=>'ProjectFollowOpportunity', 'p.usage_task'=>'ProjectFollowTasks', 'p.usage_bill_time'=>'BillTime', - 'p.datec'=>"DateCreation", 'p.dateo'=>"DateStart", 'p.datee'=>"DateEnd", 'p.fk_statut'=>'ProjectStatus', 'cls.code'=>'OpportunityStatus', 'p.opp_percent'=>'OpportunityProbability', 'p.opp_amount'=>'OpportunityAmount', 'p.budget_amount'=>'Budget', 'p.description'=>"Description" + 'p.datec'=>"DateCreation", 'p.dateo'=>"DateStart", 'p.datee'=>"DateEnd", 'p.fk_statut'=>'ProjectStatus', 'cls.code'=>'OpportunityStatus', 'p.opp_percent'=>'OpportunityProbability', 'p.opp_amount'=>'OpportunityAmount', 'p.description'=>"Description", 'p.budget_amount'=>'Budget', + 'p.note_public'=>'NotePublic', 'p.note_private'=>'NotePrivate', ); // Add multicompany field if (getDolGlobalString('MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED')) { From 9870069f44f25c6774134aa7dc4ba9099c368bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2025 13:56:46 +0100 Subject: [PATCH 36/77] more fields in liste_contacts --- htdocs/core/class/commonobject.class.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3aa18de36e9..02cee9b9716 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1500,14 +1500,14 @@ abstract class CommonObject $sql = "SELECT ec.rowid, ec.statut as statuslink, ec.fk_socpeople as id, ec.fk_c_type_contact"; // This field contains id of llx_socpeople or id of llx_user if ($source == 'internal') { - $sql .= ", '-1' as socid, t.statut as statuscontact, t.login, t.photo, t.gender"; + $sql .= ", '-1' as socid, t.statut as statuscontact, t.login, t.photo, t.gender, t.fk_country as country_id"; } if ($source == 'external' || $source == 'thirdparty') { - $sql .= ", t.fk_soc as socid, t.statut as statuscontact"; + $sql .= ", t.fk_soc as socid, t.statut as statuscontact, t.fk_pays as country_id"; } - $sql .= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email"; + $sql .= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email, t.address, t.zip, t.town"; if (empty($arrayoftcids)) { - $sql .= ", tc.source, tc.element, tc.code, tc.libelle as type_label"; + $sql .= ", tc.source, tc.element, tc.code, tc.libelle as type_label, co.label as country"; } $sql .= " FROM"; if (empty($arrayoftcids)) { @@ -1516,9 +1516,11 @@ abstract class CommonObject $sql .= " ".$this->db->prefix()."element_contact as ec"; if ($source == 'internal') { // internal contact (user) $sql .= " LEFT JOIN ".$this->db->prefix()."user as t on ec.fk_socpeople = t.rowid"; + $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as co ON co.rowid = t.fk_country"; } if ($source == 'external' || $source == 'thirdparty') { // external contact (socpeople) $sql .= " LEFT JOIN ".$this->db->prefix()."socpeople as t on ec.fk_socpeople = t.rowid"; + $sql .= " LEFT JOIN ".$this->db->prefix()."c_country as co ON co.rowid = t.fk_pays"; } $sql .= " WHERE ec.element_id = ".((int) $this->id); if (empty($arrayoftcids)) { @@ -1566,6 +1568,11 @@ abstract class CommonObject 'lastname' => $obj->lastname, 'firstname' => $obj->firstname, 'email' => $obj->email, + 'address' => $obj->address, + 'zip' => $obj->zip, + 'town' => $obj->town, + 'country_id' => $obj->country_id, + 'country' => $obj->country, 'login' => (empty($obj->login) ? '' : $obj->login), 'photo' => (empty($obj->photo) ? '' : $obj->photo), 'gender' => (empty($obj->gender) ? '' : $obj->gender), From cad040a96d6953b80889d6336392f6cf5ef4f1fe Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 29 Jan 2025 14:08:48 +0100 Subject: [PATCH 37/77] Debug v21 - print of description --- htdocs/projet/card.php | 39 +++++++++++++++-------------- htdocs/projet/contact.php | 37 ++++++++++++++++------------ htdocs/projet/element.php | 37 ++++++++++++++++------------ htdocs/projet/tasks.php | 37 ++++++++++++++++------------ htdocs/projet/tasks/contact.php | 42 +++++++++++++++++++------------- htdocs/projet/tasks/document.php | 42 +++++++++++++++++++------------- htdocs/projet/tasks/note.php | 42 +++++++++++++++++++------------- htdocs/projet/tasks/task.php | 42 +++++++++++++++++++------------- htdocs/projet/tasks/time.php | 37 ++++++++++++++++------------ htdocs/theme/eldy/global.inc.php | 2 +- 10 files changed, 206 insertions(+), 151 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 6fdd27c568c..fea8f4ce90e 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1409,17 +1409,6 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { print ''; } - // Visibility - print ''.$langs->trans("Visibility").''; - if ($object->public) { - print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); - print $langs->trans('SharedProject'); - } else { - print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); - print $langs->trans('PrivateProject'); - } - print ''; - if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') && !empty($object->usage_opportunity)) { // Opportunity status print ''.$langs->trans("OpportunityStatus"); @@ -1463,6 +1452,17 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { } print ''; + // Visibility + print ''.$langs->trans("Visibility").''; + if ($object->public) { + print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); + print $langs->trans('SharedProject'); + } else { + print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); + print $langs->trans('PrivateProject'); + } + print ''; + // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; @@ -1475,13 +1475,6 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { print ''; - // Description - print ''; - // Categories if (isModEnabled('category')) { print '"; } + // Description + print ''; + if ($object->description) { + print ''; + } + print '
'.$langs->trans("Description").''; - print '
'; - print dolPrintHTML($object->description); - print '
'; - print '
'.$langs->trans("Categories").''; @@ -1489,6 +1482,16 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { print "
'.$langs->trans("Description").'
'; + print '
'; + print dolPrintHTML($object->description); + print '
'; + print '
'; print ''; diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 4f2dde28a50..f04c1df9ae6 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -424,17 +424,6 @@ if ($id > 0 || !empty($ref)) { print ''; } - // Visibility - print ''.$langs->trans("Visibility").''; - if ($object->public) { - print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); - print $langs->trans('SharedProject'); - } else { - print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); - print $langs->trans('PrivateProject'); - } - print ''; - if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') && !empty($object->usage_opportunity)) { // Opportunity status print ''.$langs->trans("OpportunityStatus").''; @@ -480,6 +469,17 @@ if ($id > 0 || !empty($ref)) { } print ''; + // Visibility + print ''.$langs->trans("Visibility").''; + if ($object->public) { + print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); + print $langs->trans('SharedProject'); + } else { + print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); + print $langs->trans('PrivateProject'); + } + print ''; + // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; @@ -492,11 +492,6 @@ if ($id > 0 || !empty($ref)) { print ''; - // Description - print ''; - // Categories if (isModEnabled('category')) { print '"; } + // Description + print ''; + if ($object->description) { + print ''; + } + print '
'.$langs->trans("Description").''; - print dol_htmlentitiesbr($object->description); - print '
'.$langs->trans("Categories").''; @@ -504,6 +499,16 @@ if ($id > 0 || !empty($ref)) { print "
'.$langs->trans("Description").'
'; + print '
'; + print dolPrintHTML($object->description); + print '
'; + print '
'; print ''; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index f4ffea34d18..80af93b7cd0 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -311,17 +311,6 @@ if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJ print ''; } -// Visibility -print ''.$langs->trans("Visibility").''; -if ($object->public) { - print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); - print $langs->trans('SharedProject'); -} else { - print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); - print $langs->trans('PrivateProject'); -} -print ''; - if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { // Opportunity status print ''.$langs->trans("OpportunityStatus").''; @@ -368,6 +357,17 @@ if ($object->hasDelay()) { } print ''; +// Visibility +print ''.$langs->trans("Visibility").''; +if ($object->public) { + print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); + print $langs->trans('SharedProject'); +} else { + print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); + print $langs->trans('PrivateProject'); +} +print ''; + // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; @@ -380,11 +380,6 @@ print '
'; print ''; -// Description -print ''; - // Categories if (isModEnabled('category')) { print '"; } +// Description +print ''; +if ($object->description) { + print ''; +} + print '
'.$langs->trans("Description").''; -print dol_htmlentitiesbr($object->description); -print '
'.$langs->trans("Categories").''; @@ -392,6 +387,16 @@ if (isModEnabled('category')) { print "
'.$langs->trans("Description").'
'; + print '
'; + print dolPrintHTML($object->description); + print '
'; + print '
'; print ''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 2dde9cf51ed..4cd188910ec 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -660,17 +660,6 @@ if ($id > 0 || !empty($ref)) { print ''; } - // Visibility - print ''.$langs->trans("Visibility").''; - if ($object->public) { - print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); - print $langs->trans('SharedProject'); - } else { - print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); - print $langs->trans('PrivateProject'); - } - print ''; - // Budget print ''.$langs->trans("Budget").''; if (!is_null($object->budget_amount) && strcmp($object->budget_amount, '')) { @@ -690,6 +679,17 @@ if ($id > 0 || !empty($ref)) { } print ''; + // Visibility + print ''.$langs->trans("Visibility").''; + if ($object->public) { + print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); + print $langs->trans('SharedProject'); + } else { + print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); + print $langs->trans('PrivateProject'); + } + print ''; + // Other attributes $cols = 2; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; @@ -702,11 +702,6 @@ if ($id > 0 || !empty($ref)) { print ''; - // Description - print ''; - // Categories if (isModEnabled('category')) { print '"; } + // Description + print ''; + if ($object->description) { + print ''; + } + print '
'.$langs->trans("Description").''; - print dol_htmlentitiesbr($object->description); - print '
'.$langs->trans("Categories").''; @@ -714,6 +709,16 @@ if ($id > 0 || !empty($ref)) { print "
'.$langs->trans("Description").'
'; + print '
'; + print dolPrintHTML($object->description); + print '
'; + print '
'; print ''; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index f829533062a..ef379748e77 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -255,17 +255,6 @@ if ($id > 0 || !empty($ref)) { print ''; } - // Visibility - print ''.$langs->trans("Visibility").''; - if ($projectstatic->public) { - print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); - print $langs->trans('SharedProject'); - } else { - print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); - print $langs->trans('PrivateProject'); - } - print ''; - // Budget print ''.$langs->trans("Budget").''; if (isset($projectstatic->budget_amount) && strcmp($projectstatic->budget_amount, '')) { @@ -285,9 +274,23 @@ if ($id > 0 || !empty($ref)) { } print ''; + // Visibility + print ''.$langs->trans("Visibility").''; + if ($projectstatic->public) { + print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); + print $langs->trans('SharedProject'); + } else { + print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); + print $langs->trans('PrivateProject'); + } + print ''; + // Other attributes $cols = 2; - //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + $savobject = $object; + $object = $projectstatic; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + $object = $savobject; print ''; @@ -297,11 +300,6 @@ if ($id > 0 || !empty($ref)) { print ''; - // Description - print ''; - // Categories if (isModEnabled('category')) { print '"; } + // Description + print ''; + if ($projectstatic->description) { + print ''; + } + print '
'.$langs->trans("Description").''; - print nl2br($projectstatic->description); - print '
'.$langs->trans("Categories").''; @@ -309,6 +307,16 @@ if ($id > 0 || !empty($ref)) { print "
'.$langs->trans("Description").'
'; + print '
'; + print dolPrintHTML($projectstatic->description); + print '
'; + print '
'; print ''; diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 8f091a04a5e..a85d451efa8 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -212,17 +212,6 @@ if ($object->id > 0) { print ''; } - // Visibility - print ''.$langs->trans("Visibility").''; - if ($projectstatic->public) { - print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); - print $langs->trans('SharedProject'); - } else { - print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); - print $langs->trans('PrivateProject'); - } - print ''; - // Budget print ''.$langs->trans("Budget").''; if (isset($projectstatic->budget_amount) && strcmp($projectstatic->budget_amount, '')) { @@ -242,9 +231,23 @@ if ($object->id > 0) { } print ''; + // Visibility + print ''.$langs->trans("Visibility").''; + if ($projectstatic->public) { + print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); + print $langs->trans('SharedProject'); + } else { + print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); + print $langs->trans('PrivateProject'); + } + print ''; + // Other attributes $cols = 2; - //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + $savobject = $object; + $object = $projectstatic; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + $object = $savobject; print ''; @@ -254,11 +257,6 @@ if ($object->id > 0) { print ''; - // Description - print ''; - // Categories if (isModEnabled('category')) { print '"; } + // Description + print ''; + if ($projectstatic->description) { + print ''; + } + print '
'.$langs->trans("Description").''; - print nl2br($projectstatic->description); - print '
'.$langs->trans("Categories").''; @@ -266,6 +264,16 @@ if ($object->id > 0) { print "
'.$langs->trans("Description").'
'; + print '
'; + print dolPrintHTML($projectstatic->description); + print '
'; + print '
'; print ''; diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 673c820368b..c938650cef5 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -202,17 +202,6 @@ if ($object->id > 0) { print ''; } - // Visibility - print ''.$langs->trans("Visibility").''; - if ($projectstatic->public) { - print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); - print $langs->trans('SharedProject'); - } else { - print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); - print $langs->trans('PrivateProject'); - } - print ''; - // Budget print ''.$langs->trans("Budget").''; if (isset($projectstatic->budget_amount) && strcmp($projectstatic->budget_amount, '')) { @@ -232,9 +221,23 @@ if ($object->id > 0) { } print ''; + // Visibility + print ''.$langs->trans("Visibility").''; + if ($projectstatic->public) { + print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); + print $langs->trans('SharedProject'); + } else { + print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); + print $langs->trans('PrivateProject'); + } + print ''; + // Other attributes $cols = 2; - //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + $savobject = $object; + $object = $projectstatic; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + $object = $savobject; print ''; @@ -244,11 +247,6 @@ if ($object->id > 0) { print ''; - // Description - print ''; - // Categories if (isModEnabled('category')) { print '"; } + // Description + print ''; + if ($projectstatic->description) { + print ''; + } + print '
'.$langs->trans("Description").''; - print nl2br($projectstatic->description); - print '
'.$langs->trans("Categories").''; @@ -256,6 +254,16 @@ if ($object->id > 0) { print "
'.$langs->trans("Description").'
'; + print '
'; + print dolPrintHTML($projectstatic->description); + print '
'; + print '
'; print ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 494e3f20774..8eaa2bb9062 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -361,17 +361,6 @@ if ($id > 0 || !empty($ref)) { print ''; } - // Visibility - print ''.$langs->trans("Visibility").''; - if ($projectstatic->public) { - print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); - print $langs->trans('SharedProject'); - } else { - print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); - print $langs->trans('PrivateProject'); - } - print ''; - // Budget print ''.$langs->trans("Budget").''; if (isset($projectstatic->budget_amount) && strcmp($projectstatic->budget_amount, '')) { @@ -391,9 +380,23 @@ if ($id > 0 || !empty($ref)) { } print ''; + // Visibility + print ''.$langs->trans("Visibility").''; + if ($projectstatic->public) { + print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); + print $langs->trans('SharedProject'); + } else { + print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); + print $langs->trans('PrivateProject'); + } + print ''; + // Other attributes $cols = 2; - //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + $savobject = $object; + $object = $projectstatic; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + $object = $savobject; print ''; @@ -404,11 +407,6 @@ if ($id > 0 || !empty($ref)) { print ''; - // Description - print ''; - // Categories if (isModEnabled('category')) { print '"; } + // Description + print ''; + if ($projectstatic->description) { + print ''; + } + print '
'.$langs->trans("Description").''; - print nl2br($projectstatic->description); - print '
'.$langs->trans("Categories").''; @@ -416,6 +414,16 @@ if ($id > 0 || !empty($ref)) { print "
'.$langs->trans("Description").'
'; + print '
'; + print dolPrintHTML($projectstatic->description); + print '
'; + print '
'; print ''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index e72ccc48706..568cf922cd5 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1002,17 +1002,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print ''; } - // Visibility - print '' . $langs->trans("Visibility") . ''; - if ($projectstatic->public) { - print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); - print $langs->trans('SharedProject'); - } else { - print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); - print $langs->trans('PrivateProject'); - } - print ''; - // Budget print '' . $langs->trans("Budget") . ''; if (!is_null($projectstatic->budget_amount) && strcmp($projectstatic->budget_amount, '')) { @@ -1032,6 +1021,17 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } print ''; + // Visibility + print '' . $langs->trans("Visibility") . ''; + if ($projectstatic->public) { + print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); + print $langs->trans('SharedProject'); + } else { + print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); + print $langs->trans('PrivateProject'); + } + print ''; + // Other attributes $cols = 2; $savobject = $object; @@ -1047,11 +1047,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print ''; - // Description - print ''; - // Categories if (isModEnabled('category')) { print '"; } + // Description + print ''; + if ($projectstatic->description) { + print ''; + } + print '
'.$langs->trans("Description").''; - print dol_htmlentitiesbr($projectstatic->description); - print '
' . $langs->trans("Categories") . ''; @@ -1059,6 +1054,16 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print "
'.$langs->trans("Description").'
'; + print '
'; + print dolPrintHTML($projectstatic->description); + print '
'; + print '
'; print ''; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index d94ade62111..46f5c1ddf45 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2313,7 +2313,7 @@ datalist { .linkobject { cursor: pointer; } -table.tableforfield tr:not(.liste_titre)>td:first-of-type, tr.trforfield:not(.liste_titre)>td:first-of-type, div.tableforfield div.tagtr:not(.liste_titre)>div.tagtd:first-of-type { +table.tableforfield tr:not(.liste_titre)>td:first-of-type:not(.nottitleforfield), tr.trforfield:not(.liste_titre)>td:first-of-type, div.tableforfield div.tagtr:not(.liste_titre)>div.tagtd:first-of-type { color: var(--tableforfieldcolor); } From 710b5d3405c75ac6922821efc34d49380d7d2fa8 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 29 Jan 2025 14:15:08 +0100 Subject: [PATCH 38/77] Debug v21 --- .../conferenceorbooth_list.php | 37 +++++++++++-------- .../conferenceorboothattendee_list.php | 37 +++++++++++-------- htdocs/projet/element.php | 2 +- 3 files changed, 43 insertions(+), 33 deletions(-) diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 46bb260a6be..020aecc753f 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -385,17 +385,6 @@ if ($projectid > 0) { print ''; } - // Visibility - print ''.$langs->trans("Visibility").''; - if ($project->public == 0) { - print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); - print $langs->trans("PrivateProject"); - } else { - print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); - print $langs->trans("SharedProject"); - } - print ''; - // Budget print ''.$langs->trans("Budget").''; if (strcmp($project->budget_amount, '')) { @@ -432,6 +421,17 @@ if ($projectid > 0) { print $project->location; print ''; + // Visibility + print ''.$langs->trans("Visibility").''; + if ($project->public == 0) { + print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); + print $langs->trans("PrivateProject"); + } else { + print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); + print $langs->trans("SharedProject"); + } + print ''; + // Other attributes $cols = 2; $objectconf = $object; @@ -447,11 +447,6 @@ if ($projectid > 0) { print ''; - // Description - print ''; - // Categories if (isModEnabled('category')) { print '"; } + // Description + print ''; + if ($project->description) { + print ''; + } + print ''; } - // Visibility - print ''; - // Budget print ''; + // Visibility + print ''; + // Location event print '
'.$langs->trans("Description").''; - print dol_htmlentitiesbr($project->description); - print '
'.$langs->trans("Categories").''; @@ -459,6 +454,16 @@ if ($projectid > 0) { print "
'.$langs->trans("Description").'
'; + print '
'; + print dolPrintHTML($project->description); + print '
'; + print '
'; $typeofdata = 'checkbox:'.($project->accept_conference_suggestions ? ' checked="checked"' : ''); $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index c5934e13ecd..98ea7f6adf9 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -484,17 +484,6 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { print '
'.$langs->trans("Visibility").''; - if ($projectstatic->public == 0) { - print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); - print $langs->trans("PrivateProject"); - } else { - print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); - print $langs->trans("SharedProject"); - } - print '
'.$langs->trans("Budget").''; if (strcmp($projectstatic->budget_amount, '')) { @@ -526,6 +515,17 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { } print '
'.$langs->trans("Visibility").''; + if ($projectstatic->public == 0) { + print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); + print $langs->trans("PrivateProject"); + } else { + print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); + print $langs->trans("SharedProject"); + } + print '
'.$langs->trans("Location").''; print $projectstatic->location; @@ -547,11 +547,6 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { print ''; - // Description - print ''; - // Categories if (isModEnabled('category')) { print '"; } + // Description + print ''; + if ($projectstatic->description) { + print ''; + } + print ''; } -if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { +if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') && !empty($object->usage_opportunity)) { // Opportunity status print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn '); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.rowid']['checked'])) { + print ''; + } + if (!empty($arrayfields['t.libelle']['checked'])) { + print ''; + } + if (!empty($arrayfields['t.morphy']['checked'])) { + print ''; } - print ''; - print ''; - print ''; print ''; print ''; print ''; @@ -353,7 +369,8 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; print ''; if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); + $totalarray['nbfield']++; } print "\n"; @@ -397,13 +414,15 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; } } - - print ''; - - print ''; + if (!empty($arrayfields['t.rowid']['checked'])) { + print ''; + } + if (!empty($arrayfields['t.libelle']['checked'])) { + print ''; + } print ''; + $totalarray['nbfield']++; } if (!empty($arrayfields['t.libelle']['checked'])) { print ''; + $totalarray['nbfield']++; } if (!empty($arrayfields['t.morphy']['checked'])) { print ''; + $totalarray['nbfield']++; } print ''; print ''; @@ -423,16 +426,17 @@ if (!$rowid && $action != 'create' && $action != 'edit') { if (!empty($arrayfields['t.libelle']['checked'])) { print ''; } - - print ''; } - print ''; print ''; $totalarray['nbfield']++; } - print ''; + if (!empty($arrayfields['t.duration']['checked'])) { + print ''; + $totalarray['nbfield']++; + } print ''; print ''; print ''; @@ -437,19 +440,20 @@ if (!$rowid && $action != 'create' && $action != 'edit') { } print ''; } - - print ''; } - print ''; print ''; From 0cbedd4ff0a4e8c24b85c7a43eae70ebb37de050 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 29 Jan 2025 19:15:57 +0100 Subject: [PATCH 48/77] Fix warnings --- htdocs/comm/propal/class/propal.class.php | 18 ++++++++-------- .../comm/propal/class/propaleligne.class.php | 8 ++----- htdocs/commande/class/commande.class.php | 21 ++++++++----------- htdocs/commande/class/orderline.class.php | 9 ++------ htdocs/compta/facture/class/facture.class.php | 14 ++++++------- .../facture/class/factureligne.class.php | 10 +++------ htdocs/product/class/product.class.php | 15 ++++++------- htdocs/product/price.php | 6 +++--- 8 files changed, 41 insertions(+), 60 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index eb81c4c084e..2fb35bdcf2f 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -634,7 +634,7 @@ class Propal extends CommonObject */ public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = array(), $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0, $noupdateafterinsertline = 0) { - global $mysoc, $conf, $langs; + global $mysoc, $langs; dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type, fk_remise_except=".$fk_remise_except); @@ -659,7 +659,7 @@ class Propal extends CommonObject } $remise_percent = price2num($remise_percent); - $qty = (float) price2num($qty); + $qty = (float) price2num($qty, 'MS'); $pu_ht = price2num($pu_ht); $pu_ht_devise = price2num($pu_ht_devise); $pu_ttc = price2num($pu_ttc); @@ -710,14 +710,14 @@ class Propal extends CommonObject $localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { - $product = new Product($this->db); - $result = $product->fetch($fk_product); - if ($qty < $product->packaging) { - $qty = $product->packaging; + $tmpproduct = new Product($this->db); + $result = $tmpproduct->fetch($fk_product); + if (abs($qty) < $tmpproduct->packaging) { + $qty = (float) $tmpproduct->packaging; } else { - if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) { - $coeff = intval((float) $qty / $product->packaging) + 1; - $qty = (float) $product->packaging * $coeff; + if (!empty($tmpproduct->packaging) && $qty > $tmpproduct->packaging) { + $coeff = intval(abs($qty) / $tmpproduct->packaging) + 1; + $qty = price2num((float) $tmpproduct->packaging * $coeff, 'MS'); setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); } } diff --git a/htdocs/comm/propal/class/propaleligne.class.php b/htdocs/comm/propal/class/propaleligne.class.php index 67c941e9851..b976193a0e1 100644 --- a/htdocs/comm/propal/class/propaleligne.class.php +++ b/htdocs/comm/propal/class/propaleligne.class.php @@ -373,10 +373,8 @@ class PropaleLigne extends CommonObjectLine $sql .= ' pd.localtax1_tx, pd.localtax2_tx, pd.total_localtax1, pd.total_localtax2,'; $sql .= ' pd.fk_multicurrency, pd.multicurrency_code, pd.multicurrency_subprice, pd.multicurrency_total_ht, pd.multicurrency_total_tva, pd.multicurrency_total_ttc,'; $sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc,'; + $sql .= ' p.packaging,'; $sql .= ' pd.date_start, pd.date_end, pd.product_type'; - if (getDolGlobalInt('PRODUCT_USE_CUSTOMER_PACKAGING')) { - $sql .= ', p.packaging'; - } $sql .= ' FROM '.MAIN_DB_PREFIX.'propaldet as pd'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pd.fk_product = p.rowid'; $sql .= ' WHERE pd.rowid = '.((int) $rowid); @@ -425,9 +423,7 @@ class PropaleLigne extends CommonObjectLine $this->product_desc = $objp->product_desc; $this->fk_unit = $objp->fk_unit; - if (getDolGlobalInt('PRODUCT_USE_CUSTOMER_PACKAGING')) { - $this->packaging = $objp->packaging; - } + $this->packaging = $objp->packaging; $this->date_start = $this->db->jdate($objp->date_start); $this->date_end = $this->db->jdate($objp->date_end); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 71e03085f69..b052263ee7e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1635,14 +1635,14 @@ class Commande extends CommonOrder $localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { - $product = new Product($this->db); - $result = $product->fetch($fk_product); - if ($qty < $product->packaging) { - $qty = $product->packaging; + $tmpproduct = new Product($this->db); + $result = $tmpproduct->fetch($fk_product); + if (abs($qty) < $tmpproduct->packaging) { + $qty = (float) $tmpproduct->packaging; } else { - if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) { - $coeff = intval((float) $qty / $product->packaging) + 1; - $qty = (float) $product->packaging * $coeff; + if (!empty($tmpproduct->packaging) && $qty > $tmpproduct->packaging) { + $coeff = intval(abs($qty) / $tmpproduct->packaging) + 1; + $qty = price2num((float) $tmpproduct->packaging * $coeff, 'MS'); setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); } } @@ -2130,7 +2130,7 @@ class Commande extends CommonOrder $sql .= ' l.fk_unit,'; $sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,'; $sql .= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch, p.barcode as product_barcode,'; - $sql .= ' p.weight, p.weight_units, p.volume, p.volume_units'; + $sql .= ' p.weight, p.weight_units, p.volume, p.volume_units, p.packaging'; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as l'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)'; $sql .= ' WHERE l.fk_commande = '.((int) $this->id); @@ -2205,10 +2205,7 @@ class Commande extends CommonOrder $line->weight_units = $objp->weight_units; $line->volume = $objp->volume; $line->volume_units = $objp->volume_units; - - if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { - $line->packaging = $objp->packaging; - } + $line->packaging = $objp->packaging; $line->date_start = $this->db->jdate($objp->date_start); $line->date_end = $this->db->jdate($objp->date_end); diff --git a/htdocs/commande/class/orderline.class.php b/htdocs/commande/class/orderline.class.php index 10519dd0cf2..ec78db8e44d 100644 --- a/htdocs/commande/class/orderline.class.php +++ b/htdocs/commande/class/orderline.class.php @@ -174,10 +174,8 @@ class OrderLine extends CommonOrderLine $sql .= ' cd.fk_unit,'; $sql .= ' cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc,'; $sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc, p.tobatch as product_tobatch,'; + $sql .= ' p.packaging,'; $sql .= ' cd.date_start, cd.date_end, cd.vat_src_code'; - if (getDolGlobalInt('PRODUCT_USE_CUSTOMER_PACKAGING')) { - $sql .= ', p.packaging'; - } $sql .= ' FROM '.MAIN_DB_PREFIX.'commandedet as cd'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid'; $sql .= ' WHERE cd.rowid = '.((int) $rowid); @@ -231,10 +229,7 @@ class OrderLine extends CommonOrderLine $this->product_desc = $objp->product_desc; $this->product_tobatch = $objp->product_tobatch; $this->fk_unit = $objp->fk_unit; - - if (getDolGlobalInt('PRODUCT_USE_CUSTOMER_PACKAGING')) { - $this->packaging = $objp->packaging; - } + $this->packaging = $objp->packaging; $this->date_start = $this->db->jdate($objp->date_start); $this->date_end = $this->db->jdate($objp->date_end); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 09dddafbbd5..8307f205204 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4000,14 +4000,14 @@ class Facture extends CommonInvoice $localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { - $product = new Product($this->db); - $result = $product->fetch($fk_product); - if ($qty < $product->packaging) { - $qty = $product->packaging; + $tmpproduct = new Product($this->db); + $result = $tmpproduct->fetch($fk_product); + if (abs($qty) < $tmpproduct->packaging) { + $qty = (float) $tmpproduct->packaging; } else { - if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) { - $coeff = intval((float) $qty / $product->packaging) + 1; - $qty = (float) $product->packaging * $coeff; + if (!empty($tmpproduct->packaging) && $qty > $tmpproduct->packaging) { + $coeff = intval(abs($qty) / $tmpproduct->packaging) + 1; + $qty = price2num((float) $tmpproduct->packaging * $coeff, 'MS'); setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); } } diff --git a/htdocs/compta/facture/class/factureligne.class.php b/htdocs/compta/facture/class/factureligne.class.php index c397b5ddf00..c0b69cb14d3 100644 --- a/htdocs/compta/facture/class/factureligne.class.php +++ b/htdocs/compta/facture/class/factureligne.class.php @@ -215,10 +215,8 @@ class FactureLigne extends CommonInvoiceLine $sql .= ' fd.multicurrency_total_ht,'; $sql .= ' fd.multicurrency_total_tva,'; $sql .= ' fd.multicurrency_total_ttc,'; - $sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc'; - if (getDolGlobalInt('PRODUCT_USE_CUSTOMER_PACKAGING')) { - $sql .= ', p.packaging'; - } + $sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc,'; + $sql .= ' p.packaging'; $sql .= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid'; $sql .= ' WHERE fd.rowid = '.((int) $rowid); @@ -285,9 +283,7 @@ class FactureLigne extends CommonInvoiceLine $this->multicurrency_total_tva = $objp->multicurrency_total_tva; $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; - if (getDolGlobalInt('PRODUCT_USE_CUSTOMER_PACKAGING')) { - $this->packaging = $objp->packaging; - } + $this->packaging = $objp->packaging; $this->fetch_optionals(); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 05d88261d19..46121f12a94 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1596,8 +1596,8 @@ class Product extends CommonObject $sql .= ", fk_price_expression = ".($this->fk_price_expression != 0 ? (int) $this->fk_price_expression : 'NULL'); $sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL'); $sql .= ", mandatory_period = ".($this->mandatory_period); - if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING') && !empty($this->packaging)) { - $sql .= ", packaging = " . (float) $this->packaging; + if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { + $sql .= ", packaging = ".(float) $this->packaging; } // stock field is not here because it is a denormalized value from product_stock. $sql .= " WHERE rowid = ".((int) $id); @@ -2893,15 +2893,12 @@ class Product extends CommonObject $sql .= " p.price_min, p.price_min_ttc, p.price_base_type, p.cost_price, p.default_vat_code, p.tva_tx, p.recuperableonly as tva_npr, p.localtax1_tx, p.localtax2_tx, p.localtax1_type, p.localtax2_type, p.tosell,"; $sql .= " p.tobuy, p.fk_product_type, p.duration, p.fk_default_warehouse, p.fk_default_workstation, p.seuil_stock_alerte, p.canvas, p.net_measure, p.net_measure_units, p.weight, p.weight_units,"; $sql .= " p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.last_main_doc,"; - $sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished, p.fk_default_bom, p.mandatory_period,"; + $sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished, p.fk_default_bom, p.mandatory_period, p.packaging,"; if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { $sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,"; } else { $sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export, ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,"; } - if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) { - $sql .= " p.packaging,"; - } // For MultiCompany // PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity @@ -2959,7 +2956,7 @@ class Product extends CommonObject $sql .= " p.price_min, p.price_min_ttc, p.price_base_type, p.cost_price, p.default_vat_code, p.tva_tx, p.recuperableonly, p.localtax1_tx, p.localtax2_tx, p.localtax1_type, p.localtax2_type, p.tosell,"; $sql .= " p.tobuy, p.fk_product_type, p.duration, p.fk_default_warehouse, p.fk_default_workstation, p.seuil_stock_alerte, p.canvas, p.net_measure, p.net_measure_units, p.weight, p.weight_units,"; $sql .= " p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,"; - $sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished, p.fk_default_bom, p.mandatory_period,"; + $sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished, p.fk_default_bom, p.mandatory_period, p.packaging,"; if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { $sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,"; } else { @@ -2971,8 +2968,8 @@ class Product extends CommonObject $sql .= " p.pmp,"; } $sql .= " p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.sell_or_eat_by_mandatory, p.batch_mask, p.fk_unit,"; - $sql .= " p.fk_price_expression, p.price_autogen, p.model_pdf"; - $sql .= " ,p.price_label"; + $sql .= " p.fk_price_expression, p.price_autogen, p.model_pdf,"; + $sql .= " p.price_label"; if (!$separatedStock) { $sql .= ", p.stock"; } diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 2a3dc750d9b..7e455771536 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -279,12 +279,12 @@ if (empty($reshook)) { $error = 0; $pricestoupdate = array(); - $psq = GETPOST('psqflag'); - $psq = empty($newpsq) ? 0 : $newpsq; + $psq = GETPOSTINT('psqflag'); + $maxpricesupplier = $object->min_recommended_price(); // Packaging - $packaging = getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING') ? GETPOST('packaging') : null; + $packaging = getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING') ? price2num(GETPOST('packaging', 'alpha'), 'MS') : null; if (isModEnabled('dynamicprices')) { $object->fk_price_expression = empty($eid) ? 0 : $eid; //0 discards expression From d1adfb32a453e3f0b8d272d5657820a1812993db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2025 19:21:44 +0100 Subject: [PATCH 49/77] enhance member types list --- htdocs/adherents/type.php | 51 +++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 5e0a853eaa8..221c76c7bfa 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -369,11 +369,26 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; $totalarray['nbfield']++; } - print ''; - print ''; - print ''; - print ''; - print ''; + if (!empty($arrayfields['t.subscription']['checked'])) { + print ''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.amount']['checked'])) { + print ''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.caneditamount']['checked'])) { + print ''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.vote']['checked'])) { + print ''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.statut']['checked'])) { + print ''; + $totalarray['nbfield']++; + } if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); $totalarray['nbfield']++; @@ -454,17 +469,21 @@ if (!$rowid && $action != 'create' && $action != 'edit') { } print ''; } - - print ''; - - print ''; - - print ''; - - print ''; - - print ''; - + if (!empty($arrayfields['t.subscription']['checked'])) { + print ''; + } + if (!empty($arrayfields['t.amount']['checked'])) { + print ''; + } + if (!empty($arrayfields['t.caneditamount']['checked'])) { + print ''; + } + if (!empty($arrayfields['t.vote']['checked'])) { + print ''; + } + if (!empty($arrayfields['t.statut']['checked'])) { + print ''; + } if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if ($user->hasRight('adherent', 'configurer')) { print ''; From 1c94227320c639e1a6318b2ec89a2ff3636a0e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2025 19:24:40 +0100 Subject: [PATCH 50/77] fix phan --- htdocs/comm/propal/class/propal.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 070f9914417..eb81c4c084e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -713,9 +713,9 @@ class Propal extends CommonObject $product = new Product($this->db); $result = $product->fetch($fk_product); if ($qty < $product->packaging) { - $qty = (float) $product->packaging; + $qty = $product->packaging; } else { - if (!empty($product->packaging) && (fmod((float) $qty, (float) $product->packaging) > 0.000001)) { + if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) { $coeff = intval((float) $qty / $product->packaging) + 1; $qty = (float) $product->packaging * $coeff; setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); From 7a6b650e828c39b0fae8200d87983548c562c757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2025 19:25:32 +0100 Subject: [PATCH 51/77] fix phan --- htdocs/commande/class/commande.class.php | 4 ++-- htdocs/compta/facture/class/facture.class.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index ccce40846ce..71e03085f69 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1638,9 +1638,9 @@ class Commande extends CommonOrder $product = new Product($this->db); $result = $product->fetch($fk_product); if ($qty < $product->packaging) { - $qty = (float) $product->packaging; + $qty = $product->packaging; } else { - if (!empty($product->packaging) && (fmod((float) $qty, (float) $product->packaging) > 0.000001)) { + if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) { $coeff = intval((float) $qty / $product->packaging) + 1; $qty = (float) $product->packaging * $coeff; setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 68a019043d5..09dddafbbd5 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -4003,9 +4003,9 @@ class Facture extends CommonInvoice $product = new Product($this->db); $result = $product->fetch($fk_product); if ($qty < $product->packaging) { - $qty = (float) $product->packaging; + $qty = $product->packaging; } else { - if (!empty($product->packaging) && (fmod((float) $qty, (float) $product->packaging) > 0.000001)) { + if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) { $coeff = intval((float) $qty / $product->packaging) + 1; $qty = (float) $product->packaging * $coeff; setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs'); From 82eb875fabed66fe5554ac528f9e360a196abbbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2025 19:34:35 +0100 Subject: [PATCH 52/77] enhance member types list --- htdocs/adherents/type.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 221c76c7bfa..7db9917b1d2 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -286,6 +286,9 @@ $help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_M llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-member page-type'); $arrayofselected = is_array($toselect) ? $toselect : array(); +$totalarray = [ + 'nbfield' => 0, +]; // List of members type if (!$rowid && $action != 'create' && $action != 'edit') { From 4fc66c6ee16062b44747ce3442e8be307af53570 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Jan 2025 19:44:50 +0100 Subject: [PATCH 53/77] FIX missing quick edit for extrafields --- htdocs/core/tpl/extrafields_view.tpl.php | 3 +++ htdocs/projet/card.php | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 10481b4ad10..26c11f099a6 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -159,6 +159,9 @@ if (empty($reshook) && !empty($object->table_element) && isset($extrafields->att if ($object->element == 'product') { $keyforperm = 'produit'; } + if ($object->element == 'project') { + $keyforperm = 'projet'; + } if (isset($user->rights->$keyforperm)) { $permok = $user->hasRight($keyforperm, 'creer') || $user->hasRight($keyforperm, 'create') || $user->hasRight($keyforperm, 'write'); } diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 1b17aff16af..fd6fa35d136 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -553,6 +553,30 @@ if (empty($reshook)) { } } + // Quick edit for extrafields + if ($action == 'update_extras' && $permissiontoadd) { + $object->oldcopy = dol_clone($object, 2); + + // Fill array 'array_options' with data from update form + $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml')); + if ($ret < 0) { + $error++; + } + + if (!$error) { + // Actions on extra fields + $result = $object->insertExtraFields('PROJECT_MODIFY'); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + } + + if ($error) { + $action = 'edit_extras'; + } + } + // Actions to send emails $triggersendname = 'PROJECT_SENTBYMAIL'; $paramname = 'id'; From 65ebb94181d55c268040d50a0292617ee783e21d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 30 Jan 2025 01:12:50 +0100 Subject: [PATCH 54/77] FIX wrong var name --- 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 b00bb69b3fb..bc59136f69e 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1578,7 +1578,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Vat is used print ''; print ''; if ($conf->browser->layout == 'phone') { print ''; From c07be3dfc39d892e094e07c7967a0212a8b25a9e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 30 Jan 2025 09:30:10 +0100 Subject: [PATCH 55/77] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 136f946a257..607ab21f166 100644 --- a/README.md +++ b/README.md @@ -34,12 +34,12 @@ There is a lot of different solutions to install Dolibarr. ### Using packages -If you have low technical skills and you're looking to install Dolibarr ERP/CRM with just a few clicks, you can use one of the packaged versions: +If you have low technical skills and you're looking to install Dolibarr ERP/CRM with just few clicks, you can use one of the packaged versions (see next chapter if you have IT knowledge) : - [DoliWamp for Windows](https://wiki.dolibarr.org/index.php/Dolibarr_for_Windows_(DoliWamp)) -- [DoliDeb for Debian](https://wiki.dolibarr.org/index.php/Dolibarr_for_Ubuntu_or_Debian) +- [DoliDeb for Debian, Ubuntu](https://wiki.dolibarr.org/index.php/Dolibarr_for_Ubuntu_or_Debian) - DoliRpm for Red Hat, Fedora, OpenSuse, Mandriva or Mageia -- The Docker image (see next chapter) +- The Docker image (see chapter "Using Docker") Releases can be downloaded from [official website](https://www.dolibarr.org/). From 7848d77830373d1881d5f5851f375eb0e6910c49 Mon Sep 17 00:00:00 2001 From: Irvine Fleith Date: Thu, 30 Jan 2025 09:58:29 +0100 Subject: [PATCH 56/77] fix(contrat,facture-rec): undefined properties --- htdocs/compta/facture/class/facture-rec.class.php | 7 +++++++ htdocs/contrat/class/contrat.class.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 228badc04dc..a45feec9cdc 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -125,6 +125,13 @@ class FactureRec extends CommonInvoice public $cond_reglement_code; // Code in llx_c_paiement public $mode_reglement_code; // Code in llx_c_paiement + public $fk_multicurrency; + public $multicurrency_code; + public $multicurrency_tx; + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; + public $suspended; // status public $auto_validate; // 0 to create in draft, 1 to create and validate the new invoice diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index a29df83b834..d78c636b0f1 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -3097,7 +3097,7 @@ class ContratLigne extends CommonObjectLine $sql .= " t.label,"; // This field is not used. Only label of product $sql .= " p.ref as product_ref,"; $sql .= " p.label as product_label,"; - $sql .= " p.description as product_desc,"; + $sql .= " p.description as product_description,"; $sql .= " p.fk_product_type as product_type,"; $sql .= " t.description,"; $sql .= " t.date_commande,"; From 1298229345a4a9e05c2d3160e8772eaf089ffa9c Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 30 Jan 2025 12:10:21 +0100 Subject: [PATCH 57/77] Doc --- dev/build/makepack-howto.txt | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/dev/build/makepack-howto.txt b/dev/build/makepack-howto.txt index 61a6006f0ae..b23b21e1bd7 100644 --- a/dev/build/makepack-howto.txt +++ b/dev/build/makepack-howto.txt @@ -1,14 +1,14 @@ ----- Dolibarr Makepack How To ----- -This documentation describe steps to build a BETA or RELEASE versions -of Dolibarr. There is a chapter for BETA version and a chapter for RELEASE version. +This documentation describe steps to build a BETA or RELEASE versions of Dolibarr. +There is a chapter for BETA version and a chapter for RELEASE version. -***** Prerequisites For Linux ***** +***** Prerequisites on Linux ***** -Prerequisites to build tgz, debian and rpm packages: +Prerequisites to build the tgz, debian and rpm packages: > apt-get install perl tar dpkg dpatch p7zip-full rpm zip php-cli -Prerequisites to build autoexe DoliWamp package from Linux (solution seems broken since Ubuntu 20.04): +Prerequisites to build autoexe DoliWamp package from Linux (solution seems broken since Ubuntu 20.04+): > apt-get install wine q4wine > Launch "wine cmd" to check a drive Z: pointing to / exists. > Install InnoSetup @@ -23,7 +23,7 @@ Prerequisites to build autoexe DoliWamp package from Linux (solution seems broke The .exe file will be build into directory build. -***** Prerequisites For Windows ***** +***** Prerequisites on Windows ***** Prerequisites to build autoexe DoliWamp package from Windows: @@ -49,9 +49,9 @@ This files describe steps made by Dolibarr packaging team to make a beta version - Check all files are committed. - Update version/info in ChangeLog, for this you can: -To generate a changelog of a major new version x.y.0 (from a repo on branch develop), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" -To generate a changelog of a major new version x.y.0 (from a repo on branch x.y repo), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" -To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" +To generate a changelog of a major new version x.y.0 (from a repo on branch develop), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/changelogtocopy" +To generate a changelog of a major new version x.y.0 (from a repo on branch x.y repo), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/changelogtocopy" +To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/changelogtocopy" Recopy the content of the output file into the file ChangeLog. - Note: To know number of lines changes: git diff --shortstat A B - Update version number with x.y.z-w in file htdocs/filefunc.inc.php @@ -67,15 +67,15 @@ Recopy the content of the output file into the file ChangeLog. ***** Actions to do a RELEASE ***** This files describe steps made by Dolibarr packaging team to make a complete release of Dolibarr, step by step. -We suppose the branch x.y has already been created during the beta (see previous step). +We suppose the branch x.y has already been created during the beta (see previous step) and we want to release a version x.y.z (with z >= 0) - Check all files are committed. -- Update version/info in ChangeLog, for this you can: -To generate a changelog of a major new version x.y.0 (from a repo on branch develop), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" -To generate a changelog of a major new version x.y.0 (from a repo pn branch x.y), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" -To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" +- Update version/info in ChangeLog, for this: +To generate a changelog of a major new version x.y.0 (from a repo on branch develop), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/changelogtocopy" +To generate a changelog of a major new version x.y.0 (from a repo pn branch x.y), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/changelogtocopy" +To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/changelogtocopy" Recopy the content of the output file into the file ChangeLog. -- Note: To know the number of lines changes: git diff --shortstat A B +- Note: To know the number of lines changes: git diff --shortstat vA vB - Update version number with x.y.z in file htdocs/filefunc.inc.php - Commit all changes. @@ -84,6 +84,6 @@ Recopy the content of the output file into the file ChangeLog. - Check content of built packages. - Run makepack-dolibarr.pl again with option to publish files on dolibarr foundation server (Dir /home/dolibarr/wwwroot/files/stable on www.dolibarr.org). -- Run makepack-dolibarr.pl again with option to publish files on sourceforge. This will also add official tag. +- Run makepack-dolibarr.pl again with option to publish files on sourceforge. This will also add the official tag x.y.z. -- Post a news on dolibarr.org/dolibarr.fr + social networks +- Post a news in english dolibarr.org/dolibarr.fr web site by cloning a past news (the news will be propagated on social networks) From 4e1a319113b3880e1b3161ce0b74c3dece6c8557 Mon Sep 17 00:00:00 2001 From: Dolibot Date: Thu, 30 Jan 2025 12:06:34 +0000 Subject: [PATCH 58/77] PHPStan > Update baseline --- dev/build/phpstan/phpstan-baseline.neon | 78 ------------------------- 1 file changed, 78 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 2d9c290b25a..740e50d80c5 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -9540,12 +9540,6 @@ parameters: count: 1 path: ../../../htdocs/core/class/dolgraph.class.php - - - message: '#^Comparison operation "\>" between 0 and 0 is always false\.$#' - identifier: greater.alwaysFalse - count: 3 - path: ../../../htdocs/core/class/dolgraph.class.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -9564,24 +9558,6 @@ parameters: count: 1 path: ../../../htdocs/core/class/dolgraph.class.php - - - message: '#^Loose comparison using \=\= between 0 and 0 will always evaluate to true\.$#' - identifier: equal.alwaysTrue - count: 2 - path: ../../../htdocs/core/class/dolgraph.class.php - - - - message: '#^Loose comparison using \=\= between 1 and 3 will always evaluate to false\.$#' - identifier: equal.alwaysFalse - count: 1 - path: ../../../htdocs/core/class/dolgraph.class.php - - - - message: '#^Offset 0 on array\{array\{stacknum\: int, legend\: mixed, legendwithgroup\: non\-falsy\-string\}\} in empty\(\) always exists and is not falsy\.$#' - identifier: empty.offset - count: 1 - path: ../../../htdocs/core/class/dolgraph.class.php - - message: '#^Ternary operator condition is always true\.$#' identifier: ternary.alwaysTrue @@ -14670,24 +14646,12 @@ parameters: count: 12 path: ../../../htdocs/core/tpl/card_presend.tpl.php - - - message: '#^Variable \$hidedesc might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/card_presend.tpl.php - - message: '#^Variable \$hidedetails might not be defined\.$#' identifier: variable.undefined count: 1 path: ../../../htdocs/core/tpl/card_presend.tpl.php - - - message: '#^Variable \$hideref might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/core/tpl/card_presend.tpl.php - - message: '#^Variable \$hookmanager might not be defined\.$#' identifier: variable.undefined @@ -15444,12 +15408,6 @@ parameters: count: 1 path: ../../../htdocs/cron/list.php - - - message: '#^Variable \$texttoshow might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/cron/list.php - - message: '#^Offset ''css'' on array\{css\: ''minwidth200'', picto\: mixed\} in empty\(\) always exists and is not falsy\.$#' identifier: empty.offset @@ -15510,12 +15468,6 @@ parameters: count: 1 path: ../../../htdocs/delivery/card.php - - - message: '#^Variable \$arrayoptions might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/delivery/card.php - - message: '#^Variable \$hidedesc might not be defined\.$#' identifier: variable.undefined @@ -15786,42 +15738,12 @@ parameters: count: 1 path: ../../../htdocs/don/paiement/list.php - - - message: '#^Variable \$morecss might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/don/paiement/list.php - - - - message: '#^Variable \$morejs might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/don/paiement/list.php - - - - message: '#^Variable \$outputlangs might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/don/payment/card.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue count: 1 path: ../../../htdocs/don/payment/payment.php - - - message: '#^Variable \$sumpaid might not be defined\.$#' - identifier: variable.undefined - count: 3 - path: ../../../htdocs/don/payment/payment.php - - - - message: '#^Variable \$objectlink might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../../htdocs/don/tpl/linkedobjectblock.tpl.php - - message: '#^Property EcmFiles\:\:\$acl \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property From 7fa1baf1ddbf35d4710f175d1a5ad387672abcc0 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 30 Jan 2025 13:34:26 +0100 Subject: [PATCH 59/77] Fix regression --- htdocs/categories/class/categorie.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 305649da4e4..5dd92761cdb 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1785,10 +1785,9 @@ class Categorie extends CommonObject } // Check contrast with background and correct text color - //$forced_color = 'categtextwhite'; // TODO This css class hide the link - $forced_color = 'categtextblack'; + $forced_color = 'categtextwhite'; // We want color white because the background is dark (grey or other) if ($this->color) { - if (colorIsLight($this->color)) { + if (colorIsLight($this->color)) { // If color is light, we force color to dark $forced_color = 'categtextblack'; } } From 09d745057c92804bf27bc18b6813257c4ea49951 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 30 Jan 2025 14:36:43 +0100 Subject: [PATCH 60/77] Fix structured data --- htdocs/core/lib/website.lib.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 697d3f5674d..00de6abe9ae 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -779,13 +779,13 @@ function getStructuredData($type, $data = array()) $pageurl = $websitepage->pageurl; $title = $websitepage->title; - $image = $websitepage->image; + $image = getImageFromHtmlContent($websitepage->content); $companyname = $mysoc->name; $description = $websitepage->description; $pageurl = str_replace('__WEBSITE_KEY__', $website->ref, $pageurl); $title = str_replace('__WEBSITE_KEY__', $website->ref, $title); - $image = '/medias'.(preg_match('/^\//', $image) ? '' : '/').str_replace('__WEBSITE_KEY__', $website->ref, $image); + $imagepath = '/medias'.(preg_match('/^\//', $image) ? '' : '/').str_replace('__WEBSITE_KEY__', $website->ref, $image); $companyname = str_replace('__WEBSITE_KEY__', $website->ref, $companyname); $description = str_replace('__WEBSITE_KEY__', $website->ref, $description); @@ -798,10 +798,14 @@ function getStructuredData($type, $data = array()) "@type": "WebPage", "@id": "'.dol_escape_json($pageurl).'" }, - "headline": "'.dol_escape_json($title).'", + "headline": "'.dol_escape_json($title).'",'; + if ($image) { + $ret .= ' "image": [ - "'.dol_escape_json($image).'" - ], + "'.dol_escape_json($imagepath).'" + ],'; + } + $ret .= ' "dateCreated": "'.dol_print_date($websitepage->date_creation, 'dayhourrfc').'", "datePublished": "'.dol_print_date($websitepage->date_creation, 'dayhourrfc').'", "dateModified": "'.dol_print_date($websitepage->date_modification, 'dayhourrfc').'", @@ -814,7 +818,7 @@ function getStructuredData($type, $data = array()) "name": "'.dol_escape_json($companyname).'", "logo": { "@type": "ImageObject", - "url": "/wrapper.php?modulepart=mycompany&file=logos%2F'.urlencode($mysoc->logo).'" + "url": "/wrapper.php?modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo).'" } },'."\n"; if ($websitepage->keywords) { From 0cc2ce2c1190bca56cf0d984e27bdb1bb5ee816d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sol=C3=A8ne?= Date: Thu, 30 Jan 2025 15:48:50 +0100 Subject: [PATCH 61/77] Translations fixed --- htdocs/core/lib/fichinter.lib.php | 2 +- htdocs/langs/en_US/interventions.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index 64b91da0206..2eeb365cc62 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -232,7 +232,7 @@ function fichinter_rec_prepare_head($object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/fichinter/card-rec.php?id='.$object->id; - $head[$h][1] = $langs->trans("CardFichinter"); + $head[$h][1] = $langs->trans("InterventionCard"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 1d7b2ada84f..2e3e1d1f510 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -86,3 +86,4 @@ TypeContact_fichinter_external_BILLING=Customer contact of intervention billing TypeContact_fichinter_external_CUSTOMER=Customer contact of intervention follow-up NotARecurringInterventionalTemplate=Not a recurring intervention template ShowInterventionModel=Show intervention model +CreateRepeatableIntervention=Create recurring intervention From e83e318fc92bef80fa98d919ed694ec627e850d7 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Thu, 30 Jan 2025 16:04:25 +0100 Subject: [PATCH 62/77] Enhance selectForForms --- htdocs/core/class/commonobject.class.php | 31 +++++++++++------- htdocs/core/class/html.form.class.php | 41 +++++++++++++----------- htdocs/hrm/class/position.class.php | 6 ++-- htdocs/hrm/position_list.php | 14 +++++--- 4 files changed, 55 insertions(+), 37 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3aa18de36e9..6ba5e3e730f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7450,16 +7450,15 @@ abstract class CommonObject * Return HTML string to put an input field into a page * Code very similar with showInputField of extra fields * - * @param ?array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string} $val Array of properties for field to show (used only if ->fields not defined) - * Array of properties of field to show - * @param string $key Key of attribute - * @param string|string[] $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value, for array type must be array) - * @param string $moreparam To add more parameters on html input tag - * @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names) - * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) - * @param string|int $morecss Value for css to define style/length of field. May also be a numeric. - * @param int<0,1> $nonewbutton Force to not show the new button on field that are links to object - * @return string + * @param ?array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string} $val Array of properties for field to show (used only if ->fields not defined, so try to keep this null) + * @param string $key Key of attribute + * @param string|string[] $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value, for array type must be array) + * @param string $moreparam To add more parameters on html input tag + * @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names) + * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) + * @param string|int $morecss Value for css to define style/length of field. May also be a numeric. + * @param int<0,1> $nonewbutton Force to not show the new button on field that are links to object + * @return string */ public function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0, $nonewbutton = 0) { @@ -8269,7 +8268,17 @@ abstract class CommonObject } } } - $objectfield = $this->element.($this->module ? '@'.$this->module : '').':'.$key.$keysuffix; + + // $param_list_array[0] can be the name of object (Example 'User' the field is linked to). Not as taking the information from the record in ->fields found from $objectfield. + + // $valparent is a string 'dataobject@module:keyoffieldinfieldsarray' to find the record field to link to. + // $valparent = $this->element.($this->module ? '@'.$this->module : '').':'.$key.$keysuffix; + + // $val is already the record field found at same place than found by $valparent but already loaded and may have been modified by parent caller. + + //$objectfield = $valparent; + $objectfield = $val; // Is better than using old method $valparent + $out = $form->selectForForms($param_list_array[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, $moreparam, 0, (empty($val['disabled']) ? 0 : 1), '', $objectfield); if (!empty($param_list_array[2])) { // If the entry into $fields is set, we must add a create button diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e611d3ec66f..af533b9474b 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8486,22 +8486,22 @@ class Form /** * Generic method to select a component from a combo list. - * Can use autocomplete with ajax after x key pressed or a full combo, depending on setup. + * Can use autocomplete with ajax after x key pressed (if $objecttmp->element.'_USE_SEARCH_TO_SELECT' is set) or a full combo, depending on setup. * This is the generic method that will replace all specific existing methods. * - * @param string $objectdesc 'ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]'. For hard coded custom needs. Try to prefer method using $objectfield instead of $objectdesc. - * @param string $htmlname Name of HTML select component - * @param int $preSelectedValue Preselected value (ID of element) + * @param string $objectdesc 'ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]'. For hard coded custom needs. Try to prefer method using $objectfield array instead of $objectdesc. + * @param string $htmlname Name of HTML select component + * @param int $preSelectedValue Preselected value (ID of element) * @param string|int<0,1> $showempty ''=empty values not allowed, 'string'=value show if we allow empty values (for example 'All', ...) - * @param string $searchkey Search criteria - * @param string $placeholder Place holder - * @param string $morecss More CSS - * @param string $moreparams More params provided to ajax call - * @param int $forcecombo Force to load all values and output a standard combobox (with no beautification) - * @param int<0,1> $disabled 1=Html component is disabled - * @param string $selected_input_value Value of preselected input text (for use with ajax) - * @param string $objectfield Object:Field that contains the definition of parent (in table $fields or $extrafields). Example: 'Object:xxx' or 'Object@module:xxx' (old syntax 'Module_Object:xxx') or 'Object:options_xxx' or 'Object@module:options_xxx' (old syntax 'Module_Object:options_xxx') - * @return string Return HTML string + * @param string $searchkey Search criteria + * @param string $placeholder Place holder + * @param string $morecss More CSS + * @param string $moreparams More params provided to ajax call + * @param int $forcecombo Force to load all values and output a standard combobox (with no beautification) + * @param int<0,1> $disabled 1=Html component is disabled + * @param string $selected_input_value Value of preselected input text (for use with ajax) + * @param string|array $objectfield 'Object:Field' that contains the definition of parent (in table $fields or $extrafields). Example: 'Object:xxx' or 'Object@module:xxx' or 'Object:options_xxx' or 'Object@module:options_xxx' or, better, the full entry array in ->fields + * @return string Return HTML string * @see selectForFormsList(), select_thirdparty_list() */ public function selectForForms($objectdesc, $htmlname, $preSelectedValue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $disabled = 0, $selected_input_value = '', $objectfield = '') @@ -8511,14 +8511,16 @@ class Form // Example of common usage for a link to a thirdparty // We got this in a modulebuilder form of "MyObject" of module "mymodule". - // ->fields is array( ... "fk_soc" => array("type"=>"integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))" ...) + // When ->fields is array( ... "fk_soc" => array("type"=>"integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))" ...), we have // $objectdesc = 'Societe' - // $objectfield = 'myobject@mymodule:fk_soc' ('fk_soc' is code to retrieve myobject->fields['fk_soc']) + // $objectfield = 'myobject@mymodule:fk_soc' ('fk_soc' is code to retrieve myobject->fields['fk_soc']) or it can be an array that is directly + // array("type"=>"integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))" ...) // We got this when showing an extrafields on resource that is a link to societe - // extrafields 'link_to_societe' of Resource is 'link' to 'Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))" ...)' + // When extrafields 'link_to_societe' of Resource is 'link' to 'Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))" ...)', we have // $objectdesc = 'Societe' - // $objectfield = 'resource:options_link_to_societe' + // $objectfield = 'resource:options_link_to_societe' or it can be an array that is directly + // array("type"=>'Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))" ...) // With old usage: // $objectdesc = 'Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))' @@ -8534,7 +8536,10 @@ class Form $filter = ''; // Ensure filter has value (for static analysis) $sortfield = ''; // Ensure filter has value (for static analysis) - if ($objectfield) { // We must retrieve the objectdesc from the field or extrafield + if (is_array($objectfield)) { + $objectdesc = $objectfield['type']; + $objectdesc = preg_replace('/^integer[^:]*:/', '', $objectdesc); + } elseif ($objectfield) { // We must retrieve the objectdesc from the field or extrafield. Deprecated, it is better to provide the array record directly. // Example: $objectfield = 'product:options_package' or 'myobject@mymodule:options_myfield' $tmparray = explode(':', $objectfield); diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index 50705c1ece5..2059a1d4ff5 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -207,7 +207,7 @@ class Position extends CommonObject */ public function __construct(DoliDB $db) { - global $conf, $langs; + global $langs; $this->db = $db; @@ -873,7 +873,7 @@ class Position extends CommonObject * Return HTML string to put an input field into a page * Code very similar with showInputField of extra fields * - * @param ?array{type:string,label:string,enabled:int|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string} $val Array of properties for field to show + * @param ?array{type:string,label:string,enabled:int|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array,comment?:string} $val Array of properties for field to show. If ->fields is defined, keep this null. * @param string $key Key of attribute * @param string $value Preselected value to show (for date type it must be in timestamp format, for amount or price it must be a php numeric value) * @param string $moreparam To add more parameters on html input tag @@ -890,7 +890,7 @@ class Position extends CommonObject if ($key == 'fk_user') { $vacantId = $keyprefix.$key.'vacant'.$keysuffix; - $out = parent::showInputField($val, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss); + $out = parent::showInputField(null, $key, $value, $moreparam, $keysuffix, $keyprefix, $morecss); $out .= ''; ?>
'.$langs->trans("Description").''; - print dol_htmlentitiesbr($projectstatic->description); - print '
'.$langs->trans("Categories").''; @@ -559,6 +554,16 @@ if ($projectstatic->id > 0 || $confOrBooth > 0) { print "
'.$langs->trans("Description").'
'; + print '
'; + print dolPrintHTML($projectstatic->description); + print '
'; + print '
'; $typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : ''); $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 80af93b7cd0..f416f4fc55d 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -311,7 +311,7 @@ if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJ print '
'.$langs->trans("OpportunityStatus").''; $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); From 8f3b814aaf2febfa4a4b4b7b65d398d3c42d946a Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Wed, 29 Jan 2025 17:31:07 +0100 Subject: [PATCH 39/77] Update llx_c_forme_juridique.sql added new Austrian business entity type FlexKapG #32803 --- htdocs/install/mysql/data/llx_c_forme_juridique.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_c_forme_juridique.sql b/htdocs/install/mysql/data/llx_c_forme_juridique.sql index fd094e387ef..38140954e39 100644 --- a/htdocs/install/mysql/data/llx_c_forme_juridique.sql +++ b/htdocs/install/mysql/data/llx_c_forme_juridique.sql @@ -10,7 +10,7 @@ -- Copyright (C) 2012 Tommaso Basilici -- Copyright (C) 2012 Ricardo Schluter -- Copyright (C) 2013 Cedric GROSS --- Copyright (C) 2020-2021 Udo Tamm +-- Copyright (C) 2020-2025 Udo Tamm -- Copyright (C) 2022 Miro Sertić -- -- This program is free software; you can redistribute it and/or modify @@ -83,6 +83,7 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, ' INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4112', 'GesbR - Gesellschaft nach bürgerlichem Recht', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4113', 'GesnbR - Gesellschaft nach bürgerlichem Recht', 1); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4114', 'e.U. - eingetragener Einzelunternehmer', 1); +INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (41, '4115', 'FlexKapG - Flexible Kapitalgesellschaft', 1); -- Belgium From 40567ce7f680e422b90f138859dc9a7f5ad0bbca Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 29 Jan 2025 18:13:03 +0100 Subject: [PATCH 40/77] FIX E_STRICT is deprecated since PHP 8.4 --- htdocs/filefunc.inc.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index aa03bc81bd9..abba0355be6 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -205,10 +205,19 @@ if (!$result && !empty($_SERVER["GATEWAY_INTERFACE"])) { // If install not do } // Force PHP error_reporting setup (Dolibarr may report warning without this) -if (!empty($dolibarr_strict_mode)) { - error_reporting(E_ALL | E_STRICT); +if (version_compare(phpversion(), '8.4', '<')) { + if (!empty($dolibarr_strict_mode)) { + error_reporting(E_ALL | E_STRICT); + } else { + error_reporting(E_ALL & ~(E_STRICT | E_NOTICE | E_DEPRECATED)); + } } else { - error_reporting(E_ALL & ~(E_STRICT | E_NOTICE | E_DEPRECATED)); + // E_STRICT is deprecated since PHP 8.4 + if (!empty($dolibarr_strict_mode)) { + error_reporting(E_ALL); + } else { + error_reporting(E_ALL & ~(E_NOTICE | E_DEPRECATED)); + } } // Disable php display errors From 9cb16ea555ee945da759107f8b16c229013204d5 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Wed, 29 Jan 2025 19:34:18 +0200 Subject: [PATCH 41/77] fix trans --- htdocs/langs/en_US/datapolicy.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/datapolicy.lang b/htdocs/langs/en_US/datapolicy.lang index 38a4f48f39f..3f8e33544fa 100644 --- a/htdocs/langs/en_US/datapolicy.lang +++ b/htdocs/langs/en_US/datapolicy.lang @@ -19,7 +19,7 @@ Module4100Desc = Module to manage Data Privacy (Conformity with the GDPR) datapolicySetup = Module Data Privacy Policy Setup DataDeletion=Deletion of data DataAnonymization=Anonymization of data -datapolicySetupPage = Depending on the laws of your countries (Example Article 5 of the GDPR), personal data must be kept for a period not exceeding the duration the data is needed for the purpose for which it was collected, except for archival purposes.
This module will make an anonymization automatically after a certain duration without events (the duration which you will have indicated below) and if the object has no existing business object children. +datapolicySetupPage = Depending on the laws of your country (Example Article 5 of the GDPR), personal data must be kept for a period not exceeding the duration the data is needed for the purpose for which it was collected, except for archival purposes.
This module will make an anonymization automatically after a certain duration without events (the duration which you will have indicated below) and if the object has no existing business object children. NB_MONTHS = %s months ONE_YEAR = 1 year NB_YEARS = %s years From 4d8f28f22bd42202cbd981b0a23d49e3f5bf7dcb Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Wed, 29 Jan 2025 19:36:31 +0200 Subject: [PATCH 42/77] fix typo --- htdocs/langs/en_US/website.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 212147881ff..892960dc610 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -92,7 +92,7 @@ DisableSiteFirst=Put website offline first MyContainerTitle=My web site title AnotherContainer=This is how to include content of another page/container (you may have an error here if you enable dynamic code because the embedded subcontainer may not exists) SorryWebsiteIsCurrentlyOffLine=Sorry, this website is currently off line. Please comme back later... -WEBSITE_USE_WEBSITE_ACCOUNTS=Enable the table of web site account fo thirdparties +WEBSITE_USE_WEBSITE_ACCOUNTS=Enable the table of web site account for thirdparties WEBSITE_USE_WEBSITE_ACCOUNTSTooltip=Enable the table to store the web site accounts (login/pass) for each third party YouMustDefineTheHomePage=You must first define the default Home page OnlyEditionOfSourceForGrabbedContentFuture=Warning: Creating a web page by importing an external web page is reserved for experienced users. Depending on the complexity of source page, the result of importation may differ from the original. Also if the source page uses common CSS styles or conflicting JavaScript, it may break the look or features of the Website editor when working on this page. This method is a quicker way to create a page but it is recommended to create your new page from scratch or from a suggested page template.
Note also that the inline editor might not work correctly when used on a grabbed external page. From d66ff94c72f89e5521a63c46ea1ccb9c0315214e Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Wed, 29 Jan 2025 19:38:49 +0200 Subject: [PATCH 43/77] fix trans --- htdocs/langs/en_US/members.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 4d1c90f9e1b..f730d33d5f4 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -191,7 +191,7 @@ MembersStatisticsByRegion=Members statistics by region NbOfMembers=Total number of members NbOfActiveMembers=Total number of current active members NoValidatedMemberYet=No validated members found -MembersByCountryDesc=This screen shows you the statistics of members by countries. +MembersByCountryDesc=This screen shows you the statistics of members by country. MembersByCountryDesc2=Graphs and charts depend on the availability of the Google online graph service as well as on the availability of a working internet connection. MembersByStateDesc=This screen show you statistics of members by state/provinces/canton. MembersByTownDesc=This screen show you statistics of members by town. From 9984652a4502bc47d9472179279577502f6f2230 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Wed, 29 Jan 2025 19:43:00 +0200 Subject: [PATCH 44/77] fix trans --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index a5e14c17cb8..4166884bdf2 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2606,5 +2606,5 @@ AttributeCodeHelp=A code of your choice (without special chars and spaces) to id ThereIsMoreThanXAnswers=There is more than %s answers with your filter. Please add more filters... PdfAddTermOfSaleHelp=You can upload the terms and conditions of sale file at the bottom of this setup page WarningOnlineSignature=Please note that this function allows a person (customer, supplier...) to insert, online, the image of his signature in the PDF document. As for a handwritten signature, such a signature can be made by anyone and might not have the same legal value as a legal electronic signature system going through an authorized trusted third party. If you need this level of security, you can contact an integrator for more information or check for addons on www.dolistore.org. -UploadExtensionRestriction=File exension list forbidden to upload +UploadExtensionRestriction=List of forbidden file extensions to upload UploadExtensionRestrictionExemple=htm, html, shtml, js, php From 841cd5f570ad44c9fabdc4b30ce73c3bf8e26445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2025 19:08:08 +0100 Subject: [PATCH 45/77] enhance member types list --- htdocs/adherents/type.php | 45 +++++++++++++++++++++++---------- htdocs/langs/en_US/members.lang | 4 ++- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 91f105c48b8..25bdae150a5 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -9,7 +9,7 @@ * Copyright (C) 2020 Josep Lluís Amador * Copyright (C) 2021 Waël Almoman * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -136,6 +136,9 @@ $result = restrictedArea($user, 'adherent', $rowid, 'adherent_type'); */ $error = 0; +// Selection of new fields +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers $search_ref = ""; $search_lastname = ""; @@ -329,8 +332,14 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''; print ''; print ''; + print ''; + print ''; print ''; + $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; + $htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup + $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : ''); + // $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -341,11 +350,18 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print '
 '.$langs->trans("Ref").''.$langs->trans($arrayfields['t.libelle']['label']).''.$langs->trans("MembersNature").''.$langs->trans("Ref").''.$langs->trans("Label").''.$langs->trans("MembersNature").''.$langs->trans("MembershipDuration").''.$langs->trans("SubscriptionRequired").''.$langs->trans("Amount").''.$langs->trans("VoteAllowed").''.$langs->trans("Status").' 
rowid.'">'.img_edit().''; - print $membertype->getNomUrl(1); - //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' - print ''.dol_escape_htmltag($objp->label).''; + print $membertype->getNomUrl(1); + //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' + print ''.dol_escape_htmltag($objp->label).''; if ($objp->morphy == 'phy') { diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 4d1c90f9e1b..a4cecf6be82 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -191,7 +191,7 @@ MembersStatisticsByRegion=Members statistics by region NbOfMembers=Total number of members NbOfActiveMembers=Total number of current active members NoValidatedMemberYet=No validated members found -MembersByCountryDesc=This screen shows you the statistics of members by countries. +MembersByCountryDesc=This screen shows you the statistics of members by countries. MembersByCountryDesc2=Graphs and charts depend on the availability of the Google online graph service as well as on the availability of a working internet connection. MembersByStateDesc=This screen show you statistics of members by state/provinces/canton. MembersByTownDesc=This screen show you statistics of members by town. @@ -251,3 +251,5 @@ XSubsriptionErrors=%s subscription(s) where in error CreateSubscription=Create subscription WarningNoComplementaryActionDone=No Complementary action on recording will be executed with this massaction NewMembership=New membership +Caneditamount=Can edit amount +Morphy=Moral or physical From 0338b5c65851f490b3458113a642b57a43910ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2025 19:11:03 +0100 Subject: [PATCH 46/77] enhance member types list --- htdocs/adherents/type.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 25bdae150a5..c1584085f12 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -355,12 +355,15 @@ if (!$rowid && $action != 'create' && $action != 'edit') { } if (!empty($arrayfields['t.rowid']['checked'])) { print ''.$langs->trans("Ref").''.$langs->trans($arrayfields['t.libelle']['label']).''.$langs->trans("MembersNature").''.$langs->trans("MembershipDuration").''.$langs->trans("SubscriptionRequired").''.dol_escape_htmltag($objp->label).''; - if ($objp->morphy == 'phy') { - print $langs->trans("Physical"); - } elseif ($objp->morphy == 'mor') { - print $langs->trans("Moral"); - } else { - print $langs->trans("MorAndPhy"); + if (!empty($arrayfields['t.morphy']['checked'])) { + print ''; + if ($objp->morphy == 'phy') { + print $langs->trans("Physical"); + } elseif ($objp->morphy == 'mor') { + print $langs->trans("Moral"); + } else { + print $langs->trans("MorAndPhy"); + } + print ''; if ($objp->duration) { From de131d7d8ef262862c7dd18af426a82f4fbc3df0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 29 Jan 2025 19:13:23 +0100 Subject: [PATCH 47/77] enhance member types list --- htdocs/adherents/type.php | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index c1584085f12..5e0a853eaa8 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -365,7 +365,10 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print ''.$langs->trans("MembersNature").''.$langs->trans("MembershipDuration").''.$langs->trans("MembershipDuration").''.$langs->trans("SubscriptionRequired").''.$langs->trans("Amount").''.$langs->trans("CanEditAmountShort").''; - if ($objp->duration) { - $duration_value = intval($objp->duration); - if ($duration_value > 1) { - $dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years")); - } else { - $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year")); + if (!empty($arrayfields['t.duration']['checked'])) { + print ''; + if ($objp->duration) { + $duration_value = intval($objp->duration); + if ($duration_value > 1) { + $dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years")); + } else { + $dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year")); + } + $unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration); + print max(1, $duration_value).' '.$dur[$unit]; } - $unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration); - print max(1, $duration_value).' '.$dur[$unit]; + print ''.yn($objp->subscription).''.$langs->trans("MembershipDuration").''.$langs->trans("SubscriptionRequired").''.$langs->trans("Amount").''.$langs->trans("CanEditAmountShort").''.$langs->trans("VoteAllowed").''.$langs->trans("Status").''.$langs->trans("SubscriptionRequired").''.$langs->trans("Amount").''.$langs->trans("CanEditAmountShort").''.$langs->trans("VoteAllowed").''.$langs->trans("Status").''.yn($objp->subscription).''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''.yn($objp->caneditamount).''.yn($objp->vote).''.$membertype->getLibStatut(5).''.yn($objp->subscription).''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''.yn($objp->caneditamount).''.yn($objp->vote).''.$membertype->getLibStatut(5).'rowid.'">'.img_edit().'
'.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).''; - print ''; // Assujeti par default en creation + print ''; // Assujeti par default en creation print '