From 308e7a3d9bd74ec3267491aa14178bd05d4fdeb6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 May 2022 12:40:44 +0200 Subject: [PATCH] Fix scrutinizer --- .../class/accountingaccount.class.php | 1 + htdocs/accountancy/class/lettering.class.php | 2 ++ htdocs/compta/facture/class/facture.class.php | 7 +++-- .../core/class/commondocgenerator.class.php | 20 ++++++++++++ htdocs/core/class/html.form.class.php | 31 ++++++++++--------- htdocs/core/class/html.formticket.class.php | 28 +++++++++++------ htdocs/core/modules/action/rapport.pdf.php | 8 +++++ .../doc/doc_generic_asset_odt.modules.php | 1 - .../core/modules/bank/doc/pdf_ban.modules.php | 1 - .../bank/doc/pdf_sepamandate.modules.php | 1 - .../doc/doc_generic_order_odt.modules.php | 1 - .../commande/doc/pdf_einstein.modules.php | 1 - .../commande/doc/pdf_eratosthene.modules.php | 1 - .../doc/doc_generic_contract_odt.modules.php | 1 - .../contract/doc/pdf_strato.modules.php | 1 - .../delivery/doc/pdf_storm.modules.php | 1 - .../delivery/doc/pdf_typhon.modules.php | 1 - .../doc/doc_generic_shipment_odt.modules.php | 1 - .../doc/pdf_standard.modules.php | 9 +++++- .../doc/doc_generic_invoice_odt.modules.php | 1 - .../modules/facture/doc/pdf_crabe.modules.php | 1 - .../facture/doc/pdf_sponge.modules.php | 1 - .../fichinter/doc/pdf_soleil.modules.php | 1 - .../doc/doc_generic_member_odt.class.php | 1 - .../movement/doc/pdf_standard.modules.php | 31 ++++++++----------- .../modules/movement/modules_movement.php | 2 ++ .../mrp/doc/doc_generic_mo_odt.modules.php | 1 - .../modules/mrp/doc/pdf_vinci.modules.php | 1 - .../doc/doc_generic_product_odt.modules.php | 1 - .../product/doc/pdf_standard.modules.php | 1 - .../doc/doc_generic_project_odt.modules.php | 1 - .../project/doc/pdf_baleine.modules.php | 1 - .../project/doc/pdf_beluga.modules.php | 1 - .../project/doc/pdf_timespent.modules.php | 1 - .../task/doc/doc_generic_task_odt.modules.php | 1 - .../doc/doc_generic_proposal_odt.modules.php | 1 - .../modules/propale/doc/pdf_azur.modules.php | 1 - .../modules/propale/doc/pdf_cyan.modules.php | 1 - .../doc/doc_generic_reception_odt.modules.php | 1 - .../doc/doc_generic_stock_odt.modules.php | 1 - .../doc/pdf_canelle.modules.php | 1 - ...doc_generic_supplier_order_odt.modules.php | 2 -- .../supplier_order/doc/pdf_cornas.modules.php | 1 - .../doc/pdf_muscadet.modules.php | 1 - .../doc/pdf_standard.modules.php | 8 +++++ ..._generic_supplier_proposal_odt.modules.php | 1 - .../doc/pdf_aurore.modules.php | 1 - .../user/doc/doc_generic_user_odt.modules.php | 1 - .../doc/doc_generic_usergroup_odt.modules.php | 1 - .../doc/doc_generic_myobject_odt.modules.php | 1 - htdocs/product/class/product.class.php | 16 +++++----- htdocs/public/recruitment/view.php | 2 +- htdocs/public/ticket/list.php | 4 +-- ...ric_recruitmentjobposition_odt.modules.php | 1 - ...tandard_recruitmentjobposition.modules.php | 1 - 55 files changed, 112 insertions(+), 99 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 72efffc2b49..28c35016054 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -748,6 +748,7 @@ class AccountingAccount extends CommonObject $reshook = $hookmanager->executeHooks('accoutancyBindingCalculation', $parameters); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { + $const_name = ''; if ($type == 'customer') { $const_name = "SOLD"; } elseif ($type == 'supplier') { diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index 81caaa05358..405a630942e 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -699,6 +699,8 @@ class Lettering extends BookKeeping return $grouped_payments; } + $save_payment_by_element = null; + $save_element_by_payment = null; if ($element_id == 0) { // Save list when is the begin of recursive function $save_payment_by_element = $payment_by_element; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e971262208c..3dde8ce2638 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1652,13 +1652,13 @@ class Facture extends CommonInvoice 0, // date_start 0, // date_end 0, - $lines[$i]->info_bits, // info_bits + 0, // info_bits 0, 'HT', 0, 0, // product_type 1, - $lines[$i]->special_code, + 0, // special_code $deposit->origin, 0, 0, @@ -5503,6 +5503,7 @@ class Facture extends CommonInvoice $sendContent = make_substitutions($content, $substitutionarray, $outputlangs, 1); // Recipient + $to = ''; $res = $tmpinvoice->fetch_thirdparty(); $recipient = $tmpinvoice->thirdparty; if ($res > 0) { @@ -5524,7 +5525,7 @@ class Facture extends CommonInvoice $error++; } - if (!$error) { + if (!$error && $to) { // Errors Recipient $errors_to = $conf->global->MAIN_MAIL_ERRORS_TO; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index a9536f410ca..e80eaa52b14 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -65,6 +65,26 @@ abstract class CommonDocGenerator */ public $scandir; + public $page_hauteur; + public $page_largeur; + public $marge_gauche; + public $marge_droite; + public $marge_haute; + public $marge_basse; + + public $option_logo; + public $option_tva; + public $option_multilang; + public $option_freetext; + public $option_draft_watermark; + + public $option_modereg; + public $option_condreg; + public $option_escompte; + public $option_credit_note; + + public $emetteur; + /** * Constructor diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c21434b49de..06b56076316 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -466,6 +466,8 @@ class Form $ext_element = false; $button_only = false; $inputOption = ''; + $rows = ''; + $cols = ''; if (is_object($object)) { $element = $object->element; @@ -1001,9 +1003,10 @@ class Form * @param string $htmloption Options html on select object * @param int $forcecombo Force to load all values and output a standard combobox (with no beautification) * @param array $events Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @param array $disableautocomplete Disable autocomplete * @return string HTML string with select and input */ - public function select_incoterms($selected = '', $location_incoterms = '', $page = '', $htmlname = 'incoterm_id', $htmloption = '', $forcecombo = 1, $events = array()) + public function select_incoterms($selected = '', $location_incoterms = '', $page = '', $htmlname = 'incoterm_id', $htmloption = '', $forcecombo = 1, $events = array(), $disableautocomplete = 0) { // phpcs:enable global $conf, $langs; @@ -1038,8 +1041,6 @@ class Form $num = $this->db->num_rows($resql); $i = 0; if ($num) { - $foundselected = false; - while ($i < $num) { $obj = $this->db->fetch_object($resql); $incotermArray[$i]['rowid'] = $obj->rowid; @@ -1901,6 +1902,7 @@ class Form { // phpcs:enable global $conf, $user, $langs, $hookmanager; + global $action; // If no preselected user defined, we take current user if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) { @@ -2414,6 +2416,7 @@ class Form if (!$forcecombo) { include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; + $events = array(); $out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); } @@ -4192,6 +4195,7 @@ class Form } } $out .= '>'; + $value = ''; if ($format == 0) { $value = ($maxlength ?dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']); } elseif ($format == 1) { @@ -6333,6 +6337,9 @@ class Form // Analysis of the pre-selection date $reg = array(); + $shour = ''; + $smin = ''; + $ssec = ''; if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?/', $set_time, $reg)) { // deprecated usage // Date format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' $syear = (!empty($reg[1]) ? $reg[1] : ''); @@ -6349,10 +6356,6 @@ class Form $shour = dol_print_date($set_time, "%H", $gm); $smin = dol_print_date($set_time, "%M", $gm); $ssec = dol_print_date($set_time, "%S", $gm); - } else { - $shour = ''; - $smin = ''; - $ssec = ''; } } else { // Date est '' ou vaut -1 @@ -6878,6 +6881,7 @@ class Form unset($tickettmpselect); } + $urloption = ''; $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/ticket/ajax/tickets.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 1, $ajaxoptions); if (empty($hidelabel)) $out .= $langs->trans("RefOrLabel").' : '; @@ -7020,16 +7024,11 @@ class Form protected function constructTicketListOption(&$objp, &$opt, &$optJson, $selected, $filterkey = '') { $outkey = ''; - $outval = ''; $outref = ''; - $outlabel = ''; $outtype = ''; - $label = $objp->label; - $outkey = $objp->rowid; $outref = $objp->ref; - $outlabel = $objp->label; $outtype = $objp->fk_product_type; $opt = '\n"; - $optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtypem); + $optJson = array('key'=>$outkey, 'value'=>$outref, 'type'=>$outtype); } /** @@ -7648,6 +7646,7 @@ class Form $out = ''; $outarray = array(); + $tmparray = array(); $num = 0; @@ -9353,10 +9352,12 @@ class Form global $conf, $user, $langs; // Permettre l'exclusion de groupes + $excludeGroups = null; if (is_array($exclude)) { $excludeGroups = implode(",", $exclude); } // Permettre l'inclusion de groupes + $includeGroups = null; if (is_array($include)) { $includeGroups = implode(",", $include); } @@ -9920,7 +9921,7 @@ class Form //if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled $out .= '>' . $labeltoshow . ''; } else { - if ($hideunselectables && $disabled && ($selected != $obj->rowid)) { + if ($disabled && ($selected != $obj->rowid)) { $resultat = ''; } else { $resultat = '