From 59ffaa538c9ed216455f0c971ed2b04a23b7900e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 01:29:01 +0100 Subject: [PATCH 01/82] Clean code --- htdocs/expedition/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 2583dec22c2..532b7ae411e 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -138,6 +138,8 @@ $result = restrictedArea($user, 'expedition', $object->id, ''); $permissiondellink = $user->hasRight('expedition', 'delivery', 'creer'); // Used by the include of actions_dellink.inc.php $permissiontoadd = $user->hasRight('expedition', 'creer'); +$upload_dir = $conf->expedition->dir_output.'/sending'; + $editColspan = 0; $objectsrc = null; $typeobject = null; @@ -146,6 +148,7 @@ $typeobject = null; /* * Actions */ + $error = 0; $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -169,7 +172,6 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once' // Actions to build doc - $upload_dir = $conf->expedition->dir_output.'/sending'; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; // Back to draft From 322e8c921d52260b6664adae9a045ed581c39661 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 01:37:58 +0100 Subject: [PATCH 02/82] Update VDP --- SECURITY.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index 809681c74d1..50a74ea0716 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -12,8 +12,9 @@ Security report are valid only on current stable version (see https://dolibarr.o To report a vulnerability, for a private report, you can: -- Send your report on Vulnerability Disclosure Program (VDP) [https://app.yogosha.com/cvd/dolibarr/10VxeNx6Ui3rSEhAgX63US](https://app.yogosha.com/cvd/dolibarr/10VxeNx6Ui3rSEhAgX63US) (recommended for everybody) +- Send your report on Vulnerability Disclosure Program (VDP): Link will be upadeted soon (recommended for everybody) - Or send an email to security@dolibarr.org with clear textual description of the report along with steps to reproduce the issue, include attachments such as screenshots or proof of concept code as necessary. From 28f657ea1daa27d152e34e10a3398b70d160c3c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 13:22:37 +0100 Subject: [PATCH 03/82] Better error message --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 53a7fba96df..ebd5fd2e3ca 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -268,7 +268,7 @@ if (empty($dolibarr_strict_mode)) { define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs) if (!file_exists(DOL_DOCUMENT_ROOT."/core/lib/functions.lib.php")) { - print "Error: Dolibarr config file content seems to be not correctly defined.
\n"; + print "Error: Dolibarr config file content seems to be not correctly defined (file ".DOL_DOCUMENT_ROOT."/core/lib/functions.lib.php not found).
\n"; print "Please run dolibarr setup by calling page /install.
\n"; exit(1); } From ce0d9d82c2414d66040be91481e7f4b075fc1436 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 13:29:07 +0100 Subject: [PATCH 04/82] Fix test on install process --- htdocs/install/inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index b1a80578fa6..3fd55c11bc4 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -242,7 +242,7 @@ if (!defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > $result = conf($dolibarr_main_document_root); } // Load database driver - if ($result) { + if ($result > 0) { if (!empty($dolibarr_main_document_root) && !empty($dolibarr_main_db_type)) { $result = include_once $dolibarr_main_document_root."/core/db/".$dolibarr_main_db_type.'.class.php'; if (!$result) { @@ -432,7 +432,7 @@ function conf($dolibarr_main_document_root) global $dolibarr_main_instance_unique_id; global $dolibarr_main_cookie_cryptkey; - $return = include_once $dolibarr_main_document_root.'/core/class/conf.class.php'; + $return = @include_once $dolibarr_main_document_root.'/core/class/conf.class.php'; if (!$return) { return -1; } From 12ec583cb826275cbbd45b07a212d6f77a066d40 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 15:40:51 +0100 Subject: [PATCH 05/82] Look and feel v21 --- htdocs/adherents/card.php | 2 +- htdocs/theme/eldy/global.inc.php | 3 +++ htdocs/theme/md/style.css.php | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 37c52af55e8..153644333b7 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1623,7 +1623,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (isModEnabled('mailman') && getDolGlobalString('ADHERENT_USE_SPIP')) { $formquestion[] = array('type' => 'other', 'label' => $langs->transnoentitiesnoconv("SynchroSpipEnabled"), 'value' => ''); } - print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ValidateMember"), $langs->trans("ConfirmValidateMember"), "confirm_valid", $formquestion, 'yes', 1, 220); + print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ValidateMember"), $langs->trans("ConfirmValidateMember"), "confirm_valid", $formquestion, 'yes', 1, 250); } // Confirm resiliate diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index a37f76bcb3d..374537924e1 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5409,6 +5409,9 @@ div.info { background: #eff8fc; color: #558; } +div.fiche div.info { + box-shadow: 4px 4px 12px #ddd; +} /* Warning message */ div.warning, div.warningborder { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index eeb8358107f..1327a739682 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5396,6 +5396,9 @@ div.info { border-: solid 5px #87cfd2; background: #eff8fc; } +div.fiche div.info { + box-shadow: 4px 4px 12px #ddd; +} /* Warning message */ div.warning, div.warningborder { From 88a1eadfc7893084232dce9277e065fdcad5492e Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Wed, 20 Nov 2024 19:50:07 +0100 Subject: [PATCH 06/82] fix: php warning (#32020) * fix: php warning * fix php warning * fix php warning --- htdocs/admin/mails.php | 2 +- htdocs/comm/action/card.php | 4 ++-- htdocs/comm/action/peruser.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index ab8695e871b..7808ff615d3 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -511,7 +511,7 @@ if ($action == 'edit') { // SuperAdministrator access only if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { - print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE); + print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE', $oauthservices, getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE')); } else { $text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE')]; if (empty($text)) { diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index d37b799493c..30c71c6e01a 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1963,8 +1963,8 @@ if ($id > 0) { 'type' => 'user', //'transparency'=>$object->userassigned[$user->id]['transparency'], 'transparency' => $object->transparency, // Force transparency on ownerfrom event - 'answer_status' => $object->userassigned[$object->userownerid]['answer_status'], - 'mandatory' => $object->userassigned[$object->userownerid]['mandatory'] + 'answer_status' => (isset($object->userassigned[$object->userownerid]['answer_status']) ? $object->userassigned[$object->userownerid]['answer_status']: null), + 'mandatory' => (isset($object->userassigned[$object->userownerid]['mandatory']) ? $object->userassigned[$object->userownerid]['mandatory']:null) ); } if (!empty($object->userassigned)) { // Now concat assigned users diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 6abe480da9c..56b758f64a6 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -1426,7 +1426,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $tmpcontact->fetch($event->contact_id); $cachecontacts[$event->contact_id] = $tmpcontact; } - $cases2[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); + $cases3[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); } } if ($event->date_start_in_calendar < $c && $dateendtouse > $b2) { From 9f56bfe5b76171ba4f8452740fd0b9be76a6dc00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Cendrier?= <81741011+altairis-noe@users.noreply.github.com> Date: Wed, 20 Nov 2024 20:06:43 +0100 Subject: [PATCH 07/82] FIX: shipping date was not editable in view mode (#32022) --- htdocs/expedition/card.php | 14 +++++++--- htdocs/expedition/class/expedition.class.php | 28 ++++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 532b7ae411e..38e18e2302c 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -560,6 +560,14 @@ if (empty($reshook)) { if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } + } elseif ($action == 'setdate_shipping' && $user->hasRight('expedition', 'creer')) { + $dateshipping = dol_mktime(GETPOSTINT('ship_hour'), GETPOSTINT('ship_min'), 0, GETPOSTINT('ship_month'), GETPOSTINT('ship_day'), GETPOSTINT('ship_year')); + + $object->fetch($id); + $result = $object->setShippingDate($user, $dateshipping); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } } elseif (in_array($action, array('settracking_number', 'settracking_url', 'settrueWeight', 'settrueWidth', 'settrueHeight', 'settrueDepth', 'setshipping_method_id')) && $user->hasRight('expedition', 'creer')) { // Action update $error = 0; @@ -2061,10 +2069,10 @@ if ($action == 'create') { print ''; print ''; if ($action == 'editdate_shipping') { - print '
'; + print ''; print ''; - print ''; - print $form->selectDate($object->date_shipping ? $object->date_shipping : -1, 'liv_', 1, 1, 0, "setdate_shipping", 1, 0); + print ''; + print $form->selectDate($object->date_shipping ? $object->date_shipping : -1, 'ship_', 1, 1, 0, "setdate_shipping", 1, 0); print ''; print '
'; } else { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 8a49d6139a6..5193c3cde90 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -2223,6 +2223,34 @@ class Expedition extends CommonObject } } + /** + * Set the shipping date + * + * @param User $user Object user that modify + * @param integer $shipping_date Date of shipping + * @return int Return integer <0 if KO, >0 if OK + */ + public function setShippingDate($user, $shipping_date) + { + if ($user->hasRight('expedition', 'creer')) { + $sql = "UPDATE ".MAIN_DB_PREFIX."expedition"; + $sql .= " SET date_expedition = ".($shipping_date ? "'".$this->db->idate($shipping_date)."'" : 'null'); + $sql .= " WHERE rowid = ".((int) $this->id); + + dol_syslog(get_class($this)."::setShippingDate", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $this->date_shipping = $shipping_date; + return 1; + } else { + $this->error = $this->db->error(); + return -1; + } + } else { + return -2; + } + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Fetch deliveries method and return an array. Load array this->meths(rowid=>label). From a9b2e7bde133f0e29049e807e62608a3db18bfa4 Mon Sep 17 00:00:00 2001 From: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com> Date: Wed, 20 Nov 2024 20:50:49 +0100 Subject: [PATCH 08/82] Update facture.class.php (#32013) Incoterms and location are missing when invoice is auto gen from an order (when WORKFLOW_ORDER_AUTOCREATE_INVOICE is active for instance) --- htdocs/compta/facture/class/facture.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index dacff6569d8..06eb0d45c29 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1472,6 +1472,8 @@ class Facture extends CommonInvoice $this->fk_account = $object->fk_account; $this->cond_reglement_id = $object->cond_reglement_id; $this->mode_reglement_id = $object->mode_reglement_id; + $this->fk_incoterms = $object->fk_incoterms; + $this->location_incoterms = $object->location_incoterms; $this->availability_id = $object->availability_id; $this->demand_reason_id = $object->demand_reason_id; $this->delivery_date = $object->delivery_date; From b7816bf6480f77b10a8517210cad0a465e82c04c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 20 Nov 2024 20:56:16 +0100 Subject: [PATCH 09/82] fix phpstan (#32010) * fix phpstan * Update extrafields_view.tpl.php * Update extrafields.class.php --- htdocs/core/class/extrafields.class.php | 2 +- htdocs/core/tpl/extrafields_view.tpl.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 221925075e1..0aef926b693 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -51,7 +51,7 @@ class ExtraFields public $attributes = array(); /** - * @var array> Array with boolean of status of groups + * @var array>|null Array with boolean of status of groups */ public $expand_display; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index e0dccc9b8ab..700824e7ae3 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -29,6 +29,7 @@ * @var CommonObject $object * @var Conf $conf * @var DoliDB $db + * @var ExtraFields $extrafields * @var Form $form * @var Translate $langs * @var User $user @@ -81,7 +82,7 @@ if (empty($reshook) && !empty($object->table_element) && isset($extrafields->att $enabled = 1; if ($enabled && isset($extrafields->attributes[$object->table_element]['enabled'][$tmpkeyextra])) { - $enabled = (int) dol_eval($extrafields->attributes[$object->table_element]['enabled'][$tmpkeyextra], 1, 1, '2'); + $enabled = (int) dol_eval((string) $extrafields->attributes[$object->table_element]['enabled'][$tmpkeyextra], 1, 1, '2'); } if ($enabled && isset($extrafields->attributes[$object->table_element]['list'][$tmpkeyextra])) { $enabled = (int) dol_eval($extrafields->attributes[$object->table_element]['list'][$tmpkeyextra], 1, 1, '2'); From 98b884e8ba26a466cd2806cefe31e52a0d624748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 20 Nov 2024 20:57:47 +0100 Subject: [PATCH 10/82] Fix typo in SECURITY.md (#32011) --- SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index 50a74ea0716..062578e03b9 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -12,7 +12,7 @@ Security report are valid only on current stable version (see https://dolibarr.o To report a vulnerability, for a private report, you can: -- Send your report on Vulnerability Disclosure Program (VDP): Link will be upadeted soon (recommended for everybody) +- Send your report on Vulnerability Disclosure Program (VDP): Link will be updated soon (recommended for everybody) '; - $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element); + $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this, $this->table_element); break; case "edit": $listoftypestoshowpicto = explode(',', getDolGlobalString('MAIN_TYPES_TO_SHOW_PICTO', 'email,phone,ip,password')); if (in_array($extrafields->attributes[$this->table_element]['type'][$key], $listoftypestoshowpicto)) { $out .= getPictoForType($extrafields->attributes[$this->table_element]['type'][$key], ($extrafields->attributes[$this->table_element]['type'][$key] == 'text' ? 'tdtop' : '')); } - $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', '', $this->id, $this->table_element); + $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', '', $this, $this->table_element); break; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6138ad7c169..4a1ed96b238 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1076,18 +1076,18 @@ class ExtraFields * Return HTML string to put an input field into a page * Code very similar with showInputField of common object * - * @param string $key Key of attribute + * @param string $key Key of attribute * @param string|array{start:int,end:int} $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 dates in filter mode, a range array('start'=>, 'end'=>) should be provided - * @param string $moreparam To add more parameters on html input tag - * @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names) - * @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names) - * @param string $morecss More css (to defined size of field. Old behaviour: may also be a numeric) - * @param int $objectid Current object id - * @param string $extrafieldsobjectkey The key to use to store retrieved data (commonly $object->table_element) - * @param int $mode 1=Used for search filters + * @param string $moreparam To add more parameters on html input tag + * @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names) + * @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names) + * @param string $morecss More css (to defined size of field. Old behaviour: may also be a numeric) + * @param int|CommonObject $object Current object or object ID. Preferably, pass the object itself. + * @param string $extrafieldsobjectkey The key to use to store retrieved data (commonly $object->table_element) + * @param int $mode 1=Used for search filters * @return string */ - public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $objectid = 0, $extrafieldsobjectkey = '', $mode = 0) + public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $object = 0, $extrafieldsobjectkey = '', $mode = 0) { global $conf, $langs, $form; @@ -1096,6 +1096,8 @@ class ExtraFields $form = new Form($this->db); } + $objectid = (is_numeric($object) ? $object : $object->id); + $out = ''; if (!preg_match('/options_$/', $keyprefix)) { // Because we work on extrafields, we add 'options_' to prefix if not already added @@ -1120,6 +1122,7 @@ class ExtraFields $list = (string) dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '2'); $totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key]; $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; + $alwayseditable = $this->attributes[$extrafieldsobjectkey]['alwayseditable'][$key]; $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) //var_dump('key='.$key.' '.$value.' '.$moreparam.' '.$keysuffix.' '.$keyprefix.' '.$objectid.' '.$extrafieldsobjectkey.' '.$mode); @@ -1935,6 +1938,12 @@ class ExtraFields if (!empty($hidden)) { $out = ''; } + + // If alwayseditable is false, and object is not in draft, then showOutputField + // @phan-suppress-next-line PhanUndeclaredConstantOfClass + if ($alwayseditable == 0 && !is_numeric($object) && isset($object->status) && $object->status != $object::STATUS_DRAFT) { + $out = $this->showOutputField($key, $value, $moreparam, $extrafieldsobjectkey, null, $object); + } /* Add comments if ($type == 'date') $out.=' (YYYY-MM-DD)'; elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)'; From 914ed1b18cc1c388b1b9bd45982d43ec7c3dc432 Mon Sep 17 00:00:00 2001 From: Mohamed DAOUD Date: Wed, 20 Nov 2024 21:33:32 +0100 Subject: [PATCH 17/82] Fix #30766 Extra field Can Always Be Edited (#31876) * fix alwayseditable * Update extrafields.class.php * Update extrafields.class.php * Update extrafields.class.php * enhance fix alwayseditable * fix phan --- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/core/class/extrafields.class.php | 28 ++++++++++++++++-------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d6a0ef32ba4..37a0c324dfb 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9393,14 +9393,14 @@ abstract class CommonObject $out .= getPictoForType($extrafields->attributes[$this->table_element]['type'][$key], ($extrafields->attributes[$this->table_element]['type'][$key] == 'text' ? 'tdtop' : '')); } //$out .= ''; - $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element); + $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this, $this->table_element); break; case "edit": $listoftypestoshowpicto = explode(',', getDolGlobalString('MAIN_TYPES_TO_SHOW_PICTO', 'email,phone,ip,password')); if (in_array($extrafields->attributes[$this->table_element]['type'][$key], $listoftypestoshowpicto)) { $out .= getPictoForType($extrafields->attributes[$this->table_element]['type'][$key], ($extrafields->attributes[$this->table_element]['type'][$key] == 'text' ? 'tdtop' : '')); } - $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', '', $this->id, $this->table_element); + $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', '', $this, $this->table_element); break; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6138ad7c169..6aca908bffd 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1076,18 +1076,18 @@ class ExtraFields * Return HTML string to put an input field into a page * Code very similar with showInputField of common object * - * @param string $key Key of attribute + * @param string $key Key of attribute * @param string|array{start:int,end:int} $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 dates in filter mode, a range array('start'=>, 'end'=>) should be provided - * @param string $moreparam To add more parameters on html input tag - * @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names) - * @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names) - * @param string $morecss More css (to defined size of field. Old behaviour: may also be a numeric) - * @param int $objectid Current object id - * @param string $extrafieldsobjectkey The key to use to store retrieved data (commonly $object->table_element) - * @param int $mode 1=Used for search filters + * @param string $moreparam To add more parameters on html input tag + * @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names) + * @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names) + * @param string $morecss More css (to defined size of field. Old behaviour: may also be a numeric) + * @param int|CommonObject $object Current object or object ID. Preferably, pass the object itself. + * @param string $extrafieldsobjectkey The key to use to store retrieved data (commonly $object->table_element) + * @param int $mode 1=Used for search filters * @return string */ - public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $objectid = 0, $extrafieldsobjectkey = '', $mode = 0) + public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $object = 0, $extrafieldsobjectkey = '', $mode = 0) { global $conf, $langs, $form; @@ -1096,6 +1096,8 @@ class ExtraFields $form = new Form($this->db); } + $objectid = (is_numeric($object) ? $object : $object->id); + $out = ''; if (!preg_match('/options_$/', $keyprefix)) { // Because we work on extrafields, we add 'options_' to prefix if not already added @@ -1120,6 +1122,7 @@ class ExtraFields $list = (string) dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '2'); $totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key]; $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; + $alwayseditable = $this->attributes[$extrafieldsobjectkey]['alwayseditable'][$key]; $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) //var_dump('key='.$key.' '.$value.' '.$moreparam.' '.$keysuffix.' '.$keyprefix.' '.$objectid.' '.$extrafieldsobjectkey.' '.$mode); @@ -1935,6 +1938,12 @@ class ExtraFields if (!empty($hidden)) { $out = ''; } + + // If alwayseditable is false, and object is not in draft, then showOutputField + // @phan-suppress-next-line PhanUndeclaredConstantOfClass + if ($alwayseditable == 0 && is_object($object) && isset($object->status) && defined(get_class($object)."::STATUS_DRAFT") && $object->status != $object::STATUS_DRAFT) { + $out = $this->showOutputField($key, $value, $moreparam, $extrafieldsobjectkey, null, $object); + } /* Add comments if ($type == 'date') $out.=' (YYYY-MM-DD)'; elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)'; @@ -1987,6 +1996,7 @@ class ExtraFields // If alwayseditable is false, and object is not in draft, then we show value instead of input field $showValueInsteadOfInputField = 0; // Variable used to disable update of fields via ajax + // @phan-suppress-next-line PhanUndeclaredConstantOfClass if ($alwayseditable == 0 && is_object($object) && isset($object->status) && defined(get_class($object)."::STATUS_DRAFT") && $object->status != $object::STATUS_DRAFT) { $showValueInsteadOfInputField = 1; } From d22c3dbded6282f7a834981cbeb43da56cdac678 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 21:47:02 +0100 Subject: [PATCH 18/82] Trans --- htdocs/product/stock/replenish.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 150984d4064..1f0a72aeb43 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -745,7 +745,7 @@ if ($usevirtualstock == 0) { $stocklabel = $langs->trans('PhysicalStock'); } if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) { - $stocklabelbis = $stocklabel.' (Selected warehouse)'; + $stocklabelbis = $stocklabel.' ('.$langs->trans('SelectedWarehouse').')'; $stocklabel .= ' ('.$langs->trans("AllWarehouses").')'; } $texte = $langs->trans('Replenishment'); From ec1ea71175025787170d4ce0b4dbb99a91b4609d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 22:49:59 +0100 Subject: [PATCH 19/82] Fix to make protection ok when no stock and STOCK_ALLOW_NEGATIVE_TRANSFER on --- htdocs/product/stock/class/mouvementstock.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 6f4232b1ca7..45668188f93 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -478,7 +478,7 @@ class MouvementStock extends CommonObject return -8; } } else { - if (isset($product->stock_warehouse[$entrepot_id]) && (empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty))) { + if (empty($product->stock_warehouse[$entrepot_id]) || empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty)) { $langs->load("stocks"); $this->error = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; $this->errors[] = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; From 9191c216f3c95a8349f2878507f5fe131228b4e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 22:49:59 +0100 Subject: [PATCH 20/82] Fix to make protection ok when no stock and STOCK_ALLOW_NEGATIVE_TRANSFER on --- htdocs/product/stock/class/mouvementstock.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index fd7ea010270..60cd678ba36 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -446,7 +446,7 @@ class MouvementStock extends CommonObject return -8; } } else { - if (isset($product->stock_warehouse[$entrepot_id]) && (empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty))) { + if (empty($product->stock_warehouse[$entrepot_id]) || empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty)) { $langs->load("stocks"); $this->error = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; $this->errors[] = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; From 0d07520e02c8156834093e2a9fdce45198b2f7ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 22:49:59 +0100 Subject: [PATCH 21/82] Fix to make protection ok when no stock and STOCK_ALLOW_NEGATIVE_TRANSFER on --- htdocs/comm/action/class/actioncomm.class.php | 135 +++++++++--------- .../stock/class/mouvementstock.class.php | 2 +- 2 files changed, 70 insertions(+), 67 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index fb94299c405..249e342d5fc 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2715,83 +2715,86 @@ class ActionComm extends CommonObject // Load event $res = $this->fetch($actionCommReminder->fk_actioncomm); if ($res > 0) { - $res = $this->fetch_thirdparty(); - } - if ($res > 0) { - // PREPARE EMAIL - $errormesg = ''; + $res2 = $this->fetch_thirdparty(); + if ($res2 >= 0) { + // PREPARE EMAIL + $errormesg = ''; - // Make substitution in email content - $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $this); + // Make substitution in email content + $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $this); - complete_substitutions_array($substitutionarray, $langs, $this); + complete_substitutions_array($substitutionarray, $langs, $this); - // Content - $sendContent = make_substitutions($langs->trans($arraymessage->content), $substitutionarray); + // Content + $sendContent = make_substitutions($langs->trans($arraymessage->content), $substitutionarray); - //Topic - $sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->transnoentities('EventReminder')); + //Topic + $sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->transnoentities('EventReminder')); - // Recipient - $recipient = new User($this->db); - $res = $recipient->fetch($actionCommReminder->fk_user); - if ($res > 0) { - if (!empty($recipient->email)) { - $to = $recipient->email; + // Recipient + $recipient = new User($this->db); + $res = $recipient->fetch($actionCommReminder->fk_user); + if ($res > 0) { + if (!empty($recipient->email)) { + $to = $recipient->email; + } else { + $errormesg = "Failed to send remind to user id=".$actionCommReminder->fk_user.". No email defined for user."; + $error++; + } } else { - $errormesg = "Failed to send remind to user id=".$actionCommReminder->fk_user.". No email defined for user."; + $errormesg = "Failed to load recipient with user id=".$actionCommReminder->fk_user; $error++; } + + // Sender + $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); + if (empty($from)) { + $errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM"; + $error++; + } + + if (!$error) { + // Errors Recipient + $errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); + + // Mail Creation + $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', ''); + + // Sending Mail + if ($cMailFile->sendfile()) { + $nbMailSend++; + } else { + $errormesg = 'Failed to send email to: '.$to.' '.$cMailFile->error.implode(',', $cMailFile->errors); + $error++; + } + } + + if (!$error) { + $actionCommReminder->status = $actionCommReminder::STATUS_DONE; + + $res = $actionCommReminder->update($user); + if ($res < 0) { + $errorsMsg[] = "Failed to update status to done of ActionComm Reminder"; + $error++; + break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. + } + } else { + $actionCommReminder->status = $actionCommReminder::STATUS_ERROR; + $actionCommReminder->lasterror = dol_trunc($errormesg, 128, 'right', 'UTF-8', 1); + + $res = $actionCommReminder->update($user); + if ($res < 0) { + $errorsMsg[] = "Failed to update status to error of ActionComm Reminder"; + $error++; + break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. + } else { + $errorsMsg[] = $errormesg; + } + } } else { - $errormesg = "Failed to load recipient with user id=".$actionCommReminder->fk_user; + $errorsMsg[] = 'Failed to fetch record thirdparty on actioncomm with ID = '.$actionCommReminder->fk_actioncomm; $error++; } - - // Sender - $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); - if (empty($from)) { - $errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM"; - $error++; - } - - if (!$error) { - // Errors Recipient - $errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); - - // Mail Creation - $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', ''); - - // Sending Mail - if ($cMailFile->sendfile()) { - $nbMailSend++; - } else { - $errormesg = 'Failed to send email to: '.$to.' '.$cMailFile->error.implode(',', $cMailFile->errors); - $error++; - } - } - - if (!$error) { - $actionCommReminder->status = $actionCommReminder::STATUS_DONE; - - $res = $actionCommReminder->update($user); - if ($res < 0) { - $errorsMsg[] = "Failed to update status to done of ActionComm Reminder"; - $error++; - break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. - } - } else { - $actionCommReminder->status = $actionCommReminder::STATUS_ERROR; - $actionCommReminder->lasterror = dol_trunc($errormesg, 128, 'right', 'UTF-8', 1); - - $res = $actionCommReminder->update($user); - if ($res < 0) { - $errorsMsg[] = "Failed to update status to error of ActionComm Reminder"; - $error++; - break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. - } else { - $errorsMsg[] = $errormesg; - } - } } else { $errorsMsg[] = 'Failed to fetch record actioncomm with ID = '.$actionCommReminder->fk_actioncomm; $error++; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 6f4232b1ca7..45668188f93 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -478,7 +478,7 @@ class MouvementStock extends CommonObject return -8; } } else { - if (isset($product->stock_warehouse[$entrepot_id]) && (empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty))) { + if (empty($product->stock_warehouse[$entrepot_id]) || empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty)) { $langs->load("stocks"); $this->error = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; $this->errors[] = $langs->trans('qtyToTranferIsNotEnough').' : '.$product->ref; From 4a3edf9294aec3daca8301169291b24049357346 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 22:49:59 +0100 Subject: [PATCH 22/82] Fix to make protection ok when no stock and STOCK_ALLOW_NEGATIVE_TRANSFER on --- htdocs/comm/action/class/actioncomm.class.php | 133 +++++++++--------- 1 file changed, 69 insertions(+), 64 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 3ca29e1af4e..0b0e6d73db9 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2702,82 +2702,87 @@ class ActionComm extends CommonObject // Load event $res = $this->fetch($actionCommReminder->fk_actioncomm); - if ($res > 0) $res = $this->fetch_thirdparty(); if ($res > 0) { - // PREPARE EMAIL - $errormesg = ''; + $res2 = $this->fetch_thirdparty(); + if ($res2 >= 0) { + // PREPARE EMAIL + $errormesg = ''; - // Make substitution in email content - $substitutionarray = getCommonSubstitutionArray($langs, 0, '', $this); + // Make substitution in email content + $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $this); - complete_substitutions_array($substitutionarray, $langs, $this); + complete_substitutions_array($substitutionarray, $langs, $this); - // Content - $sendContent = make_substitutions($langs->trans($arraymessage->content), $substitutionarray); + // Content + $sendContent = make_substitutions($langs->trans($arraymessage->content), $substitutionarray); - //Topic - $sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->transnoentities('EventReminder')); + //Topic + $sendTopic = (!empty($arraymessage->topic)) ? $arraymessage->topic : html_entity_decode($langs->transnoentities('EventReminder')); - // Recipient - $recipient = new User($this->db); - $res = $recipient->fetch($actionCommReminder->fk_user); - if ($res > 0) { - if (!empty($recipient->email)) { - $to = $recipient->email; + // Recipient + $recipient = new User($this->db); + $res = $recipient->fetch($actionCommReminder->fk_user); + if ($res > 0) { + if (!empty($recipient->email)) { + $to = $recipient->email; + } else { + $errormesg = "Failed to send remind to user id=".$actionCommReminder->fk_user.". No email defined for user."; + $error++; + } } else { - $errormesg = "Failed to send remind to user id=".$actionCommReminder->fk_user.". No email defined for user."; + $errormesg = "Failed to load recipient with user id=".$actionCommReminder->fk_user; $error++; } + + // Sender + $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); + if (empty($from)) { + $errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM"; + $error++; + } + + if (!$error) { + // Errors Recipient + $errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); + + // Mail Creation + $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', ''); + + // Sending Mail + if ($cMailFile->sendfile()) { + $nbMailSend++; + } else { + $errormesg = 'Failed to send email to: '.$to.' '.$cMailFile->error.implode(',', $cMailFile->errors); + $error++; + } + } + + if (!$error) { + $actionCommReminder->status = $actionCommReminder::STATUS_DONE; + + $res = $actionCommReminder->update($user); + if ($res < 0) { + $errorsMsg[] = "Failed to update status to done of ActionComm Reminder"; + $error++; + break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. + } + } else { + $actionCommReminder->status = $actionCommReminder::STATUS_ERROR; + $actionCommReminder->lasterror = dol_trunc($errormesg, 128, 'right', 'UTF-8', 1); + + $res = $actionCommReminder->update($user); + if ($res < 0) { + $errorsMsg[] = "Failed to update status to error of ActionComm Reminder"; + $error++; + break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. + } else { + $errorsMsg[] = $errormesg; + } + } } else { - $errormesg = "Failed to load recipient with user id=".$actionCommReminder->fk_user; + $errorsMsg[] = 'Failed to fetch record thirdparty on actioncomm with ID = '.$actionCommReminder->fk_actioncomm; $error++; } - - // Sender - $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); - if (empty($from)) { - $errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM"; - $error++; - } - - if (!$error) { - // Errors Recipient - $errors_to = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); - - // Mail Creation - $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', '', '', '', ''); - - // Sending Mail - if ($cMailFile->sendfile()) { - $nbMailSend++; - } else { - $errormesg = 'Failed to send email to: '.$to.' '.$cMailFile->error.implode(',', $cMailFile->errors); - $error++; - } - } - - if (!$error) { - $actionCommReminder->status = $actionCommReminder::STATUS_DONE; - - $res = $actionCommReminder->update($user); - if ($res < 0) { - $errorsMsg[] = "Failed to update status to done of ActionComm Reminder"; - $error++; - break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. - } - } else { - $actionCommReminder->status = $actionCommReminder::STATUS_ERROR; - $actionCommReminder->lasterror = dol_trunc($errormesg, 128, 'right', 'UTF-8', 1); - - $res = $actionCommReminder->update($user); - if ($res < 0) { - $errorsMsg[] = "Failed to update status to error of ActionComm Reminder"; - $error++; - break; // This is to avoid to have this error on all the selected email. If we fails here for one record, it may fails for others. We must solve first. - } else { - $errorsMsg[] = $errormesg; - } - } } else { $errorsMsg[] = 'Failed to fetch record actioncomm with ID = '.$actionCommReminder->fk_actioncomm; $error++; From e9c1274356162469298f6367182ebeee59ad4c31 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 23:47:39 +0100 Subject: [PATCH 23/82] Debug v21 --- htdocs/product/price.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index e10fe4caabd..2ca40d0bad0 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -2539,6 +2539,7 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT $total_ttc = $resultarray[2]; if (!getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) { + print ''."\n"; print ''; print '' . $langs->trans('Default') . ''; @@ -2580,7 +2581,10 @@ if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') || getDolGlobalString('PRODUIT print ''; if (!empty($extralabels)) { foreach ($extralabels as $key) { - print ''; + // Show field if not hidden + if (!empty($extrafields->attributes["product_customer_price"]['list'][$key]) && $extrafields->attributes["product_customer_price"]['list'][$key] != 3) { + print ''; + } } } if ($user->hasRight('produit', 'supprimer') || $user->hasRight('service', 'supprimer')) { From e87c66ba4edecf46854b3021439e62229ddfc80b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 20 Nov 2024 23:59:50 +0100 Subject: [PATCH 24/82] Debug v21 --- htdocs/theme/eldy/info-box.inc.php | 3 +++ htdocs/theme/md/info-box.inc.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index c0ae0fa7a93..1f5608090d7 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -447,6 +447,9 @@ a.vmenu span, span.vmenu, span.vmenu span { .infobox-order_supplier:not(.error) { color: #599caf; } +.infobox-order_supplier::before { + margin-left: 5px; +} .infobox-contrat, .infobox-ticket{ color: #3bbfa8; } diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index 2107fc5bec3..71ac51a3d7f 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -136,6 +136,9 @@ div.login_block_other a { .infobox-order_supplier:not(.pictotitle):not(.error) { color: #599caf; } +.infobox-order_supplier::before { + margin-left: 3px; +} .infobox-contrat, .infobox-ticket{ color: #46a676; From 275627bd141a5396db846f5ff79ba7568db95ba6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 00:57:16 +0100 Subject: [PATCH 25/82] Clean code --- htdocs/public/ticket/ajax/ajax.php | 2 +- htdocs/ticket/class/ticket.class.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/public/ticket/ajax/ajax.php b/htdocs/public/ticket/ajax/ajax.php index e28b849eb2d..a2f57cade82 100644 --- a/htdocs/public/ticket/ajax/ajax.php +++ b/htdocs/public/ticket/ajax/ajax.php @@ -57,7 +57,7 @@ include_once '../../../main.inc.php'; // Load $user and permissions * @var DoliDB $db */ - $action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); $id = GETPOSTINT('id'); $email = GETPOST('email', 'custom', 0, FILTER_VALIDATE_EMAIL); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index aafe16ca868..691385ef878 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2186,7 +2186,7 @@ class Ticket extends CommonObject { if ($this->id) { $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; - $sql .= " SET fk_soc = ".($id > 0 ? $id : "null"); + $sql .= " SET fk_soc = ".($id > 0 ? (int) $id : "null"); $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this).'::setCustomer sql='.$sql); $resql = $this->db->query($sql); @@ -2210,7 +2210,7 @@ class Ticket extends CommonObject { if ($this->id) { $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; - $sql .= " SET progress = ".($percent > 0 ? $percent : "null"); + $sql .= " SET progress = ".($percent > 0 ? (float) $percent : "null"); $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this).'::set_progression sql='.$sql); $resql = $this->db->query($sql); @@ -2234,7 +2234,7 @@ class Ticket extends CommonObject { if ($this->id) { $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; - $sql .= " SET fk_contract = ".($contractid > 0 ? $contractid : "null"); + $sql .= " SET fk_contract = ".($contractid > 0 ? (int) $contractid : "null"); $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this).'::setContract sql='.$sql); $resql = $this->db->query($sql); From 2d135b4c222238d85a99d76784d5f65d7a5acb95 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 02:27:41 +0100 Subject: [PATCH 26/82] Add step to read DCO --- .github/CONTRIBUTING.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 1eae1b063b0..d898628013e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -36,12 +36,13 @@ Definition: As the Developer: -1. [Fork](https://help.github.com/articles/fork-a-repo) the [GitHub repository](https://github.com/Dolibarr/dolibarr). -2. Clone your fork. -3. Choose a branch(See the [Branches](#branches) section below). -4. Read our developer documentation on the [Dolibarr Wiki](https://wiki.dolibarr.org/index.php?title=Developer_documentation). -5. Commit and push your changes. -6. [Make a pull request](https://help.github.com/articles/creating-a-pull-request). +1. Check you agree with the terms of the [DCO - Developer's Certificate of Origin](https://github.com/Dolibarr/dolibarr/DCO) +2. [Fork](https://help.github.com/articles/fork-a-repo) the [GitHub repository](https://github.com/Dolibarr/dolibarr). +3. Clone your fork. +4. Choose a branch(See the [Branches](#branches) section below). +5. Read our developer documentation on the [Dolibarr Wiki](https://wiki.dolibarr.org/index.php?title=Developer_documentation). +6. Commit and push your changes. +7. [Make a pull request](https://help.github.com/articles/creating-a-pull-request). As the PR Maintainer: From d04e0a7ac2dfe0c7818ec5d267cb7b14a587e825 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 04:45:11 +0100 Subject: [PATCH 27/82] Debug v21 --- htdocs/compta/bank/bankentries_list.php | 13 +++-- htdocs/compta/bank/releve.php | 3 +- htdocs/core/lib/bank.lib.php | 69 +++++++++++++++++++------ htdocs/langs/en_US/banks.lang | 2 +- htdocs/langs/en_US/stocks.lang | 1 + 5 files changed, 66 insertions(+), 22 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 6f4e4a946f3..3dd37bf0d1b 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -554,7 +554,11 @@ if ($id > 0 || !empty($ref)) { // Bank card $head = bank_prepare_head($object); - print dol_get_fiche_head($head, 'journal', $langs->trans("FinancialAccount"), 0, 'account'); + $activetab = 'journal'; + if ($action == 'reconcile') { + $activetab = 'reconcile'; + } + print dol_get_fiche_head($head, $activetab, $langs->trans("FinancialAccount"), 0, 'account'); $linkback = ''.$langs->trans("BackToList").''; @@ -566,7 +570,7 @@ if ($id > 0 || !empty($ref)) { /* * Buttons actions */ - + /* Moved into tab if ($action != 'reconcile') { if ($object->canBeConciliated() > 0) { $allowautomaticconciliation = false; // TODO @@ -598,6 +602,7 @@ if ($id > 0 || !empty($ref)) { } } } + */ } $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,"; @@ -1032,8 +1037,8 @@ if ($resql) { print ''; print ' '.$langs->trans("otherwise").' '; print ''; - print ' '.$langs->trans("or").' '; - print ''; + //print ' '.$langs->trans("or").' '; + //print ''; print ''; print '
'; diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index f1d3523c336..1ebf78604fd 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -310,7 +310,7 @@ if (empty($numref)) { print dol_get_fiche_end(); - + /* Moved as a tab if ($object->canBeConciliated() > 0) { $allowautomaticconciliation = false; // TODO $titletoconciliatemanual = $langs->trans("Conciliate"); @@ -339,6 +339,7 @@ if (empty($numref)) { } } } + */ // List of mass actions available $arrayofmassactions = array( diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 787ae745949..7091f6aa0e5 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -38,7 +38,8 @@ */ function bank_prepare_head(Account $object) { - global $db, $langs, $conf; + global $db, $langs, $conf, $user; + $h = 0; $head = array(); @@ -52,23 +53,44 @@ function bank_prepare_head(Account $object) $head[$h][2] = 'journal'; $h++; - // if ($conf->global->MAIN_FEATURES_LEVEL >= 1) - // { - $head[$h][0] = DOL_URL_ROOT."/compta/bank/treso.php?account=".$object->id; - $head[$h][1] = $langs->trans("PlannedTransactions"); - $head[$h][2] = 'cash'; - $h++; - // } + if ($object->canBeConciliated() > 0) { + $allowautomaticconciliation = false; // TODO + $titletoconciliatemanual = $langs->trans("Conciliate"); + $titletoconciliateauto = $langs->trans("Conciliate"); + if ($allowautomaticconciliation) { + $titletoconciliatemanual .= ' ('.$langs->trans("Manual").')'; + $titletoconciliateauto .= ' ('.$langs->trans("Auto").')'; + } - $head[$h][0] = DOL_URL_ROOT."/compta/bank/annuel.php?account=".$object->id; - $head[$h][1] = $langs->trans("IOMonthlyReporting"); - $head[$h][2] = 'annual'; - $h++; + $param = ''; - $head[$h][0] = DOL_URL_ROOT."/compta/bank/graph.php?account=".$object->id; - $head[$h][1] = $langs->trans("Graph"); - $head[$h][2] = 'graph'; - $h++; + // If not cash account and can be reconciliate + if ($user->hasRight('banque', 'consolidate')) { + $head[$h][0] = DOL_URL_ROOT."/compta/bank/bankentries_list.php?id=".$object->id.'&action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0&search_account='.$object->id.$param; + $head[$h][1] = $titletoconciliatemanual; + $head[$h][2] = 'reconcile'; + $h++; + }/* else { + $buttonreconcile = ''.$titletoconciliatemanual.''; + }*/ + + if ($allowautomaticconciliation) { + // If not cash account and can be reconciliate + if ($user->hasRight('banque', 'consolidate')) { + $newparam = $param; + $newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam); + + $head[$h][0] = DOL_URL_ROOT."/compta/bank/bankentries_list.php?id=".$object->id.'&action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0&search_account='.$object->id.$newparam; + $head[$h][1] = $titletoconciliateauto; + $head[$h][2] = 'reconcileauto'; + $h++; + + //$buttonreconcile .= ' '.$titletoconciliateauto.''; + }/* else { + $buttonreconcile .= ' '.$titletoconciliateauto.''; + }*/ + } + } if ($object->type != Account::TYPE_CASH || getDolGlobalString('BANK_CAN_RECONCILIATE_CASHACCOUNT')) { $nbReceipts = 0; @@ -110,6 +132,21 @@ function bank_prepare_head(Account $object) $head[$h][2] = 'document'; $h++; + $head[$h][0] = DOL_URL_ROOT."/compta/bank/annuel.php?account=".$object->id; + $head[$h][1] = $langs->trans("IOMonthlyReporting"); + $head[$h][2] = 'annual'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/compta/bank/graph.php?account=".$object->id; + $head[$h][1] = $langs->trans("Graph"); + $head[$h][2] = 'graph'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/compta/bank/treso.php?account=".$object->id; + $head[$h][1] = $langs->trans("PlannedTransactions"); + $head[$h][2] = 'cash'; + $h++; + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 7084a3332d7..fc5a4283965 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -133,7 +133,7 @@ DeleteTransaction=Delete entry ConfirmDeleteTransaction=Are you sure you want to delete this entry? ThisWillAlsoDeleteBankRecord=This will also delete generated bank entry BankMovements=Movements -PlannedTransactions=Planned entries +PlannedTransactions=Upcoming entries Graph=Graphs ExportDataset_banque_1=Bank entries and account statement ExportDataset_banque_2=Deposit slip diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 400a39ec951..0648dde54b4 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -348,3 +348,4 @@ QtyViewed=Quantity viewed QtyStock=Quantity on stock QtyRegulated=Quantity on stock correction InventoryEntrepot=Warehouse identity +SelectedWarehouse=Select a warehouse From ac91727bb6bedc93784c6ea26b3ece1b8d86bb00 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 04:49:57 +0100 Subject: [PATCH 28/82] Debug v21 --- htdocs/compta/bank/treso.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 69c859037b2..243ab3af6c1 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -216,7 +216,7 @@ if (GETPOST("account") || GETPOST("ref")) { $morehtml = ''; $limit = 0; - print_barre_liste($langs->trans("RemainderToPay"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit, 0, 0, 1); + print_barre_liste($langs->trans("PlannedTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $picto, 0, $morehtml, '', $limit, 0, 0, 1); $solde = $object->solde(0); From cc0db78984843173339cd6cab4b338bea6e722d4 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech <52404047+nicolas-eoxia@users.noreply.github.com> Date: Thu, 21 Nov 2024 08:48:55 +0100 Subject: [PATCH 29/82] FIX #32007 missing parameter on function multiSelectArrayWithCheckbox (#32008) --- htdocs/projet/tasks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index d770f23f4f5..6f4a3aa4832 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -857,7 +857,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object- print ''; } elseif ($id > 0 || !empty($ref)) { - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields /* * Projet card in view mode From c907327e3c0e6bea8d1b81e389e0b0979404cba7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 09:08:54 +0100 Subject: [PATCH 30/82] Fix removed foreign key not on a unique key --- htdocs/install/mysql/migration/19.0.0-20.0.0.sql | 3 ++- htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index b2397e2069c..ec3053a6a40 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -349,7 +349,8 @@ ALTER TABLE llx_societe_commerciaux ADD COLUMN fk_c_type_contact_code varchar(32 -- VPGSQL8.2 DROP INDEX uk_societe_commerciaux; ALTER TABLE llx_societe_commerciaux ADD UNIQUE INDEX uk_societe_commerciaux_c_type_contact (fk_soc, fk_user, fk_c_type_contact_code); ALTER TABLE llx_c_type_contact ADD INDEX idx_c_type_contact_code (code); -ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code); +--Removed, not unique. ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code); +ALTER TABLE llx_societe_commerciaux DROP FOREIGN KEY fk_societe_commerciaux_fk_c_type_contact_code; ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid); ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user(rowid); diff --git a/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql b/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql index 1672ff659c1..f4bc719c4ba 100644 --- a/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql +++ b/htdocs/install/mysql/tables/llx_societe_commerciaux.key.sql @@ -17,6 +17,6 @@ -- =================================================================== ALTER TABLE llx_societe_commerciaux ADD UNIQUE INDEX uk_societe_commerciaux_c_type_contact (fk_soc, fk_user, fk_c_type_contact_code); -ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code); +--Removed, not unique. ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_c_type_contact_code FOREIGN KEY (fk_c_type_contact_code) REFERENCES llx_c_type_contact(code); ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_soc FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid); ALTER TABLE llx_societe_commerciaux ADD CONSTRAINT fk_societe_commerciaux_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user(rowid); From bf3a08ffa51771a197248911e1ee406833c01a59 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 09:41:59 +0100 Subject: [PATCH 31/82] Tooltip --- htdocs/langs/en_US/ticket.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index bb0cd645857..f0f7a31831d 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -75,7 +75,7 @@ TicketParamMail=Email setup TicketEmailNotificationFrom=Sender e-mail for notification on answers TicketEmailNotificationFromHelp=Sender e-mail to use to send the notification email when an answer is provided inside the back office. For example noreply@example.com TicketEmailNotificationTo=Notify ticket creation to this e-mail address -TicketEmailNotificationToHelp=If present, this e-mail address will be notified of a ticket creation +TicketEmailNotificationToHelp=If present, this e-mail address will be notified of a ticket creation (in addition to already assigned contacts) TicketNewEmailBodyLabel=Text message sent after creating a ticket TicketNewEmailBodyHelp=The text specified here will be inserted into the email confirming the creation of a new ticket from the public interface. Information on the consultation of the ticket are automatically added. TicketParamPublicInterface=Public interface setup From 4c95fa2ac6b8a96baa6091a955aa128db30aa788 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 10:10:32 +0100 Subject: [PATCH 32/82] Fix clean a bugged option duplicated at wrong place in setup --- htdocs/admin/ticket.php | 40 +++------------------------- htdocs/ticket/class/ticket.class.php | 8 +++--- 2 files changed, 7 insertions(+), 41 deletions(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 76fd7f98064..b05d7e71f23 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -89,17 +89,9 @@ if ($action == 'updateMask') { } elseif (preg_match('/set_(.*)/', $action, $reg)) { $code = $reg[1]; $value = GETPOSTISSET($code) ? GETPOSTINT($code) : 1; - if ($code == 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS' && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } - } else { - $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } + $res = dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; } } elseif (preg_match('/del_(.*)/', $action, $reg)) { $code = $reg[1]; @@ -211,15 +203,6 @@ if ($action == 'updateMask') { if (!($res > 0)) { $error++; } - - // For compatibility when javascript is not enabled - if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 && empty($conf->use_javascript_ajax)) { - $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - } - } } @@ -659,23 +642,6 @@ print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationToH print ''; print ''; -// Also send to TICKET_NOTIFICATION_EMAIL_TO for responses (not only creation) -if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - print ''.$langs->trans("TicketsEmailAlsoSendToMainAddress").''; - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $formcategory->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS); - } - print ''; - print ''; - print $formcategory->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help'); - print ''; - print ''; -} - // Message header $mail_intro = getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO', ''); print ''.$langs->trans("TicketMessageMailIntro"); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 219feb82a0f..77671f61614 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2779,10 +2779,10 @@ class Ticket extends CommonObject } // Add global email address recipient - if (getDolGlobalString('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS') && - getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && !array_key_exists(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'), $sendto) - ) { - $sendto[getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')] = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); + if (getDolGlobalString('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS') && !array_key_exists(getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'), $sendto)) { + if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')) { + $sendto[getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')] = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); + } } if (!empty($sendto)) { From 9a5aea09da2732df10a241260d4b44c280c39bfd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 12:33:23 +0100 Subject: [PATCH 33/82] FIX Debug option not working replaced by the one that works. --- htdocs/admin/ticket.php | 31 +++++++++- htdocs/admin/ticket_public.php | 56 ++++++------------- ...terface_50_modTicket_TicketEmail.class.php | 18 ++++-- htdocs/langs/en_US/ticket.lang | 12 ++-- htdocs/ticket/class/ticket.class.php | 2 +- 5 files changed, 64 insertions(+), 55 deletions(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index b05d7e71f23..192a8ad9c98 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -59,6 +59,15 @@ $reg = array(); include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; +if (GETPOSTISSET('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION')) { // only for no js case + $param_disable_email = GETPOST('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION', $param_disable_email, 'chaine', 0, '', $conf->entity); + if (!($res > 0)) { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + } +} + if ($action == 'updateMask') { $maskconstticket = GETPOST('maskconstticket', 'aZ09'); $maskticket = GETPOST('maskticket', 'alpha'); @@ -595,13 +604,14 @@ print $formcategory->buttonsSaveCancel("Save", '', array(), 0, 'reposition'); print ''; +print '
'; /* - * Notification + * Emails */ // Admin var of module -print load_fiche_titre($langs->trans("Notification"), '', ''); +print load_fiche_titre($langs->trans("Emails"), '', ''); print ''; @@ -636,12 +646,27 @@ print ''; // Email for notification of TICKET_CREATE print ''; print ''; +print ''; print ''; print ''; +// Disable email to customers +print ''; +print ''; +print ''; +print ''; + // Message header $mail_intro = getDolGlobalString('TICKET_MESSAGE_MAIL_INTRO', ''); print ''; print ''; - // Also send to main email address - if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { - print ''; - print ''; - print ''; - print ''; - } - if (empty($conf->use_javascript_ajax)) { print ''; print ''; @@ -493,20 +467,6 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { print '
'; print '
'.$langs->trans("TicketEmailNotificationTo").''; -print ''; print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1, 'help'); print '
'; +print $form->textwithpicto($langs->trans("TicketsNotifyThirdPartyFromBackOfficeByDefault"), $langs->trans("TicketsNotifyThirdPartyFromBackOfficeByDefaultHelp"), 1, 'help'); +print ''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION'); +} else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION", $arrval, getDolGlobalInt('TICKET_CHECK_NOTIFY_THIRDPARTY_AT_CREATION')); +} +print '
'.$langs->trans("TicketMessageMailIntro"); diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index abda918f202..91ae4bf5491 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -72,15 +72,6 @@ if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') { } } - if (GETPOSTISSET('TICKET_DISABLE_CUSTOMER_MAILS')) { // only for no js case - $param_disable_email = GETPOST('TICKET_DISABLE_CUSTOMER_MAILS', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity); - if (!($res > 0)) { - $error++; - $errors[] = $db->lasterror(); - } - } - if (GETPOSTISSET('TICKET_SHOW_COMPANY_LOGO')) { // only for no js case $param_show_module_logo = GETPOST('TICKET_SHOW_COMPANY_LOGO', 'alpha'); $res = dolibarr_set_const($db, 'TICKET_SHOW_COMPANY_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity); @@ -412,23 +403,6 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { print '
'.$langs->trans("TicketsEmailAlsoSendToMainAddress").''; - if (!empty($conf->use_javascript_ajax)) { - print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, getDolGlobalInt('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS')); - } - print ''; - print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv("TicketEmailNotificationTo").' ('.$langs->transnoentitiesnoconv("Creation").')', $langs->trans("Settings")), 1, 'help'); - print '
'; - // Activate email creation to user - print ''; - print ''; - print ''; - // Text of email after creatio of a ticket $mail_mesg_new = getDolGlobalString("TICKET_MESSAGE_MAIL_NEW", $langs->trans('TicketNewEmailBody')); print ''; print ''; + // Also send to main email address + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { + print ''; + print ''; + print ''; + } + print '
'; - print $form->textwithpicto($langs->trans("TicketsDisableCustomerEmail"), $langs->trans("TicketsDisableEmailHelp"), 1, 'help'); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, getDolGlobalInt('TICKET_DISABLE_CUSTOMER_MAILS')); - } - print '
'; @@ -541,6 +501,22 @@ if (getDolGlobalInt('TICKET_ENABLE_PUBLIC_INTERFACE')) { print '
'.$langs->trans("TicketsEmailAlsoSendToMainAddress"); + print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp", $langs->transnoentitiesnoconv("TicketEmailNotificationTo").' ('.$langs->transnoentitiesnoconv("Creation").')', $langs->trans("Settings")), 1, 'help'); + print ''; + if (!empty($conf->use_javascript_ajax)) { + print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, getDolGlobalInt('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS')); + } + print '
'; print ''; diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index faa556da235..ed97f3b7b40 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -183,15 +183,19 @@ class InterfaceTicketEmail extends DolibarrTriggers $see_ticket_customer = 'TicketNewEmailBodyInfosTrackUrlCustomer'; // Send email to notification email + // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation because email sending is already managed by page + // $object->context['createdfrompublicinterface'] may also be defined when creation done from public interface if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && empty($object->context['disableticketemail'])) { - $sendto = !getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') ? '' : $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); if ($sendto) { $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); } } // Send email to customer - if (!getDolGlobalInt('TICKET_DISABLE_CUSTOMER_MAILS') && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) { + // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation because email sending is already managed by page + // $object->context['createdfrompublicinterface'] may also be defined when creation done from public interface + if (empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) { $sendto = ''; // if contact selected send to email's contact else send to email's thirdparty @@ -238,15 +242,17 @@ class InterfaceTicketEmail extends DolibarrTriggers $see_ticket_customer = 'TicketCloseEmailBodyInfosTrackUrlCustomer'; // Send email to notification email + // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation but not at closing if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && empty($object->context['disableticketemail'])) { - $sendto = !getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') ? '' : $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + $sendto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); if ($sendto) { $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); } } // Send email to customer. - if (!getDolGlobalString('TICKET_DISABLE_CUSTOMER_MAILS') && empty($object->context['disableticketemail'])) { + // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation but not at closing + if (empty($object->context['disableticketemail'])) { $linked_contacts = $object->listeContact(-1, 'thirdparty'); $linked_contacts = array_merge($linked_contacts, $object->listeContact(-1, 'internal')); if (empty($linked_contacts) && getDolGlobalString('TICKET_NOTIFY_AT_CLOSING') && !empty($object->fk_soc)) { @@ -346,7 +352,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_admin .= '

'.$langs->trans('Message').' :

'.$message.'


'; $message_admin .= '

'.$langs->trans('SeeThisTicketIntomanagementInterface').'

'; - $from = getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . '<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; + $from = (getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' ' : '') . '<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; $trackid = 'tic'.$object->id; @@ -434,7 +440,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $message_customer .= '

'.$langs->trans($see_ticket).' : '.$url_public_ticket.'

'; $message_customer .= '

'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'

'; - $from = (!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? '' : getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' ').'<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; + $from = (getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' ' : '').'<' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; $trackid = 'tic'.$object->id; diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index f0f7a31831d..4e3788f0512 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -72,10 +72,10 @@ TicketPublicAccess=A public interface requiring no identification is available a TicketSetupDictionaries=The type of ticket, severity and analytic codes are configurable from dictionaries TicketParamModule=Module variable setup TicketParamMail=Email setup -TicketEmailNotificationFrom=Sender e-mail for notification on answers -TicketEmailNotificationFromHelp=Sender e-mail to use to send the notification email when an answer is provided inside the back office. For example noreply@example.com +TicketEmailNotificationFrom=Sender e-mail for notification on tickets +TicketEmailNotificationFromHelp=Sender e-mail to use to send the notification emails for tickets creation or messages. For example noreply@example.com TicketEmailNotificationTo=Notify ticket creation to this e-mail address -TicketEmailNotificationToHelp=If present, this e-mail address will be notified of a ticket creation (in addition to already assigned contacts) +TicketEmailNotificationToHelp=If present, this e-mail address will be notified of a ticket creation (in addition to any other default recipients) TicketNewEmailBodyLabel=Text message sent after creating a ticket TicketNewEmailBodyHelp=The text specified here will be inserted into the email confirming the creation of a new ticket from the public interface. Information on the consultation of the ticket are automatically added. TicketParamPublicInterface=Public interface setup @@ -96,7 +96,9 @@ TicketPublicInterfaceTextHelpMessageHelpAdmin=This text will appear above the me ExtraFieldsTicket=Extra attributes TicketCkEditorEmailNotActivated=HTML editor is not activated. Please put FCKEDITOR_ENABLE_MAIL content to 1 to get it. TicketsDisableEmail=Do not send emails for ticket creation or message recording -TicketsDisableEmailHelp=By default, emails are sent when new tickets or messages created. Enable this option to disable *all* email notifications +TicketsDisableEmailHelp=By default, notification emails to third parties are sent when new tickets or messages are created for both backoffice and public interface. Enable this option to disable email notifications to thirdparties when creation is done from backoffice. +TicketsNotifyThirdPartyFromBackOfficeByDefault=Notify third party by default on ticket creation from backoffice +TicketsNotifyThirdPartyFromBackOfficeByDefaultHelp=When creating a ticket from the backoffice, the option "Notify third party" will be checked by default TicketsLogEnableEmail=Enable log by email TicketsLogEnableEmailHelp=At each change, an email will be sent **to each contact** associated with the ticket. TicketParams=Params @@ -117,7 +119,7 @@ TicketsAutoAssignTicketHelp=When creating a ticket, the user can be automaticall TicketNumberingModules=Tickets numbering module TicketsModelModule=Document templates for tickets TicketNotifyTiersAtCreation=Notify third party at creation -TicketsDisableCustomerEmail=Always disable emails when a ticket is created from public interface +TicketsDisableCustomerEmail=Always disable emails to third parties when a ticket is created from the backoffice TicketsPublicNotificationNewMessage=Send email(s) when a new message/comment is added to a ticket TicketsPublicNotificationNewMessageHelp=Send email(s) when a new message is added from public interface (to assigned user or the notifications email to (update) and/or the notifications email to) TicketPublicNotificationNewMessageDefaultEmail=Notifications email to (update) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 77671f61614..24629554b32 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -223,7 +223,7 @@ class Ticket extends CommonObject public $cache_msgs_ticket; /** - * @var int Notify thirdparty at create + * @var int Save if a thirdparty was notified at creation at ticket or not */ public $notify_tiers_at_create; From 1a752c16cfcab8703c3c80258e9e5ea9ec564184 Mon Sep 17 00:00:00 2001 From: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:11:19 +0100 Subject: [PATCH 34/82] Fix setincoterms Location (#32037) * Fix setincoterms Location * Fix location_incoterms on invoice card * Fix location_incoterms on supplier order * Fix location_incoterms on supplier invoice --- htdocs/commande/card.php | 2 +- htdocs/compta/facture/card.php | 2 +- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 7caa20868fa..586eb8bcbaa 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -633,7 +633,7 @@ if (empty($reshook)) { } } elseif ($action == 'set_incoterms' && isModEnabled('incoterm') && $usercancreate) { // Set incoterm - $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOSTFLOAT('location_incoterms')); + $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOST('location_incoterms')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f1d2eaaeaf6..1fbe7c56502 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -583,7 +583,7 @@ if (empty($reshook)) { } } } elseif ($action == 'set_incoterms' && isModEnabled('incoterm') && $usercancreate) { // Set incoterm - $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOSTINT('location_incoterms')); + $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOST('location_incoterms')); } elseif ($action == 'setbankaccount' && $usercancreate) { // bank account $result = $object->setBankAccount(GETPOSTINT('fk_account')); } elseif ($action == 'setremisepercent' && $usercancreate) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 66761d12cdd..8f3041a20ec 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -220,7 +220,7 @@ if (empty($reshook)) { // Set incoterm if ($action == 'set_incoterms' && $usercancreate) { - $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOSTINT('location_incoterms')); + $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOST('location_incoterms')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index bc0d1140b2d..2f64ae47dc4 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -445,7 +445,7 @@ if (empty($reshook)) { } } elseif ($action == 'set_incoterms' && isModEnabled('incoterm') && $usercancreate) { // Set incoterm - $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOSTINT('location_incoterms')); + $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOST('location_incoterms')); } elseif ($action == 'setmode' && $usercancreate) { // payment mode $result = $object->setPaymentMethods(GETPOSTINT('mode_reglement_id')); From 283265448a1692a548ccba666e9516c3a8fb2b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 Nov 2024 17:12:16 +0100 Subject: [PATCH 35/82] fix CI phpstan (#32032) * fix CI phpstan * Update interface_50_modTicket_TicketEmail.class.php * Update interface_50_modTicket_TicketEmail.class.php --- htdocs/core/lib/bank.lib.php | 2 +- .../interface_50_modTicket_TicketEmail.class.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 7091f6aa0e5..5815d177767 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -54,7 +54,7 @@ function bank_prepare_head(Account $object) $h++; if ($object->canBeConciliated() > 0) { - $allowautomaticconciliation = false; // TODO + $allowautomaticconciliation = getDolGlobalBool('MAIN_ALLOW_AUTOMATIC_CONCILIATION'); // TODO $titletoconciliatemanual = $langs->trans("Conciliate"); $titletoconciliateauto = $langs->trans("Conciliate"); if ($allowautomaticconciliation) { diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 27b544205b1..9661cdb6416 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -164,9 +164,9 @@ class InterfaceTicketEmail extends DolibarrTriggers // $object->context['createdfrompublicinterface'] may also be defined when creation done from public interface if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && empty($object->context['disableticketemail'])) { $sendto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); - if ($sendto) { - $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); - } + // if ($sendto) { // already test, can't be empty + $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); + // } } // Send email to assignee if an assignee was set at creation @@ -251,9 +251,9 @@ class InterfaceTicketEmail extends DolibarrTriggers // Note: $object->context['disableticketemail'] is set to 1 by public interface at creation but not at closing if (getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO') && empty($object->context['disableticketemail'])) { $sendto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO'); - if ($sendto) { - $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); - } + // if ($sendto) { // already test, can't be empty + $this->composeAndSendAdminMessage($sendto, $subject_admin, $body_admin, $object, $langs); + // } } // Send email to customer. From 0577fe44a4903520386c75843d0a289a9e5a3695 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 21 Nov 2024 17:13:22 +0100 Subject: [PATCH 36/82] FIX: when create intervention from propal (or other object), element link is mising after creation (#32035) * fix: when create intervention from propal, element link is mising * fix: when create intervention from propal, element link is mising * fix: when create intervention from propal, element link is mising --- htdocs/fichinter/card.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index eed887b616c..c29768f40c3 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -844,7 +844,7 @@ if ($action == 'create') { $res = $soc->fetch($socid); } - if (GETPOSTINT('origin') && GETPOSTINT('originid')) { + if (GETPOST('origin', 'alphanohtml') && GETPOSTINT('originid')) { // Parse element/subelement (ex: project_task) $regs = array(); $element = $subelement = GETPOST('origin', 'alphanohtml'); @@ -1011,6 +1011,7 @@ if ($action == 'create') { if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { $newclassname = $classname; if ($newclassname == 'Propal') { + $langs->load('propal'); $newclassname = 'CommercialProposal'; } print ''.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1).''; @@ -1054,7 +1055,7 @@ if ($action == 'create') { print $form->buttonsSaveCancel("CreateDraftIntervention"); // Show origin lines - if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { + if (!empty($origin) && !empty($originid) && is_object($objectsrc) && !getDolGlobalInt('FICHINTER_DISABLE_DETAILS')) { $title = $langs->trans('Services'); print load_fiche_titre($title); From b8c3bd8f41f5af62fb59d860fa95eaca0f361ea5 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 21 Nov 2024 17:19:52 +0100 Subject: [PATCH 37/82] 20 fix php warning (#32029) * fix: php warning intervention when FICHINTER_DISABLE_DETAILS is set * Update list.php --------- Co-authored-by: Laurent Destailleur --- htdocs/fichinter/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 30bfffaaf1b..08b4b55373a 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -1025,7 +1025,7 @@ while ($i < $imaxinloop) { print ''."\n"; - $total += $obj->duree; + $total += (isset($obj->duree) ? $obj->duree : 0); } $i++; } From 6c2effa2247e5ef25ef6794d7f82574523ac4ceb Mon Sep 17 00:00:00 2001 From: Eric - CAP-REL <1468823+rycks@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:31:40 +0100 Subject: [PATCH 38/82] dol_add_file_process : return nb of success in case of multiple added files (#32027) --- 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 2a77d594349..737f8ac24fc 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1898,7 +1898,7 @@ function dol_init_file_process($pathtoscan = '', $trackid = '') * @param int<0,1> $generatethumbs 1=Generate also thumbs for uploaded image files * @param ?Object $object Object used to set 'src_object_*' fields * @param string $forceFullTestIndexation '1'=Force full text storage in database even if global option not set (consume a high level of data) - * @return int Return integer <=0 if KO, >0 if OK + * @return int Return integer <=0 if KO, nb of success if OK (>0) * @see dol_remove_file_process() */ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $updatesessionordb = 0, $varfiles = 'addedfile', $savingdocmask = '', $link = null, $trackid = '', $generatethumbs = 1, $object = null, $forceFullTestIndexation = '') @@ -2041,7 +2041,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $updatesessionor } } if ($nbok > 0) { - $res = 1; + $res = $nbok; setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs'); } } else { From d1ded1caa11391f5879072cd319ddb83079b358f Mon Sep 17 00:00:00 2001 From: Mathieu Moulin Date: Thu, 21 Nov 2024 18:05:35 +0100 Subject: [PATCH 39/82] Add option to hide only Volume (and keep weight) in shipping PDF - Issue #32030 (#32031) * Add option to hide only Volume (and keep weight) in shipping PDF * Fix use of option SHIPPING_PDF_HIDE_VOLUME in shipping lines --------- Co-authored-by: Laurent Destailleur --- htdocs/core/modules/expedition/doc/pdf_espadon.modules.php | 6 +++--- htdocs/core/modules/expedition/doc/pdf_rouget.modules.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 190a50e6ae1..f5873eaeeb3 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -689,7 +689,7 @@ class pdf_espadon extends ModelePdfExpedition $weighttxt = round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, getDolGlobalInt('SHIPMENT_ROUND_WEIGHT_ON_PDF', 5)).' '.measuringUnitString(0, "weight", $object->lines[$i]->weight_units, 1); } $voltxt = ''; - if (empty($object->lines[$i]->fk_product_type) && $object->lines[$i]->volume) { + if (empty($object->lines[$i]->fk_product_type) && $object->lines[$i]->volume && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { $voltxt = round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, getDolGlobalInt('SHIPMENT_ROUND_VOLUME_ON_PDF', 5)).' '.measuringUnitString(0, "volume", $object->lines[$i]->volume_units ? $object->lines[$i]->volume_units : 0, 1); } @@ -883,13 +883,13 @@ class pdf_espadon extends ModelePdfExpedition if (!empty($totalWeight)) { $totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs, -1, 'no', 1); } - if (!empty($totalVolume)) { + if (!empty($totalVolume) && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { $totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs, -1, 'no', 1); } if (!empty($object->trueWeight)) { $totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, (int) $object->weight_units, "weight", $outputlangs); } - if (!empty($object->trueVolume)) { + if (!empty($object->trueVolume) && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { if ($object->volume_units < 50) { $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); } else { diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index dfaa64aafea..9d54b5b4e88 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -583,7 +583,7 @@ class pdf_rouget extends ModelePdfExpedition $weighttxt = round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, getDolGlobalInt('SHIPMENT_ROUND_WEIGHT_ON_PDF', 5)).' '.measuringUnitString(0, "weight", $object->lines[$i]->weight_units, 1); } $voltxt = ''; - if (empty($object->lines[$i]->fk_product_type) && $object->lines[$i]->volume) { + if (empty($object->lines[$i]->fk_product_type) && $object->lines[$i]->volume && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { $voltxt = round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, getDolGlobalInt('SHIPMENT_ROUND_VOLUME_ON_PDF', 5)).' '.measuringUnitString(0, "volume", $object->lines[$i]->volume_units ? $object->lines[$i]->volume_units : 0, 1); } @@ -769,13 +769,13 @@ class pdf_rouget extends ModelePdfExpedition if (!empty($totalWeight)) { $totalWeighttoshow = showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs, -1, 'no', 1); } - if (!empty($totalVolume)) { + if (!empty($totalVolume) && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { $totalVolumetoshow = showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs, -1, 'no', 1); } if (!empty($object->trueWeight)) { $totalWeighttoshow = showDimensionInBestUnit($object->trueWeight, (int) $object->weight_units, "weight", $outputlangs); } - if (!empty($object->trueVolume)) { + if (!empty($object->trueVolume) && !getDolGlobalString('SHIPPING_PDF_HIDE_VOLUME')) { $totalVolumetoshow = showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); } From 63073f7e712fcb94a379991762321f91557be270 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 18:15:34 +0100 Subject: [PATCH 40/82] FIX #32021 --- htdocs/recruitment/class/recruitmentcandidature.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 7fa4a473d5c..26672044baa 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -18,21 +18,22 @@ */ /** - * \file class/recruitmentcandidature.class.php + * \file recruitment/class/recruitmentcandidature.class.php * \ingroup recruitment * \brief This file is a CRUD class file for RecruitmentCandidature (Create/Read/Update/Delete) */ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonpeople.class.php'; /** * Class for RecruitmentCandidature */ class RecruitmentCandidature extends CommonObject { + use CommonPeople; + /** * @var string ID of module. */ From 2e90ba085001cfa9be578b7717eb1afcdbe0afd1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 18:21:34 +0100 Subject: [PATCH 41/82] Fix trans --- htdocs/recruitment/recruitmentcandidature_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 813f0b74677..0c1d222e5c1 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -277,7 +277,7 @@ llxHeader('', $title, $help_url); // Part to create if ($action == 'create') { - print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("RecruitmentCandidature")), '', 'object_'.$object->picto); + print load_fiche_titre($title, '', 'object_'.$object->picto); print '
'; print ''; From 3d2adf511ed70cf6bc8f421b2a02abbc3255d3c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 18:39:48 +0100 Subject: [PATCH 42/82] Debug v21 --- htdocs/langs/en_US/hrm.lang | 3 ++- htdocs/recruitment/class/recruitmentcandidature.class.php | 2 +- htdocs/recruitment/recruitmentcandidature_card.php | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/hrm.lang b/htdocs/langs/en_US/hrm.lang index 7b78f488cd0..5c8287b4c0b 100644 --- a/htdocs/langs/en_US/hrm.lang +++ b/htdocs/langs/en_US/hrm.lang @@ -98,4 +98,5 @@ NeedBusinessTravels=Need business travels NoDescription=No description TheJobProfileHasNoSkillsDefinedFixBefore=The evaluated job profile of this employee has no skill defined on it. Please add skill(s), then delete and restart the evaluation. PDFStandardHrmEvaluation=Standard template to generate a PDF document for a competency assessment -SkillNotRequired=Skill not required \ No newline at end of file +SkillNotRequired=Skill not required +LinkToUserCreated=Link to an employee if the applicant has been hired and converted into a user. diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index d9ac151e59d..c70153127c3 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -120,7 +120,7 @@ class RecruitmentCandidature extends CommonObject 'description' => array('type' => 'html', 'label' => 'Description', 'enabled' => 1, 'position' => 300, 'notnull' => 0, 'visible' => 3, 'cssview' => 'wordbreak'), 'date_creation' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 500, 'notnull' => 1, 'visible' => -4, 'csslist' => 'nowraponall'), 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'position' => 501, 'notnull' => 0, 'visible' => -2, 'csslist' => 'nowraponall'), - 'fk_user' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'LinkedToDolibarrUser', 'enabled' => 1, 'position' => 600, 'notnull' => 0, 'visible' => -1, 'csslist' => 'tdoverflowmax100'), + 'fk_user' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'Employee', 'picto' => 'user', 'help' => 'LinkToUserCreated', 'enabled' => 1, 'position' => 600, 'notnull' => 0, 'visible' => -1, 'css' => 'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist' => 'tdoverflowmax100'), 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 1000, 'notnull' => -1, 'visible' => -2,), 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'position' => 1010, 'notnull' => -1, 'visible' => 0,), 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'notnull' => 1, 'visible' => 2, 'index' => 1, 'default' => '0', 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Received', '3' => 'ContractProposed', '5' => 'ContractSigned', '8' => 'Refused', '9' => 'Canceled')), diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index d1d7eb128a8..8c3030a07e3 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -117,7 +117,7 @@ if (empty($reshook)) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { $backtopage = $backurlforlist; } else { - $backtopage = dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); + $backtopage = DOL_URL_ROOT.'/recruitment/recruitmentcandidature_card.php?id='.($id > 0 ? $id : '__ID__'); } } } @@ -597,7 +597,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($user->hasRight('user', 'user', 'creer')) { $useralreadyexists = $object->fk_user; if (empty($useralreadyexists)) { - print ''; + print ''; } else { print ''; } From 687e71dfa305fb6c8577e7e2875bbb6b0b1b98ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 19:05:06 +0100 Subject: [PATCH 43/82] Debug v21 --- htdocs/adherents/subscription.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index a4d7451af03..0f882fb1d53 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -608,7 +608,7 @@ if (getDolGlobalInt('MAIN_MULTILANGS')) { // Public $linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.$conf->entity : ''); -print ''.$form->textwithpicto($langs->trans("PublicFile"), $langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist), 1, 'help', '', 0, 3, 'publicfile').''.yn($object->public).''; +print ''.$form->textwithpicto($langs->trans("MembershipPublic"), $langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist), 1, 'help', '', 0, 3, 'publicfile').''.yn($object->public).''; // Other attributes $cols = 2; @@ -617,7 +617,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; // Third party Dolibarr if (isModEnabled('societe')) { print ''; - print '
'; + print ''; if ($action != 'editthirdparty' && $user->hasRight('adherent', 'creer')) { @@ -638,9 +638,9 @@ if (isModEnabled('societe')) { print ''; print '
'; print $langs->trans("LinkedToDolibarrThirdParty"); print '
'; } else { - if ($object->fk_soc) { + if ($object->socid > O) { $company = new Societe($db); - $result = $company->fetch($object->fk_soc); + $result = $company->fetch($object->socid); print $company->getNomUrl(1); // Show link to invoices @@ -659,7 +659,7 @@ if (isModEnabled('societe')) { // Login Dolibarr - Link to user print '
'; -print '
'; +print ''; if ($action != 'editlogin' && $user->hasRight('adherent', 'creer')) { From 57d121664fc53ba2204ab9e094b8d91eed210a98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 Nov 2024 19:11:32 +0100 Subject: [PATCH 44/82] set object entity at create (#32019) * set object entity at create * set object entity at create * set object entity at create * set object entity at create * set object entity at create * set object entity at create * do not break multicompany thing * do not break multicompany thing * missing translation * fix phpstan * doc * fix entity * fix set entity --- htdocs/adherents/class/adherent.class.php | 5 ++++- htdocs/comm/propal/class/propal.class.php | 4 +++- htdocs/commande/class/commande.class.php | 3 ++- htdocs/compta/facture/class/facture.class.php | 3 ++- htdocs/contact/class/contact.class.php | 3 ++- htdocs/contrat/class/contrat.class.php | 3 ++- htdocs/expedition/class/expedition.class.php | 3 ++- htdocs/fichinter/class/fichinter.class.php | 3 ++- htdocs/fourn/class/fournisseur.commande.class.php | 11 ++++++++--- htdocs/fourn/class/fournisseur.facture.class.php | 3 ++- htdocs/societe/class/societe.class.php | 2 +- 11 files changed, 30 insertions(+), 13 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index fb48539e467..452bd835d11 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -646,6 +646,9 @@ class Adherent extends CommonObject } } + // setEntity will set entity with the right value if empty or change it for the right value if multicompany module is active + $this->entity = setEntity($this); + $this->db->begin(); // Insert member @@ -658,7 +661,7 @@ class Adherent extends CommonObject $sql .= ", ".($user->id > 0 ? $user->id : "null"); // Can be null because member can be created by a guest or a script $sql .= ", null, null, '".$this->db->escape($this->morphy)."'"; $sql .= ", ".((int) $this->typeid); - $sql .= ", ".$conf->entity; + $sql .= ", ".((int) $this->entity); $sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); $sql .= ", ".(!empty($this->ip) ? "'".$this->db->escape($this->ip)."'" : "null"); $sql .= ")"; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c42b5b22c93..daa19da672d 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1135,6 +1135,8 @@ class Propal extends CommonObject $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } + // setEntity will set entity with the right value if empty or change it for the right value if multicompany module is active + $this->entity = setEntity($this); // Set tmp vars $delivery_date = $this->delivery_date; @@ -1229,7 +1231,7 @@ class Propal extends CommonObject $sql .= ", ".($this->fk_project ? $this->fk_project : "null"); $sql .= ", ".(int) $this->fk_incoterms; $sql .= ", '".$this->db->escape($this->location_incoterms)."'"; - $sql .= ", ".setEntity($this); + $sql .= ", ".(int) $this->entity; $sql .= ", ".(int) $this->fk_multicurrency; $sql .= ", '".$this->db->escape($this->multicurrency_code)."'"; $sql .= ", ".(float) $this->multicurrency_tx; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3e97bd80372..976b37d28de 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -947,6 +947,7 @@ class Commande extends CommonOrder $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } + $this->entity = setEntity($this); dol_syslog(get_class($this)."::create user=".$user->id); @@ -1010,7 +1011,7 @@ class Commande extends CommonOrder $sql .= ", ".(!empty($this->warehouse_id) && $this->warehouse_id > 0 ? ((int) $this->warehouse_id) : 'NULL'); $sql .= ", ".(int) $this->fk_incoterms; $sql .= ", '".$this->db->escape($this->location_incoterms)."'"; - $sql .= ", ".setEntity($this); + $sql .= ", ".(int) $this->entity; $sql .= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null"); $sql .= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null"); $sql .= ", ".(int) $this->fk_multicurrency; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 06eb0d45c29..ed4d1e522a1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -523,6 +523,7 @@ class Facture extends CommonInvoice $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } + $this->entity = setEntity($this); dol_syslog(get_class($this)."::create user=".$user->id." date=".$this->date); @@ -718,7 +719,7 @@ class Facture extends CommonInvoice $sql .= ")"; $sql .= " VALUES ("; $sql .= "'(PROV)'"; - $sql .= ", ".setEntity($this); + $sql .= ", ".(int) $this->entity; $sql .= ", ".($this->ref_ext ? "'".$this->db->escape($this->ref_ext)."'" : "null"); $sql .= ", '".$this->db->escape($this->type)."'"; $sql .= ", ".($this->subtype ? "'".$this->db->escape($this->subtype)."'" : "null"); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 08041134de3..9af01fe74ce 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -508,7 +508,8 @@ class Contact extends CommonObject $this->statut = 0; // This is to convert '' into '0' to avoid bad sql request } - $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); + // setEntity will set entity with the right value if empty or change it for the right value if multicompany module is active + $this->entity = setEntity($this); $sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople ("; $sql .= " datec"; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 81371d0556e..2fefa846bce 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1024,6 +1024,7 @@ class Contrat extends CommonObject $this->error .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("SalesRepresentativeFollowUp")); $paramsok = 0; } + $this->entity = setEntity($this); if (!$paramsok) { return -1; } @@ -1043,7 +1044,7 @@ class Contrat extends CommonObject $sql .= ",".($this->commercial_suivi_id > 0 ? ((int) $this->commercial_suivi_id) : "NULL"); $sql .= ",".($this->fk_project > 0 ? ((int) $this->fk_project) : "NULL"); $sql .= ", ".(dol_strlen($this->ref) <= 0 ? "null" : "'".$this->db->escape($this->ref)."'"); - $sql .= ", ".((int) $conf->entity); + $sql .= ", ".((int) $this->entity); $sql .= ", ".((int) $this->signed_status); $sql .= ", ".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL"); $sql .= ", ".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL"); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 5193c3cde90..54df830cd06 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -430,6 +430,7 @@ class Expedition extends CommonObject if (empty($this->date_shipping) && !empty($this->date_expedition)) { $this->date_shipping = $this->date_expedition; } + $this->entity = setEntity($this); $this->user = $user; @@ -462,7 +463,7 @@ class Expedition extends CommonObject $sql .= ", signed_status"; $sql .= ") VALUES ("; $sql .= "'(PROV)'"; - $sql .= ", ".((int) $conf->entity); + $sql .= ", ".((int) $this->entity); $sql .= ", ".($this->ref_customer ? "'".$this->db->escape($this->ref_customer)."'" : "null"); $sql .= ", ".($this->ref_ext ? "'".$this->db->escape($this->ref_ext)."'" : "null"); $sql .= ", '".$this->db->idate($now)."'"; diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 33d4eda3805..1a9340923e6 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -295,6 +295,7 @@ class Fichinter extends CommonObject dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -1; } + $this->entity = setEntity($this); $soc = new Societe($this->db); $result = $soc->fetch($this->socid); @@ -325,7 +326,7 @@ class Fichinter extends CommonObject $sql .= ", '".$this->db->idate($now)."'"; $sql .= ", '".$this->db->escape($this->ref)."'"; $sql .= ", ".($this->ref_client ? "'".$this->db->escape($this->ref_client)."'" : "null"); - $sql .= ", ".((int) $conf->entity); + $sql .= ", ".((int) $this->entity); $sql .= ", ".((int) $user->id); $sql .= ", ".((int) $user->id); $sql .= ", ".($this->description ? "'".$this->db->escape($this->description)."'" : "null"); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 3fef90726d4..9064fe9bbc4 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -116,6 +116,8 @@ class CommandeFournisseur extends CommonOrder /** * @var ?int<0,9> + * @deprecated see $status + * @see $status */ public $statut; // 0=Draft -> 1=Validated -> 2=Approved -> 3=Ordered/Process running -> 4=Received partially -> 5=Received totally -> (reopen) 4=Received partially // -> 7=Canceled/Never received -> (reopen) 3=Process running @@ -892,7 +894,7 @@ class CommandeFournisseur extends CommonOrder */ public function getLibStatut($mode = 0) { - return $this->LibStatut($this->statut, $mode, $this->billed); + return $this->LibStatut($this->status, $mode, $this->billed); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -992,7 +994,7 @@ class CommandeFournisseur extends CommonOrder if ($user->hasRight("fournisseur", "commande", "read")) { $datas['picto'] = ''.$langs->trans("SupplierOrder").''; - if ($this->statut) { + if ($this->status) { $datas['picto'] .= ' '.$this->getLibStatut(5); } if (!empty($this->ref)) { @@ -1156,6 +1158,7 @@ class CommandeFournisseur extends CommonOrder $obj = new $classname(); '@phan-var-force ModeleNumRefSuppliersOrders $obj'; + /** @var ModeleNumRefSuppliersOrders $obj */ $numref = $obj->getNextValue($soc, $this); if ($numref != "") { @@ -1169,6 +1172,7 @@ class CommandeFournisseur extends CommonOrder return -2; } } + /** * Class invoiced the supplier order * @@ -1598,6 +1602,7 @@ class CommandeFournisseur extends CommonOrder $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } + $this->entity = setEntity($this); // We set order into draft status $this->statut = self::STATUS_DRAFT; // deprecated @@ -1630,7 +1635,7 @@ class CommandeFournisseur extends CommonOrder $sql .= ", ".(isset($this->ref_supplier) ? "'".$this->db->escape($this->ref_supplier)."'" : "NULL"); $sql .= ", '".$this->db->escape($this->note_private)."'"; $sql .= ", '".$this->db->escape($this->note_public)."'"; - $sql .= ", ".setEntity($this); + $sql .= ", ".((int) $this->entity); $sql .= ", ".((int) $this->socid); $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : "null"); $sql .= ", '".$this->db->idate($date)."'"; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index c0514cead7e..be62ce3770b 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -423,6 +423,7 @@ class FactureFournisseur extends CommonInvoice $this->fk_multicurrency = 0; $this->multicurrency_tx = 1; } + $this->entity = setEntity($this); $this->db->begin(); @@ -577,7 +578,7 @@ class FactureFournisseur extends CommonInvoice $sql .= "'(PROV)'"; $sql .= ", '".$this->db->escape($this->ref_supplier)."'"; $sql .= ", '".$this->db->escape($this->ref_ext)."'"; - $sql .= ", ".((int) $conf->entity); + $sql .= ", ".((int) $this->entity); $sql .= ", '".$this->db->escape($this->type)."'"; $sql .= ", ".((int) $this->subtype); $sql .= ", '".$this->db->escape(isset($this->label) ? $this->label : (isset($this->libelle) ? $this->libelle : ''))."'"; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 7f35e25cef7..35b5d930548 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1038,7 +1038,7 @@ class Societe extends CommonObject $result = $this->verify(); if ($result >= 0) { - $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); + $this->entity = setEntity($this); $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe ("; $sql .= "nom"; From 869ee70c440ecd2c9fa0a239bfcb597a156135d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20de=20Grandpr=C3=A9?= Date: Thu, 21 Nov 2024 13:11:58 -0500 Subject: [PATCH 45/82] FIX#29901 blocking tasktimesel for nonbillabletime with dblclick enabling option (#32023) * FIX#29901 - Disable task checkbox in list with enable option on dbl-click when aligned in left column ans task not billable * typo * Managing $invoiced variable for phpstan * pre-commit hook correct. * phpcs * Update time.php * Update time.php --------- Co-authored-by: Laurent Destailleur --- htdocs/projet/tasks/time.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 523f93e97e4..aad0471027b 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -2119,6 +2119,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser break; } + // Line is invoiced if it has an invoice_id + $invoiced = $task_time->invoice_id ? true : false; + $date1 = $db->jdate($task_time->element_date); $date2 = $db->jdate($task_time->element_datehour); @@ -2156,7 +2159,18 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $selected = 1; } print ' '; - print ''; + + // Disable select if task not billable or already invoiced + $disabled = (intval($task_time->billable) != 1 || $invoiced); + $ctrl = ''; + if ($disabled) { + // If disabled, a dbl-click very close outside the control + // will re-enable it, so that user is not blocked if needed. + print ''.$ctrl.''; + print ''; + } else { + print $ctrl; + } } } } @@ -2426,7 +2440,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } // Invoiced - $invoiced = false; if (!empty($arrayfields['valuebilled']['checked'])) { print '\n"; // Allow external download print ''; print ''; -print ''; print ''; From 538c10fa6eab28346e3852e362d816479324d12e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 22:59:24 +0100 Subject: [PATCH 52/82] Fix phpstan --- htdocs/compta/tva/quadri_detail.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 2d24466a2a4..e0ea47ccbd8 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -678,7 +678,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { $subtot_paye_total_ht = 0; $subtot_paye_vat = 0; - if (is_array($x_both[$rate]['paye']['detail'])) { + if (is_array($x_both[$rate]['paye']['detail'])) { // @phpstan-ignore-line print ""; print '
'; print $langs->trans("LinkedToDolibarrUser"); print ''; // invoice_id and invoice_line_id if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { @@ -2506,6 +2519,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser $selected = 1; } print ' '; + // Disable select if task not billable or already invoiced $disabled = (intval($task_time->billable) != 1 || $invoiced); $ctrl = ''; From 71d988b015677851cc3848736cce7300bc5da332 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 19:34:36 +0100 Subject: [PATCH 46/82] Add code to make easier to test PDF generation with n lines of product --- htdocs/commande/class/commande.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3e97bd80372..d29baca6cd5 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -4049,8 +4049,9 @@ class Commande extends CommonOrder $this->status = $this::STATUS_DRAFT; // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; + while ($xnbp < $nbp) { $line = new OrderLine($this->db); From 6e9bbe42bb59b0db9c8f4db60e1f5f0843de8e82 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 19:40:52 +0100 Subject: [PATCH 47/82] Add code to make easier to test PDF generation with n lines of product --- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/compta/facture/class/facture-rec.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/expensereport/class/expensereport.class.php | 2 +- htdocs/fourn/class/fournisseur.commande.class.php | 3 ++- htdocs/fourn/class/fournisseur.facture-rec.class.php | 2 +- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/reception/class/reception.class.php | 2 +- htdocs/supplier_proposal/class/supplier_proposal.class.php | 2 +- 11 files changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index daa19da672d..ac6d62da82c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3568,7 +3568,7 @@ class Propal extends CommonObject $this->multicurrency_code = $conf->currency; // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new PropaleLigne($this->db); diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index c8242aa1753..3a5fe7166ab 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1830,7 +1830,7 @@ class FactureRec extends CommonInvoice if (empty($option) || $option != 'nolines') { // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new FactureLigne($this->db); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ed4d1e522a1..e63c86551cc 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5159,7 +5159,7 @@ class Facture extends CommonInvoice if (empty($option) || $option != 'nolines') { // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new FactureLigne($this->db); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 2fefa846bce..7a5311695ff 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2487,7 +2487,7 @@ class Contrat extends CommonObject $this->note_public = 'This is a comment (public)'; $this->fk_project = 0; // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new ContratLigne($this->db); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 54df830cd06..47fae30ca4b 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -2157,7 +2157,7 @@ class Expedition extends CommonObject $this->note_private = 'Private note'; $this->note_public = 'Public note'; - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new ExpeditionLigne($this->db); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index f73497dd375..a4e5b557b08 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -968,7 +968,7 @@ class ExpenseReport extends CommonObject $this->note_private = 'Private note'; $this->note_public = 'SPECIMEN'; - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new ExpenseReportLine($this->db); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9064fe9bbc4..7f6dc7b957e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3193,9 +3193,10 @@ class CommandeFournisseur extends CommonOrder $this->multicurrency_code = $conf->currency; $this->statut = 0; + $this->status = 0; // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new CommandeFournisseurLigne($this->db); diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index db1b79ad4c6..f57cfab72fb 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1783,7 +1783,7 @@ class FactureFournisseurRec extends CommonInvoice if (empty($option) || $option != 'nolines') { // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new FactureLigne($this->db); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index be62ce3770b..b0b14cf5092 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3072,7 +3072,7 @@ class FactureFournisseur extends CommonInvoice $xnbp = 0; if (empty($option) || $option != 'nolines') { // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) while ($xnbp < $nbp) { $line = new SupplierInvoiceLine($this->db); $line->desc = $langs->trans("Description")." ".$xnbp; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 25a6cc5c78c..71d4a47caff 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -1528,7 +1528,7 @@ class Reception extends CommonObject $this->fk_incoterms = 1; - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new CommandeFournisseurDispatch($this->db); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 0aba526fa84..fd29fe5bbbf 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2373,7 +2373,7 @@ class SupplierProposal extends CommonObject $this->note_public = 'This is a comment (public)'; $this->note_private = 'This is a comment (private)'; // Lines - $nbp = 5; + $nbp = min(1000, GETPOSTINT('nblines') ? GETPOSTINT('nblines') : 5); // We can force the nb of lines to test from command line (but not more than 1000) $xnbp = 0; while ($xnbp < $nbp) { $line = new SupplierProposalLine($this->db); From 235b61e07a516473eed84aba9878e7c4f308c6ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 22:13:45 +0100 Subject: [PATCH 48/82] FIX Debug v21 --- htdocs/compta/resultat/clientfourn.php | 4 ++-- htdocs/compta/tva/quadri_detail.php | 8 ++++---- htdocs/core/lib/tax.lib.php | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 34610f8d98a..f7da72fa53d 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -274,9 +274,9 @@ print ''; print ''; if ($modecompta == 'BOOKKEEPING') { - print_liste_field_titre("PredefinedGroups", $_SERVER["PHP_SELF"], 'f.thirdparty_code,f.rowid', '', $param, '', $sortfield, $sortorder, 'width200 '); + print_liste_field_titre("PredefinedGroups", $_SERVER["PHP_SELF"], 'f.thirdparty_code,f.rowid', '', $param, '', $sortfield, $sortorder, ''); } else { - print_liste_field_titre("", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'width200 '); + print_liste_field_titre("", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, ''); } print_liste_field_titre(''); if ($modecompta == 'BOOKKEEPING') { diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 54fee8c2882..2d24466a2a4 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -60,6 +60,7 @@ $refresh = (GETPOSTISSET('submit') || GETPOSTISSET('vat_rate_show') || GETPOSTIS $invoice_type = GETPOSTISSET('invoice_type') ? GETPOST('invoice_type', 'alpha') : ''; $vat_rate_show = GETPOSTISSET('vat_rate_show') ? GETPOST('vat_rate_show', 'alphanohtml') : -1; +// Set $date_start_xxx and $date_end_xxx... include DOL_DOCUMENT_ROOT . '/compta/tva/initdatesforvat.inc.php'; // Variables provided by include: ' @@ -323,7 +324,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { foreach ($x_paye[$my_paye_rate]['facid'] as $id => $dummy) { // ExpenseReport - if ($x_paye[$my_paye_rate]['ptype'][$id] == 'ExpenseReportPayment') { + if ($x_paye[$my_paye_rate]['ptype'][$id] === 'ExpenseReportPayment') { $expensereport->id = $x_paye[$my_paye_rate]['facid'][$id]; $expensereport->ref = $x_paye[$my_paye_rate]['facnum'][$id]; $expensereport->type = $x_paye[$my_paye_rate]['type'][$id]; @@ -441,7 +442,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { print ""; print ''; print '
'; print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%'; - print ' - "; print ''; print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%'; - print ' - '; // Ref diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index 205031bed98..ed5586ff29d 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -1160,8 +1160,8 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire $sql = "SELECT d.rowid, d.product_type as dtype, e.rowid as facid, d.$f_rate as rate, d.vat_src_code as vat_src_code, d.total_ht as total_ht, d.total_ttc as total_ttc, d.total_tva as total_vat, e.note_private as descr,"; $sql .= " d.total_localtax1 as total_localtax1, d.total_localtax2 as total_localtax2, "; $sql .= " e.date_debut as date_start, e.date_fin as date_end, e.fk_user_author,"; - $sql .= " e.ref as facnum, e.total_ttc as ftotal_ttc, e.date_create, d.fk_c_type_fees as type,"; - $sql .= " p.fk_bank as payment_id, p.amount as payment_amount, p.rowid as pid, e.ref as pref"; + $sql .= " e.ref as facnum, e.ref as pref, e.total_ttc as ftotal_ttc, e.date_create, d.fk_c_type_fees as type,"; + $sql .= " p.fk_bank as payment_id, p.amount as payment_amount, p.rowid as pid"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as e"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."expensereport_det as d ON d.fk_expensereport = e.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_expensereport as p ON p.fk_expensereport = e.rowid"; @@ -1184,7 +1184,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire $sql .= " AND (d.product_type = -1"; $sql .= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service if (getDolGlobalString('MAIN_NOT_INCLUDE_ZERO_VAT_IN_REPORTS')) { - $sql .= " AND (d.".$f_rate." <> 0 OR d.total_tva <> 0)"; + $sql .= " AND (d.".$db->sanitize($f_rate)." <> 0 OR d.total_tva <> 0)"; } $sql .= " ORDER BY e.rowid"; From 75400611e1d3d7415e26a3d2163c55e9f5e91d79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 Nov 2024 22:36:00 +0100 Subject: [PATCH 49/82] fix phpstan (#32040) * fix phpstan * fix * fix * fix * fix * fix * fix --- build/phpstan/phpstan-baseline.neon | 300 +--------------------- htdocs/adherents/class/adherent.class.php | 4 +- htdocs/adherents/subscription.php | 2 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/commonpeople.class.php | 32 ++- htdocs/core/lib/project.lib.php | 10 +- htdocs/societe/class/societe.class.php | 15 +- 7 files changed, 36 insertions(+), 329 deletions(-) diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index f08d62540be..9b055ffc31c 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -972,12 +972,6 @@ parameters: count: 2 path: ../../htdocs/adherents/class/adherent.class.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - message: '#^Call to function method_exists\(\) with \$this\(Adherent\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -1014,36 +1008,12 @@ parameters: count: 5 path: ../../htdocs/adherents/class/adherent.class.php - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(Adherent\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(Adherent\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(Adherent\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - message: '#^Parameter \#1 \$substitutionarray of function complete_substitutions_array expects array\, array\ given\.$#' identifier: argument.type count: 1 path: ../../htdocs/adherents/class/adherent.class.php - - - message: '#^Property Adherent\:\:\$email \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - message: '#^Property Adherent\:\:\$first_subscription_amount \(int\|string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -1056,16 +1026,10 @@ parameters: count: 1 path: ../../htdocs/adherents/class/adherent.class.php - - - message: '#^Property Adherent\:\:\$societe \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/adherents/class/adherent.class.php - - message: '#^Ternary operator condition is always false\.$#' identifier: ternary.alwaysFalse - count: 2 + count: 1 path: ../../htdocs/adherents/class/adherent.class.php - @@ -5280,12 +5244,6 @@ parameters: count: 2 path: ../../htdocs/compta/bank/bankentries_list.php - - - message: '#^If condition is always false\.$#' - identifier: if.alwaysFalse - count: 2 - path: ../../htdocs/compta/bank/bankentries_list.php - - message: '#^Left side of && is always true\.$#' identifier: booleanAnd.leftAlwaysTrue @@ -5568,12 +5526,6 @@ parameters: count: 3 path: ../../htdocs/compta/bank/list.php - - - message: '#^If condition is always false\.$#' - identifier: if.alwaysFalse - count: 2 - path: ../../htdocs/compta/bank/releve.php - - message: '#^Variable \$buttonreconcile might not be defined\.$#' identifier: variable.undefined @@ -7860,12 +7812,6 @@ parameters: count: 1 path: ../../htdocs/contact/card.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/contact/class/contact.class.php - - message: '#^Call to function method_exists\(\) with \$this\(Contact\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -7902,33 +7848,9 @@ parameters: count: 3 path: ../../htdocs/contact/class/contact.class.php - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(Contact\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/contact/class/contact.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(Contact\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/contact/class/contact.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(Contact\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/contact/class/contact.class.php - - message: '#^Property CommonObject\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property - count: 2 - path: ../../htdocs/contact/class/contact.class.php - - - - message: '#^Property Contact\:\:\$email \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property count: 1 path: ../../htdocs/contact/class/contact.class.php @@ -7944,12 +7866,6 @@ parameters: count: 1 path: ../../htdocs/contact/class/contact.class.php - - - message: '#^Ternary operator condition is always false\.$#' - identifier: ternary.alwaysFalse - count: 1 - path: ../../htdocs/contact/class/contact.class.php - - message: '#^Variable \$url in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable @@ -12324,24 +12240,6 @@ parameters: count: 1 path: ../../htdocs/core/lib/project.lib.php - - - message: '#^Parameter \#1 \$inc of function projectLinesPerDay expects string, \(float\|int\) given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/lib/project.lib.php - - - - message: '#^Parameter \#1 \$inc of function projectLinesPerMonth expects string, \(float\|int\) given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/lib/project.lib.php - - - - message: '#^Parameter \#1 \$inc of function projectLinesPerWeek expects string, \(float\|int\) given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/core/lib/project.lib.php - - message: '#^Property Task\:\:\$progress \(int\|string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -17970,12 +17868,6 @@ parameters: count: 2 path: ../../htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php - - - message: '#^Negated boolean expression is always false\.$#' - identifier: booleanNot.alwaysFalse - count: 2 - path: ../../htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php - - message: '#^Variable \$old_MAIN_MAIL_AUTOCOPY_TO might not be defined\.$#' identifier: variable.undefined @@ -18432,12 +18324,6 @@ parameters: count: 1 path: ../../htdocs/don/class/api_donations.class.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/don/class/don.class.php - - message: '#^Call to function method_exists\(\) with \$this\(Don\) and ''LibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -18474,42 +18360,12 @@ parameters: count: 1 path: ../../htdocs/don/class/don.class.php - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(Don\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/don/class/don.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(Don\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/don/class/don.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(Don\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/don/class/don.class.php - - - - message: '#^Property Don\:\:\$email \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/don/class/don.class.php - - message: '#^Property Don\:\:\$societe \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property count: 1 path: ../../htdocs/don/class/don.class.php - - - message: '#^Ternary operator condition is always false\.$#' - identifier: ternary.alwaysFalse - count: 1 - path: ../../htdocs/don/class/don.class.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -19104,12 +18960,6 @@ parameters: count: 1 path: ../../htdocs/eventorganization/class/conferenceorboothattendee.class.php - - - message: '#^Property CommonObject\:\:\$name \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/eventorganization/class/conferenceorboothattendee.class.php - - message: '#^Property ConferenceOrBoothAttendee\:\:\$lastname \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -28368,12 +28218,6 @@ parameters: count: 1 path: ../../htdocs/projet/activity/perday.php - - - message: '#^Parameter \#1 \$inc of function projectLinesPerDay expects string, int given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/projet/activity/perday.php - - message: '#^Parameter \#11 \$isavailable of function projectLinesPerDay expects array\, afternoon\: int\<0, 1\>\}\>, non\-empty\-array\ given\.$#' identifier: argument.type @@ -28452,12 +28296,6 @@ parameters: count: 1 path: ../../htdocs/projet/activity/permonth.php - - - message: '#^Parameter \#1 \$inc of function projectLinesPerMonth expects string, int given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/projet/activity/permonth.php - - message: '#^Parameter \#14 \$arrayfields of function projectLinesPerMonth expects array\, array\\> given\.$#' identifier: argument.type @@ -28512,12 +28350,6 @@ parameters: count: 1 path: ../../htdocs/projet/activity/perweek.php - - - message: '#^Parameter \#1 \$inc of function projectLinesPerWeek expects string, int given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/projet/activity/perweek.php - - message: '#^Parameter \#11 \$isavailable of function projectLinesPerWeek expects array\, afternoon\: int\<0, 1\>\}\>, non\-empty\-array\ given\.$#' identifier: argument.type @@ -29184,12 +29016,6 @@ parameters: count: 1 path: ../../htdocs/projet/tasks.php - - - message: '#^Parameter \#1 \$inc of function projectLinesa expects string, int given\.$#' - identifier: argument.type - count: 1 - path: ../../htdocs/projet/tasks.php - - message: '#^Parameter \#13 \$arrayfields of function projectLinesa expects array\, array\\> given\.$#' identifier: argument.type @@ -31410,12 +31236,6 @@ parameters: count: 1 path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - - message: '#^Call to function property_exists\(\) with \$this\(RecruitmentCandidature\) and ''phone'' will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - message: '#^Call to function property_exists\(\) with RecruitmentCandidature and ''date_creation'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -31458,24 +31278,12 @@ parameters: count: 1 path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - - message: '#^Property CommonObject\:\:\$name \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - message: '#^Property RecruitmentCandidature\:\:\$fields \(array\\|string, position\: int, notnull\?\: int, visible\: int\<\-2, 5\>\|string, noteditable\?\: int\<0, 1\>, default\?\: string, \.\.\.\}\>\) does not accept default value of type array\{rowid\: array\{type\: ''integer'', label\: ''TechnicalID'', enabled\: 1, position\: 1, notnull\: 1, visible\: 0, noteditable\: 1, index\: 1, \.\.\.\}, entity\: array\{type\: ''integer'', label\: ''Entity'', enabled\: 1, visible\: 0, position\: 5, notnull\: 1, default\: ''1'', index\: 1\}, ref\: array\{type\: ''varchar\(128\)'', label\: ''Ref'', enabled\: 1, position\: 10, notnull\: 1, visible\: 4, noteditable\: 1, default\: ''\(PROV\)'', \.\.\.\}, fk_recruitmentjobposition\: array\{type\: ''integer…'', label\: ''Job'', enabled\: 1, position\: 15, notnull\: 0, visible\: 1, index\: 1, picto\: ''recruitmentjobposit…'', \.\.\.\}, note_public\: array\{type\: ''html'', label\: ''NotePublic'', enabled\: 1, position\: 61, notnull\: 0, visible\: 0\}, note_private\: array\{type\: ''html'', label\: ''NotePrivate'', enabled\: 1, position\: 62, notnull\: 0, visible\: 0\}, fk_user_creat\: array\{type\: ''integer\:User\:user…'', label\: ''UserAuthor'', enabled\: 1, position\: 510, notnull\: \-1, visible\: \-2, foreignkey\: ''user\.rowid'', csslist\: ''tdoverflowmax100''\}, fk_user_modif\: array\{type\: ''integer\:User\:user…'', label\: ''UserModif'', enabled\: 1, position\: 511, notnull\: \-1, visible\: \-2, csslist\: ''tdoverflowmax100''\}, \.\.\.\}\.$#' identifier: property.defaultValue count: 1 path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - - message: '#^Property RecruitmentCandidature\:\:\$lastname \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/recruitment/class/recruitmentcandidature.class.php - - message: '#^Property RecruitmentCandidature\:\:\$status \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -31830,30 +31638,6 @@ parameters: count: 1 path: ../../htdocs/resource/card.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/resource/class/dolresource.class.php - - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(Dolresource\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/resource/class/dolresource.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(Dolresource\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/resource/class/dolresource.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(Dolresource\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/resource/class/dolresource.class.php - - message: '#^Property CommonObject\:\:\$ref \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -31893,7 +31677,7 @@ parameters: - message: '#^Property Dolresource\:\:\$email \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property - count: 3 + count: 2 path: ../../htdocs/resource/class/dolresource.class.php - @@ -31938,12 +31722,6 @@ parameters: count: 2 path: ../../htdocs/resource/class/dolresource.class.php - - - message: '#^Ternary operator condition is always false\.$#' - identifier: ternary.alwaysFalse - count: 1 - path: ../../htdocs/resource/class/dolresource.class.php - - message: '#^Call to function is_numeric\(\) with float\|int\\|int\<1, max\>\|\(non\-falsy\-string&numeric\-string\) will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -32718,12 +32496,6 @@ parameters: count: 2 path: ../../htdocs/societe/class/companybankaccount.class.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - message: '#^Call to function method_exists\(\) with \$this\(Societe\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -32760,24 +32532,6 @@ parameters: count: 6 path: ../../htdocs/societe/class/societe.class.php - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(Societe\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(Societe\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(Societe\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - message: '#^Property Contact\:\:\$roles \(array\\) does not accept non\-empty\-list\\.$#' identifier: assign.propertyType @@ -32796,16 +32550,10 @@ parameters: count: 1 path: ../../htdocs/societe/class/societe.class.php - - - message: '#^Property Societe\:\:\$email \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - message: '#^Property Societe\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property - count: 3 + count: 2 path: ../../htdocs/societe/class/societe.class.php - @@ -32844,12 +32592,6 @@ parameters: count: 1 path: ../../htdocs/societe/class/societe.class.php - - - message: '#^Ternary operator condition is always false\.$#' - identifier: ternary.alwaysFalse - count: 1 - path: ../../htdocs/societe/class/societe.class.php - - message: '#^Property SocieteAccount\:\:\$fields \(array\\|string, position\: int, notnull\?\: int, visible\: int\<\-2, 5\>\|string, noteditable\?\: int\<0, 1\>, default\?\: string, \.\.\.\}\>\) does not accept default value of type array\{rowid\: array\{type\: ''integer'', label\: ''TechnicalID'', visible\: \-2, enabled\: 1, position\: 1, notnull\: 1, index\: 1, comment\: ''Id''\}, entity\: array\{type\: ''integer'', label\: ''Entity'', visible\: 0, enabled\: 1, position\: 5, default\: 1\}, login\: array\{type\: ''varchar\(64\)'', label\: ''Login'', visible\: 1, enabled\: 1, notnull\: 1, position\: 10, showoncombobox\: 1, autofocusoncreate\: 1\}, pass_encoding\: array\{type\: ''varchar\(24\)'', label\: ''PassEncoding'', visible\: 0, enabled\: 1, position\: 30\}, pass_crypted\: array\{type\: ''password'', label\: ''Password'', visible\: \-1, enabled\: 1, position\: 31, notnull\: 1\}, pass_temp\: array\{type\: ''varchar\(128\)'', label\: ''Temp'', visible\: 0, enabled\: 0, position\: 32, notnull\: \-1\}, fk_soc\: array\{type\: ''integer\:Societe…'', label\: ''ThirdParty'', visible\: 1, enabled\: 1, position\: 40, notnull\: \-1, index\: 1, picto\: ''company'', \.\.\.\}, site\: array\{type\: ''varchar\(128\)'', label\: ''WebsiteTypeLabel'', visible\: 0, enabled\: 0, position\: 41, notnull\: 1, default\: '''', help\: ''Name of the website…'', \.\.\.\}, \.\.\.\}\.$#' identifier: property.defaultValue @@ -34512,12 +34254,6 @@ parameters: count: 1 path: ../../htdocs/user/class/api_users.class.php - - - message: '#^Call to function is_array\(\) with array\{\}\|array\{mixed\} will always evaluate to true\.$#' - identifier: function.alreadyNarrowedType - count: 1 - path: ../../htdocs/user/class/user.class.php - - message: '#^Call to function method_exists\(\) with \$this\(User\) and ''getLibStatut'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType @@ -34542,36 +34278,12 @@ parameters: count: 3 path: ../../htdocs/user/class/user.class.php - - - message: '#^PHPDoc tag @var with type Contact is not subtype of native type \$this\(User\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/user/class/user.class.php - - - - message: '#^PHPDoc tag @var with type Societe is not subtype of native type \$this\(User\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/user/class/user.class.php - - - - message: '#^PHPDoc tag @var with type User is not subtype of native type \$this\(User\)\.$#' - identifier: varTag.nativeType - count: 1 - path: ../../htdocs/user/class/user.class.php - - message: '#^Parameter \#1 \$array of function dol_sort_array contains unresolvable type\.$#' identifier: argument.unresolvableType count: 1 path: ../../htdocs/user/class/user.class.php - - - message: '#^Property User\:\:\$email \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 1 - path: ../../htdocs/user/class/user.class.php - - message: '#^Property User\:\:\$entity \(int\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -34638,12 +34350,6 @@ parameters: count: 1 path: ../../htdocs/user/class/user.class.php - - - message: '#^Ternary operator condition is always false\.$#' - identifier: ternary.alwaysFalse - count: 1 - path: ../../htdocs/user/class/user.class.php - - message: '#^Variable \$whereforadd in empty\(\) always exists and is not falsy\.$#' identifier: empty.variable diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 452bd835d11..e2353b82af6 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -112,14 +112,14 @@ class Adherent extends CommonObject public $civility; /** - * @var string company name + * @var ?string company name * @deprecated Use $company * @see $company */ public $societe; /** - * @var string company name + * @var ?string company name */ public $company; diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 0f882fb1d53..3b7b80d6935 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -638,7 +638,7 @@ if (isModEnabled('societe')) { print '
'; } else { - if ($object->socid > O) { + if ($object->socid > 0) { $company = new Societe($db); $result = $company->fetch($object->socid); print $company->getNomUrl(1); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 37a0c324dfb..71cc203b2d8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -637,7 +637,7 @@ abstract class CommonObject public $comments = array(); /** - * @var string The name + * @var ?string The name */ public $name; diff --git a/htdocs/core/class/commonpeople.class.php b/htdocs/core/class/commonpeople.class.php index 8bd31082ba7..dae9ff582bc 100644 --- a/htdocs/core/class/commonpeople.class.php +++ b/htdocs/core/class/commonpeople.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW +/* Copyright (C) 2023-2024 Frédéric France + * Copyright (C) 2024 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 @@ -152,9 +152,9 @@ trait CommonPeople /** * Return full address for banner * - * @param string $htmlkey HTML id to make banner content unique - * @param Object $object Object (thirdparty, thirdparty of contact for contact, null for a member) - * @return string Full address string + * @param string $htmlkey HTML id to make banner content unique + * @param CommonObject $object Object (thirdparty, thirdparty of contact for contact, null for a member) + * @return string Full address string */ public function getBannerAddress($htmlkey, $object) { @@ -165,20 +165,24 @@ trait CommonPeople $contactid = 0; $thirdpartyid = 0; $elementforaltlanguage = $this->element; - if ($this->element == 'societe') { - /** @var Societe $this */ + if ($this->element == 'societe' && $this instanceof Societe) { $thirdpartyid = $this->id; } - if ($this->element == 'contact') { - /** @var Contact $this */ + if ($this->element == 'contact' && $this instanceof Contact) { $contactid = $this->id; $thirdpartyid = empty($this->fk_soc) ? 0 : $this->fk_soc; } - if ($this->element == 'user') { - /** @var User $this */ + if ($this->element == 'member' && $this instanceof Adherent) { + $contactid = $this->id; + $thirdpartyid = empty($this->socid) ? 0 : $this->socid; + } + if ($this->element == 'user' && $this instanceof User) { $contactid = $this->contact_id; $thirdpartyid = empty($object->fk_soc) ? 0 : $object->fk_soc; } + if ($this->element == 'recruitmentcandidature' && $this instanceof RecruitmentCandidature) { + $thirdpartyid = 0; + } $out = ''; @@ -210,7 +214,7 @@ trait CommonPeople $arrayoflangcode[] = getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE'); } - if (is_array($arrayoflangcode) && count($arrayoflangcode)) { + if (/* is_array($arrayoflangcode) && */count($arrayoflangcode)) { if (!is_object($extralanguages)) { include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; $extralanguages = new ExtraLanguages($this->db); @@ -258,7 +262,7 @@ trait CommonPeople // Phones $outphonedone = 0; if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone - $out .= ($outphonedone ? ' ' : ''); + // $out .= ($outphonedone ? ' ' : ''); $out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro")); $outdone++; $outphonedone++; @@ -387,7 +391,7 @@ trait CommonPeople $this->address = dol_strtoupper($this->address); $this->town = dol_strtoupper($this->town); } - if (isset($this->email)) { + if (!empty($this->email)) { $this->email = dol_strtolower($this->email); } if (isset($this->personal_email)) { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 95566b86a53..2383a86619f 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -581,7 +581,7 @@ function project_admin_prepare_head() /** * Show task lines with a particular parent * - * @param string $inc Line number (start to 0, then increased by recursive call) + * @param int $inc Line number (start to 0, then increased by recursive call) * @param int $parent Id of parent task to show (0 to show all) * @param Task[] $lines Array of lines * @param int $level Level (start to 0, then increased/decrease by recursive call), or -1 to show all level in order of $lines without the recursive groupment feature. @@ -1168,7 +1168,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t /** * Output a task line into a pertime input mode * - * @param string $inc Line number (start to 0, then increased by recursive call) + * @param int $inc Line number (start to 0, then increased by recursive call) * @param int $parent Id of parent task to show (0 to show all) * @param ?User $fuser Restrict list to user if defined * @param Task[] $lines Array of lines @@ -1398,7 +1398,7 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec /** * Output a task line into a pertime input mode * - * @param string $inc Line number (start to 0, then increased by recursive call) + * @param int $inc Line number (start to 0, then increased by recursive call) * @param int $parent Id of parent task to show (0 to show all) * @param ?User $fuser Restrict list to user if defined * @param Task[] $lines Array of lines @@ -1801,7 +1801,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr /** * Output a task line into a perday input mode * - * @param string $inc Line output identificator (start to 0, then increased by recursive call) + * @param int $inc Line output identificator (start to 0, then increased by recursive call) * @param int $firstdaytoshow First day to show * @param ?User $fuser Restrict list to user if defined * @param int $parent Id of parent task to show (0 to show all) @@ -2207,7 +2207,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ /** * Output a task line into a perday input mode * - * @param string $inc Line output identificator (start to 0, then increased by recursive call) + * @param int $inc Line output identificator (start to 0, then increased by recursive call) * @param int $firstdaytoshow First day to show * @param User|null $fuser Restrict list to user if defined * @param int $parent Id of parent task to show (0 to show all) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 35b5d930548..b3922c07312 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -273,14 +273,14 @@ class Societe extends CommonObject /** * Thirdparty name - * @var string + * @var ?string * @deprecated Use $name instead * @see $name */ public $nom; /** - * @var string Thirdparty name + * @var ?string Thirdparty name */ public $name; @@ -1212,14 +1212,13 @@ class Societe extends CommonObject $this->setUpperOrLowerCase(); $contact->phone_pro = $this->phone; if (getDolGlobalString('CONTACTS_DEFAULT_ROLES')) { - $contact->roles = explode(',', getDolGlobalString('CONTACTS_DEFAULT_ROLES')); + $contact->roles = explode(',', getDolGlobalString('CONTACTS_DEFAULT_ROLES')); } $contactId = $contact->create($user, $notrigger); if ($contactId < 0) { $error++; - $this->error = $contact->error; - $this->errors = $contact->errors; + $this->setErrorsFromObject($contact); dol_syslog(get_class($this)."::create_individual ERROR:".$this->error, LOG_ERR); } @@ -1227,8 +1226,7 @@ class Societe extends CommonObject $result = $contact->setCategories($tags); if ($result < 0) { $error++; - $this->error = $contact->error; - $this->errors = array_merge($this->errors, $contact->errors); + $this->setErrorsFromObject($contact); dol_syslog(get_class($this)."::create_individual Affect Tag ERROR:".$this->error, LOG_ERR); $contactId = $result; } @@ -1237,8 +1235,7 @@ class Societe extends CommonObject if (empty($error) && isModEnabled('mailing') && !empty($contact->email) && isset($no_email)) { $result = $contact->setNoEmail($no_email); if ($result < 0) { - $this->error = $contact->error; - $this->errors = array_merge($this->errors, $contact->errors); + $this->setErrorsFromObject($contact); dol_syslog(get_class($this)."::create_individual set mailing status ERROR:".$this->error, LOG_ERR); $contactId = $result; } From e4847961a48e9be8c215f96c3b1ae4abd1f3ccf3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 22:40:59 +0100 Subject: [PATCH 50/82] Fix phpstan --- htdocs/core/class/commonpeople.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonpeople.class.php b/htdocs/core/class/commonpeople.class.php index 8bd31082ba7..b71925e0b9a 100644 --- a/htdocs/core/class/commonpeople.class.php +++ b/htdocs/core/class/commonpeople.class.php @@ -165,16 +165,16 @@ trait CommonPeople $contactid = 0; $thirdpartyid = 0; $elementforaltlanguage = $this->element; - if ($this->element == 'societe') { + if ($this instanceOf Societe && $this->element === 'societe') { /** @var Societe $this */ $thirdpartyid = $this->id; } - if ($this->element == 'contact') { + if ($this instanceOf Contact && $this->element === 'contact') { /** @var Contact $this */ $contactid = $this->id; $thirdpartyid = empty($this->fk_soc) ? 0 : $this->fk_soc; } - if ($this->element == 'user') { + if ($this instanceOf User && $this->element === 'user') { /** @var User $this */ $contactid = $this->contact_id; $thirdpartyid = empty($object->fk_soc) ? 0 : $object->fk_soc; From 1d1f8226034d5fc105ba06a61f3103986898f5e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 22:52:50 +0100 Subject: [PATCH 51/82] debug v21 --- htdocs/admin/order.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/order.php b/htdocs/admin/order.php index e2f2cac0bfe..ebad20367b1 100644 --- a/htdocs/admin/order.php +++ b/htdocs/admin/order.php @@ -695,7 +695,7 @@ print "
'.$langs->trans("AllowExternalDownload").''; +print ''; print ajax_constantonoff('ORDER_ALLOW_EXTERNAL_DOWNLOAD', array(), null, 0, 0, 0, 2, 0, 1); print '
'; print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%'; From 9aca86d16a3c9f7348c2f76ce8be391777b354ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 22 Nov 2024 00:39:22 +0100 Subject: [PATCH 53/82] fix phpstan (#32049) * fix phpstan * refix --- htdocs/adherents/stats/geo.php | 2 ++ htdocs/core/class/commonpeople.class.php | 30 ++++++++++++++---------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 3f0ebd040f2..8e5362fdeec 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -95,6 +95,7 @@ print load_fiche_titre($title, '', $memberstatic->picto); //dol_mkdir($dir); $data = array(); $tab = null; +$label = ''; if ($mode) { // Define sql @@ -263,6 +264,7 @@ if ($mode && !count($data)) { // Show graphics if (count($arrayjs) && $mode == 'memberbycountry') { + global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; $color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; if (is_readable($color_file)) { include $color_file; diff --git a/htdocs/core/class/commonpeople.class.php b/htdocs/core/class/commonpeople.class.php index b71925e0b9a..9d80dbdd518 100644 --- a/htdocs/core/class/commonpeople.class.php +++ b/htdocs/core/class/commonpeople.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2023-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -152,9 +152,9 @@ trait CommonPeople /** * Return full address for banner * - * @param string $htmlkey HTML id to make banner content unique - * @param Object $object Object (thirdparty, thirdparty of contact for contact, null for a member) - * @return string Full address string + * @param string $htmlkey HTML id to make banner content unique + * @param CommonObject $object Object (thirdparty, thirdparty of contact for contact, null for a member) + * @return string Full address string */ public function getBannerAddress($htmlkey, $object) { @@ -165,20 +165,24 @@ trait CommonPeople $contactid = 0; $thirdpartyid = 0; $elementforaltlanguage = $this->element; - if ($this instanceOf Societe && $this->element === 'societe') { - /** @var Societe $this */ + if ($this->element === 'societe' && $this instanceof Societe) { $thirdpartyid = $this->id; } - if ($this instanceOf Contact && $this->element === 'contact') { - /** @var Contact $this */ + if ($this->element === 'contact' && $this instanceof Contact) { $contactid = $this->id; $thirdpartyid = empty($this->fk_soc) ? 0 : $this->fk_soc; } - if ($this instanceOf User && $this->element === 'user') { - /** @var User $this */ + if ($this->element == 'member' && $this instanceof Adherent) { + $contactid = $this->id; + $thirdpartyid = empty($this->socid) ? 0 : $this->socid; + } + if ($this->element === 'user' && $this instanceof User) { $contactid = $this->contact_id; $thirdpartyid = empty($object->fk_soc) ? 0 : $object->fk_soc; } + if ($this->element == 'recruitmentcandidature' && $this instanceof RecruitmentCandidature) { + $thirdpartyid = 0; + } $out = ''; @@ -210,7 +214,7 @@ trait CommonPeople $arrayoflangcode[] = getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE'); } - if (is_array($arrayoflangcode) && count($arrayoflangcode)) { + if (/* is_array($arrayoflangcode) && */count($arrayoflangcode)) { if (!is_object($extralanguages)) { include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php'; $extralanguages = new ExtraLanguages($this->db); @@ -258,7 +262,7 @@ trait CommonPeople // Phones $outphonedone = 0; if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone - $out .= ($outphonedone ? ' ' : ''); + // $out .= ($outphonedone ? ' ' : ''); $out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro")); $outdone++; $outphonedone++; @@ -387,7 +391,7 @@ trait CommonPeople $this->address = dol_strtoupper($this->address); $this->town = dol_strtoupper($this->town); } - if (isset($this->email)) { + if (!empty($this->email)) { $this->email = dol_strtolower($this->email); } if (isset($this->personal_email)) { From e12fdfb55039440502ed3128402a97c722760c86 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 02:56:17 +0100 Subject: [PATCH 54/82] Add language file for tunisia --- htdocs/langs/en_US/sendings.lang | 2 +- htdocs/langs/fr_TN/main.lang | 31 +++++++++++++++++++++++++++++++ htdocs/langs/fr_TN/sendings.lang | 2 ++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 htdocs/langs/fr_TN/main.lang create mode 100644 htdocs/langs/fr_TN/sendings.lang diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index eb9c16239cc..a9bb15faf5f 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -14,7 +14,7 @@ LastSendings=Latest %s shipments StatisticsOfSendings=Statistics for shipments NbOfSendings=Number of shipments NumberOfShipmentsByMonth=Number of shipments by month -SendingCard=Shipment card +SendingCard=Shipment NewSending=New shipment CreateShipment=Create shipment QtyShipped=Qty shipped diff --git a/htdocs/langs/fr_TN/main.lang b/htdocs/langs/fr_TN/main.lang new file mode 100644 index 00000000000..ae3db1eeb17 --- /dev/null +++ b/htdocs/langs/fr_TN/main.lang @@ -0,0 +1,31 @@ +# Dolibarr language file - Source file is en_US - main +DIRECTION=ltr +# Default for FONTFORPDF=helvetica +# Note for Chinese: +# msungstdlight or cid0ct are for traditional Chinese zh_TW (traditional does not render with Ubuntu pdf reader) +# stsongstdlight or cid0cs are for simplified Chinese zh_CN +# To read Chinese pdf with Linux: sudo apt-get install poppler-data +# cid0jp is for Japanish +# cid0kr is for Korean +# DejaVuSans is for some Eastern languages, some Asian languages and some Arabic languages +# freemono is for ru_RU or uk_UA, uz_UZ +# freeserif is for Tamil or Ethiopian +FONTFORPDF=helvetica +FONTSIZEFORPDF=10 +SeparatorDecimal=, +SeparatorThousand=Space +FormatDateShort=%d/%m/%Y +FormatDateShortInput=%d/%m/%Y +FormatDateShortJava=dd/MM/yyyy +FormatDateShortJavaInput=dd/MM/yyyy +FormatDateShortJQuery=dd/mm/yy +FormatDateShortJQueryInput=dd/mm/yy +FormatHourShortJQuery=HH:MI +FormatHourShort=%H:%M +FormatHourShortDuration=%H:%M +FormatDateTextShort=%d %b %Y +FormatDateText=%d %B %Y +FormatDateHourShort=%d/%m/%Y %H:%M +FormatDateHourSecShort=%d/%m/%Y %H:%M:%S +FormatDateHourTextShort=%d %b %Y %H:%M +FormatDateHourText=%d %B %Y %H:%M diff --git a/htdocs/langs/fr_TN/sendings.lang b/htdocs/langs/fr_TN/sendings.lang new file mode 100644 index 00000000000..776063f7602 --- /dev/null +++ b/htdocs/langs/fr_TN/sendings.lang @@ -0,0 +1,2 @@ +# Dolibarr language file - Source file is en_US - sendings +SendingCard=Bon livraison From 6d6335ccf35984853c60900641b6b6b5405d9095 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 02:57:40 +0100 Subject: [PATCH 55/82] Add french tunisia language --- htdocs/langs/en_US/languages.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index 6afa486d033..4ea49a160fa 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -72,6 +72,7 @@ Language_fr_FR=French Language_fr_GA=French (Gabon) Language_fr_NC=French (New Caledonia) Language_fr_SN=French (Senegal) +Language_fr_TN=French (Tunisia) Language_fy_NL=Frisian Language_gl_ES=Galician Language_he_IL=Hebrew From c4b34dd8f74973b0ecc2d1fc6ddb820c2130626d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 09:00:28 +0100 Subject: [PATCH 56/82] Clean code --- htdocs/expedition/list.php | 8 +++----- htdocs/langs/en_US/receptions.lang | 1 - htdocs/langs/en_US/sendings.lang | 1 - htdocs/reception/list.php | 8 ++++---- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index e2cbfed00c5..b45450396bc 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -669,7 +669,7 @@ $companystatic = new Societe($db); $formcompany = new FormCompany($db); $shipment = new Expedition($db); -$title = $langs->trans('ListOfSendings'); +$title = $langs->trans('Shipments'); $help_url = 'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones'; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'bodyforlist mod-expedition page-list'); @@ -934,8 +934,6 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ exit; } -$expedition = new Expedition($db); - if ($socid > 0) { $soc = new Societe($db); $soc->fetch($socid); @@ -1074,7 +1072,7 @@ print ''; print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder -print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'dolly', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($langs->trans('Shipments'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'dolly', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "SendShippingRef"; $modelmail = "shipping_send"; @@ -1085,7 +1083,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($massaction == 'createbills') { print ''; - print ''; + print '
'; print ''; print '
'; print $langs->trans('DateInvoice'); diff --git a/htdocs/langs/en_US/receptions.lang b/htdocs/langs/en_US/receptions.lang index 80e9724b3b4..34b2276fca7 100644 --- a/htdocs/langs/en_US/receptions.lang +++ b/htdocs/langs/en_US/receptions.lang @@ -7,7 +7,6 @@ Receptions=Receptions AllReceptions=All Receptions ShowReception=Show Receptions ReceptionsArea=Receptions area -ListOfReceptions=List of receptions ReceptionMethod=Reception method LastReceptions=Latest %s receptions StatisticsOfReceptions=Statistics for receptions diff --git a/htdocs/langs/en_US/sendings.lang b/htdocs/langs/en_US/sendings.lang index a9bb15faf5f..95406dcc87e 100644 --- a/htdocs/langs/en_US/sendings.lang +++ b/htdocs/langs/en_US/sendings.lang @@ -8,7 +8,6 @@ Shipments=Shipments ShowSending=Show Shipments Receivings=Delivery Receipts SendingsArea=Shipments area -ListOfSendings=List of shipments SendingMethod=Shipping method LastSendings=Latest %s shipments StatisticsOfSendings=Statistics for shipments diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index b8801e6a26d..e50ffb1e687 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -608,9 +608,9 @@ $reception = new Reception($db); $formcompany = new FormCompany($db); $formfile = new FormFile($db); - +$title = $langs->trans('Receptions'); $helpurl = 'EN:Module_Receptions|FR:Module_Receptions|ES:Módulo_Receptiones'; -llxHeader('', $langs->trans('ListOfReceptions'), $helpurl, '', 0, 0, '', '', '', 'bodyforlist mod-reception page-list'); +llxHeader('', $title, $helpurl, '', 0, 0, '', '', '', 'bodyforlist mod-reception page-list'); $sql = "SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as delivery_date, l.date_delivery as date_reception2, e.fk_statut as status, e.billed,"; $sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,"; @@ -906,13 +906,13 @@ print ''; print ''; // @phan-suppress-next-line PhanPluginSuspiciousParamOrder -print_barre_liste($langs->trans('ListOfReceptions'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'dollyrevert', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'dollyrevert', 0, $newcardbutton, '', $limit, 0, 0, 1); if ($massaction == 'createbills') { //var_dump($_REQUEST); print ''; - print ''; + print '
'; print ''; print ' Date: Fri, 22 Nov 2024 10:53:08 +0100 Subject: [PATCH 58/82] Debug v21 --- htdocs/core/class/html.form.class.php | 4 ++-- htdocs/langs/en_US/products.lang | 1 - htdocs/langs/en_US/stocks.lang | 3 --- htdocs/product/admin/product.php | 3 +++ htdocs/product/stats/card.php | 2 +- htdocs/product/stock/movement_card.php | 2 +- htdocs/product/stock/movement_list.php | 8 ++++---- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e61568e6209..d27e941d1e6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2767,9 +2767,9 @@ class Form } if (empty($hidelabel)) { - $out .= $langs->trans("RefOrLabel") . ' : '; + $placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"'; } elseif ($hidelabel > 1) { - $placeholder = ' placeholder="' . $langs->trans("RefOrLabel") . '"'; + $placeholder = ' placeholder="' . dolPrintHTMLForAttribute($langs->trans("RefOrLabel")) . '"'; if ($hidelabel == 2) { $out .= img_picto($langs->trans("Search"), 'search'); } diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index c3b29b9751b..2d8d05e9761 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -97,7 +97,6 @@ ShowService=Show service ProductsAndServicesArea=Product and Services area ProductsArea=Product area ServicesArea=Services area -ListOfStockMovements=List of stock movements BuyingPrice=Buying price PriceForEachProduct=Products with specific prices SupplierCard=Vendor card diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 0648dde54b4..9b651192a6b 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -27,9 +27,6 @@ LotSerialList=List of lot/serials SubjectToLotSerialOnly=Products subject to lot/serial only Movements=Movements ErrorWarehouseRefRequired=Warehouse reference name is required -ListOfWarehouses=List of warehouses -ListOfStockMovements=List of stock movements -ListOfInventories=List of inventories MovementId=Movement ID StockMovementForId=Movement ID %d ListMouvementStockProject=List of stock movements associated to project diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index ea093c7885a..3d7e56c8de8 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -650,6 +650,9 @@ print ''; +print '
'; + + print load_fiche_titre($langs->trans("UserInterface"), '', ''); diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index a0d2cf1a04a..f2708e0df27 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -217,7 +217,7 @@ if ($result || !($id > 0)) { // Product print ''; // Tag diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index f76a30f674a..9c81e707e3d 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -560,7 +560,7 @@ if ($resql) { if ($msid) { $texte = $langs->trans('StockMovementForId', $msid); } else { - $texte = $langs->trans("ListOfStockMovements"); + $texte = $langs->trans("StockMovements"); if ($id) { $texte .= ' ('.$langs->trans("ForThisWarehouse").')'; } diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index a8ecbeacf72..86986da7ed4 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -832,7 +832,7 @@ $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; if ($msid) { $title = $langs->trans('StockMovementForId', $msid); } else { - $title = $langs->trans("ListOfStockMovements"); + $title = $langs->trans("StockMovements"); if ($id) { if (!empty($warehouse->ref)) { $title .= ' ('.$warehouse->ref.')'; @@ -1236,7 +1236,7 @@ if (!empty($arrayfields['pl.sellby']['checked'])) { if (!empty($arrayfields['e.ref']['checked'])) { print ''; } if (!empty($arrayfields['m.fk_user_author']['checked'])) { @@ -1564,7 +1564,7 @@ while ($i < $imaxinloop) { } // Warehouse if (!empty($arrayfields['e.ref']['checked'])) { - print '\n"; } @@ -1591,7 +1591,7 @@ while ($i < $imaxinloop) { if (!empty($arrayfields['origin']['checked'])) { print ''; } - // fk_project + // Project if (!empty($arrayfields['m.fk_projet']['checked'])) { print ''; - print '\n"; } diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index f17607e7e74..a1e33ab79a0 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -278,7 +278,7 @@ print "\n"; print '\n"; // Services diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php index 43a1cab18a6..540244d87d6 100644 --- a/htdocs/takepos/floors.php +++ b/htdocs/takepos/floors.php @@ -59,7 +59,7 @@ $action = GETPOST('action', 'aZ09'); $left = GETPOST('left', 'alpha'); $top = GETPOST('top', 'alpha'); -$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant +$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant $newname = GETPOST('newname', 'alpha'); $mode = GETPOST('mode', 'alpha'); @@ -74,15 +74,22 @@ if (!$user->hasRight('takepos', 'run')) { */ if ($action == "getTables" && $user->hasRight('takepos', 'run')) { - $sql = "SELECT rowid, entity, label, leftpos, toppos, floor FROM ".MAIN_DB_PREFIX."takepos_floor_tables WHERE floor = ".((int) $floor)." AND entity IN (".getEntity('takepos').")"; - $resql = $db->query($sql); $rows = array(); + + $sql = "SELECT rowid, entity, label, leftpos, toppos, floor"; + $sql .= " FROM ".MAIN_DB_PREFIX."takepos_floor_tables"; + $sql .= " WHERE floor = ".((int) $floor)." AND entity IN (".getEntity('takepos').")"; + + $resql = $db->query($sql); while ($row = $db->fetch_array($resql)) { + $tmpplace = (int) $row['rowid']; + $invoice = new Facture($db); - $result = $invoice->fetch('', '(PROV-POS'.$_SESSION['takeposterminal'].'-'.$row['rowid'].')'); + $result = $invoice->fetch('', '(PROV-POS'.$_SESSION['takeposterminal'].'-'.$tmpplace.')'); if ($result > 0) { $row['occupied'] = "red"; } + $rows[] = $row; } diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 8f3259b46c0..4a7f4eebfe4 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -624,7 +624,9 @@ if (empty($reshook)) { if ($placeid < 0) { dol_htmloutput_errors($invoice->error, $invoice->errors, 1); } - $sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid = ".((int) $placeid); + $sql = "UPDATE ".MAIN_DB_PREFIX."facture"; + $sql .= " SET ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; + $sql .= " WHERE rowid = ".((int) $placeid); $resql = $db->query($sql); if (!$resql) { $error++; @@ -898,7 +900,7 @@ if (empty($reshook)) { if ($invoice->status == $invoice::STATUS_DRAFT && $invoice->pos_source && $invoice->module_source == 'takepos') { $permissiontoupdateline = true; // TODO Add also a test on $_SESSION('publicobjectid'] defined at creation of object - // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the invoice ID + // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the table ID } }*/ @@ -928,11 +930,12 @@ if (empty($reshook)) { // Action to delete or discard an invoice if ($action == "delete" && ($user->hasRight('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) { - // $placeid is the invoice id (it differs from place) and is defined if the place is set and the ref of invoice is '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')', so the fetch at beginning of page works. + // $placeid is the invoice id (it differs from place) and is defined if the place is set and + // the ref of invoice is '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')', so the fetch at beginning of page works. if ($placeid > 0) { $result = $invoice->fetch($placeid); - if ($result > 0 && $invoice->statut == Facture::STATUS_DRAFT) { + if ($result > 0 && $invoice->status == Facture::STATUS_DRAFT) { $db->begin(); // We delete the lines @@ -973,7 +976,7 @@ if (empty($reshook)) { if ($invoice->status == $invoice::STATUS_DRAFT && $invoice->pos_source && $invoice->module_source == 'takepos') { $permissiontoupdateline = true; // TODO Add also a test on $_SESSION('publicobjectid'] defined at creation of object - // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the invoice ID + // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the table ID } } if (!$permissiontoupdateline) { @@ -1023,7 +1026,7 @@ if (empty($reshook)) { if ($invoice->status == $invoice::STATUS_DRAFT && $invoice->pos_source && $invoice->module_source == 'takepos') { $permissiontoupdateline = true; // TODO Add also a test on $_SESSION('publicobjectid'] defined at creation of object - // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the invoice ID + // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the table ID } } @@ -1074,7 +1077,7 @@ if (empty($reshook)) { if ($invoice->status == $invoice::STATUS_DRAFT && $invoice->pos_source && $invoice->module_source == 'takepos') { $permissiontoupdateline = true; // TODO Add also a test on $_SESSION('publicobjectid'] defined at creation of object - // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the invoice ID + // TODO Check also that invoice->ref is (PROV-POS1-2) with 1 = terminal and 2, the table ID } } if (!$permissiontoupdateline) { diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index be9db4bb922..f60e08dd546 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -187,7 +187,7 @@ if ($usestripeterminals && $invoice->type != $invoice::TYPE_CREDIT_NOTE) { if (!getDolGlobalString($keyforstripeterminalbank)) { ?> const config = { simulated: true false - , location: 'global->STRIPE_LOCATION; ?>' + , location: '' } terminal.discoverReaders(config).then(function(discoverResult) { if (discoverResult.error) { @@ -233,8 +233,8 @@ if ($usestripeterminals && $invoice->type != $invoice::TYPE_CREDIT_NOTE) { total_ttc; ?>); - if (alreadypaydplusreceived > total_ttc; ?>) + //console.log("total_ttc = "+total_ttc; ?>); + if (alreadypaydplusreceived > total_ttc; ?>) { - var change=parseFloat(alreadypayed + parseFloat(received) - total_ttc; ?>); + var change=parseFloat(alreadypayed + parseFloat(received) - total_ttc; ?>); $('.change2').html(pricejs(change, 'MT')); $('.change2').val(change); $('.change1').removeClass('colorred'); @@ -439,7 +439,7 @@ if (!getDolGlobalInt("TAKEPOS_NUMPAD")) { fetchPaymentIntentClientSecret(amountpayed, invoiceid).then(function(client_secret) { - terminal.setSimulatorConfiguration({testCardNumber: 'global->STRIPE_TERMINAL_SIMULATED; ?>'}); + terminal.setSimulatorConfiguration({testCardNumber: ''}); document.getElementById("card-present-alert").innerHTML = '
trans('PaymentSendToStripeTerminal'); ?>
'; terminal.collectPaymentMethod(client_secret).then(function(result) { diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index 881c8bd16e5..8427e5b7b6c 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -78,8 +78,11 @@ if (!$user->hasRight('takepos', 'run')) { top_htmlhead('', '', 1); -if ($place > 0) { - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'"; +if ((string) $place != '') { + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture"; + $sql .= " WHERE ref = '(PROV-POS".$db->escape($_SESSION["takeposterminal"]."-".$place).")'"; + $sql .= " AND entity IN (".getEntity('invoice').")"; + $resql = $db->query($sql); $obj = $db->fetch_object($resql); if ($obj) { diff --git a/htdocs/takepos/reduction.php b/htdocs/takepos/reduction.php index 047fb89610c..b6eab6d8343 100644 --- a/htdocs/takepos/reduction.php +++ b/htdocs/takepos/reduction.php @@ -69,7 +69,10 @@ $invoice = new Facture($db); if ($invoiceid > 0) { $invoice->fetch($invoiceid); } else { - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture"; + $sql .= " WHERE ref = '(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; + $sql .= " AND entity IN (".getEntity('invoice').")"; + $resql = $db->query($sql); $obj = $db->fetch_object($resql); if ($obj) { diff --git a/htdocs/takepos/split.php b/htdocs/takepos/split.php index 7f6796db0b0..8fadea69c95 100644 --- a/htdocs/takepos/split.php +++ b/htdocs/takepos/split.php @@ -62,7 +62,7 @@ if (!$user->hasRight('takepos', 'run')) { * Actions */ -if ($action=="split" && $user->hasRight('takepos', 'run')) { +if ($action == "split" && $user->hasRight('takepos', 'run')) { $line = GETPOSTINT('line'); $split = GETPOSTINT('split'); if ($split==1) { // Split line @@ -85,16 +85,17 @@ if ($action=="split" && $user->hasRight('takepos', 'run')) { if ($placeid < 0) { dol_htmloutput_errors($invoice->error, $invoice->errors, 1); } - $sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-SPLIT)' where rowid=".$placeid; + $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET ref='(PROV-POS".$_SESSION["takeposterminal"]."-SPLIT)'"; + $sql .= " WHERE rowid = ".((int) $placeid); $db->query($sql); } } - $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set fk_facture=".$placeid." where rowid=".$line; + $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet SET fk_facture = ".((int) $placeid)." WHERE rowid = ".((int) $line); $db->query($sql); } elseif ($split==0) { // Unsplit line $invoice = new Facture($db); - if ($place=="SPLIT") { - $place="0"; + if ($place == "SPLIT") { + $place = "0"; } // Avoid move line to the same place (from SPLIT to SPLIT place) $ret = $invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')'); if ($ret > 0) { @@ -114,7 +115,9 @@ if ($action=="split" && $user->hasRight('takepos', 'run')) { if ($placeid < 0) { dol_htmloutput_errors($invoice->error, $invoice->errors, 1); } - $sql = "UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid; + + $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; + $sql .= " WHERE rowid = ".((int) $placeid); $db->query($sql); } } @@ -123,6 +126,7 @@ if ($action=="split" && $user->hasRight('takepos', 'run')) { } $invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-SPLIT)'); $invoice->update_price(); + $invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')'); $invoice->update_price(); } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 374537924e1..774f134dc0a 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5363,7 +5363,7 @@ img.boxhandle, img.boxclose { .add-filter-btn { margin: 0 !important; } -.search-component-assistance .operand, .operator, .value { +.search-component-assistance .operand, .search-component-assistance .operator, .search-component-assistance .value { display: contents; } .search-component-assistance .btn-div{ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 1327a739682..4a2ee8d9890 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5352,7 +5352,7 @@ img.boxhandle, img.boxclose { .add-filter-btn { margin: 0 !important; } -.search-component-assistance .operand, .operator, .value { +.search-component-assistance .operand, .search-component-assistance .operator, .search-component-assistance .value { display: contents; } .search-component-assistance .btn-div{ From ef714b23c0247b26cf0b164d776b880978d4dac2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 12:29:00 +0100 Subject: [PATCH 60/82] Debug v21 --- htdocs/takepos/invoice.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 4a7f4eebfe4..e05f6f1d4d3 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -265,7 +265,7 @@ if (empty($reshook)) { $conf->global->STOCK_CALCULATE_ON_BILL = 1; // To force the change of stock during invoice validation - $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; + $constantforkey = 'CASHDESK_ID_WAREHOUSE'.(isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : ''); dol_syslog("Validate invoice with stock change. Warehouse defined into constant ".$constantforkey." = ".getDolGlobalString($constantforkey)); // Validate invoice with stock change into warehouse getDolGlobalInt($constantforkey) @@ -799,7 +799,7 @@ if (empty($reshook)) { $line = array('description' => $prod->description, 'price' => $price, 'tva_tx' => $tva_tx, 'localtax1_tx' => $localtax1_tx, 'localtax2_tx' => $localtax2_tx, 'remise_percent' => $customer->remise_percent, 'price_ttc' => $price_ttc, 'array_options' => $array_options); /* setup of margin calculation */ - if (isset($conf->global->MARGIN_TYPE)) { + if (getDolGlobalString('MARGIN_TYPE')) { if (getDolGlobalString('MARGIN_TYPE') == 'pmp' && !empty($prod->pmp)) { $line['fk_fournprice'] = null; $line['pa_ht'] = $prod->pmp; @@ -1259,7 +1259,7 @@ if (empty($reshook)) { if (getDolGlobalInt('TAKEPOS_PRINT_INVOICE_DOC_INSTEAD_OF_RECEIPT')) { $sectionwithinvoicelink .= ' Invoice'; } elseif (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { - if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) { + if (getDolGlobalString('TAKEPOS_PRINT_SERVER') && filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) { $sectionwithinvoicelink .= ' '; } else { $sectionwithinvoicelink .= ' '; @@ -1357,11 +1357,11 @@ $(document).ready(function() { global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) { + if (filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) { ?> $.ajax({ type: "POST", - url: 'global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php', + url: '/printer/index.php', data: 'invoice='+orderprinter1esc }); $.ajax({ type: "POST", - url: 'http://global->TAKEPOS_PRINT_SERVER; ?>:8111/print', + url: 'http://:8111/print', data: '' }); @@ -1378,11 +1378,11 @@ if ($action == "order" && !empty($order_receipt_printer1)) { } if ($action == "order" && !empty($order_receipt_printer2)) { - if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) { + if (filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) { ?> $.ajax({ type: "POST", - url: 'global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php?printer=2', + url: '/printer/index.php?printer=2', data: 'invoice='+orderprinter2esc }); $.ajax({ type: "POST", - url: 'http://global->TAKEPOS_PRINT_SERVER; ?>:8111/print2', + url: 'http://:8111/print2', data: '' }); @@ -1399,11 +1399,11 @@ if ($action == "order" && !empty($order_receipt_printer2)) { } if ($action == "order" && !empty($order_receipt_printer3)) { - if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) { + if (filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) { ?> $.ajax({ type: "POST", - url: 'global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php?printer=3', + url: '/printer/index.php?printer=3', data: 'invoice='+orderprinter3esc }); $.ajax({ type: "POST", - url: 'http://global->TAKEPOS_PRINT_SERVER; ?>:8111/print', + url: 'http://:8111/print', data: '' }); @@ -1984,7 +1984,7 @@ if ($placeid > 0) { if ($line->product_label && $line->desc) { $htmlforlines .= '
'; } - $firstline = dolGetFirstLineOfText($line->desc, $conf->global->TAKEPOS_SHOW_N_FIRST_LINES); + $firstline = dolGetFirstLineOfText($line->desc, getDolGlobalString('TAKEPOS_SHOW_N_FIRST_LINES')); if ($firstline != $line->desc) { $htmlforlines .= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); } else { From 65aadd446a62d2908addf582d3d3a24c11eb4911 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 12:33:53 +0100 Subject: [PATCH 61/82] Debug v21 --- htdocs/takepos/admin/bar.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index beb3089cebd..9459557f18c 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -137,10 +137,13 @@ if (getDolGlobalInt('TAKEPOS_BAR_RESTAURANT')) { print "\n"; print '
'; print ''; if (getDolGlobalString('TAKEPOS_ORDER_PRINTERS')) { From 1f386fb8086607a670221ed0781d48ed1aba5820 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Fri, 22 Nov 2024 13:21:18 +0100 Subject: [PATCH 62/82] fix #32060 (#32061) * fix #32060 * fix #32060 --- htdocs/compta/facture/class/facture-rec.class.php | 2 +- htdocs/fourn/class/fournisseur.facture-rec.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 3a5fe7166ab..f9cd158244f 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1311,7 +1311,7 @@ class FactureRec extends CommonInvoice if (empty($this->date_when)) { return false; } - return dol_time_plus_duree($this->date_when, $this->frequency, $this->unit_frequency); + return dol_time_plus_duree($this->date_when, $this->frequency, $this->unit_frequency, 1); } /** diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index f57cfab72fb..7d2ea231dfc 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -1307,7 +1307,7 @@ class FactureFournisseurRec extends CommonInvoice if (empty($this->date_when)) { return false; } - return dol_time_plus_duree((int) $this->date_when, $this->frequency, $this->unit_frequency); + return dol_time_plus_duree((int) $this->date_when, $this->frequency, $this->unit_frequency, 1); } /** From 2b264ae5d07bb27ea407ec3390ddba7096693c76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 22 Nov 2024 15:24:11 +0100 Subject: [PATCH 63/82] fix phpstan (#32063) --- htdocs/takepos/invoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index e05f6f1d4d3..e557d95de02 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1984,7 +1984,7 @@ if ($placeid > 0) { if ($line->product_label && $line->desc) { $htmlforlines .= '
'; } - $firstline = dolGetFirstLineOfText($line->desc, getDolGlobalString('TAKEPOS_SHOW_N_FIRST_LINES')); + $firstline = dolGetFirstLineOfText($line->desc, getDolGlobalInt('TAKEPOS_SHOW_N_FIRST_LINES')); if ($firstline != $line->desc) { $htmlforlines .= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); } else { From ef88eeeffda05f2c4ebf896997a77600be795b5c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Nov 2024 15:30:19 +0100 Subject: [PATCH 64/82] Debug v21 --- htdocs/theme/eldy/global.inc.php | 6 +++++- htdocs/user/virtualcard.php | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 374537924e1..97b87c5faf0 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -8700,7 +8700,11 @@ table.jPicker { .side-nav { z-index: 200; background: var(--colorbackvmenu1); - padding-top: 70px; + /* padding-top: 70px; */ + position: relative; + top: 70px; + width: 245px; /* must be same than div.login_block */ + box-shadow: none; } #id-left { z-index: 201; diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index 95644a080fc..a83bc200025 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -131,7 +131,7 @@ if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); $enabledisablehtml .= ''; - $enabledisablehtml .= '

'.$langs->trans("UserPublicPageDesc").'

'; + $enabledisablehtml .= '

'.$langs->trans("UserPublicPageDesc").'
'; } else { // Button on, click to disable $enabledisablehtml .= ''; @@ -139,13 +139,14 @@ if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { $enabledisablehtml .= ''; } print $enabledisablehtml; -print ''; +print ''; -print '

'; print '
'; if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { + print '

'; + print ''; print ''; print ''; From fb3c464555c3ea0fded626b5c3b9e71ba908c813 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Nov 2024 13:00:08 +0100 Subject: [PATCH 65/82] Debug v21 --- htdocs/core/lib/ajax.lib.php | 18 +++++++++++----- htdocs/core/lib/functions.lib.php | 2 +- htdocs/public/users/view.php | 36 ++++++++++++++++++++++++------- htdocs/user/virtualcard.php | 29 ++++++++++++------------- 4 files changed, 56 insertions(+), 29 deletions(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 20ebd6464df..8fa4576ad8c 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -639,14 +639,14 @@ function ajax_event($htmlname, $events) * @param string $suffix Suffix to use on the name of the switch picto when option is on. Example: '', '_red' * @param string $mode Add parameter &mode= to the href link (Used for href link) * @param string $morecss More CSS - * @param int $userconst 1=OnOff for user constant of user $userconst + * @param User|int $userconst If set, use the ajax On/Off for user or user ID $userconst * @param string $showwarning String to show a warning when enabled the option * @return string * @see ajax_object_onoff() to update the status of an object */ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0, $setzeroinsteadofdel = 0, $suffix = '', $mode = '', $morecss = 'inline-block', $userconst = 0, $showwarning = '') { - global $conf, $langs, $user; + global $conf, $langs, $user, $db; $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity); if (!isset($input)) { @@ -660,6 +660,14 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof $out = ''.img_picto($langs->trans("Enabled"), 'on').''; } } else { + if (is_object($userconst)) { + $userconstid = $userconst->id; + } elseif (is_numeric($userconstid) && $userconstid > 0) { + $userconstid = $userconst; + $userconst = new User($db); + $userconst->fetch($userconstid); + } + $out = "\n".' '."\n"; - if ($userconst) { - $value = getDolUserString($code); + if (!empty($userconst) && $userconst instanceof User) { + $value = getDolUserString($code, '', $userconst); } else { $value = getDolGlobalString($code); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d2609495d49..1c91d3d0b2d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4039,7 +4039,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor $link = str_replace('{socialid}', $value, getDolGlobalString($networkconstname)); if (preg_match('/^https?:\/\//i', $link)) { $htmllink .= ''.dol_escape_htmltag($value).''; - } else { + } elseif ($link) { $htmllink .= ''.dol_escape_htmltag($value).''; } } elseif (!empty($dictsocialnetworks[$type]['url'])) { diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index f0b759fa668..deec8d448ed 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -99,7 +99,6 @@ if ($cancel) { * View */ -$form = new Form($db); $v = new vCard(); $company = $mysoc; @@ -157,9 +156,20 @@ if (getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object)) { } if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object)) { $object->socialnetworks = []; +} else { + // Show list of social networks for company + $listofnetworks = $object->socialnetworks; + + if (!empty($listofnetworks)) { + foreach ($listofnetworks as $key => $networkVal) { + if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS_'.strtoupper($key), 0, $object)) { + unset($object->socialnetworks[$key]); + } + } + } } -// By default, personal address not visible +// By default, personal birthdate and address is not visible if (!getDolUserInt('USER_PUBLIC_SHOW_BIRTH', 0, $object)) { $object->birth = null; } @@ -176,8 +186,18 @@ if (getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) { } if (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS', 0, $object) && is_object($company)) { $company->socialnetworks = []; -} +} else { + // Show list of social networks for company + $listofnetworks = $mysoc->socialnetworks; + if (!empty($listofnetworks)) { + foreach ($listofnetworks as $key => $networkVal) { + if (getDolUserInt('SOCIETE_PUBLIC_HIDE_SOCIALNETWORKS_'.strtoupper($key), 0, $object)) { + unset($mysoc->socialnetworks[$key]); + } + } + } +} // Output vcard if ($mode == 'vcard') { @@ -220,7 +240,7 @@ $arrayofjs = array(); $arrayofcss = array(); $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; -llxHeader($head, $object->getFullName($langs).' - '.$langs->trans("PublicVirtualCard"), '', '', 0, 0, '', '', '', 'onlinepaymentbody'.(GETPOST('mode')=='preview' ? ' scalepreview cursorpointer virtualcardpreview' : ''), $replacemainarea, 1, 1); +llxHeader($head, $object->getFullName($langs).' - '.$langs->trans("PublicVirtualCard"), '', '', 0, 0, $arrayofjs, $arrayofcss, '', 'onlinepaymentbody'.(GETPOST('mode') == 'preview' ? ' scalepreview cursorpointer virtualcardpreview' : ''), $replacemainarea, 1, 1); print '
'; print $langs->trans('DateInvoice'); From dbba584dfbdcccd35870fbd378ef7c076ac5e61e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 09:19:12 +0100 Subject: [PATCH 57/82] Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop --- htdocs/adherents/class/adherent.class.php | 2 +- htdocs/contact/class/contact.class.php | 2 +- htdocs/contact/list.php | 5 ----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index e2353b82af6..7ad5ee54ee7 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -3300,7 +3300,7 @@ class Adherent extends CommonObject $return .= '
'; $return .= ''; if (property_exists($this, 'photo') || !empty($this->photo)) { - $return .= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photoref photowithmargin photologintooltip', 'small', 0, 1); + $return .= Form::showphoto('memberphoto', $this, 0, 60, 0, 'photokanban photowithmargin photologintooltip', 'small', 0, 1); } else { $return .= img_picto('', 'user'); } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 9af01fe74ce..5fc553e9994 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1531,7 +1531,7 @@ class Contact extends CommonObject * @param string $morecss Add more css on link * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $moreparam = '', $save_lastsearch_value = -1, $notooltip = 0, $morecss = '') + public function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $moreparam = '', $save_lastsearch_value = -1, $notooltip = 0, $morecss = 'valignmiddle') { global $conf, $langs, $hookmanager; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 0d971f01723..ae6fd816681 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -166,26 +166,22 @@ if ($type == "p") { $contextpage = 'contactprospectlist'; } $title .= ' ('.$langs->trans("ThirdPartyProspects").')'; - $urlfiche = "card.php"; } if ($type == "c") { if (empty($contextpage) || $contextpage == 'contactlist') { $contextpage = 'contactcustomerlist'; } $title .= ' ('.$langs->trans("ThirdPartyCustomers").')'; - $urlfiche = "card.php"; } elseif ($type == "f") { if (empty($contextpage) || $contextpage == 'contactlist') { $contextpage = 'contactsupplierlist'; } $title .= ' ('.$langs->trans("ThirdPartySuppliers").')'; - $urlfiche = "card.php"; } elseif ($type == "o") { if (empty($contextpage) || $contextpage == 'contactlist') { $contextpage = 'contactotherlist'; } $title .= ' ('.$langs->trans("OthersNotLinkedToThirdParty").')'; - $urlfiche = ""; } // Initialize a technical object @@ -1453,7 +1449,6 @@ while ($i < $imaxinloop) { } } else { // Show here line of result - $j = 0; print '
'.$langs->trans("ProductOrService").''; print img_picto('', 'product', 'class="pictofixedwidth"'); - print $form->select_produits($id, 'id', '', 0, 0, 1, 2, '', ($conf->dol_optimize_smallscreen ? 1 : 0), array(), 0, '1', 0, 'widthcentpercentminusx maxwidth400'); + print $form->select_produits($id, 'id', '', 0, 0, 1, 2, '', 0, array(), 0, $langs->trans("RefOrLabel"), 0, 'widthcentpercentminusx maxwidth400'); print '
'; //print ''; - print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'maxwidth200'); + print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'maxwidth150'); print ''; + print ''; print $warehousestatic->getNomUrl(1); print "'.$origin.''; if ($obj->fk_project != 0) { From 999754c1842b3c786ae046d11fc40c21c7c6864e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 12:07:48 +0100 Subject: [PATCH 59/82] Debug v21 --- htdocs/langs/en_US/cashdesk.lang | 2 +- htdocs/langs/fr_FR/cashdesk.lang | 2 +- htdocs/takepos/admin/bar.php | 4 ++-- htdocs/takepos/admin/setup.php | 2 +- htdocs/takepos/floors.php | 15 +++++++++++---- htdocs/takepos/invoice.php | 17 ++++++++++------- htdocs/takepos/pay.php | 14 +++++++------- htdocs/takepos/receipt.php | 7 +++++-- htdocs/takepos/reduction.php | 5 ++++- htdocs/takepos/split.php | 16 ++++++++++------ htdocs/theme/eldy/global.inc.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 12 files changed, 54 insertions(+), 34 deletions(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index afe22259f17..5155d532f7c 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -60,7 +60,7 @@ Numberspad=Numbers Pad BillsCoinsPad=Coins and banknotes Pad DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr TakeposNeedsCategories=TakePOS needs at least one product category to work -TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS needs at least 1 product category under the category %s to work +TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS needs at least 1 sub-category under the product category %s to work OrderNotes=Can add some notes to each ordered items CashDeskBankAccountFor=Default account to use for payments in NoPaimementModesDefined=No paiment mode defined in TakePOS configuration diff --git a/htdocs/langs/fr_FR/cashdesk.lang b/htdocs/langs/fr_FR/cashdesk.lang index 2f7a1a59aa8..ecbb052ad0b 100644 --- a/htdocs/langs/fr_FR/cashdesk.lang +++ b/htdocs/langs/fr_FR/cashdesk.lang @@ -60,7 +60,7 @@ Numberspad=Pavé numérique BillsCoinsPad=Pavé avec montant des Pièces et Billets DolistorePosCategory=Modules TakePOS et autres solutions de PDV pour Dolibarr TakeposNeedsCategories=TakePOS a besoin d'au moins une catégorie de produits pour fonctionner -TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS a besoin d'au moins 1 catégorie de produits dans la catégorie %s pour fonctionner +TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS a besoin d'au moins 1 sous-catégorie dans la catégorie de produit %s pour fonctionner OrderNotes=Il est possible d'ajouter des notes sur chacun des produits commandés CashDeskBankAccountFor=Compte par défaut à utiliser pour les paiements en NoPaimementModesDefined=Aucun mode de paiement défini dans la configuration de TakePOS diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index 362942bc16d..beb3089cebd 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -179,9 +179,9 @@ if (getDolGlobalInt('TAKEPOS_BAR_RESTAURANT')) { print '
'; print $langs->trans("SupplementCategory"); print ''; + print ''; print img_picto('', 'category', 'class="pictofixedwidth"'); - print $form->select_all_categories(Categorie::TYPE_PRODUCT, getDolGlobalString('TAKEPOS_SUPPLEMENTS_CATEGORY'), 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0); + print $form->select_all_categories(Categorie::TYPE_PRODUCT, getDolGlobalString('TAKEPOS_SUPPLEMENTS_CATEGORY'), 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0, 0, 'minwidth 200 maxwidth500 widthcentpercentminusx'); print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY'); print "
'; print $langs->trans("NumberOfTerminals"); print ''; -print ''; +print ''; print "
'; - print $langs->trans("OrderPrinters").' ('.$langs->trans("Setup").')'; + print $langs->trans("OrderPrinters"); print ''; print ajax_constantonoff("TAKEPOS_ORDER_PRINTERS", array(), $conf->entity, 0, 0, 1, 0); + if (getDolGlobalString('TAKEPOS_ORDER_PRINTERS')) { + print'   '.$langs->trans("Setup").''; + } print '