From e9eb22f8f0a8667873e13cafca87723002a28d0d Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Fri, 10 Jan 2025 11:17:06 +0100 Subject: [PATCH 01/23] zero could be a value --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 9d265d0240d..3536ec55be5 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2076,7 +2076,7 @@ if ($id > 0) { //var_dump($fieldlist); $class = ''; $showfield = 1; - $valuetoshow = empty($obj->$value) ? '' : $obj->$value; + $valuetoshow = !isset($obj->$value) ? '' : $obj->$value; $titletoshow = ''; if ($value == 'entity') { From a34d760a88cfd7a96b00864180aed06cde2d4c5c Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Fri, 10 Jan 2025 11:28:46 +0100 Subject: [PATCH 02/23] fix edit : display zero value instead of nothing --- htdocs/admin/dict.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 3536ec55be5..e1a38d4c750 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2445,7 +2445,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') } if (in_array($value, array('code', 'libelle', 'type')) && $tabname == "c_actioncomm" && isset($obj->$value) && in_array($obj->type, array('system', 'systemauto'))) { - $hidden = (!empty($obj->{$value}) ? $obj->{$value}:''); + $hidden = (isset($obj->{$value}) ? $obj->{$value}:''); print ''; print ''; print $langs->trans($hidden); @@ -2558,7 +2558,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') } elseif ($value == 'price' || preg_match('/^amount/i', $value)) { print ''; } elseif ($value == 'code' && isset($obj->{$value})) { - print ''; + print ''; } elseif ($value == 'unit') { print ''; $units = array( From dd40aea3803251c57f84213eb134ebc68bc5fd49 Mon Sep 17 00:00:00 2001 From: tnegre Date: Tue, 28 Jan 2025 14:18:26 +0100 Subject: [PATCH 03/23] Add hook PrintFieldListFrom on actions list --- htdocs/comm/action/list.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index d3d1ecfb833..18cd89caa2c 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -454,6 +454,12 @@ if ($filtert > 0 || $usergroup > 0) { if ($usergroup > 0) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; } + +// Add table from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sql .= " WHERE c.id = a.fk_action"; $sql .= ' AND a.entity IN ('.getEntity('agenda').')'; // Condition on actioncode From d288fe74a2372afe67268473fbc8a6d9610cbb1f Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Fri, 7 Feb 2025 15:05:49 +0100 Subject: [PATCH 04/23] fk_user_author instead of user_author into update --- htdocs/compta/facture/class/facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 1c02a897a14..4f95b29cfa8 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2551,7 +2551,7 @@ class Facture extends CommonInvoice $sql .= " total_ttc=".(isset($this->total_ttc) ? $this->total_ttc : "null").","; $sql .= " revenuestamp=".((isset($this->revenuestamp) && $this->revenuestamp != '') ? $this->db->escape($this->revenuestamp) : "null").","; $sql .= " fk_statut=".(isset($this->statut) ? $this->db->escape($this->statut) : "null").","; - $sql .= " fk_user_author=".(isset($this->user_author) ? $this->db->escape($this->user_author) : "null").","; + $sql .= " fk_user_author=".(isset($this->fk_user_author) ? $this->db->escape($this->fk_user_author) : "null").","; $sql .= " fk_user_valid=".(isset($this->fk_user_valid) ? $this->db->escape($this->fk_user_valid) : "null").","; $sql .= " fk_facture_source=".(isset($this->fk_facture_source) ? $this->db->escape($this->fk_facture_source) : "null").","; $sql .= " fk_projet=".(isset($this->fk_project) ? $this->db->escape($this->fk_project) : "null").","; From 03340d601622e791b9b00094ce0980e1d70f82ba Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Fri, 7 Feb 2025 15:13:20 +0100 Subject: [PATCH 05/23] in case of old code in other part makes a direct assignation --- htdocs/compta/facture/class/facture.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 4f95b29cfa8..5011753c47f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2522,6 +2522,9 @@ class Facture extends CommonInvoice if (isset($this->retained_warranty)) { $this->retained_warranty = floatval($this->retained_warranty); } + if (!isset($this->fk_user_author) && isset($this->user_author) ) { + $this->fk_user_author = $this->user_author; + } // Check parameters From 7eba8832e683f4cb4cecdf928427f8ff40622f9e Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Fri, 7 Feb 2025 15:47:36 +0100 Subject: [PATCH 06/23] FIX bad dispatched quantities for batches on shipment card --- htdocs/expedition/dispatch.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/expedition/dispatch.php b/htdocs/expedition/dispatch.php index fd9f2f7f1b9..53ac2ff3cc6 100644 --- a/htdocs/expedition/dispatch.php +++ b/htdocs/expedition/dispatch.php @@ -765,14 +765,14 @@ if ($object->id > 0 || !empty($object->ref)) { print ''; // Dispatch column print ''; // Warehouse column - /*$sql = "SELECT cfd.rowid, cfd.qty, cfd.fk_entrepot, cfd.batch, cfd.eatby, cfd.sellby, cfd.fk_product"; - $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd"; - $sql .= " WHERE cfd.fk_commandefourndet = ".(int) $objp->rowid;*/ - - $sql = "SELECT ed.rowid, ed.qty, ed.fk_entrepot, eb.batch, eb.eatby, eb.sellby, cd.fk_product"; - $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."expeditiondet_batch as eb on ed.rowid = eb.fk_expeditiondet"; - $sql .= " JOIN ".MAIN_DB_PREFIX."commandedet as cd on ed.fk_origin_line = cd.rowid"; + $sql = "SELECT ed.rowid"; + $sql .= ", cd.fk_product"; + $sql .= ", ".$db->ifsql('eb.rowid IS NULL', 'ed.qty', 'eb.qty')." as qty"; + $sql .= ", ed.fk_entrepot"; + $sql .= ", eb.batch, eb.eatby, eb.sellby"; + $sql .= " FROM ".$db->prefix()."expeditiondet as ed"; + $sql .= " LEFT JOIN ".$db->prefix()."expeditiondet_batch as eb on ed.rowid = eb.fk_expeditiondet"; + $sql .= " INNER JOIN ".$db->prefix()."commandedet as cd on ed.fk_origin_line = cd.rowid"; $sql .= " WHERE ed.fk_origin_line =".(int) $objp->rowid; $sql .= " AND ed.fk_expedition =".(int) $object->id; $sql .= " ORDER BY ed.rowid, ed.fk_origin_line"; From 47f10cdc297433548eb34e35039556e5851d13d7 Mon Sep 17 00:00:00 2001 From: ulysse-vldn Date: Mon, 10 Feb 2025 09:55:47 +0100 Subject: [PATCH 07/23] Fix missing unset post fourn_ref --- htdocs/fourn/facture/card-rec.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index ae26587c6bc..4ef17a83632 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -717,6 +717,7 @@ if (empty($reshook)) { unset($_POST['date_end_fill']); unset($_POST['situations']); unset($_POST['progress']); + unset($_POST['fourn_ref']); } else { setEventMessages($object->error, $object->errors, 'errors'); } @@ -859,6 +860,7 @@ if (empty($reshook)) { unset($_POST['date_endyear']); unset($_POST['situations']); unset($_POST['progress']); + unset($_POST['fourn_ref']); } else { setEventMessages($object->error, $object->errors, 'errors'); } From d04ac67ecdc70fa84189ade0490560598840d65a Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Tue, 11 Feb 2025 00:31:59 +0100 Subject: [PATCH 08/23] backport 20.0 solution --- htdocs/admin/dict.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index e1a38d4c750..c9f44885d2c 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2004,6 +2004,11 @@ if ($id > 0) { $canbemodified = 1; } + if ($tabname[$id] == "c_product_nature" && in_array($obj->code, array(0, 1))) { + $canbedisabled = 0; + $canbemodified = 0; + $iserasable = 0; + } // Build Url. The table is id=, the id of line is rowid= $rowidcol = $tabrowid[$id]; // If rowidcol not defined From 94eaf5d0891320bbf94a975295ff8fc7fe946f23 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Tue, 11 Feb 2025 00:32:57 +0100 Subject: [PATCH 09/23] cancel first idea --- htdocs/admin/dict.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index c9f44885d2c..859ef271a85 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2081,7 +2081,7 @@ if ($id > 0) { //var_dump($fieldlist); $class = ''; $showfield = 1; - $valuetoshow = !isset($obj->$value) ? '' : $obj->$value; + $valuetoshow = empty($obj->$value) ? '' : $obj->$value; $titletoshow = ''; if ($value == 'entity') { @@ -2450,7 +2450,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') } if (in_array($value, array('code', 'libelle', 'type')) && $tabname == "c_actioncomm" && isset($obj->$value) && in_array($obj->type, array('system', 'systemauto'))) { - $hidden = (isset($obj->{$value}) ? $obj->{$value}:''); + $hidden = (!empty($obj->{$value}) ? $obj->{$value}:''); print ''; print ''; print $langs->trans($hidden); @@ -2563,7 +2563,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') } elseif ($value == 'price' || preg_match('/^amount/i', $value)) { print ''; } elseif ($value == 'code' && isset($obj->{$value})) { - print ''; + print ''; } elseif ($value == 'unit') { print ''; $units = array( From 33475b8e92efea7112b9ca2cdc86cb2982c11135 Mon Sep 17 00:00:00 2001 From: MarcVJ <38230768+MarcVJ@users.noreply.github.com> Date: Tue, 11 Feb 2025 10:00:06 +0100 Subject: [PATCH 10/23] Added one line to allow use of price_ttc in calculated extra fields price_ttc sometimes needs to be used in extra fields to compute price ttc per kilo or per liter. Currently price_ttc does not compute in the product list, so price per kilo cannot compute either. This allows to add an extra field "Price TTC per kilo" like this : $object->price_ttc / $object->weight. $object->price_ttc will work because the added line puts price_ttc into $products_static, which is put in $object. --- htdocs/product/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index aa378d1c85c..d262f757909 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1628,6 +1628,7 @@ while ($i < $imaxinloop) { } $product_static->price = $obj->price; + $product_static->price_ttc = $obj->price_ttc; // Allows to use price_ttc in calculated extra fields (ex : price per kilo) $object = $product_static; From edea44bccba3e580950b1f8310891b416bef3c68 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Tue, 11 Feb 2025 17:12:15 +0100 Subject: [PATCH 11/23] FIX display full tree on shipment card when a kit contains a same component in other sub-kit --- htdocs/product/class/product.class.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4860fe9c34a..7f8de67a96a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4966,8 +4966,6 @@ class Product extends CommonObject */ public function getChildsArbo($id, $firstlevelonly = 0, $level = 1, $parents = array()) { - global $alreadyfound; - if (empty($id)) { return array(); } @@ -4984,9 +4982,6 @@ class Product extends CommonObject dol_syslog(get_class($this).'::getChildsArbo id='.$id.' level='.$level. ' parents='.(is_array($parents)?implode(',', $parents):$parents), LOG_DEBUG); - if ($level == 1) { - $alreadyfound = array($id=>1); // We init array of found object to start of tree, so if we found it later (should not happened), we stop immediatly - } // Protection against infinite loop if ($level > 30) { return array(); @@ -4995,14 +4990,16 @@ class Product extends CommonObject $res = $this->db->query($sql); if ($res) { $prods = array(); + if ($this->db->num_rows($res) > 0) { + $parents[] = $id; + } + while ($rec = $this->db->fetch_array($res)) { - if (!empty($alreadyfound[$rec['rowid']])) { + if (in_array($rec['id'], $parents)) { dol_syslog(get_class($this).'::getChildsArbo the product id='.$rec['rowid'].' was already found at a higher level in tree. We discard to avoid infinite loop', LOG_WARNING); - if (in_array($rec['id'], $parents)) { - continue; // We discard this child if it is already found at a higher level in tree in the same branch. - } + continue; // We discard this child if it is already found at a higher level in tree in the same branch. } - $alreadyfound[$rec['rowid']] = 1; + $prods[$rec['rowid']] = array( 0=>$rec['rowid'], 1=>$rec['qty'], @@ -5016,7 +5013,6 @@ class Product extends CommonObject //$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty'],2=>$rec['fk_product_type']); //$prods[$this->db->escape($rec['label'])]= array(0=>$rec['id'],1=>$rec['qty']); if (empty($firstlevelonly)) { - $parents[] = $rec['rowid']; $listofchilds = $this->getChildsArbo($rec['rowid'], 0, $level + 1, $parents); foreach ($listofchilds as $keyChild => $valueChild) { $prods[$rec['rowid']]['childs'][$keyChild] = $valueChild; From f00c288e855f6c1c6f57b6f2657e43494e73597d Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 12:53:15 +0100 Subject: [PATCH 12/23] Debug v21 --- htdocs/public/members/new.php | 2 +- htdocs/public/onlinesign/newonlinesign.php | 63 +++++++++++++++++++++- 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index df26dbf783a..40c79fc427e 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -978,7 +978,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR } } - +//htmlPrintOnlineFooter($mysoc, $langs); llxFooterVierge(); $db->close(); diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 17506fc264a..641e5413771 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -185,6 +185,62 @@ $hookmanager->initHooks(array('onlinesign')); $error = 0; +/** + * Show header for online signature + * + * @param string $title Title + * @param string $head Head array + * @param int $disablejs More content into html header + * @param int $disablehead More content into html header + * @param string[]|string $arrayofjs Array of complementary js files + * @param string[]|string $arrayofcss Array of complementary css files + * @return void + */ +function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) +{ + global $conf, $langs, $mysoc; + + top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers + + print ''; + + // Define urllogo + $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png'; + + if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); + } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); + } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { + $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; + } + + print '
'; + + // Output html code for logo + if ($urllogo) { + print '
'; + print '
'; + print ''; + print '
'; + if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { + print ''; + } + print '
'; + } + + if (getDolGlobalString('MEMBER_IMAGE_PUBLIC_REGISTRATION')) { + print '
'; + print ''; + print '
'; + } + + print '
'; + + print '
'; +} + + /* * Actions @@ -233,6 +289,7 @@ if ($action == 'confirm_refusepropal' && $confirm == 'yes') { // Test on pemriss */ $form = new Form($db); + $head = ''; if (getDolGlobalString('MAIN_SIGN_CSS_URL')) { $head = ''."\n"; @@ -241,8 +298,12 @@ if (getDolGlobalString('MAIN_SIGN_CSS_URL')) { $conf->dol_hide_topmenu = 1; $conf->dol_hide_leftmenu = 1; +$title = $langs->trans("OnlineSignature"); + $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; -llxHeader($head, $langs->trans("OnlineSignature"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1); +llxHeader($head, $title, '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1); + +llxHeaderVierge($title); if ($action == 'refusepropal') { print $form->formconfirm($_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&securekey='.urlencode($SECUREKEY).(isModEnabled('multicompany') ? '&entity='.$entity : ''), $langs->trans('RefusePropal'), $langs->trans('ConfirmRefusePropal', $object->ref), 'confirm_refusepropal', '', '', 1); From bcca177bdf4e719d209abac6e770fb32919dc544 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 14:00:50 +0100 Subject: [PATCH 13/23] Debug v21 - fix pb with setup of mandatory vat number --- htdocs/compta/facture/class/facture.class.php | 13 +++-- htdocs/langs/en_US/accountancy.lang | 1 + htdocs/langs/en_US/errors.lang | 1 + htdocs/societe/admin/societe.php | 51 ++++++++++++++----- 4 files changed, 49 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 43859ecab23..d8075c86fb8 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3325,10 +3325,17 @@ class Facture extends CommonInvoice } } if ($key == 'TVA_INTRA') { - // Check for mandatory - if (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY') && ($this->thirdparty->tva_assuj) && empty($this->thirdparty->tva_intra)) { + // Check for mandatory vat number + if (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY') == 'eeconly') { + if (($this->thirdparty->tva_assuj) && empty($this->thirdparty->tva_intra) && $this->thirdparty->isInEEC()) { + $langs->load("errors"); + $this->error = $langs->trans('ErrorProdIdIsMandatoryForEuThirdparties', $langs->transnoentitiesnoconv('VATIntra')).' ('.$langs->transnoentitiesnoconv("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); + return -1; + } + } elseif (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY') && ($this->thirdparty->tva_assuj) && empty($this->thirdparty->tva_intra)) { $langs->load("errors"); - $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->trans('VATIntra')).' ('.$langs->trans("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; + $this->error = $langs->trans('ErrorProdIdIsMandatory', $langs->transnoentitiesnoconv('VATIntra')).' ('.$langs->transnoentitiesnoconv("ForbiddenBySetupRules").') ['.$langs->trans('Company').' : '.$this->thirdparty->name.']'; dol_syslog(__METHOD__.' '.$this->error, LOG_ERR); return -1; } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index d0984b30ca3..78cc4145ab6 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -409,6 +409,7 @@ SaleExport=Export sale SaleEEC=Sale in EEC SaleEECWithVAT=Sale in EEC with a VAT not null, so we suppose this is NOT an intracommunautary sale and the suggested account is the standard product account. SaleEECWithoutVATNumber=Sale in EEC with no VAT but the VAT ID of third party is not defined. We fall back on the account for standard sales. You can fix the VAT ID of the third party, or change the product account suggested for binding if needed. +AnySale=Any sale ForbiddenTransactionAlreadyExported=Forbidden: The transaction has been validated and/or exported. ForbiddenTransactionAlreadyValidated=Forbidden: The transaction has been validated. DataMustHaveBeenTransferredInAccounting=The transfer of data in accounting must have been done diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index fc7a83c44e6..c66ece16b31 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -31,6 +31,7 @@ ErrorFromToAccountsMustDiffers=Source and targets bank accounts must be differen ErrorBadThirdPartyName=Bad value for third-party name ForbiddenBySetupRules=Forbidden by setup rules ErrorProdIdIsMandatory=The %s is mandatory +ErrorProdIdIsMandatoryForEuThirdparties=The %s is mandatory for customers in EEC ErrorAccountancyCodeCustomerIsMandatory=The accountancy code of customer %s is mandatory ErrorAccountancyCodeSupplierIsMandatory=The accountancy code of supplier %s is mandatory ErrorBadCustomerCodeSyntax=Bad syntax for customer code diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 29b48fb1e7b..da898296d82 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; * @var User $user */ -$langs->loadLangs(array("admin", "companies", "other")); +$langs->loadLangs(array("admin", "accountancy", "companies", "other")); $action = GETPOST('action', 'aZ09'); $value = GETPOST('value', 'alpha'); @@ -329,9 +329,11 @@ if ($action == 'setprofidmandatory') { } //Activate ProfId invoice mandatory -if ($action == 'setprofidinvoicemandatory') { +if ($action == 'setprofidinvoicemandatory' || $action == 'setprofidinvoicemandatoryeeconly') { $status = GETPOST('status', 'alpha'); - + if ($status == '1' && $action == 'setprofidinvoicemandatoryeeconly') { + $status = 'eeconly'; + } $idprof = "SOCIETE_".$value."_INVOICE_MANDATORY"; $result = dolibarr_set_const($db, $idprof, $status, 'chaine', 0, '', $conf->entity); if ($result <= 0) { @@ -777,31 +779,52 @@ print ''.$langs->trans('VATIntra')."\n"; $key = 'VAT_INTRA'; if (getDolGlobalString('SOCIETE_VAT_INTRA_UNIQUE')) { print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); + print img_picto($langs->trans("Activated"), 'switch_on', 'class="valignmiddle"'); print ''; } else { print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); + print img_picto($langs->trans("Disabled"), 'switch_off', 'class="valignmiddle"'); print ''; } if (getDolGlobalString('SOCIETE_VAT_INTRA_MANDATORY')) { print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); + print img_picto($langs->trans("Activated"), 'switch_on', 'class="valignmiddle"'); print ''; } else { print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); + print img_picto($langs->trans("Disabled"), 'switch_off', 'class="valignmiddle"'); print ''; } -if (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY')) { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; +print ''; +if (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY') == 'eeconly') { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on', 'class="valignmiddle paddingrightonly"'); + print ''; + print $langs->trans("SaleEEC").'
'; + print ''; + print img_picto($langs->trans("Activated"), 'switch_off', 'class="valignmiddle paddingrightonly"'); + print ''; + print $langs->trans("AnySale"); +} elseif (getDolGlobalString('SOCIETE_VAT_INTRA_INVOICE_MANDATORY')) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_off', 'class="valignmiddle paddingrightonly"'); + print ''; + print $langs->trans("SaleEEC").'
'; + print ''; + print img_picto($langs->trans("Activated"), 'switch_on', 'class="valignmiddle paddingrightonly"'); + print ''; + print $langs->trans("AnySale"); } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off', 'class="valignmiddle paddingrightonly"'); + print ''; + print $langs->trans("SaleEEC").'
'; + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off', 'class="valignmiddle paddingrightonly"'); + print ''; + print $langs->trans("AnySale"); } +print ''; print "\n"; print "\n"; From 2b5295497b04616e8a7dc4dab3f17db82ece3a82 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 16:22:06 +0100 Subject: [PATCH 14/23] Debug v21 --- htdocs/ecm/class/ecmfiles.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 142aaf70270..28db17eceb0 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -1013,9 +1013,17 @@ class EcmFiles extends CommonObject } elseif ($option == 'commande_fournisseur') { $tmppath = preg_replace('/^fournisseur\/commande\//', '', $this->filepath); } else { - $tmppath = preg_replace('/^[^\/]+\//', '', $this->filepath); + if ((int) $this->entity > 1) { + // Remove the part "entityid/commande/" into "entityid/commande/REFXXX" to get only the ref + $tmppath = preg_replace('/^\d+\/[^\/]+\//', '', $this->filepath); + } else { + // Remove the part "commande/" into "commande/REFXXX" to get only the ref + $tmppath = preg_replace('/^[^\/]+\//', '', $this->filepath); + } } - $url = DOL_URL_ROOT.'/document.php?modulepart='.urlencode($option).'&file='.urlencode($tmppath.'/'.$this->filename).'&entity='.$this->entity; + //var_dump($this->filepath); + + $url = DOL_URL_ROOT.'/document.php?modulepart='.urlencode($option).'&file='.urlencode($tmppath.'/'.$this->filename).'&entity='.((int) $this->entity); } else { $url = DOL_URL_ROOT.'/ecm/file_card.php?id='.$this->id; } From 922e58e1e186643763015f2dafb16264ee562b74 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 19:10:36 +0100 Subject: [PATCH 15/23] WIP Add option MAIN_MAIL_EMAIL_FROM_PASSWORDRESET --- htdocs/admin/mails.php | 14 ++++--- htdocs/admin/mails_passwordreset.php | 55 ++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index afda0e31733..b32c64b8b35 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -382,6 +382,7 @@ if ($action == 'edit') { clearstatcache(); + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''; print ''; @@ -613,11 +614,11 @@ if ($action == 'edit') { print ''; print '
'.$langs->trans("Parameters").'
'; - + print '
'; print '
'; - + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''; print ''; @@ -664,6 +665,7 @@ if ($action == 'edit') { print ''; print '
'.$langs->trans("OtherOptions").'
'; + print '
'; print dol_get_fiche_end(); @@ -868,7 +870,7 @@ if ($action == 'edit') { print ''.$langs->trans("MAIN_MAIL_FORCE_SENDTO").''.getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'); if (getDolGlobalString('MAIN_MAIL_FORCE_SENDTO')) { if (!isValidEmail(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) { - print img_warning($langs->trans("ErrorBadEMail")); + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))); } else { print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue")); } @@ -892,7 +894,7 @@ if ($action == 'edit') { print ''.$langs->trans("MAIN_MAIL_FORCE_SENDTO").''.getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'); if (getDolGlobalString('MAIN_MAIL_FORCE_SENDTO')) { if (!isValidEmail(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) { - print img_warning($langs->trans("ErrorBadEMail")); + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))); } else { print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue")); } @@ -910,7 +912,7 @@ if ($action == 'edit') { if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM')) { print img_warning($langs->trans("Mandatory")); } elseif (!isValidEmail(getDolGlobalString('MAIN_MAIL_EMAIL_FROM'))) { - print img_warning($langs->trans("ErrorBadEMail")); + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_EMAIL_FROM'))); } print ''; @@ -958,7 +960,7 @@ if ($action == 'edit') { print ''.$langs->trans("MAIN_MAIL_ERRORS_TO").''; print ''.(getDolGlobalString('MAIN_MAIL_ERRORS_TO')); if (getDolGlobalString('MAIN_MAIL_ERRORS_TO') && !isValidEmail(getDolGlobalString('MAIN_MAIL_ERRORS_TO'))) { - print img_warning($langs->trans("ErrorBadEMail")); + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_ERRORS_TO'))); } print ''; diff --git a/htdocs/admin/mails_passwordreset.php b/htdocs/admin/mails_passwordreset.php index 5f3b07ce7ee..6433b63486c 100644 --- a/htdocs/admin/mails_passwordreset.php +++ b/htdocs/admin/mails_passwordreset.php @@ -104,6 +104,10 @@ if ($action == 'update' && !$cancel) { dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET", GETPOST("MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET", GETPOST("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET("MAIN_MAIL_EMAIL_FROM_PASSWORDRESET")) { + dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM_PASSWORDRESET", GETPOST("MAIN_MAIL_EMAIL_FROM_PASSWORDRESET", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + } + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); exit; } @@ -349,6 +353,7 @@ if ($action == 'edit') { clearstatcache(); + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''; print ''; @@ -553,6 +558,26 @@ if ($action == 'edit') { print ''; print '
'.$langs->trans("Parameters").'
'; + print '
'; + + print '
'; + + + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table + print ''; + print ''; + + // From + $help = $form->textwithpicto('', $langs->trans("EMailHelpMsgSPFDKIM")); + print ''; + print ''; + + print '
'.$langs->trans("OtherOptions").'
'; + print $langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ? ini_get('sendmail_from') : $langs->transnoentities("Undefined")); + print ' '.$help; + print '
'; + print '
'; print dol_get_fiche_end(); @@ -685,6 +710,36 @@ if ($action == 'edit') { print ''; print '
'; + + print '
'; + + + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table + print ''; + print ''; + + // From + $help = $form->textwithpicto('', $langs->trans("EMailHelpMsgSPFDKIM")); + print ''; + print ''; + + print '
'.$langs->trans("OtherOptions").'
'; + print $langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ? ini_get('sendmail_from') : $langs->transnoentities("Undefined")); + print ' '.$help; + print ''; + if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET')) { + print ''.getDolGlobalString('MAIN_MAIL_EMAIL_FROM').''; + } else { + print getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET'); + } + if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM') && !getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET')) { + print img_warning($langs->trans("Mandatory")); + } elseif (getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET') && !isValidEmail(getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET'))) { + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET'))); + } + print '
'; + print '
'; + print dol_get_fiche_end(); From fe3669621a216aadc15709110f5c3fa483668247 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 19:10:36 +0100 Subject: [PATCH 16/23] NEW Add option MAIN_MAIL_EMAIL_FROM_PASSWORDRESET --- htdocs/admin/mails.php | 14 ++++--- htdocs/admin/mails_passwordreset.php | 55 ++++++++++++++++++++++++++++ htdocs/user/class/user.class.php | 10 ++--- 3 files changed, 68 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index afda0e31733..b32c64b8b35 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -382,6 +382,7 @@ if ($action == 'edit') { clearstatcache(); + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''; print ''; @@ -613,11 +614,11 @@ if ($action == 'edit') { print ''; print '
'.$langs->trans("Parameters").'
'; - + print '
'; print '
'; - + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''; print ''; @@ -664,6 +665,7 @@ if ($action == 'edit') { print ''; print '
'.$langs->trans("OtherOptions").'
'; + print '
'; print dol_get_fiche_end(); @@ -868,7 +870,7 @@ if ($action == 'edit') { print ''.$langs->trans("MAIN_MAIL_FORCE_SENDTO").''.getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'); if (getDolGlobalString('MAIN_MAIL_FORCE_SENDTO')) { if (!isValidEmail(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) { - print img_warning($langs->trans("ErrorBadEMail")); + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))); } else { print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue")); } @@ -892,7 +894,7 @@ if ($action == 'edit') { print ''.$langs->trans("MAIN_MAIL_FORCE_SENDTO").''.getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'); if (getDolGlobalString('MAIN_MAIL_FORCE_SENDTO')) { if (!isValidEmail(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) { - print img_warning($langs->trans("ErrorBadEMail")); + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))); } else { print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue")); } @@ -910,7 +912,7 @@ if ($action == 'edit') { if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM')) { print img_warning($langs->trans("Mandatory")); } elseif (!isValidEmail(getDolGlobalString('MAIN_MAIL_EMAIL_FROM'))) { - print img_warning($langs->trans("ErrorBadEMail")); + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_EMAIL_FROM'))); } print ''; @@ -958,7 +960,7 @@ if ($action == 'edit') { print ''.$langs->trans("MAIN_MAIL_ERRORS_TO").''; print ''.(getDolGlobalString('MAIN_MAIL_ERRORS_TO')); if (getDolGlobalString('MAIN_MAIL_ERRORS_TO') && !isValidEmail(getDolGlobalString('MAIN_MAIL_ERRORS_TO'))) { - print img_warning($langs->trans("ErrorBadEMail")); + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_ERRORS_TO'))); } print ''; diff --git a/htdocs/admin/mails_passwordreset.php b/htdocs/admin/mails_passwordreset.php index 5f3b07ce7ee..6433b63486c 100644 --- a/htdocs/admin/mails_passwordreset.php +++ b/htdocs/admin/mails_passwordreset.php @@ -104,6 +104,10 @@ if ($action == 'update' && !$cancel) { dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET", GETPOST("MAIN_MAIL_EMAIL_STARTTLS_PASSWORDRESET"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET", GETPOST("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_PASSWORDRESET"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET("MAIN_MAIL_EMAIL_FROM_PASSWORDRESET")) { + dolibarr_set_const($db, "MAIN_MAIL_EMAIL_FROM_PASSWORDRESET", GETPOST("MAIN_MAIL_EMAIL_FROM_PASSWORDRESET", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + } + header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); exit; } @@ -349,6 +353,7 @@ if ($action == 'edit') { clearstatcache(); + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''; print ''; @@ -553,6 +558,26 @@ if ($action == 'edit') { print ''; print '
'.$langs->trans("Parameters").'
'; + print '
'; + + print '
'; + + + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table + print ''; + print ''; + + // From + $help = $form->textwithpicto('', $langs->trans("EMailHelpMsgSPFDKIM")); + print ''; + print ''; + + print '
'.$langs->trans("OtherOptions").'
'; + print $langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ? ini_get('sendmail_from') : $langs->transnoentities("Undefined")); + print ' '.$help; + print '
'; + print '
'; print dol_get_fiche_end(); @@ -685,6 +710,36 @@ if ($action == 'edit') { print ''; print '
'; + + print '
'; + + + print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table + print ''; + print ''; + + // From + $help = $form->textwithpicto('', $langs->trans("EMailHelpMsgSPFDKIM")); + print ''; + print ''; + + print '
'.$langs->trans("OtherOptions").'
'; + print $langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ? ini_get('sendmail_from') : $langs->transnoentities("Undefined")); + print ' '.$help; + print ''; + if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET')) { + print ''.getDolGlobalString('MAIN_MAIL_EMAIL_FROM').''; + } else { + print getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET'); + } + if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM') && !getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET')) { + print img_warning($langs->trans("Mandatory")); + } elseif (getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET') && !isValidEmail(getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET'))) { + print img_warning($langs->trans("ErrorBadEMail", getDolGlobalString('MAIN_MAIL_EMAIL_FROM_PASSWORDRESET'))); + } + print '
'; + print '
'; + print dol_get_fiche_end(); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 3c46fd80675..bec40c850f7 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2663,12 +2663,12 @@ class User extends CommonObject $outputlangs = new Translate("", $conf); if (isset($this->conf->MAIN_LANG_DEFAULT) - && $this->conf->MAIN_LANG_DEFAULT != 'auto') { // If user has defined its own language (rare because in most cases, auto is used) - $outputlangs->getDefaultLang($this->conf->MAIN_LANG_DEFAULT); + && getDolGlobalString('MAIN_LANG_DEFAULT') != 'auto') { // If user has defined its own language (rare because in most cases, auto is used) + $outputlangs->getDefaultLang(getDolGlobalString('MAIN_LANG_DEFAULT')); } - if ($this->conf->MAIN_LANG_DEFAULT) { - $outputlangs->setDefaultLang($this->conf->MAIN_LANG_DEFAULT); + if (getDolGlobalString('MAIN_LANG_DEFAULT')) { + $outputlangs->setDefaultLang(getDolGlobalString('MAIN_LANG_DEFAULT')); } else { // If user has not defined its own language, we used current language $outputlangs = $langs; } @@ -2729,7 +2729,7 @@ class User extends CommonObject $mailfile = new CMailFile( $subject, $this->email, - $conf->global->MAIN_MAIL_EMAIL_FROM, + getDolGlobalString("MAIN_MAIL_EMAIL_FROM_PASSWORDRESET", getDolGlobalString("MAIN_MAIL_EMAIL_FROM")), $mesg, array(), array(), From 48354a6d73fec5db5296b4d470195aae922f5e03 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 19:16:56 +0100 Subject: [PATCH 17/23] Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index bec40c850f7..5e7686e6d52 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2650,7 +2650,7 @@ class User extends CommonObject public function send_password($user, $password = '', $changelater = 0) { // phpcs:enable - global $conf, $langs, $mysoc; + global $conf, $langs; global $dolibarr_main_url_root; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; From 073a6eeae32060864b8d23e0d2741e4c6478531b Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 21:02:50 +0100 Subject: [PATCH 18/23] NEW Add options PDF_XXX_SHOW_PRICE_INCL_TAX into PDF setup --- htdocs/admin/pdf_other.php | 237 +++++++++++------- .../commande/doc/pdf_proforma.modules.php | 2 +- htdocs/langs/en_US/admin.lang | 3 + 3 files changed, 152 insertions(+), 90 deletions(-) diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index 73b4d52596c..80986a883b4 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -224,11 +224,33 @@ if (isModEnabled('propal')) { print ajax_constantonoff('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING", $arrval, $conf->global->MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING); + print $form->selectarray("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING", $arrval, getDolGlobalString('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING')); } print ''; */ + print ''; + print $form->textwithpicto($langs->trans("PDF_XXX_SHOW_PRICE_INCL_TAX"), $langs->trans("AvailableWithSomePDFTemplatesOnly")); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('PDF_PROPAL_SHOW_PRICE_INCL_TAX'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("PDF_PROPAL_SHOW_PRICE_INCL_TAX", $arrval, getDolGlobalString('PDF_PROPAL_SHOW_PRICE_INCL_TAX')); + } + print ''; + + print ''; + print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_WITH_PICTURE"), $langs->trans("RandomlySelectedIfSeveral")); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_PROPOSALS_WITH_PICTURE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, getdolGlobalString('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')); + } + print ''; + print ''; print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_PROPAL"), $langs->trans("PdfAddTermOfSaleHelp")); print ''; @@ -236,18 +258,7 @@ if (isModEnabled('propal')) { print ajax_constantonoff('MAIN_PDF_ADD_TERMSOFSALE_PROPAL'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_PDF_ADD_TERMSOFSALE_PROPAL", $arrval, $conf->global->MAIN_PDF_ADD_TERMSOFSALE_PROPAL); - } - print ''; - - print ''; - print $form->textwithpicto($langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"), $langs->trans("RandomlySelectedIfSeveral")); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('MAIN_GENERATE_PROPOSALS_WITH_PICTURE'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, $conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE); + print $form->selectarray("MAIN_PDF_ADD_TERMSOFSALE_PROPAL", $arrval, getDolGlobalString('MAIN_PDF_ADD_TERMSOFSALE_PROPAL')); } print ''; @@ -261,7 +272,31 @@ if (isModEnabled('order')) { print '
'; print ''; + print ''; + + print ''; + + print ''; + print ''; - print ''; @@ -289,74 +324,6 @@ if (isModEnabled('order')) { } -if (isModEnabled('supplier_proposal')) { - $langs->load("supplier_proposal"); - print load_fiche_titre($langs->trans("SupplierProposal"), '', 'supplier_proposal'); - - print '
'; - print '
'.$langs->trans("Parameters").'
'; + print $form->textwithpicto($langs->trans("PDF_XXX_SHOW_PRICE_INCL_TAX"), $langs->trans("AvailableWithSomePDFTemplatesOnly")); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('PDF_ORDER_SHOW_PRICE_INCL_TAX'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("PDF_ORDER_SHOW_PRICE_INCL_TAX", $arrval, getDolGlobalString('PDF_ORDER_SHOW_PRICE_INCL_TAX')); + } + print '
'; + print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_WITH_PICTURE"), $langs->trans("RandomlySelectedIfSeveral")); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_ORDERS_WITH_PICTURE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_GENERATE_ORDERS_WITH_PICTURE", $arrval, getdolGlobalString('MAIN_GENERATE_ORDERS_WITH_PICTURE')); + } + print '
'; print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_ORDER"), $langs->trans("PdfAddTermOfSaleHelp")); print ''; @@ -269,18 +304,18 @@ if (isModEnabled('order')) { print ajax_constantonoff('MAIN_PDF_ADD_TERMSOFSALE_ORDER'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_PDF_ADD_TERMSOFSALE_ORDER", $arrval, $conf->global->MAIN_PDF_ADD_TERMSOFSALE_ORDER); + print $form->selectarray("MAIN_PDF_ADD_TERMSOFSALE_ORDER", $arrval, getDolGlobalString('MAIN_PDF_ADD_TERMSOFSALE_ORDER')); } print '
'; + print '
'; print $form->textwithpicto($langs->trans("SALES_ORDER_SHOW_SHIPPING_ADDRESS"), $langs->trans("SALES_ORDER_SHOW_SHIPPING_ADDRESSMore")); print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('SALES_ORDER_SHOW_SHIPPING_ADDRESS'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("SALES_ORDER_SHOW_SHIPPING_ADDRESS", $arrval, $conf->global->SALES_ORDER_SHOW_SHIPPING_ADDRESS); + print $form->selectarray("SALES_ORDER_SHOW_SHIPPING_ADDRESS", $arrval, getDolGlobalString('SALES_ORDER_SHOW_SHIPPING_ADDRESS')); } print '
'; - print ''; - - print ''; - - print ''; - - print '
'.$langs->trans("Parameter").'
'; - print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE"), ''); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE", $arrval, $conf->global->MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE); - } - print '
'; - print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN"), ''); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN", $arrval, $conf->global->MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN); - } - print '
'; - print '
'; -} - - -if (isModEnabled('supplier_order')) { - $langs->load("supplier_order"); - print load_fiche_titre($langs->trans("SupplierOrder"), '', 'supplier_proposal'); - - print '
'; - print ''; - print ''; - - print ''; - - print ''; - - print '
'.$langs->trans("Parameter").'
'; - print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE"), ''); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE", $arrval, $conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE); - } - print '
'; - print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN"), ''); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN", $arrval, $conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN); - } - print '
'; - print '
'; -} if (isModEnabled('invoice')) { print load_fiche_titre($langs->trans("Invoices"), '', 'bill'); @@ -365,6 +332,28 @@ if (isModEnabled('invoice')) { print ''; print ''; + print ''; + + print ''; + print ''; + print ''; @@ -466,7 +456,77 @@ if (isModEnabled('invoice')) { print ajax_constantonoff('INVOICE_HIDE_LINKED_OBJECT'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("INVOICE_HIDE_LINKED_OBJECT", $arrval, $conf->global->INVOICE_HIDE_LINKED_OBJECT); + print $form->selectarray("INVOICE_HIDE_LINKED_OBJECT", $arrval, getDolGlobalString('INVOICE_HIDE_LINKED_OBJECT')); + } + print ''; + + print '
'.$langs->trans("Parameters").'
'; + print $form->textwithpicto($langs->trans("PDF_XXX_SHOW_PRICE_INCL_TAX"), $langs->trans("AvailableWithSomePDFTemplatesOnly")); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('PDF_INVOICE_SHOW_PRICE_INCL_TAX'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("PDF_INVOICE_SHOW_PRICE_INCL_TAX", $arrval, getDolGlobalString('PDF_INVOICE_SHOW_PRICE_INCL_TAX')); + } + print '
'; + print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_WITH_PICTURE"), $langs->trans("RandomlySelectedIfSeveral")); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_INVOICES_WITH_PICTURE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_GENERATE_INVOICES_WITH_PICTURE", $arrval, getdolGlobalString('MAIN_GENERATE_INVOICES_WITH_PICTURE')); + } + print '
'; print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_INVOICE"), $langs->trans("PdfAddTermOfSaleHelp")); print ''; @@ -372,9 +361,10 @@ if (isModEnabled('invoice')) { print ajax_constantonoff('MAIN_PDF_ADD_TERMSOFSALE_INVOICE'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_PDF_ADD_TERMSOFSALE_INVOICE", $arrval, $conf->global->MAIN_PDF_ADD_TERMSOFSALE_INVOICE); + print $form->selectarray("MAIN_PDF_ADD_TERMSOFSALE_INVOICE", $arrval, getDolGlobalString('MAIN_PDF_ADD_TERMSOFSALE_INVOICE')); } print '
'; print $form->textwithpicto($langs->trans("INVOICE_ADD_ZATCA_QR_CODE"), $langs->trans("INVOICE_ADD_ZATCA_QR_CODEMore")); print ''; @@ -430,7 +420,7 @@ if (isModEnabled('invoice')) { print ajax_constantonoff('INVOICE_SHOW_SHIPPING_ADDRESS'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("INVOICE_SHOW_SHIPPING_ADDRESS", $arrval, $conf->global->INVOICE_SHOW_SHIPPING_ADDRESS); + print $form->selectarray("INVOICE_SHOW_SHIPPING_ADDRESS", $arrval, getDolGlobalString('INVOICE_SHOW_SHIPPING_ADDRESS')); } print '
'; + print '
'; +} + + +if (isModEnabled('supplier_proposal')) { + $langs->load("supplier_proposal"); + print load_fiche_titre($langs->trans("SupplierProposal"), '', 'supplier_proposal'); + + print '
'; + print ''; + print ''; + + print ''; + + print ''; + + print '
'.$langs->trans("Parameter").'
'; + print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE"), ''); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE", $arrval, getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE')); + } + print '
'; + print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN"), ''); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN", $arrval, getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN')); + } + print '
'; + print '
'; +} + + +if (isModEnabled('supplier_order')) { + $langs->load("supplier_order"); + print load_fiche_titre($langs->trans("SupplierOrder"), '', 'supplier_proposal'); + + print '
'; + print ''; + print ''; + + print ''; + + print ''; @@ -495,7 +555,6 @@ if (isModEnabled('shipping')) { print ''; } - if (isModEnabled('reception')) { print load_fiche_titre($langs->trans("Receptions"), '', 'reception'); @@ -572,7 +631,7 @@ $maxfilesizearray = getMaxFileSizeArray(); $tooltiptermsofsale .= ($maxfilesizearray['maxmin'] > 0) ? '
'.$langs->trans('MaxSize').' : '.$maxfilesizearray['maxmin'].' '.$langs->trans('Kb') : ''; $documenturl = DOL_URL_ROOT.'/document.php'; if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) { - $documenturl = $conf->global->DOL_URL_ROOT_DOCUMENT_PHP; + $documenturl = getDolGlobalString('DOL_URL_ROOT_DOCUMENT_PHP'); } $modulepart = 'mycompany'; diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index e4199a5bf8e..0b068fbfa22 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -47,7 +47,7 @@ class pdf_proforma extends pdf_eratosthene */ public function __construct($db) { - global $conf, $langs, $mysoc; + global $langs; parent::__construct($db); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index df17e0ee429..a8c61ef799f 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2137,6 +2137,7 @@ MAIN_PDF_MARGIN_BOTTOM=Bottom margin on PDF MAIN_DOCUMENTS_LOGO_HEIGHT=Height for logo on PDF DOC_SHOW_FIRST_SALES_REP=Show first sales representative MAIN_GENERATE_PROPOSALS_WITH_PICTURE=Add column for picture on proposal lines +MAIN_GENERATE_DOCUMENTS_WITH_PICTURE=Add column for picture on document lines MAIN_DOCUMENTS_WITH_PICTURE_WIDTH=Width of the column if a picture is added on lines MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_UNIT_PRICE=Hide the unit price column on quotation requests MAIN_GENERATE_DOCUMENTS_SUPPLIER_PROPOSAL_WITHOUT_TOTAL_COLUMN=Hide the total price column on quotation requests @@ -2611,3 +2612,5 @@ UploadExtensionRestriction=List of forbidden file extensions to upload UploadExtensionRestrictionExemple=htm, html, shtml, js, php Privileges=Privileges FieldsLinked=Fields Linked +PDF_XXX_SHOW_PRICE_INCL_TAX=Show column Price including tax +AvailableWithSomePDFTemplatesOnly=Feature not supported on old PDF templates From 0ef79d47d89e044a86d6a093ffd4c9edef737c85 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 22:43:01 +0100 Subject: [PATCH 19/23] Fix warning --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e6198c8bb6e..32796db2147 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -701,7 +701,7 @@ abstract class CommonObject public $user_creation; /** - * @var int User id author/creation + * @var int|null User id author/creation */ public $user_creation_id; From a1ce8272acbbbb72f0aee83ddf740a0ca49b9fd7 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 22:46:09 +0100 Subject: [PATCH 20/23] Fix warning --- htdocs/compta/facture/class/facture.class.php | 14 ++--- htdocs/core/lib/company.lib.php | 47 ++++++++++++++- htdocs/public/onlinesign/newonlinesign.php | 59 +------------------ 3 files changed, 55 insertions(+), 65 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 311c8df539a..53867a36681 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2555,12 +2555,12 @@ class Facture extends CommonInvoice if (isset($this->retained_warranty)) { $this->retained_warranty = (float) $this->retained_warranty; } - if (!isset($this->fk_user_author) && isset($this->user_author) ) { - $this->fk_user_author = $this->user_author; + if (!isset($this->user_creation_id) && isset($this->fk_user_author) ) { + $this->user_creation_id = $this->fk_user_author; + } + if (!isset($this->user_validation_id) && isset($this->fk_user_valid) ) { + $this->user_validation_id = $this->fk_user_valid; } - - // Check parameters - // Put here code to add control on parameters values // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET"; @@ -2585,8 +2585,8 @@ class Facture extends CommonInvoice $sql .= " total_ttc=".(isset($this->total_ttc) ? (float) $this->total_ttc : "null").","; $sql .= " revenuestamp=".((isset($this->revenuestamp) && $this->revenuestamp != '') ? (float) $this->revenuestamp : "null").","; $sql .= " fk_statut=".(isset($this->status) ? (int) $this->status : "null").","; - $sql .= " fk_user_author=".(isset($this->fk_user_author) ? ((int) $this->fk_user_author) : "null").","; - $sql .= " fk_user_valid=".(isset($this->fk_user_valid) ? (int) $this->fk_user_valid : "null").","; + $sql .= " fk_user_author=".(isset($this->user_creation_id) ? ((int) $this->user_creation_id) : "null").","; + $sql .= " fk_user_valid=".(isset($this->user_validation_id) ? (int) $this->user_validation_id : "null").","; $sql .= " fk_facture_source=".(isset($this->fk_facture_source) ? (int) $this->fk_facture_source : "null").","; $sql .= " fk_projet=".(isset($this->fk_project) ? (int) $this->fk_project : "null").","; $sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? (int) $this->cond_reglement_id : "null").","; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index ba8b55c69d7..eb1b72a3846 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -2659,9 +2659,54 @@ function addMailingEventTypeSQL($actioncode, $objcon, $filterobj) } +/** + * Show header of company in HTML public pages + * + * @param Societe $mysoc Third party + * @param Translate $langs Output language + * @return void + */ +function htmlPrintOnlineHeader($mysoc, $langs) +{ + global $conf; + + // Define urllogo + $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png'; + + if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); + } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { + $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); + } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { + $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; + } + + print '
'; + + // Output html code for logo + if ($urllogo) { + print '
'; + print '
'; + print ''; + print '
'; + if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { + print ''; + } + print '
'; + } + + if (getDolGlobalString('MEMBER_IMAGE_PUBLIC_REGISTRATION')) { + print '
'; + print ''; + print '
'; + } + + print '
'; +} + /** - * Show footer of company in HTML pages + * Show footer of company in HTML public pages * * @param Societe $fromcompany Third party * @param Translate $langs Output language diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 641e5413771..566b45618cc 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -185,62 +185,6 @@ $hookmanager->initHooks(array('onlinesign')); $error = 0; -/** - * Show header for online signature - * - * @param string $title Title - * @param string $head Head array - * @param int $disablejs More content into html header - * @param int $disablehead More content into html header - * @param string[]|string $arrayofjs Array of complementary js files - * @param string[]|string $arrayofcss Array of complementary css files - * @return void - */ -function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) -{ - global $conf, $langs, $mysoc; - - top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers - - print ''; - - // Define urllogo - $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png'; - - if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); - } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { - $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); - } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { - $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; - } - - print '
'; - - // Output html code for logo - if ($urllogo) { - print '
'; - print '
'; - print ''; - print '
'; - if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { - print ''; - } - print '
'; - } - - if (getDolGlobalString('MEMBER_IMAGE_PUBLIC_REGISTRATION')) { - print '
'; - print ''; - print '
'; - } - - print '
'; - - print '
'; -} - - /* * Actions @@ -303,7 +247,7 @@ $title = $langs->trans("OnlineSignature"); $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; llxHeader($head, $title, '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1); -llxHeaderVierge($title); +htmlPrintOnlineHeader($mysoc, $langs); if ($action == 'refusepropal') { print $form->formconfirm($_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&securekey='.urlencode($SECUREKEY).(isModEnabled('multicompany') ? '&entity='.$entity : ''), $langs->trans('RefusePropal'), $langs->trans('ConfirmRefusePropal', $object->ref), 'confirm_refusepropal', '', '', 1); @@ -923,6 +867,7 @@ if ($action == "dosign" && empty($cancel)) { } print ''."\n"; print '
'.$langs->trans("Parameter").'
'; + print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE"), ''); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE", $arrval, getDolGlobalString('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE')); + } + print '
'; + print $form->textwithpicto($langs->trans("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN"), ''); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN", $arrval, getDolGlobalString('MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN')); } print '
'."\n"; + print ''."\n"; print '
'."\n"; print '
'; From 8c082525fd0c2516b5c440c4e69154015ae1b0d5 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 22:50:59 +0100 Subject: [PATCH 21/23] Fix warning --- htdocs/admin/pdf_other.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index 80986a883b4..8e5bbe44ae5 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -247,7 +247,7 @@ if (isModEnabled('propal')) { print ajax_constantonoff('MAIN_GENERATE_PROPOSALS_WITH_PICTURE'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, getdolGlobalString('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')); + print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, getDolGlobalString('MAIN_GENERATE_PROPOSALS_WITH_PICTURE')); } print ''; @@ -293,7 +293,7 @@ if (isModEnabled('order')) { print ajax_constantonoff('MAIN_GENERATE_ORDERS_WITH_PICTURE'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_GENERATE_ORDERS_WITH_PICTURE", $arrval, getdolGlobalString('MAIN_GENERATE_ORDERS_WITH_PICTURE')); + print $form->selectarray("MAIN_GENERATE_ORDERS_WITH_PICTURE", $arrval, getDolGlobalString('MAIN_GENERATE_ORDERS_WITH_PICTURE')); } print ''; @@ -350,7 +350,7 @@ if (isModEnabled('invoice')) { print ajax_constantonoff('MAIN_GENERATE_INVOICES_WITH_PICTURE'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("MAIN_GENERATE_INVOICES_WITH_PICTURE", $arrval, getdolGlobalString('MAIN_GENERATE_INVOICES_WITH_PICTURE')); + print $form->selectarray("MAIN_GENERATE_INVOICES_WITH_PICTURE", $arrval, getDolGlobalString('MAIN_GENERATE_INVOICES_WITH_PICTURE')); } print ''; From 382394575d1f8818ce9a0ae4a21bec8a9d18e8ff Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 22:58:51 +0100 Subject: [PATCH 22/23] Fix warning --- htdocs/expedition/shipment.php | 2 +- htdocs/webportal/class/webportalorder.class.php | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index c0d84059027..a964ea621b4 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -94,7 +94,7 @@ $result = restrictedArea($user, 'expedition', 0, ''); // We use 0 for id, becaus $permissiontoread = $user->hasRight('expedition', 'lire'); $permissiontoadd = $user->hasRight('expedition', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->hasRight('expedition', 'supprimer') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); +$permissiontodelete = $user->hasRight('expedition', 'supprimer') || ($permissiontoadd && ((int) $object->status == $object::STATUS_DRAFT)); $permissionnote = $user->hasRight('expedition', 'creer'); // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->hasRight('expedition', 'creer'); // Used by the include of actions_dellink.inc.php diff --git a/htdocs/webportal/class/webportalorder.class.php b/htdocs/webportal/class/webportalorder.class.php index 1cbf082dccb..8c11ba5d92f 100644 --- a/htdocs/webportal/class/webportalorder.class.php +++ b/htdocs/webportal/class/webportalorder.class.php @@ -166,7 +166,7 @@ class WebPortalOrder extends Commande */ public function getTooltipContentArray($params) { - global $conf, $langs; + global $langs; $datas = []; @@ -174,9 +174,8 @@ class WebPortalOrder extends Commande return ['optimize' => $langs->trans("WebPortalOrder")]; } $datas['picto'] = img_picto('', $this->picto) . ' ' . $langs->trans("WebPortalOrder") . ''; - if (isset($this->status)) { - $datas['picto'] .= ' ' . $this->getLibStatut(5); - } + $datas['picto'] .= ' ' . $this->getLibStatut(5); + $datas['ref'] .= '
' . $langs->trans('Ref') . ': ' . $this->ref; return $datas; From d59421ff84bacbe14cae740b83e26033dccaa406 Mon Sep 17 00:00:00 2001 From: "Laurent Destailleur (aka Eldy)" Date: Wed, 12 Feb 2025 23:11:48 +0100 Subject: [PATCH 23/23] Fix warning --- dev/build/phpstan/phpstan-baseline.neon | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 13c5539c16e..c092f13c4fd 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -10749,7 +10749,7 @@ parameters: - message: '#^If condition is always true\.$#' identifier: if.alwaysTrue - count: 1 + count: 2 path: ../../../htdocs/core/lib/company.lib.php - diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index eb5d0c5165d..081725e89e3 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -104,7 +104,7 @@ class Facture extends CommonInvoice protected $table_ref_field = 'ref'; /** - * @var int ID + * @var int|null ID * @deprecated Use $user_creation_id */ public $fk_user_author;