From b44ddaa69632000a8a665a16bdebb9a0ebc04762 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 30 Jul 2023 18:04:03 +0200 Subject: [PATCH 1/7] FIX Use the wrong logo size on PDF --- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 10 +++++++++- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 8aef1aff7b0..07383d96e7f 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1453,9 +1453,17 @@ class pdf_azur extends ModelePDFPropales // Logo if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) + { + $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; + } + else { + $logo = $logodir.'/logos/'.$this->emetteur->logo; + } if (is_readable($logo)) { $height=pdf_getHeightForLogo($logo); diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index c93fc9a7c81..18f3617bdc4 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1449,9 +1449,17 @@ class pdf_cyan extends ModelePDFPropales // Logo if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) + { + $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; + } + else { + $logo = $logodir.'/logos/'.$this->emetteur->logo; + } if (is_readable($logo)) { $height=pdf_getHeightForLogo($logo); From 90854dc2bf7116cf4ce53fe5e48b15155b2d838b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 30 Jul 2023 19:51:58 +0200 Subject: [PATCH 2/7] FIX Use the wrong logo size on PDF --- .../core/modules/commande/doc/pdf_einstein.modules.php | 10 +++++++++- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 778b6525d21..77b1eb60e25 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1251,9 +1251,17 @@ class pdf_einstein extends ModelePDFCommandes // Logo if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) + { + $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; + } + else { + $logo = $logodir.'/logos/'.$this->emetteur->logo; + } if (is_readable($logo)) { $height=pdf_getHeightForLogo($logo); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 37d63efb3e3..81fe6310dd4 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1563,9 +1563,17 @@ class pdf_crabe extends ModelePDFFactures // Logo if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) + { + $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; + } + else { + $logo = $logodir.'/logos/'.$this->emetteur->logo; + } if (is_readable($logo)) { $height=pdf_getHeightForLogo($logo); From 75ea7e52b2902ebf897a26d8f386caf232b14a2a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 9 Aug 2023 13:18:42 +0200 Subject: [PATCH 3/7] FIX not create/update extrafields for visibility 0,2 and 5 --- htdocs/core/class/extrafields.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 30e6ec0dea6..5a43852b110 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2106,7 +2106,8 @@ class ExtraFields ) { continue; } - if (empty($visibility)) { + // O: never visible, 2: visible only in list, 5: no creation, no update + if (in_array($visibility, array(0, 2, 5))) { continue; } if (empty($perms)) { From 44f775e354e702d3ce48d67610819c7d9f9a664c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Aug 2023 17:03:04 +0200 Subject: [PATCH 4/7] Debug v18 Fix set date properties of an extrafields --- htdocs/core/class/extrafields.class.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 1fcdd713741..d4ebf615f7a 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2248,12 +2248,15 @@ class ExtraFields if (in_array($key_type, array('date'))) { $dateparamname_start = $keysuffix . 'options_' . $key . $keyprefix . '_start'; $dateparamname_end = $keysuffix . 'options_' . $key . $keyprefix . '_end'; - if (GETPOSTISSET($dateparamname_start . 'year') && GETPOSTISSET($dateparamname_end . 'year')) { - // values provided as a date pair (start date + end date), each date being broken down as year, month, day, etc. - $value_key = array( - 'start' => dol_mktime(0, 0, 0, GETPOST($dateparamname_start . 'month', 'int'), GETPOST($dateparamname_start . 'day', 'int'), GETPOST($dateparamname_start . 'year', 'int')), - 'end' => dol_mktime(23, 59, 59, GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int')) - ); + if (GETPOSTISSET($dateparamname_start . 'year') || GETPOSTISSET($dateparamname_end . 'year')) { + $value_key = array(); + // values provided as a component year, month, day, etc. + if (GETPOSTISSET($dateparamname_start . 'year')) { + $value_key['start'] = dol_mktime(0, 0, 0, GETPOST($dateparamname_start . 'month', 'int'), GETPOST($dateparamname_start . 'day', 'int'), GETPOST($dateparamname_start . 'year', 'int')); + } + if (GETPOSTISSET($dateparamname_start . 'year')) { + $value_key['end'] = dol_mktime(23, 59, 59, GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int')); + } } elseif (GETPOSTISSET($keysuffix."options_".$key.$keyprefix."year")) { // Clean parameters $value_key = dol_mktime(12, 0, 0, GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int')); From 7c2036f437ee24f81ab7903f2865d15948cab5a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 9 Aug 2023 15:24:45 +0200 Subject: [PATCH 5/7] Fix trans --- htdocs/fourn/facture/card.php | 3 ++- htdocs/langs/en_US/errors.lang | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 32bb4e752fd..c882e3cff4a 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3099,7 +3099,8 @@ if ($action == 'create') { $facusing->fetch($object->fk_facture_source); print ' '.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).''; } else { - print ' '.$langs->transnoentities("CorrectedInvoiceNotFound").''; + $langs->load("errors"); + print ' '.$langs->transnoentities("WarningCorrectedInvoiceNotFound").''; } } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index ad957849ad5..8689be74db3 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -359,6 +359,7 @@ WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal=Automatic validation i WarningModuleNeedRefrech = Module %s has been disabled. Don't forget to enable it WarningPermissionAlreadyExist=Existing permissions for this object WarningGoOnAccountancySetupToAddAccounts=If this list is empty, go into menu %s - %s - %s to load or create accounts for your chart of account. +WarningCorrectedInvoiceNotFound=Corrected invoice not found SwissQrOnlyVIR = SwissQR invoice can only be added on invoices set to be paid with credit transfer payments. SwissQrCreditorAddressInvalid = Creditor address is invalid (are ZIP and city set? (%s) From 670f779a5f28474290434ba48efc4acc4ae6508f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Aug 2023 01:36:31 +0200 Subject: [PATCH 6/7] Do not show value --- htdocs/admin/security.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index e30e50769bb..166d8d420dc 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -130,7 +130,8 @@ if ($action == 'activate_encryptdbpassconf') { header("Location: security.php"); exit; } else { - setEventMessages($langs->trans('InstrucToClearPass', $dolibarr_main_db_pass), null, 'warnings'); + //setEventMessages($langs->trans('InstrucToClearPass', $dolibarr_main_db_pass), null, 'warnings'); + setEventMessages($langs->trans('InstrucToClearPass', $langs->transnoentitiesnoconv("DatabasePassword")), null, 'warnings'); } } From 2761f993e9436d2806238af84de7753d43305f98 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 10 Aug 2023 02:09:17 +0200 Subject: [PATCH 7/7] FIX creation of invoice from contract with discount lines --- htdocs/compta/facture/card.php | 10 ++++++++-- htdocs/core/class/commonobject.class.php | 5 ++--- htdocs/core/class/discount.class.php | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index be552526e1f..073291094a1 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1038,6 +1038,7 @@ if (empty($reshook)) { $object->note_public = trim(GETPOST('note_public', 'restricthtml')); $object->note_private = trim(GETPOST('note_private', 'restricthtml')); $object->ref_client = GETPOST('ref_client', 'alphanohtml'); + $object->ref_customer = GETPOST('ref_client', 'alphanohtml'); $object->model_pdf = GETPOST('model', 'alphanohtml'); $object->fk_project = GETPOST('projectid', 'int'); $object->cond_reglement_id = GETPOST('cond_reglement_id', 'int'); @@ -1090,7 +1091,8 @@ if (empty($reshook)) { $object->date_pointoftax = $date_pointoftax; $object->note_public = trim(GETPOST('note_public', 'restricthtml')); $object->note_private = trim(GETPOST('note_private', 'restricthtml')); - $object->ref_client = GETPOST('ref_client'); + $object->ref_client = GETPOST('ref_client', 'alphanohtml'); + $object->ref_customer = GETPOST('ref_client', 'alphanohtml'); $object->model_pdf = GETPOST('model'); $object->fk_project = GETPOST('projectid', 'int'); $object->cond_reglement_id = 0; // No payment term for a credit note @@ -1653,13 +1655,17 @@ if (empty($reshook)) { } $label = (!empty($lines[$i]->label) ? $lines[$i]->label : ''); - $desc = (!empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->libelle); + $desc = (!empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->label); if ($object->situation_counter == 1) { $lines[$i]->situation_percent = 0; } if ($lines[$i]->subprice < 0 && empty($conf->global->INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN)) { // Negative line, we create a discount line + if (empty($desc)) { + $desc = $label ? $label : $langs->trans('Discount'); + } + $discount = new DiscountAbsolute($db); $discount->fk_soc = $object->socid; $discount->amount_ht = abs($lines[$i]->total_ht); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ffe3fc0c7a5..a5bf3cb8fa8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1123,7 +1123,7 @@ abstract class CommonObject * @param int|string $type_contact Type of contact (code or id). Must be id or code found into table llx_c_type_contact. For example: SALESREPFOLL * @param string $source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user) * @param int $notrigger Disable all triggers - * @return int <0 if KO, 0 if already added, >0 if OK + * @return int <0 if KO, 0 if already added or code not valid, >0 if OK */ public function add_contact($fk_socpeople, $type_contact, $source = 'external', $notrigger = 0) { @@ -1168,9 +1168,8 @@ abstract class CommonObject } if ($id_type_contact == 0) { - $this->error = 'CODE_NOT_VALID_FOR_THIS_ELEMENT'; dol_syslog("CODE_NOT_VALID_FOR_THIS_ELEMENT: Code type of contact '".$type_contact."' does not exists or is not active for element ".$this->element.", we can ignore it"); - return -3; + return 0; } $datecreate = dol_now(); diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 9f5ea960c9a..86fb546be9a 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -254,7 +254,7 @@ class DiscountAbsolute // Check parameters if (empty($this->description)) { - $this->error = 'BadValueForPropertyDescription'; + $this->error = 'BadValueForPropertyDescriptionOfDiscount'; dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -1; }