From 1d81322120391fc8337fee12e4ec4907c851c051 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Thu, 6 May 2021 22:54:32 +0200 Subject: [PATCH 01/12] Update pdf.php --- htdocs/admin/pdf.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 7d7b5e36a40..256038d356c 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2012-2107 Juanjo Menent * Copyright (C) 2019 Ferran Marcet + * Copyright (C) 2021 Anthony Berton * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -329,6 +330,11 @@ print ''.$langs->trans("MAIN_DOCUMENTS_LOGO_HEIGHT").'global->MAIN_DOCUMENTS_LOGO_HEIGHT) ? $conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT : 20).'">'; print ''; +// Width of picture product lign +print ''.$langs->trans("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH").''; +print ''; +print ''; + // Show project if (!empty($conf->projet->enabled)) { From 52a255e0cb9a9ed95e8781849b2aff827d4986d8 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Thu, 12 Aug 2021 10:10:57 +0200 Subject: [PATCH 02/12] move at bottom of pdf_other.php page --- htdocs/admin/pdf.php | 5 ---- htdocs/admin/pdf_other.php | 59 +++++++++++++++++++++----------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 256038d356c..540d8318dd1 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -330,11 +330,6 @@ print ''.$langs->trans("MAIN_DOCUMENTS_LOGO_HEIGHT").'global->MAIN_DOCUMENTS_LOGO_HEIGHT) ? $conf->global->MAIN_DOCUMENTS_LOGO_HEIGHT : 20).'">'; print ''; -// Width of picture product lign -print ''.$langs->trans("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH").''; -print ''; -print ''; - // Show project if (!empty($conf->projet->enabled)) { diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index 8a757a7d34c..3d0ff2ad23a 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -80,38 +80,43 @@ print dol_get_fiche_head($head, 'other', $langs->trans("other"), -1, 'pdf'); print ''.$form->textwithpicto($langs->trans("PDFOtherDesc"), $s)."
\n"; print "
\n"; +if (!empty($conf->propal->enabled)) { + print load_fiche_titre($langs->trans("Proposal"), '', ''); -print load_fiche_titre($langs->trans("Proposal"), '', ''); + print '
'; + print ''; + print ''; -print ''; -print ''; -print ''; + print '
'; + print ''; + print ''; -print '
'; -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; -print ''; + print ''; -print ''; + + // Width of picture product lign + print ''; + + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE").''; + 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 '
'.$langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE").''; -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 '
'.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").''; + if ($conf->use_javascript_ajax) { + 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 '
'.$langs->trans("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH").''; + print ''; + print '
'; + print '
'; } -print ''; - -print ''.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").''; -if ($conf->use_javascript_ajax) { - 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 ''; - -print ''; -print ''; - print '
'; print ''; From 14ad317acce9fc07fed0efd63f7a599c55882a54 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 12 Aug 2021 08:18:44 +0000 Subject: [PATCH 03/12] Fixing style errors. --- htdocs/admin/pdf_other.php | 102 ++++++++++++++++++------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index ff4748b08f1..e2b307691e4 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -93,65 +93,65 @@ print ''.$form->textwithpicto($langs->trans("PDFOthe print "
\n"; if (!empty($conf->propal->enabled)) { - print load_fiche_titre($langs->trans("Proposal"), '', ''); + print load_fiche_titre($langs->trans("Proposal"), '', ''); - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; - print '
'; - print ''; - print ''; + print '
'; + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - // Width of picture product lign - print ''; + // Width of picture product lign + print ''; - /* - print ''; - */ + /* + print ''; + */ - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"); - print ' ('.$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 '
'.$langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"); + print ' ('.$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 '
'.$langs->trans("PROPOSAL_PDF_HIDE_PAYMENTTERM"); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('PROPOSAL_PDF_HIDE_PAYMENTTERM'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("PROPOSAL_PDF_HIDE_PAYMENTTERM", $arrval, $conf->global->PROPOSAL_PDF_HIDE_PAYMENTTERM); - } - print '
'.$langs->trans("PROPOSAL_PDF_HIDE_PAYMENTTERM"); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('PROPOSAL_PDF_HIDE_PAYMENTTERM'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("PROPOSAL_PDF_HIDE_PAYMENTTERM", $arrval, $conf->global->PROPOSAL_PDF_HIDE_PAYMENTTERM); + } + print '
'.$langs->trans("PROPOSAL_PDF_HIDE_PAYMENTMODE"); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('PROPOSAL_PDF_HIDE_PAYMENTMODE'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("PROPOSAL_PDF_HIDE_PAYMENTMODE", $arrval, $conf->global->PROPOSAL_PDF_HIDE_PAYMENTMODE); - } - print '
'.$langs->trans("PROPOSAL_PDF_HIDE_PAYMENTMODE"); + print ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('PROPOSAL_PDF_HIDE_PAYMENTMODE'); + } else { + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("PROPOSAL_PDF_HIDE_PAYMENTMODE", $arrval, $conf->global->PROPOSAL_PDF_HIDE_PAYMENTMODE); + } + print '
'.$langs->trans("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH").''; - print ''; - print '
'.$langs->trans("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH").''; + print ''; + print '
'.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").''; - if ($conf->use_javascript_ajax) { - 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 '
'.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").''; + if ($conf->use_javascript_ajax) { + 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 '
'; - print '
'; + print ''; + print '
'; } /* From 67bc64d68753fa0ff8aaea01716aa945977931bc Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Thu, 12 Aug 2021 10:19:55 +0200 Subject: [PATCH 04/12] save no ajax --- htdocs/admin/pdf.php | 1 - htdocs/admin/pdf_other.php | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 540d8318dd1..949666c40dc 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -87,7 +87,6 @@ if ($action == 'update') { dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_DESC"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", GETPOST("MAIN_GENERATE_DOCUMENTS_HIDE_REF"), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", GETPOST("MAIN_INVERT_SENDER_RECIPIENT"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", GETPOST("MAIN_PDF_USE_ISO_LOCATION"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", GETPOST("MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"), 'chaine', 0, '', $conf->entity); diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index 3d0ff2ad23a..c042b1af32a 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -53,6 +53,7 @@ if ($cancel) { } if ($action == 'update') { + dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); From fdd85845ce1e741019d5b8cee5655d44cc17e214 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Thu, 12 Aug 2021 10:27:19 +0200 Subject: [PATCH 05/12] erreur save const --- htdocs/admin/pdf_other.php | 7 +------ htdocs/langs/en_US/admin.lang | 1 + 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index c042b1af32a..a6ab77ec2c5 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -41,19 +41,14 @@ if (!$user->admin) { } $action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'alpha'); /* * Actions */ -if ($cancel) { - $action = ''; -} - if ($action == 'update') { - dolibarr_set_const($db, "MAIN_DOCUMENTS_LOGO_HEIGHT", GETPOST("MAIN_DOCUMENTS_LOGO_HEIGHT", 'int'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", GETPOST("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH", 'int'), 'chaine', 0, '', $conf->entity); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 34852c2ca61..e776c5b16f8 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1984,6 +1984,7 @@ MAIN_PDF_MARGIN_RIGHT=Right margin on PDF MAIN_PDF_MARGIN_TOP=Top margin on PDF MAIN_PDF_MARGIN_BOTTOM=Bottom margin on PDF MAIN_DOCUMENTS_LOGO_HEIGHT=Height for logo on PDF +MAIN_DOCUMENTS_WITH_PICTURE_WIDTH=Width the picture in the line MAIN_GENERATE_PROPOSALS_WITH_PICTURE=Add picture on proposal ligne MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING=Add electronic sign in PDF NothingToSetup=There is no specific setup required for this module. From 73998ac927cc617debfacc41022d6d61caa8b5dd Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 12 Aug 2021 08:36:38 +0000 Subject: [PATCH 06/12] Fixing style errors. --- htdocs/admin/pdf_other.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index cafbdee144b..54b4642b9f4 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -48,7 +48,6 @@ $action = GETPOST('action', 'aZ09'); */ if ($action == 'update') { - if (GETPOSTISSET('PROPOSAL_PDF_HIDE_PAYMENTTERM')) { dolibarr_set_const($db, "PROPOSAL_PDF_HIDE_PAYMENTTERM", GETPOST("PROPOSAL_PDF_HIDE_PAYMENTTERM"), 'chaine', 0, '', $conf->entity); } From acbae5cafb51876c75f8556a79546ac0677b337d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 19 Oct 2021 12:14:42 +0200 Subject: [PATCH 07/12] FIX add possibility to bypass MAIN_ANTIVIRUS_* constants --- htdocs/core/class/conf.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index ee91d67b9ce..04fd0266150 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -836,6 +836,12 @@ class Conf // Note: Set MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL=1 to have a renewal of token at each page call instead of each session (not recommended) } + // To bypass MAIN_ANTIVIRUS_* constants + if (defined('MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) { + define("MAIN_ANTIVIRUS_COMMAND", false); + define("MAIN_ANTIVIRUS_PARAM", false); + } + if (defined('MAIN_ANTIVIRUS_COMMAND')) { $this->global->MAIN_ANTIVIRUS_COMMAND = constant('MAIN_ANTIVIRUS_COMMAND'); } From db01fed44722883140c9c92bd37ccb4e68fa158b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 19 Oct 2021 12:36:33 +0200 Subject: [PATCH 08/12] FIX error when defining an already existing constant --- htdocs/admin/security_file.php | 4 ++-- htdocs/admin/system/security.php | 2 +- htdocs/core/class/conf.class.php | 18 +++++++----------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 0a0e0b5973a..fbae10a9512 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -153,8 +153,8 @@ if (ini_get('safe_mode') && !empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) { dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING); } } -print ''; -if (defined('MAIN_ANTIVIRUS_COMMAND')) { +print ''; +if (defined('MAIN_ANTIVIRUS_COMMAND') && !defined('MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) { print '
'.$langs->trans("ValueIsForcedBySystem").''; } print ""; diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index b0614c7501d..f03246a6bdf 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -306,7 +306,7 @@ print empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? '' : img_picto('', 'tick'). print yn(empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? 0 : 1); if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) { print '   - '.$conf->global->MAIN_ANTIVIRUS_COMMAND; - if (defined('MAIN_ANTIVIRUS_COMMAND')) { + if (defined('MAIN_ANTIVIRUS_COMMAND') && !defined('MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) { print ' - '.$langs->trans("ValueIsForcedBySystem").''; } } diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 04fd0266150..044dc192426 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -836,17 +836,13 @@ class Conf // Note: Set MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL=1 to have a renewal of token at each page call instead of each session (not recommended) } - // To bypass MAIN_ANTIVIRUS_* constants - if (defined('MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) { - define("MAIN_ANTIVIRUS_COMMAND", false); - define("MAIN_ANTIVIRUS_PARAM", false); - } - - if (defined('MAIN_ANTIVIRUS_COMMAND')) { - $this->global->MAIN_ANTIVIRUS_COMMAND = constant('MAIN_ANTIVIRUS_COMMAND'); - } - if (defined('MAIN_ANTIVIRUS_PARAM')) { - $this->global->MAIN_ANTIVIRUS_PARAM = constant('MAIN_ANTIVIRUS_PARAM'); + if (!defined('MAIN_ANTIVIRUS_BYPASS_COMMAND_AND_PARAM')) { + if (defined('MAIN_ANTIVIRUS_COMMAND')) { + $this->global->MAIN_ANTIVIRUS_COMMAND = constant('MAIN_ANTIVIRUS_COMMAND'); + } + if (defined('MAIN_ANTIVIRUS_PARAM')) { + $this->global->MAIN_ANTIVIRUS_PARAM = constant('MAIN_ANTIVIRUS_PARAM'); + } } if (!empty($this->global->MAIN_TZUSERINPUTKEY)) { From d8cd6b6f557cbb099f91e0e8c04e2b9184cf7ea7 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 19 Oct 2021 15:54:25 +0200 Subject: [PATCH 09/12] Fix autoselect multilevel --- htdocs/core/class/html.formticket.class.php | 76 +++++++++++++-------- 1 file changed, 46 insertions(+), 30 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 5ce2dd0fca7..0061609ef01 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -755,7 +755,23 @@ class FormTicket } elseif ($htmlname!='') { $groupticket=GETPOST($htmlname, 'aZ09'); $child_id=GETPOST($htmlname.'_child_id', 'aZ09')?GETPOST($htmlname.'_child_id', 'aZ09'):0; - + if (!empty($groupticket)) { + $tmpgroupticket = $groupticket; + $sql = "SELECT ctc.rowid, ctc.fk_parent, ctc.code FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc WHERE ctc.code = '".$tmpgroupticket."'"; + $resql = $this->db->query($sql); + if ($resql) { + $obj = $this->db->fetch_object($resql); + $selectedgroups[] = $obj->code; + while ($obj->fk_parent > 0) { + $sql = "SELECT ctc.rowid, ctc.fk_parent, ctc.code FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc WHERE ctc.rowid ='".$obj->fk_parent."'"; + $resql = $this->db->query($sql); + if ($resql) { + $obj = $this->db->fetch_object($resql); + $selectedgroups[] = $obj->code; + } + } + } + } $arrayidused = array(); $arrayidusedconcat = array(); $arraycodenotparent = array(); @@ -794,7 +810,11 @@ class FormTicket $grouplabel = $label; $isparent = $obj->isparent; - $iselected = $groupticket == $obj->code ?'selected':''; + if (is_array($selectedgroups)) { + $iselected = in_array($obj->code, $selectedgroups) ?'selected':''; + } else { + $iselected = $groupticket == $obj->code ?'selected':''; + } $stringtoprint .= ''; if ($isparent == 'NOTPARENT') { $arraycodenotparent[] = $groupvalue; @@ -868,10 +888,14 @@ class FormTicket if ($isparent == 'NOTPARENT') { $arraycodenotparent[] = $groupvalue; } - $iselected = $groupticket == $obj->code ?'selected':''; + if (is_array($selectedgroups)) { + $iselected = in_array($obj->code, $selectedgroups) ?'selected':''; + } else { + $iselected = $groupticket == $obj->code ?'selected':''; + } $stringtoprint .= ''; if (empty($tabscript[$groupcodefather])) { - $tabscript[$groupcodefather] = 'if ($("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'")[0].value == "'.dol_escape_js($groupcodefather).'"){ + $tabscript[$groupcodefather] = 'if ($("#'.$htmlname.($levelid > 1 ?'_child_'.$levelid-1:'').'").val() == "'.dol_escape_js($groupcodefather).'"){ $(".'.$htmlname.'_'.dol_escape_htmltag($fatherid).'_child_'.$levelid.'").show() console.log("We show childs tickets of '.$groupcodefather.' group ticket") }else{ @@ -889,23 +913,15 @@ class FormTicket $stringtoprint .=''; $stringtoprint .= ajax_combobox($htmlname); From f5942300e0f01b0317519734d4001a78788ac300 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 19 Oct 2021 16:09:06 +0200 Subject: [PATCH 10/12] fix CI bot error --- htdocs/core/class/html.formticket.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 0061609ef01..89260c35d03 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -757,13 +757,13 @@ class FormTicket $child_id=GETPOST($htmlname.'_child_id', 'aZ09')?GETPOST($htmlname.'_child_id', 'aZ09'):0; if (!empty($groupticket)) { $tmpgroupticket = $groupticket; - $sql = "SELECT ctc.rowid, ctc.fk_parent, ctc.code FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc WHERE ctc.code = '".$tmpgroupticket."'"; + $sql = "SELECT ctc.rowid, ctc.fk_parent, ctc.code FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc WHERE ctc.code = '".$this->db->escape($tmpgroupticket)."'"; $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); $selectedgroups[] = $obj->code; while ($obj->fk_parent > 0) { - $sql = "SELECT ctc.rowid, ctc.fk_parent, ctc.code FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc WHERE ctc.rowid ='".$obj->fk_parent."'"; + $sql = "SELECT ctc.rowid, ctc.fk_parent, ctc.code FROM ".MAIN_DB_PREFIX."c_ticket_category as ctc WHERE ctc.rowid ='".$this->db->escape($obj->fk_parent)."'"; $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); From 58941e9a9558416e9c83f56894e9222fccb6c087 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Oct 2021 19:31:06 +0200 Subject: [PATCH 11/12] Update pdf_other.php --- htdocs/admin/pdf_other.php | 55 +++++++++++--------------------------- 1 file changed, 15 insertions(+), 40 deletions(-) diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index 54b4642b9f4..f42c49a4bfe 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -91,53 +91,28 @@ print ''.$form->textwithpicto($langs->trans("PDFOthe print "
\n"; if (!empty($conf->propal->enabled)) { - print load_fiche_titre($langs->trans("Proposal"), '', ''); + print load_fiche_titre($langs->trans("Proposal"), '', ''); - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; - print '
'; - print ''; - print ''; + print '
'; + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + print ''; - print ''; + print ''; - print ''; - - print ''; - - // Width of picture product lign - print ''; - - /* + /* print ''; - */ + */ - print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"); - print ' ('.$langs->trans("RandomlySelectedIfSeveral").')'; - print ''; + print '
'.$langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE"); + print ' ('.$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 '
'.$langs->trans("PROPOSAL_PDF_HIDE_PAYMENTTERM"); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('PROPOSAL_PDF_HIDE_PAYMENTTERM'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("PROPOSAL_PDF_HIDE_PAYMENTTERM", $arrval, $conf->global->PROPOSAL_PDF_HIDE_PAYMENTTERM); - } - print '
'.$langs->trans("PROPOSAL_PDF_HIDE_PAYMENTMODE"); - print ''; - if ($conf->use_javascript_ajax) { - print ajax_constantonoff('PROPOSAL_PDF_HIDE_PAYMENTMODE'); - } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("PROPOSAL_PDF_HIDE_PAYMENTMODE", $arrval, $conf->global->PROPOSAL_PDF_HIDE_PAYMENTMODE); - } - print '
'.$langs->trans("MAIN_DOCUMENTS_WITH_PICTURE_WIDTH").''; - print ''; - print '
'.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING'); @@ -146,10 +121,10 @@ if (!empty($conf->propal->enabled)) { print $form->selectarray("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING", $arrval, $conf->global->MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING); } print '
'; - print '
'; + print ''; + print ''; } print '
'; From 3a14cd7a1615488e160fb9dd672f55ff92740679 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Oct 2021 19:32:28 +0200 Subject: [PATCH 12/12] Update admin.lang --- htdocs/langs/en_US/admin.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 6652d4de983..554cd00d31c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1994,8 +1994,8 @@ MAIN_PDF_MARGIN_RIGHT=Right margin on PDF MAIN_PDF_MARGIN_TOP=Top margin on PDF MAIN_PDF_MARGIN_BOTTOM=Bottom margin on PDF MAIN_DOCUMENTS_LOGO_HEIGHT=Height for logo on PDF -MAIN_GENERATE_PROPOSALS_WITH_PICTURE=Add picture on proposal line -MAIN_DOCUMENTS_WITH_PICTURE_WIDTH=Width the picture in the line +MAIN_GENERATE_PROPOSALS_WITH_PICTURE=Add column for picture on proposal lines +MAIN_DOCUMENTS_WITH_PICTURE_WIDTH=Width of the column if a picture is added on lines MAIN_PDF_NO_SENDER_FRAME=Hide borders on sender address frame MAIN_PDF_NO_RECIPENT_FRAME=Hide borders on recipent address frame MAIN_PDF_HIDE_CUSTOMER_CODE=Hide customer code