diff --git a/dev/tools/phan/config.php b/dev/tools/phan/config.php index 1d8a2f6f467..21d410a9665 100644 --- a/dev/tools/phan/config.php +++ b/dev/tools/phan/config.php @@ -497,7 +497,7 @@ return [ // 'PhanTypeMismatchDimAssignment', // 'PhanPluginDescriptionlessCommentOnProtectedMethod', // 'PhanPluginPrintfIncompatibleArgumentTypeWeak', - 'PhanUndeclaredVariableAssignOp', + // 'PhanUndeclaredVariableAssignOp', // 'PhanTypeExpectedObjectOrClassName', 'PhanEmptyFQSENInClasslike', // 'PhanTypeMismatchArgumentInternalReal', diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index d0efa85599e..9c512bfc047 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -1491,6 +1491,7 @@ if ($action == 'create') { print ''; // List of files $listofpaths = dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0); + $out = ''; // TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript $out .= ''."\n"; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 7296c3dd820..86898548291 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1573,6 +1573,7 @@ if (empty($reshook)) { $TTotalByTva[$line->tva_tx] += $line->total_ttc; } + $amount_ttc_diff = 0.; foreach ($TTotalByTva as $tva => &$total) { $coef = $total / $srcobject->total_ttc; // Calc coef $am = $amount * $coef; diff --git a/htdocs/compta/paiement_vat.php b/htdocs/compta/paiement_vat.php index af4e1463ae3..ecb946e6686 100644 --- a/htdocs/compta/paiement_vat.php +++ b/htdocs/compta/paiement_vat.php @@ -253,6 +253,7 @@ if ($action == 'create') { $total = 0; $totalrecu = 0; + $total_ttc = 0.; while ($i < $num) { $objp = $tva; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 2cc21fb215d..e3a3eb07439 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -83,6 +83,9 @@ class BonPrelevement extends CommonObject public $factures = array(); + /** + * @var array + */ public $methodes_trans = array(); public $invoice_in_error = array(); @@ -171,6 +174,9 @@ class BonPrelevement extends CommonObject public $credite; public $note; public $date_trans; + /** + * @var int Current transport method, index to $methodes_trans + */ public $method_trans; public $fk_user_trans; public $date_credit; diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 1fe40efa05e..1dc1fd3d76d 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -274,10 +274,10 @@ if ($resql) { $num = $db->num_rows($resql); $i = 0; + $param = "&id=".((int) $id); if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } - $param = "&id=".urlencode((string) ($id)); // Lines of title fields print '
'; @@ -325,10 +325,14 @@ if ($resql) { while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); - if ($salaryBonPl) { + $itemurl = ''; + $partyurl = ''; + if ($salaryBonPl && ($salarytmp instanceof Salary) && ($user instanceof User)) { $salarytmp->fetch($obj->salaryid); $usertmp->fetch($obj->userid); - } else { + $itemurl = $salarytmp->getNomUrl(1); + $partyurl = $usertmp->getNomUrl(1); + } elseif ($invoicetmp instanceof Facture && $invoicetmpsupplier instanceof FactureFournisseur) { if ($obj->type == 'bank-transfer') { $invoicetmp = $invoicetmpsupplier; } else { @@ -337,22 +341,24 @@ if ($resql) { $invoicetmp->fetch($obj->facid); $thirdpartytmp->fetch($obj->socid); + $itemurl = $invoicetmp->getNomUrl(1); + $partyurl = $thirdpartytmp->getNomUrl(1); } print ''; print ''; - print($salaryBonPl ? $salarytmp->getNomUrl(1) : $invoicetmp->getNomUrl(1)); + print $itemurl; print "\n"; - if ($object->type == 'bank-transfer' && !$salaryBonPl) { + if ($object->type == 'bank-transfer' && !$salaryBonPl && $invoicetmp instanceof Facture) { print ''; print dol_escape_htmltag($invoicetmp->ref_supplier); print "\n"; } print ''; - print($salaryBonPl ? $usertmp->getNomUrl(-1) : $thirdpartytmp->getNomUrl(1)); + print $partyurl; print "\n"; // Amount of invoice diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index affca98a90d..61b31bfb5fd 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -172,19 +172,19 @@ if ($action == 'add') { //In sellist we have only one line and it can have come to do SQL expression if ($type == 'sellist' || $type == 'chkbxlst') { foreach ($parameters_array as $param_ligne) { - $params['options'] = array($parameters=>null); + $params['options'] = array($parameters => null); } } else { // Else it's separated key/value and coma list foreach ($parameters_array as $param_ligne) { - if (strpos($param_ligne, ',')!==false) { + if (strpos($param_ligne, ',') !== false) { list($key, $value) = explode(',', $param_ligne); if (!array_key_exists('options', $params)) { $params['options'] = array(); } } else { - $key=$param_ligne; - $value=null; + $key = $param_ligne; + $value = null; } $params['options'][$key] = $value; } @@ -345,7 +345,7 @@ if ($action == 'update') { //In sellist we have only one line and it can have come to do SQL expression if ($type == 'sellist' || $type == 'chkbxlst') { foreach ($parameters_array as $param_ligne) { - $params['options'] = array($parameters=>null); + $params['options'] = array($parameters => null); } } else { //Else it's separated key/value and coma list @@ -447,7 +447,7 @@ if ($action == 'encrypt') { if ($extrafields->attributes[$elementtype]['entityid'][$attributekey] == $conf->entity || empty($extrafields->attributes[$elementtype]['entityid'][$attributekey])) { dol_syslog("Loop on each extafields of table ".$arrayofelement['table_element']); - $sql .= "SELECT te.rowid, te.".$attributekey; + $sql = "SELECT te.rowid, te.".$attributekey; $sql .= " FROM ".MAIN_DB_PREFIX.$arrayofelement['table_element']." as t, ".MAIN_DB_PREFIX.$arrayofelement['table_element'].'_extrafields as te'; $sql .= " WHERE te.fk_object = t.rowid"; $sql .= " AND te.".$attributekey." NOT LIKE 'dolcrypt:%'"; @@ -462,7 +462,7 @@ if ($action == 'encrypt') { $resql = $db->query($sql); if ($resql) { $num_rows = $db->num_rows($resql); - $i=0; + $i = 0; while ($i < $num_rows) { $objtmp = $db->fetch_object($resql); $id = $objtmp->rowid; diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 9498ed91d9c..d6e4f788500 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -390,6 +390,7 @@ if ($action == 'viewgraph') { // Get all possible values of fields when a 'group by' is set, and save this into $arrayofvaluesforgroupby // $arrayofvaluesforgroupby will be used to forge lael of each grouped series if (is_array($search_groupby) && count($search_groupby)) { + $fieldtocount = ''; foreach ($search_groupby as $gkey => $gval) { $gvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $gval); diff --git a/htdocs/core/get_info.php b/htdocs/core/get_info.php index 28434f7d405..2b5fc8f69d4 100644 --- a/htdocs/core/get_info.php +++ b/htdocs/core/get_info.php @@ -88,6 +88,8 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) { } $logouttext = ''; +$logouthtmltext = ''; +$toprightmenu = ''; if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { //$logouthtmltext=$appli.'
'; if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') { diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index cfe406a7684..36cb26e4b6d 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1589,8 +1589,9 @@ function check_value($mask, $value) function binhex($bin, $pad = false, $upper = false) { $last = dol_strlen($bin) - 1; + $x = 0; for ($i = 0; $i <= $last; $i++) { - $x += $bin[$last - $i] * pow(2, $i); + $x += ($bin[$last - $i] ? 1 : 0) << $i; } $x = dechex($x); if ($pad) { diff --git a/htdocs/core/multicompany_page.php b/htdocs/core/multicompany_page.php index 864dd76cc3d..9286e3efaaa 100644 --- a/htdocs/core/multicompany_page.php +++ b/htdocs/core/multicompany_page.php @@ -91,7 +91,9 @@ print ''."\n"; print '
'; //print '
'; - +if (!isset($bookmarkList)) { + $bookmarkList = ''; +} if (!isModEnabled('multicompany')) { $langs->load("admin"); $bookmarkList .= '
'.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("MultiCompany")).''; @@ -128,7 +130,7 @@ if (!isModEnabled('multicompany')) { // Execute hook printBookmarks - $parameters = array('multicompany'=>$multicompanyList); + $parameters = array('multicompany' => $multicompanyList); $reshook = $hookmanager->executeHooks('printMultiCompanyEntities', $parameters); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { $multicompanyList .= $hookmanager->resPrint; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 97f21ccb533..db8b2f6c8e6 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1172,6 +1172,7 @@ if (empty($reshook)) { $TTotalByTva[$line->tva_tx] += $line->total_ttc; } + $amount_ttc_diff = 0.; foreach ($TTotalByTva as $tva => &$total) { $coef = $total / $srcobject->total_ttc; // Calc coef $am = $amount * $coef; diff --git a/htdocs/intracommreport/list.php b/htdocs/intracommreport/list.php index 3611ae2c51e..132163b1f89 100644 --- a/htdocs/intracommreport/list.php +++ b/htdocs/intracommreport/list.php @@ -113,20 +113,20 @@ else $result=restrictedArea($user, 'produit|service', '', '', '', '', '', $objca // List of fields to search into when doing a "search in all" $fieldstosearchall = array( - 'i.ref'=>"Ref", - 'pfi.ref_fourn'=>"RefSupplier", - 'i.label'=>"ProductLabel", - 'i.description'=>"Description", - "i.note"=>"Note", + 'i.ref' => "Ref", + 'pfi.ref_fourn' => "RefSupplier", + 'i.label' => "ProductLabel", + 'i.description' => "Description", + "i.note" => "Note", ); $isInEEC = isInEEC($mysoc); // Definition of fields for lists $arrayfields = array( - 'i.ref' => array('label'=>$langs->trans("Ref"), 'checked'=>1), - 'i.label' => array('label'=>$langs->trans("Label"), 'checked'=>1), - 'i.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(isModEnabled("product") && isModEnabled("service"))), + 'i.ref' => array('label' => $langs->trans("Ref"), 'checked' => 1), + 'i.label' => array('label' => $langs->trans("Label"), 'checked' => 1), + 'i.fk_product_type' => array('label' => $langs->trans("Type"), 'checked' => 0, 'enabled' => (isModEnabled("product") && isModEnabled("service"))), ); /* @@ -360,7 +360,7 @@ $param .= $hookmanager->resPrint; // List of mass actions available $arrayofmassactions = array( - 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + 'generate_doc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), //'builddoc'=>$langs->trans("PDFMerge"), //'presend'=>$langs->trans("SendByMail"), ); @@ -415,6 +415,9 @@ if ($search_all) { $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +if (!isset($moreforfilter)) { + $moreforfilter = ''; +} if (empty($reshook)) { $moreforfilter .= $hookmanager->resPrint; } else { @@ -470,7 +473,7 @@ if (!empty($arrayfields['customerorsupplier']['checked'])) { if (!empty($arrayfields['i.fk_product_type']['checked'])) { print ''; - $array = array('-1'=>' ', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service')); + $array = array('-1' => ' ', '0' => $langs->trans('Product'), '1' => $langs->trans('Service')); print $form->selectarray('search_type', $array, $search_type); print ''; } @@ -480,7 +483,7 @@ if (!empty($arrayfields['i.fk_product_type']['checked'])) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; */ // Fields from hook -$parameters = array('arrayfields'=>$arrayfields); +$parameters = array('arrayfields' => $arrayfields); $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -532,7 +535,7 @@ if (!empty($arrayfields['i.fk_product_type']['checked'])) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; */ // Hook fields -$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); +$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['i.datec']['checked'])) { diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index 3eca1f0e68f..ff15655c5ff 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -38,6 +38,7 @@ $_SESSION["formatsondage"] = "D"; $erreur = false; $erreurNbchoice = 0; +$choixdate = ''; /* * Actions @@ -178,7 +179,7 @@ if (GETPOST('confirmation')) { // Add survey into database if (!$erreur && $erreurNb == 0) { - $_SESSION["toutchoix"] = substr("$choixdate", 1); + $_SESSION["toutchoix"] = substr($choixdate, 1); unset($_SESSION["nbrecaseshoraires"]); ajouter_sondage(); diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 327b8e7988e..ccbda2e2e62 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -862,6 +862,7 @@ $savnbfield = $totalarray['nbfield']; $totalarray = array(); $totalarray['nbfield'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); +$textlate = ''; while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); if (empty($obj)) { diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index 7d5df469aac..60c91239254 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -59,6 +59,7 @@ $langs->loadLangs(array("other", "dict", "bills", "companies", "errors", "paybox // Security check // No check on module enabled. Done later according to $validpaymentmethod +$errmsg = ''; $action = GETPOST('action', 'aZ09'); $id = GETPOSTINT('id'); $securekeyreceived = GETPOST("securekey", 'alpha'); diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index c436a2ead90..90b56165cc2 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -66,6 +66,7 @@ $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", // Security check // No check on module enabled. Done later according to $validpaymentmethod +$errmsg = ''; $action = GETPOST('action', 'aZ09'); $id = GETPOST('id'); $securekeyreceived = GETPOST("securekey"); @@ -172,7 +173,7 @@ if (strlen($idvote)) { // Has not already voted $conforbooth = new ActionComm($db); $resultconforbooth = $conforbooth->fetch($idvote); - if ($resultconforbooth<=0) { + if ($resultconforbooth <= 0) { $error++; $errmsg .= $conforbooth->error; } else { @@ -188,11 +189,11 @@ if (strlen($idvote)) { } } } - if ($votestatus=="ok") { + if ($votestatus == "ok") { setEventMessage($langs->trans("VoteOk"), 'mesgs'); - } elseif ($votestatus=="ko") { + } elseif ($votestatus == "ko") { setEventMessage($langs->trans("AlreadyVoted"), 'warnings'); - } elseif ($votestatus=="err") { + } elseif ($votestatus == "err") { setEventMessage($langs->trans("VoteError"), 'warnings'); } header("Refresh:0;url=".dol_buildpath('/public/project/viewandvote.php?id='.$id.'&securekey=', 1).$securekeyreceived); diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 71639adc51b..838052dac5b 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -68,27 +68,27 @@ if (empty($usedolheader)) { use_javascript_ajax)) { include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } @@ -201,10 +204,10 @@ if ($filtert) { if ($socid) { $nav .= ''; } -if ($showbirthday) { +if (isset($showbirthday) && $showbirthday) { $nav .= ''; } -if ($pid) { +if (isset($pid) && $pid) { $nav .= ''; } if ($type) { @@ -213,7 +216,7 @@ if ($type) { if ($usergroup) { $nav .= ''; } -$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); +$nav .= $form->selectDate($dateselect ?? '', 'dateselect', 0, 0, 1, '', 1, 0); $nav .= ' '; $nav .= ''; @@ -222,25 +225,25 @@ print_barre_liste('Title of my list', 12, $_SERVER["PHP_SELF"], '', '', '', 'Tex $moreforfilter .= '
'; $moreforfilter .= $langs->trans('This is a select list for a filter A (no combo forced)').': '; -$cate_arbo = array('field1'=>'value1a into the select list A', 'field2'=>'value2a'); +$cate_arbo = array('field1' => 'value1a into the select list A', 'field2' => 'value2a'); $moreforfilter .= $form->selectarray('search_aaa', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 0); // List with no js combo $moreforfilter .= '
'; $moreforfilter .= '
'; $moreforfilter .= $langs->trans('This is a select list for a filter B (auto combo)').': '; -$cate_arbo = array('field1'=>'value1b into the select list B', 'field2'=>'value2b'); +$cate_arbo = array('field1' => 'value1b into the select list B', 'field2' => 'value2b'); $moreforfilter .= $form->selectarray('search_bbb', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', -1); // List with js combo auto $moreforfilter .= '
'; $moreforfilter .= '
'; $moreforfilter .= $langs->trans('This is a select list for a filter C (combo forced)').': '; -$cate_arbo = array('field1'=>'value1c into the select list C', 'field2'=>'value2c'); +$cate_arbo = array('field1' => 'value1c into the select list C', 'field2' => 'value2c'); $moreforfilter .= $form->selectarray('search_ccc', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 1); // List with js combo forced $moreforfilter .= '
'; $moreforfilter .= '
'; $moreforfilter .= $langs->trans('This is a select list for a filter D (combo forced)').': '; -$cate_arbo = array('field1'=>'value1d into the select list D', 'field2'=>'value2d'); +$cate_arbo = array('field1' => 'value1d into the select list D', 'field2' => 'value2d'); $moreforfilter .= $form->selectarray('search_ddd', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, '', 'maxwidth300', 1); // List with js combo forced $moreforfilter .= '
'; @@ -328,7 +331,7 @@ $(document).ready(function(){ use_javascript_ajax)) { include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } diff --git a/htdocs/salaries/paiement_salary.php b/htdocs/salaries/paiement_salary.php index 6e5b19c857e..5f3165ed14b 100644 --- a/htdocs/salaries/paiement_salary.php +++ b/htdocs/salaries/paiement_salary.php @@ -264,6 +264,7 @@ if ($action == 'create') { print "\n"; $total = 0; + $total_ttc = 0.; $totalrecu = 0; while ($i < $num) { diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index a1d1f03cb54..f9d7e96cb4f 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -567,6 +567,7 @@ if (empty($reshook)) { echo ""; if ($nbofsuggested > 0) { + $quantityToBeDelivered = 0; echo "
".$langs->trans("SearchIntoBatch").": $nbofsuggested

"; foreach ($prod->stock_warehouse[getDolGlobalString($constantforkey)]->detail_batch as $dbatch) { // $dbatch is instance of Productbatch $batchStock = + $dbatch->qty; // To get a numeric @@ -1604,6 +1605,7 @@ if (!empty($_SESSION["basiclayout"]) && $_SESSION["basiclayout"] == 1) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $categorie = new Categorie($db); $categories = $categorie->get_full_arbo('product'); + $htmlforlines = ''; foreach ($categories as $row) { if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { $htmlforlines .= '