From 7e0ae4bf0ef1c1d98b34d4c95fa519146ec08e96 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Nov 2019 14:17:22 +0100 Subject: [PATCH 1/4] FIX The pdf templates were using the large logo making PDF too large --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 8 +++++++- .../core/modules/commande/doc/pdf_eratosthene.modules.php | 8 +++++++- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 8 +++++++- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 8 +++++++- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 8 +++++++- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 8 +++++++- 6 files changed, 42 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index f7f2acfbeb5..34fd8681178 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1260,9 +1260,15 @@ 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) { + if (empty($conf->global->PDF_USE_LARGE_LOGO)) + { + $logo=$conf->mycompany->dir_output.'/logos/thumbs/'.$this->emetteur->logo_small; + } + else { + $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + } if (is_readable($logo)) { $height=pdf_getHeightForLogo($logo); diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index fe0a3cb0570..94adf8e8c07 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -1394,9 +1394,15 @@ class pdf_eratosthene extends ModelePDFCommandes // Logo if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { + if (empty($conf->global->PDF_USE_LARGE_LOGO)) + { + $logo=$conf->mycompany->dir_output.'/logos/thumbs/'.$this->emetteur->logo_small; + } + else { + $logo=$conf->mycompany->dir_output.'/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 2cd59d94ee7..8ab120b19e4 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1571,9 +1571,15 @@ 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) { + if (empty($conf->global->PDF_USE_LARGE_LOGO)) + { + $logo=$conf->mycompany->dir_output.'/logos/thumbs/'.$this->emetteur->logo_small; + } + else { + $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + } if (is_readable($logo)) { $height=pdf_getHeightForLogo($logo); diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index afdee523bbd..9cde518fa67 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1602,9 +1602,15 @@ class pdf_sponge extends ModelePDFFactures // Logo if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) { - $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { + if (empty($conf->global->PDF_USE_LARGE_LOGO)) + { + $logo=$conf->mycompany->dir_output.'/logos/thumbs/'.$this->emetteur->logo_small; + } + else { + $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + } if (is_readable($logo)) { $height=pdf_getHeightForLogo($logo); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 14f4dfe8f9f..ebfaf64d4ff 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1462,9 +1462,15 @@ 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) { + if (empty($conf->global->PDF_USE_LARGE_LOGO)) + { + $logo=$conf->mycompany->dir_output.'/logos/thumbs/'.$this->emetteur->logo_small; + } + else { + $logo=$conf->mycompany->dir_output.'/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 d8b20db9a40..770515959cd 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1507,9 +1507,15 @@ 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) { + if (empty($conf->global->PDF_USE_LARGE_LOGO)) + { + $logo=$conf->mycompany->dir_output.'/logos/thumbs/'.$this->emetteur->logo_small; + } + else { + $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + } if (is_readable($logo)) { $height=pdf_getHeightForLogo($logo); From 80b3e273413490315d8a3a4366e21226010b249f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Nov 2019 14:23:48 +0100 Subject: [PATCH 2/4] Fix bad name of constant --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 2 +- htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 2 +- htdocs/core/modules/facture/doc/pdf_sponge.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 +- htdocs/core/modules/propale/doc/pdf_cyan.modules.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 34fd8681178..7c1aaefb8bf 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1262,7 +1262,7 @@ class pdf_einstein extends ModelePDFCommandes { if ($this->emetteur->logo) { - if (empty($conf->global->PDF_USE_LARGE_LOGO)) + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { $logo=$conf->mycompany->dir_output.'/logos/thumbs/'.$this->emetteur->logo_small; } diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 94adf8e8c07..89f36d34352 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -1396,7 +1396,7 @@ class pdf_eratosthene extends ModelePDFCommandes { if ($this->emetteur->logo) { - if (empty($conf->global->PDF_USE_LARGE_LOGO)) + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { $logo=$conf->mycompany->dir_output.'/logos/thumbs/'.$this->emetteur->logo_small; } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 8ab120b19e4..ed99a04fcc2 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -1573,7 +1573,7 @@ class pdf_crabe extends ModelePDFFactures { if ($this->emetteur->logo) { - if (empty($conf->global->PDF_USE_LARGE_LOGO)) + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { $logo=$conf->mycompany->dir_output.'/logos/thumbs/'.$this->emetteur->logo_small; } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 9cde518fa67..1f4d9524bc8 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1604,7 +1604,7 @@ class pdf_sponge extends ModelePDFFactures { if ($this->emetteur->logo) { - if (empty($conf->global->PDF_USE_LARGE_LOGO)) + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { $logo=$conf->mycompany->dir_output.'/logos/thumbs/'.$this->emetteur->logo_small; } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index ebfaf64d4ff..603b32c59b4 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1464,7 +1464,7 @@ class pdf_azur extends ModelePDFPropales { if ($this->emetteur->logo) { - if (empty($conf->global->PDF_USE_LARGE_LOGO)) + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { $logo=$conf->mycompany->dir_output.'/logos/thumbs/'.$this->emetteur->logo_small; } diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 770515959cd..b2d1c9b4996 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1509,7 +1509,7 @@ class pdf_cyan extends ModelePDFPropales { if ($this->emetteur->logo) { - if (empty($conf->global->PDF_USE_LARGE_LOGO)) + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { $logo=$conf->mycompany->dir_output.'/logos/thumbs/'.$this->emetteur->logo_small; } From f7ab1498a7f42febddd817b6d896216728e75bd7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Nov 2019 17:00:02 +0100 Subject: [PATCH 3/4] FIX Advisory ID: usd20190053 --- htdocs/core/class/doleditor.class.php | 2 +- htdocs/core/class/html.formother.class.php | 2 +- htdocs/user/card.php | 50 +++++++++++----------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index eb1dd7a7e8c..d84fdca4e91 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -174,7 +174,7 @@ class DolEditor //$out.= ''; if ($this->tool == 'ckeditor' && ! empty($conf->use_javascript_ajax) && ! empty($conf->fckeditor->enabled)) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index c6a138b2a02..9556fd6c423 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -747,7 +747,7 @@ class FormOther } ); }); '; } - $out.= ''; + $out.= ''; } else // In most cases, this is not used. We used instead function with no specific list of colors { diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 90cc0a142cb..34802a57a5d 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -788,12 +788,12 @@ if ($action == 'create' || $action == 'adduserldap') print ''; if (! empty($ldap_lastname)) { - print ''; + print ''; print $ldap_lastname; } else { - print ''; + print ''; } print ''; @@ -802,12 +802,12 @@ if ($action == 'create' || $action == 'adduserldap') print ''; if (! empty($ldap_firstname)) { - print ''; + print ''; print $ldap_firstname; } else { - print ''; + print ''; } print ''; @@ -816,17 +816,17 @@ if ($action == 'create' || $action == 'adduserldap') print ''; if (! empty($ldap_login)) { - print ''; + print ''; print $ldap_login; } elseif (! empty($ldap_loginsmb)) { - print ''; + print ''; print $ldap_loginsmb; } else { - print ''; + print ''; } print ''; @@ -836,7 +836,7 @@ if ($action == 'create' || $action == 'adduserldap') require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $generated_password=getRandomPassword(false); } - $password=$generated_password; + $password=(GETPOSTISSET('password')?GETPOST('password'):$generated_password); // Password print ''.$langs->trans("Password").''; @@ -1004,12 +1004,12 @@ if ($action == 'create' || $action == 'adduserldap') print ''; if (! empty($ldap_phone)) { - print ''; + print ''; print $ldap_phone; } else { - print ''; + print ''; } print ''; @@ -1018,12 +1018,12 @@ if ($action == 'create' || $action == 'adduserldap') print ''; if (! empty($ldap_mobile)) { - print ''; + print ''; print $ldap_mobile; } else { - print ''; + print ''; } print ''; @@ -1032,12 +1032,12 @@ if ($action == 'create' || $action == 'adduserldap') print ''; if (! empty($ldap_fax)) { - print ''; + print ''; print $ldap_fax; } else { - print ''; + print ''; } print ''; @@ -1114,12 +1114,12 @@ if ($action == 'create' || $action == 'adduserldap') print ''; if (! empty($ldap_mail)) { - print ''; + print ''; print $ldap_mail; } else { - print ''; + print ''; } print ''; @@ -1128,7 +1128,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''.$langs->trans("AccountancyCode").''; print ''; - print ''; + print ''; print ''; } @@ -1137,7 +1137,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''.$langs->trans("ColorUser").''; print ''; - print $formother->selectColor(GETPOST('color')?GETPOST('color'):$object->color, 'color', null, 1, '', 'hideifnotset'); + print $formother->selectColor(GETPOSTISSET('color')?GETPOST('color', 'alphanohtml'):$object->color, 'color', null, 1, '', 'hideifnotset'); print ''; } @@ -1183,7 +1183,7 @@ if ($action == 'create' || $action == 'adduserldap') print $langs->trans("Note"); print ''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('note', '', '', 120, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_3, '90%'); + $doleditor=new DolEditor('note', GETPOSTISSET('note')?GETPOST('note', 'none'):'', '', 120, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_3, '90%'); $doleditor->Create(); print "\n"; @@ -1204,7 +1204,7 @@ if ($action == 'create' || $action == 'adduserldap') // Position/Job print ''.$langs->trans("PostOrFunction").''; print ''; - print ''; + print ''; print ''; // Default warehouse @@ -1226,7 +1226,7 @@ if ($action == 'create' || $action == 'adduserldap') print $form->textwithpicto($text, $langs->trans("THMDescription"), 1, 'help', 'classthm'); print ''; print ''; - print ''; + print ''; print ''; print "\n"; @@ -1236,14 +1236,14 @@ if ($action == 'create' || $action == 'adduserldap') print $form->textwithpicto($text, $langs->trans("TJMDescription"), 1, 'help', 'classtjm'); print ''; print ''; - print ''; + print ''; print ''; print "\n"; // Salary print ''.$langs->trans("Salary").''; print ''; - print ''; + print ''; print ''; print "\n"; } @@ -1251,7 +1251,7 @@ if ($action == 'create' || $action == 'adduserldap') // Weeklyhours print ''.$langs->trans("WeeklyHours").''; print ''; - print ''; + print ''; print ''; print "\n"; @@ -2446,7 +2446,7 @@ else print ''; if ($caneditfield) { - print $formother->selectColor(GETPOST('color')?GETPOST('color'):$object->color, 'color', null, 1, '', 'hideifnotset'); + print $formother->selectColor(GETPOSTISSET('color')?GETPOST('color', 'alphanohtml'):$object->color, 'color', null, 1, '', 'hideifnotset'); }else{ print $formother->showColor($object->color, ''); } From 7e52c70321fdd5270f7ae94419e8858b6ea50a30 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 14 Nov 2019 21:16:18 +0100 Subject: [PATCH 4/4] FIX Advisory ID: usd20190067 --- htdocs/core/lib/functions.lib.php | 6 ++++-- htdocs/fourn/class/fournisseur.product.class.php | 2 +- htdocs/product/fournisseurs.php | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9d926b3bc98..071b7a3b794 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5134,16 +5134,18 @@ function get_default_npr(Societe $thirdparty_seller, Societe $thirdparty_buyer, if ($idprodfournprice > 0) { - if (! class_exists('ProductFournisseur')) + if (! class_exists('ProductFournisseur')) { require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php'; + } $prodprice = new ProductFournisseur($db); $prodprice->fetch_product_fournisseur_price($idprodfournprice); return $prodprice->fourn_tva_npr; } elseif ($idprod > 0) { - if (! class_exists('Product')) + if (! class_exists('Product')) { require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + } $prod = new Product($db); $prod->fetch($idprod); return $prod->tva_npr; diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index faa681b0e88..786a650efb3 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -499,7 +499,7 @@ class ProductFournisseur extends Product $sql.= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,"; $sql.=" pfp.barcode, pfp.fk_barcode_type"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; - $sql.= " WHERE pfp.rowid = ".$rowid; + $sql.= " WHERE pfp.rowid = ".(int) $rowid; dol_syslog(get_class($this)."::fetch_product_fournisseur_price", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 560f5b1b574..0bda7d44564 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -254,8 +254,8 @@ if (empty($reshook)) { $supplier=new Fournisseur($db); $result=$supplier->fetch($id_fourn); - if (isset($_POST['ref_fourn_price_id'])) - $object->fetch_product_fournisseur_price($_POST['ref_fourn_price_id']); + if (GETPOSTISSET('ref_fourn_price_id')) + $object->fetch_product_fournisseur_price(GETPOST('ref_fourn_price_id', 'int')); $newprice = price2num(GETPOST("price", "alpha"));