From cd60d09d9e0814a2dac20b6316ae2693b9330cad Mon Sep 17 00:00:00 2001 From: lainwir3d Date: Thu, 12 Aug 2021 16:15:04 +0400 Subject: [PATCH 1/9] FIX #18399 Fix shipment validation email template override. Object type name for shipment was apparently wrong. --- htdocs/core/class/notify.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php index 044115f1568..557d76b05f1 100644 --- a/htdocs/core/class/notify.class.php +++ b/htdocs/core/class/notify.class.php @@ -515,7 +515,7 @@ class Notify case 'SHIPPING_VALIDATE': $link = ''.$newref.''; $dir_output = $conf->expedition->dir_output."/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment'); - $object_type = 'expedition'; + $object_type = 'shipping'; $labeltouse = $conf->global->SHIPPING_VALIDATE_TEMPLATE; $mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpeditionValidated", $link); break; From ba12071ea3ad98d97852a3a2098ece09cdfe1333 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 16 Aug 2021 07:57:40 +0200 Subject: [PATCH 2/9] FIX Accountancy - SQL error on select journal on journal --- htdocs/accountancy/class/bookkeeping.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index aeaa42154d8..8d8ba413f21 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1024,6 +1024,8 @@ class BookKeeping extends CommonObject $sqlwhere[] = $key.'\''.$this->db->idate($value).'\''; } elseif ($key == 't.credit' || $key == 't.debit') { $sqlwhere[] = natural_search($key, $value, 1, 1); + } elseif ($key == 't.code_journal' && !empty($value)) { + $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1); } else { $sqlwhere[] = natural_search($key, $value, 0, 1); } From 1bfc0004b1a6a7f8472a45de6fc44e7191f63654 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 16 Aug 2021 08:12:24 +0200 Subject: [PATCH 3/9] Better fix --- htdocs/accountancy/class/bookkeeping.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 8d8ba413f21..6eed5223d45 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1025,7 +1025,11 @@ class BookKeeping extends CommonObject } elseif ($key == 't.credit' || $key == 't.debit') { $sqlwhere[] = natural_search($key, $value, 1, 1); } elseif ($key == 't.code_journal' && !empty($value)) { - $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1); + if (is_array($value)) { + $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1); + } else { + $sqlwhere[] = natural_search("t.code_journal", $value, 3, 1); + } } else { $sqlwhere[] = natural_search($key, $value, 0, 1); } From 7207ae2caeaef2f63badadd4889865e267e0334e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Aug 2021 02:33:58 +0200 Subject: [PATCH 4/9] Fix warning --- htdocs/contrat/services_list.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 8368bffbab2..5a93f3fde33 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -35,6 +35,8 @@ require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"; // Load translation files required by the page $langs->loadLangs(array('products', 'contracts', 'companies')); +$optioncss = GETPOST('optioncss', 'aZ09'); + $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); @@ -58,7 +60,6 @@ $search_name = GETPOST("search_name", 'alpha'); $search_contract = GETPOST("search_contract", 'alpha'); $search_service = GETPOST("search_service", 'alpha'); $search_status = GETPOST("search_status", 'alpha'); -$statut = GETPOST('statut', 'int') ?GETPOST('statut', 'int') : 1; $search_product_category = GETPOST('search_product_category', 'int'); $socid = GETPOST('socid', 'int'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'contractservicelist'.$mode; @@ -412,16 +413,16 @@ if (!empty($filter_op2) && $filter_op2 != -1) { if (!empty($filter_opcloture) && $filter_opcloture != -1) { $param .= '&filter_opcloture='.urlencode($filter_opcloture); } -if ($filter_dateouvertureprevue != '') { +if ($filter_dateouvertureprevue_start != '') { $param .= '&opouvertureprevueday='.$opouvertureprevueday.'&opouvertureprevuemonth='.$opouvertureprevuemonth.'&opouvertureprevueyear='.$opouvertureprevueyear; } -if ($filter_date1 != '') { +if ($filter_date1_start != '') { $param .= '&op1day='.$op1day.'&op1month='.$op1month.'&op1year='.$op1year; } -if ($filter_date2 != '') { +if ($filter_date2_start != '') { $param .= '&op2day='.$op2day.'&op2month='.$op2month.'&op2year='.$op2year; } -if ($filter_datecloture != '') { +if ($filter_datecloture_start != '') { $param .= '&opclotureday='.$op2day.'&opcloturemonth='.$op2month.'&opclotureyear='.$op2year; } if ($optioncss != '') { From f51bcf00380d1b71ebabb51c0e9afbfe287c3d5e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Aug 2021 03:20:57 +0200 Subject: [PATCH 5/9] Debug notification module --- htdocs/admin/notification.php | 22 ++++++++++++++-------- htdocs/core/lib/admin.lib.php | 4 ++-- htdocs/langs/en_US/admin.lang | 2 +- htdocs/user/notify/card.php | 6 +++++- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index c0c6b45464f..d27b6f05808 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -270,7 +270,14 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { } $helptext = ''; - form_constantes($constantes, 3, $helptext); + form_constantes($constantes, 3, $helptext, 'EmailTemplate'); + + print '
'; + print '* '.$langs->trans("GoOntoUserCardToAddMore").'
'; + if (!empty($conf->societe->enabled)) { + print '** '.$langs->trans("GoOntoContactCardToAddMore").'
'; + } + print '
'; print '
'; } else { @@ -316,15 +323,14 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { print ''; print ''; -} - -print '
'; -print '* '.$langs->trans("GoOntoUserCardToAddMore").'
'; -if (!empty($conf->societe->enabled)) { - print '** '.$langs->trans("GoOntoContactCardToAddMore").'
'; + print '
'; + print '* '.$langs->trans("GoOntoUserCardToAddMore").'
'; + if (!empty($conf->societe->enabled)) { + print '** '.$langs->trans("GoOntoContactCardToAddMore").'
'; + } + print '
'; } -print '
'; print ''; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index ae260171a0b..17da39e4f3c 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1529,7 +1529,7 @@ function complete_elementList_with_modules(&$elementList) * @param string $helptext Help * @return void */ -function form_constantes($tableau, $strictw3c = 0, $helptext = '') +function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Value') { global $db, $langs, $conf, $user; global $_Avery_Labels; @@ -1550,7 +1550,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '') print ''; print ''.$langs->trans("Description").''; print ''; - $text = $langs->trans("Value"); + $text = $langs->trans($text); print $form->textwithpicto($text, $helptext, 1, 'help', '', 0, 2, 'idhelptext'); print ''; if (empty($strictw3c)) { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 1484a741e80..78cbff5cafe 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1367,7 +1367,7 @@ AccountCodeManager=Options for automatic generation of customer/vendor accountin NotificationsDesc=Email notifications can be sent automatically for some Dolibarr events.
Recipients of notifications can be defined: NotificationsDescUser=* per user, one user at a time. NotificationsDescContact=* per third-party contacts (customers or vendors), one contact at a time. -NotificationsDescGlobal=* or by setting global email addresses in this setup page. +NotificationsDescGlobal=* or by setting global email addresses in the setup page of the module. ModelModules=Document Templates DocumentModelOdt=Generate documents from OpenDocument templates (.ODT / .ODS files from LibreOffice, OpenOffice, KOffice, TextEdit,...) WatermarkOnDraft=Watermark on draft document diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 3acad0ac0c3..73c9d817ae8 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -226,13 +226,14 @@ if ($result > 0) { // List of notifications enabled for contacts $sql = "SELECT n.rowid, n.type,"; $sql .= " a.code, a.label,"; - $sql .= " c.rowid as userid, c.lastname, c.firstname, c.email"; + $sql .= " c.rowid as userid, c.entity, c.login, c.lastname, c.firstname, c.email, c.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,"; $sql .= " ".MAIN_DB_PREFIX."notify_def as n,"; $sql .= " ".MAIN_DB_PREFIX."user c"; $sql .= " WHERE a.rowid = n.fk_action"; $sql .= " AND c.rowid = n.fk_user"; $sql .= " AND c.rowid = ".$object->id; + $sql .= " AND c.entity IN (".getEntity('user').')'; $resql = $db->query($sql); if ($resql) { @@ -311,6 +312,9 @@ if ($result > 0) { $userstatic->id = $obj->userid; $userstatic->lastname = $obj->lastname; $userstatic->firstname = $obj->firstname; + $userstatic->email = $obj->email; + $userstatic->statut = $obj->status; + print ''.$userstatic->getNomUrl(1); if ($obj->type == 'email') { if (isValidEmail($obj->email)) { From a3d04163b6bfc3847a2532284fcc2053d9c7f671 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Aug 2021 04:14:28 +0200 Subject: [PATCH 6/9] Debug notification setup --- htdocs/admin/notification.php | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index d27b6f05808..ffed6b948bc 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -47,7 +47,7 @@ $error = 0; */ // Action to update or add a constant -if ($action == 'settemplates') { +if ($action == 'settemplates' && $user->admin) { $db->begin(); if (!$error && is_array($_POST)) { @@ -169,14 +169,14 @@ llxHeader('', $langs->trans("NotificationSetup")); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("NotificationSetup"), $linkback, 'title_setup'); -print ''; +print '
'; print $langs->trans("NotificationsDesc").'
'; print $langs->trans("NotificationsDescUser").'
'; if (!empty($conf->societe->enabled)) { print $langs->trans("NotificationsDescContact").'
'; } print $langs->trans("NotificationsDescGlobal").'
'; -print ''; +print '
'; print '
'; print '
'; @@ -192,7 +192,8 @@ print "\n"; print ''; print $langs->trans("NotificationEMailFrom").''; print ''; -print ''; +print img_picto('', 'email', 'class="pictofixedwidth"'); +print ''; if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->global->NOTIFICATION_EMAIL_FROM)) { print ' '.img_warning($langs->trans("ErrorBadEMail")); } @@ -390,6 +391,7 @@ foreach ($listofnotifiedevents as $notifiedevent) { print ''.$notifiedevent['code'].''; print ''.$label.''; print ''; + $inputfieldalreadyshown = 0; // Notification with threshold foreach ($conf->global as $key => $val) { if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) { @@ -413,24 +415,36 @@ foreach ($listofnotifiedevents as $notifiedevent) { } print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'
'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2); print '
'; + + $inputfieldalreadyshown++; } // New entry input fields - $s = ''; // Do not use type="email" here, we must be able to enter a list of email with , separator. - print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'
'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2); + if (empty($inputfieldalreadyshown) || !preg_match('/^HOLIDAY/', $notifiedevent['code'])) { + $s = ''; // Do not use type="email" here, we must be able to enter a list of email with , separator. + print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'
'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2); + } print ''; print ''; + $labelfortrigger = 'AmountHT'; // Notification with threshold + $inputfieldalreadyshown = 0; foreach ($conf->global as $key => $val) { if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_(.*)/', $key, $reg)) { continue; } - print $langs->trans("AmountHT").' >= '; - print '
'; + if (!preg_match('/^HOLIDAY/', $notifiedevent['code'])) { + print $langs->trans($labelfortrigger).' >= '; + print '
'; + + $inputfieldalreadyshown++; + } } // New entry input fields - print $langs->trans("AmountHT").' >= '; + if (!preg_match('/^HOLIDAY/', $notifiedevent['code'])) { + print $langs->trans($labelfortrigger).' >= '; + } print ''; print ''; From 30c40afeb3f4a94b4f7b146c8f23b838b15be023 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Aug 2021 04:28:16 +0200 Subject: [PATCH 7/9] Debug notification setup --- htdocs/admin/notification.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index ffed6b948bc..4c1df0fa938 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -169,14 +169,14 @@ llxHeader('', $langs->trans("NotificationSetup")); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("NotificationSetup"), $linkback, 'title_setup'); -print '
'; +print ''; print $langs->trans("NotificationsDesc").'
'; print $langs->trans("NotificationsDescUser").'
'; if (!empty($conf->societe->enabled)) { print $langs->trans("NotificationsDescContact").'
'; } print $langs->trans("NotificationsDescGlobal").'
'; -print '
'; +print ''; print '
'; print ''; @@ -342,6 +342,7 @@ print '

'; print ''; print ''; print ''; +print ''; print load_fiche_titre($langs->trans("ListOfFixedNotifications"), '', ''); @@ -383,6 +384,12 @@ foreach ($listofnotifiedevents as $notifiedevent) { $elementLabel = $langs->trans('ExpenseReport'); } + $labelfortrigger = 'AmountHT'; + $codehasnotrigger = 0; + if (preg_match('/^HOLIDAY/', $notifiedevent['code'])) { + $codehasnotrigger++; + } + print ''; print ''; print img_picto('', $elementPicto, 'class="pictofixedwidth"'); @@ -419,14 +426,13 @@ foreach ($listofnotifiedevents as $notifiedevent) { $inputfieldalreadyshown++; } // New entry input fields - if (empty($inputfieldalreadyshown) || !preg_match('/^HOLIDAY/', $notifiedevent['code'])) { + if (empty($inputfieldalreadyshown) || !$codehasnotrigger) { $s = ''; // Do not use type="email" here, we must be able to enter a list of email with , separator. print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'
'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2); } print ''; print ''; - $labelfortrigger = 'AmountHT'; // Notification with threshold $inputfieldalreadyshown = 0; foreach ($conf->global as $key => $val) { @@ -434,7 +440,7 @@ foreach ($listofnotifiedevents as $notifiedevent) { continue; } - if (!preg_match('/^HOLIDAY/', $notifiedevent['code'])) { + if (!$codehasnotrigger) { print $langs->trans($labelfortrigger).' >= '; print '
'; @@ -442,7 +448,7 @@ foreach ($listofnotifiedevents as $notifiedevent) { } } // New entry input fields - if (!preg_match('/^HOLIDAY/', $notifiedevent['code'])) { + if (!$codehasnotrigger) { print $langs->trans($labelfortrigger).' >= '; } print ''; @@ -457,7 +463,7 @@ print ''; print '
'; -print '
'; +print '
'; print ''; From a31f991b39433b83a1e337c9a8e3de306b44038a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Aug 2021 04:41:33 +0200 Subject: [PATCH 8/9] Doc --- htdocs/core/lib/admin.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 17da39e4f3c..3cd4b058a81 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1526,7 +1526,8 @@ function complete_elementList_with_modules(&$elementList) * @param array $tableau Array of constants array('key'=>array('type'=>type, 'label'=>label) * where type can be 'string', 'text', 'textarea', 'html', 'yesno', 'emailtemplate:xxx', ... * @param int $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (deprecated), 2=No form nor button at all, 3=No form nor button at all and each field has a unique name (form is output by caller, recommended) - * @param string $helptext Help + * @param string $helptext Tooltip help to use for the column name of values + * @param string $text Text to use for the column name of values * @return void */ function form_constantes($tableau, $strictw3c = 0, $helptext = '', $text = 'Value') From 7d61609462e4035727b355ca0384846589450674 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 17 Aug 2021 13:08:03 +0200 Subject: [PATCH 9/9] FIX #yogosha6907 --- htdocs/core/lib/barcode.lib.php | 8 +++----- .../core/modules/barcode/doc/phpbarcode.modules.php | 6 +++--- .../modules/barcode/doc/tcpdfbarcode.modules.php | 2 +- htdocs/viewimage.php | 12 ++++++++---- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php index 54bbc0a7666..12022ed178c 100644 --- a/htdocs/core/lib/barcode.lib.php +++ b/htdocs/core/lib/barcode.lib.php @@ -20,7 +20,7 @@ /** * \file htdocs/core/lib/barcode.lib.php - * \brief Set of functions used for barcode generation + * \brief Set of functions used for barcode generation (internal lib, also code 'phpbarcode') * \ingroup core */ @@ -69,7 +69,7 @@ if (defined('PHP-BARCODE_PATH_COMMAND')) { * Print barcode * * @param string $code Code - * @param string $encoding Encoding + * @param string $encoding Encoding ('EAN13', 'ISBN', 'C128', 'UPC', 'CBR', 'QRCODE', 'DATAMATRIX', 'ANY'...) * @param integer $scale Scale * @param string $mode 'png' or 'jpg' ... * @return array|string $bars array('encoding': the encoding which has been used, 'bars': the bars, 'text': text-positioning info) or string with error message @@ -149,12 +149,10 @@ function barcode_encode($code, $encoding) dol_syslog("barcode.lib.php::barcode_encode Use genbarcode ".$genbarcode_loc." code=".$code." encoding=".$encoding); $bars = barcode_encode_genbarcode($code, $encoding); } else { - print "barcode_encode needs an external programm for encodings other then EAN/ISBN (code=".$code.", encoding=".$encoding.")
\n"; + print "barcode_encode needs an external program for encodings other then EAN/ISBN (code=".dol_escape_htmltag($code).", encoding=".dol_escape_htmltag($encoding).")
\n"; print "
    \n"; print "
  • download gnu-barcode from www.gnu.org/software/barcode/\n"; print "
  • compile and install them\n"; - print "
  • download genbarcode from www.ashberg.de/bar/\n"; - print "
  • compile and install them\n"; print "
  • specify path the genbarcode in barcode module setup\n"; print "
\n"; print "
\n"; diff --git a/htdocs/core/modules/barcode/doc/phpbarcode.modules.php b/htdocs/core/modules/barcode/doc/phpbarcode.modules.php index fe36f7604c2..443e3f436f8 100644 --- a/htdocs/core/modules/barcode/doc/phpbarcode.modules.php +++ b/htdocs/core/modules/barcode/doc/phpbarcode.modules.php @@ -20,7 +20,7 @@ /** * \file htdocs/core/modules/barcode/doc/phpbarcode.modules.php * \ingroup barcode - * \brief File with class to generate barcode images using php barcode generator + * \brief File with class to generate barcode images using php internal lib barcode generator */ require_once DOL_DOCUMENT_ROOT.'/core/modules/barcode/modules_barcode.class.php'; @@ -126,7 +126,7 @@ class modPhpbarcode extends ModeleBarCode * * @param string $code Value to encode * @param string $encoding Mode of encoding - * @param string $readable Code can be read + * @param string $readable Code can be read (What is this ? is this used ?) * @param integer $scale Scale * @param integer $nooutputiferror No output if error * @return int <0 if KO, >0 if OK @@ -163,7 +163,7 @@ class modPhpbarcode extends ModeleBarCode if (!is_array($result)) { $this->error = $result; if (empty($nooutputiferror)) { - print $this->error; + print dol_escape_htmltag($this->error); } return -1; } diff --git a/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php b/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php index df9ec39546d..ed32667a67e 100644 --- a/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php +++ b/htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php @@ -100,7 +100,7 @@ class modTcpdfbarcode extends ModeleBarCode * * @param string $code Value to encode * @param string $encoding Mode of encoding - * @param string $readable Code can be read + * @param string $readable Code can be read (What is this ? is this used ?) * @param integer $scale Scale (not used with this engine) * @param integer $nooutputiferror No output if error (not used with this engine) * @return int <0 if KO, >0 if OK diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index e01bad39d77..9c584f5b8bb 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -282,10 +282,14 @@ if (preg_match('/\.\./', $fullpath_original_file) || preg_match('/[<>|]/', $full if ($modulepart == 'barcode') { - $generator = GETPOST("generator", "alpha"); - $code = GETPOST("code", 'none'); // This can be rich content (qrcode, datamatrix, ...) - $encoding = GETPOST("encoding", "alpha"); - $readable = GETPOST("readable", 'alpha') ?GETPOST("readable", "alpha") : "Y"; + $generator = GETPOST("generator", "aZ09"); + $encoding = GETPOST("encoding", "aZ09"); + $readable = GETPOST("readable", 'aZ09') ? GETPOST("readable", "aZ09") : "Y"; + if (in_array($encoding, array('EAN8', 'EAN13'))) { + $code = GETPOST("code", 'alphanohtml'); + } else { + $code = GETPOST("code", 'none'); // This can be rich content (qrcode, datamatrix, ...) + } if (empty($generator) || empty($encoding)) { print 'Error: Parameter "generator" or "encoding" not defined';