diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 1d05ced1d52..f94fa243ad0 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -9,20 +9,20 @@ */ return [ // # Issue statistics: - // PhanPluginUnknownPropertyType : 1560+ occurrences - // PhanPossiblyUndeclaredGlobalVariable : 1090+ occurrences + // PhanPluginUnknownPropertyType : 1550+ occurrences + // PhanPossiblyUndeclaredGlobalVariable : 1070+ occurrences // PhanTypeMismatchArgumentProbablyReal : 1000+ occurrences - // PhanUndeclaredProperty : 770+ occurrences + // PhanUndeclaredProperty : 750+ occurrences // PhanUndeclaredGlobalVariable : 690+ occurrences - // PhanPluginUnknownObjectMethodCall : 540+ occurrences + // PhanPluginUnknownObjectMethodCall : 520+ occurrences // PhanPluginUnknownArrayMethodReturnType : 480+ occurrences - // PhanPluginUnknownArrayMethodParamType : 430+ occurrences + // PhanPluginUnknownArrayMethodParamType : 420+ occurrences // PhanPossiblyUndeclaredVariable : 350+ occurrences // PhanPluginUnknownArrayFunctionReturnType : 230+ occurrences // PhanTypeMismatchProperty : 210+ occurrences // PhanPluginUnknownArrayFunctionParamType : 170+ occurrences - // PhanTypeExpectedObjectPropAccess : 150+ occurrences // PhanTypeMismatchArgumentNullableInternal : 120+ occurrences + // PhanTypeExpectedObjectPropAccess : 85+ occurrences // PhanPluginUnknownArrayPropertyType : 80+ occurrences // PhanPluginUndeclaredVariableIsset : 70+ occurrences // PhanPluginEmptyStatementIf : 65+ occurrences @@ -376,7 +376,6 @@ return [ 'htdocs/core/class/cgenericdic.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'], 'htdocs/core/class/commondocgenerator.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredProperty'], 'htdocs/core/class/commonhookactions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType'], - 'htdocs/core/class/commonincoterm.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredProperty'], 'htdocs/core/class/commoninvoice.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/class/commonobject.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'], 'htdocs/core/class/commonobjectline.class.php' => ['PhanPluginUnknownPropertyType'], @@ -568,7 +567,7 @@ return [ 'htdocs/core/modules/mrp/doc/pdf_vinci.modules.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/mrp/mod_mo_advanced.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/core/modules/oauth/github_oauthcallback.php' => ['PhanUndeclaredGlobalVariable'], - 'htdocs/core/modules/oauth/stripelive_oauthcallback.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'], + 'htdocs/core/modules/oauth/stripelive_oauthcallback.php' => ['PhanPluginUnknownObjectMethodCall'], 'htdocs/core/modules/oauth/stripetest_oauthcallback.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'], 'htdocs/core/modules/printing/modules_printing.php' => ['PhanPluginUnknownArrayMethodReturnType'], 'htdocs/core/modules/printing/printgcp.modules.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'], @@ -1079,12 +1078,12 @@ return [ 'htdocs/societe/website.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/stripe/admin/stripe.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/stripe/ajax/ajax.php' => ['PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/stripe/charge.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/stripe/charge.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/stripe/class/actions_stripe.class.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginSuspiciousParamPosition', 'PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/stripe/class/stripe.class.php' => ['PhanPluginConstantVariableNull', 'PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/stripe/lib/stripe.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], - 'htdocs/stripe/payout.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/stripe/transaction.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/stripe/payout.php' => ['PhanTypeMismatchArgumentProbablyReal'], + 'htdocs/stripe/transaction.php' => ['PhanTypeMismatchArgumentProbablyReal'], 'htdocs/supplier_proposal/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'], 'htdocs/supplier_proposal/class/api_supplier_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'], 'htdocs/supplier_proposal/class/supplier_proposal.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], @@ -1178,7 +1177,7 @@ return [ 'htdocs/webservices/server_thirdparty.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'], 'htdocs/webservices/server_user.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'], 'htdocs/website/class/website.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredVariable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal'], - 'htdocs/website/class/websitepage.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'], + 'htdocs/website/class/websitepage.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/website/index.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'], 'htdocs/website/lib/websiteaccount.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'], 'htdocs/website/samples/wrapper.php' => ['PhanTypeMismatchArgumentProbablyReal'], diff --git a/htdocs/asset/model/list.php b/htdocs/asset/model/list.php index 8d1644e0e9a..f4681c88bd2 100644 --- a/htdocs/asset/model/list.php +++ b/htdocs/asset/model/list.php @@ -2,6 +2,7 @@ /* Copyright (C) 2007-2017 Laurent Destailleur * Copyright (C) 2018-2024 Alexandre Spangaro * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -108,11 +109,11 @@ foreach ($object->fields as $key => $val) { if (!empty($val['visible'])) { $visible = (int) dol_eval((string) $val['visible'], 1); $arrayfields['t.'.$key] = array( - 'label'=>$val['label'], - 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>(abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), - 'position'=>$val['position'], - 'help'=> isset($val['help']) ? $val['help'] : '' + 'label' => $val['label'], + 'checked' => (($visible < 0) ? 0 : 1), + 'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)), + 'position' => $val['position'], + 'help' => isset($val['help']) ? $val['help'] : '' ); } } @@ -418,7 +419,7 @@ print ''; print ''; $newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/asset/model/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); +$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/asset/model/card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', (int) $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -504,7 +505,7 @@ foreach ($object->fields as $key => $val) { 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); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -536,7 +537,7 @@ foreach ($object->fields as $key => $val) { // Extra fields 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, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -620,7 +621,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column @@ -659,7 +660,7 @@ if ($num == 0) { $db->free($resql); -$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 35091f7ad57..84e6ff85648 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -737,7 +737,7 @@ $url = DOL_URL_ROOT.'/comm/action/card.php?action=create'; $url .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes']; $url .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : '')); -$newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')); +$newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', (int) ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create'))); $param .= '&mode='.urlencode($mode); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 49134c3c723..f67b8e8ddea 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1405,7 +1405,7 @@ $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); -$newcardbutton .= dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', ($contextpage == 'orderlist' || $contextpage == 'billableorders') && $permissiontoadd); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', (int) (($contextpage == 'orderlist' || $contextpage == 'billableorders') && $permissiontoadd)); // Lines of title fields print '
'."\n"; @@ -2354,7 +2354,7 @@ while ($i < $imaxinloop) { if (empty($typenArray)) { $typenArray = $formcompany->typent_array(1); } - print $typenArray[$obj->typent_code]??''; + print $typenArray[$obj->typent_code] ?? ''; print ''; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index e0d4e467920..85953cbda95 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -74,6 +74,9 @@ if ($socid && $socid != $object->thirdparty->id) { accessforbidden(); } +$stripecu = null; +$stripeacc = null; + // Init Stripe objects if (isModEnabled('stripe')) { require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 1f3cee6d87b..23321b117e7 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -331,7 +331,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO $sendtobcc .= (getDolGlobalString($autocopy) ? (($sendtobcc ? ", " : "") . getDolGlobalString($autocopy)) : ''); } - $deliveryreceipt = GETPOST('deliveryreceipt'); + $deliveryreceipt = GETPOSTINT('deliveryreceipt') ? 1 : 0; if ($action == 'send' || $action == 'relance') { $actionmsg2 = $langs->transnoentities('MailSentByTo', CMailFile::getValidAddress($from, 4, 0, 1), CMailFile::getValidAddress($sendto, 4, 0, 1)); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 658c1b05942..ab8b500e38b 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -536,6 +536,7 @@ abstract class CommonDocGenerator if ($object->element == 'facture') { /** @var Facture $object */ + '@phan-var-force Facture $object'; $invoice_source = new Facture($this->db); if ($object->fk_facture_source > 0) { $invoice_source->fetch($object->fk_facture_source); @@ -546,10 +547,10 @@ abstract class CommonDocGenerator $already_payed_all = $sumpayed + $sumdeposit + $sumcreditnote; } + // Ignore notice for deprecated date - @phan-suppress-next-line PhanUndeclaredProperty $date = (isset($object->element) && $object->element == 'contrat' && isset($object->date_contrat)) ? $object->date_contrat : (isset($object->date) ? $object->date : null); - if (get_class($object) == 'CommandeFournisseur') { - /** @var CommandeFournisseur $object*/ + if ($object instanceof CommandeFournisseur) { $object->date_validation = $object->date_valid; $object->date_commande = $object->date; } diff --git a/htdocs/core/class/commonincoterm.class.php b/htdocs/core/class/commonincoterm.class.php index 3b1d820e58b..35aad528570 100644 --- a/htdocs/core/class/commonincoterm.class.php +++ b/htdocs/core/class/commonincoterm.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * 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 @@ -23,7 +24,15 @@ /** - * Superclass for incoterm classes + * Trait for incoterm classes + * + * Properties expected on the host class: + * + * @property DoliDB $db + * @property int $id + * @property string[] $errors + * @property string $table_element + * */ trait CommonIncoterm { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0d28261d4c7..f3a988717bc 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3366,7 +3366,7 @@ abstract class CommonObject * Get children of line * * @param int $id Id of parent line - * @param int<0,1> $includealltree 0 = 1st level child, 1 = All level child + * @param int<0,1001> $includealltree 0 = 1st level child, 1 = All level child, 2-1001: internal use * @return int[] Array with list of children lines id */ public function getChildrenOfLine($id, $includealltree = 0) diff --git a/htdocs/core/class/commonpeople.class.php b/htdocs/core/class/commonpeople.class.php index e8a48b36926..c9d7dba4cb9 100644 --- a/htdocs/core/class/commonpeople.class.php +++ b/htdocs/core/class/commonpeople.class.php @@ -27,7 +27,7 @@ * Support class for third parties, contacts, members, users or resources * * - * Properties expected in the class the trait is attached to. + * Properties expected in the host class receiving this trait. * * @property int $id * @property int $contact_id @@ -110,6 +110,7 @@ trait CommonPeople $lastname = $this->lastname; $firstname = $this->firstname; if (empty($lastname)) { + // societe is deprecated - @suppress-next-line PhanUndeclaredProperty $lastname = (isset($this->lastname) ? $this->lastname : (isset($this->name) ? $this->name : (property_exists($this, 'nom') && isset($this->nom) ? $this->nom : (property_exists($this, 'societe') && isset($this->societe) ? $this->societe : (property_exists($this, 'company') && isset($this->company) ? $this->company : ''))))); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 645d527708b..a26fa443496 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4022,7 +4022,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor if ($hookmanager) { $parameters = array( - 'value'=> $value, + 'value' => $value, 'cid' => $cid, 'socid' => $socid, 'type' => $type, @@ -10094,7 +10094,7 @@ function dol_htmloutput_errors($mesgstring = '', $mesgarray = array(), $keepembe * @param array $array Array to sort (array of array('key1'=>val1,'key2'=>val2,'key3'...) or array of objects) * @param string $index Key in array to use for sorting criteria * @param string $order Sort order ('asc' or 'desc') - * @param int<0,1> $natsort If values are strings (I said value not type): 0=Use alphabetical order, 1=use "natural" sort (natsort) + * @param int<-1,1> $natsort If values are strings (I said value not type): 0=Use alphabetical order, 1=use "natural" sort (natsort), -1=Force alpha order * If values are numeric (I said value not type): 0=Use numeric order (even if type is string) so use a "natural" sort, 1=use "natural" sort too (same than 0), -1=Force alphabetical order * @param int<0,1> $case_sensitive 1=sort is case sensitive, 0=not case sensitive * @param int<0,1> $keepindex If 0 and index key of array to sort is a numeric, then index will be rewritten. If 1 or index key is not numeric, key for index is kept after sorting. diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index de9942c6bc3..72161f32e5e 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -838,7 +838,7 @@ function dolObfuscateEmail($mail, $replace = "*", $nbreplace = 8, $nbdisplaymail * Return lines of an html table from an array * Used by array2table function only * - * @param array $data Array of data + * @param array $data Array of data * @param string $troptions Options for tr * @param string $tdoptions Options for td * @return string @@ -847,7 +847,7 @@ function array2tr($data, $troptions = '', $tdoptions = '') { $text = ''; foreach ($data as $key => $item) { - $text .= ''.$item.''; + $text .= ''.((string) $item).''; } $text .= ''; return $text; @@ -856,7 +856,7 @@ function array2tr($data, $troptions = '', $tdoptions = '') /** * Return an html table from an array * - * @param array $data Array of data + * @param array $data Array of data * @param int $tableMarkup Table markup * @param string $tableoptions Options for table * @param string $troptions Options for tr @@ -874,8 +874,8 @@ function array2table($data, $tableMarkup = 1, $tableoptions = '', $troptions = ' $text .= array2tr($item, $troptions, $tdoptions); } else { $text .= ''; - $text .= ''.$key.''; - $text .= ''.$item.''; + $text .= ''.((string) $key).''; + $text .= ''.((string) $item).''; $text .= ''; } } @@ -1406,7 +1406,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ $maskrefclient_maskbefore = '{'.$maskrefclient.'}'; $maskrefclient_maskafter = $maskrefclient_clientcode; if (dol_strlen($maskrefclient_maskcounter) > 0) { - $maskrefclient_maskafter .= str_pad($maskrefclient_counter, dol_strlen($maskrefclient_maskcounter), "0", STR_PAD_LEFT); + $maskrefclient_maskafter .= str_pad((string) $maskrefclient_counter, dol_strlen($maskrefclient_maskcounter), "0", STR_PAD_LEFT); } $numFinal = str_replace($maskrefclient_maskbefore, $maskrefclient_maskafter, $numFinal); } diff --git a/htdocs/core/modules/oauth/stripelive_oauthcallback.php b/htdocs/core/modules/oauth/stripelive_oauthcallback.php index 6de062f2dfa..6184fb8d0c3 100644 --- a/htdocs/core/modules/oauth/stripelive_oauthcallback.php +++ b/htdocs/core/modules/oauth/stripelive_oauthcallback.php @@ -1,6 +1,7 @@ * Copyright (C) 2019 Thibault FOUCART + * Copyright (C) 2024 MDW * * 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 @@ -86,6 +87,8 @@ if (GETPOST('state')) { }*/ //var_dump($requestedpermissionsarray);exit; +$apiService = null; +$state = null; // Instantiate the Api service using the credentials, http client and storage mechanism for the token //$apiService = $serviceFactory->createService('StripeTest', $credentials, $storage, $requestedpermissionsarray); @@ -131,23 +134,27 @@ if (GETPOST('code')) { // We are coming from oauth provider page dol_syslog("We are coming from the oauth provider page code=".dol_trunc(GETPOST('code'), 5)); // This was a callback request from service, get the token - try { - //var_dump($state); - //var_dump($apiService); // OAuth\OAuth2\Service\Stripe + if ($apiService === null) { + dol_syslog("No API Service", LOG_ERR); + } else { + try { + //var_dump($state); + //var_dump($apiService); // OAuth\OAuth2\Service\Stripe - //$token = $apiService->requestAccessToken(GETPOST('code'), $state); - $token = $apiService->requestAccessToken(GETPOST('code')); - // Stripe is a service that does not need state to be stored as second parameter of requestAccessToken + //$token = $apiService->requestAccessToken(GETPOST('code'), $state); + $token = $apiService->requestAccessToken(GETPOST('code')); + // Stripe is a service that does not need state to be stored as second parameter of requestAccessToken - setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token + setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token - $backtourl = $_SESSION["backtourlsavedbeforeoauthjump"]; - unset($_SESSION["backtourlsavedbeforeoauthjump"]); + $backtourl = $_SESSION["backtourlsavedbeforeoauthjump"]; + unset($_SESSION["backtourlsavedbeforeoauthjump"]); - header('Location: '.$backtourl); - exit(); - } catch (Exception $e) { - print $e->getMessage(); + header('Location: '.$backtourl); + exit(); + } catch (Exception $e) { + print $e->getMessage(); + } } } else { // If entry on page with no parameter, we arrive here $_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl; @@ -157,7 +164,11 @@ if (GETPOST('code')) { // We are coming from oauth provider page // This may create record into oauth_state before the header redirect. // Creation of record with state in this tables depend on the Provider used (see its constructor). if (GETPOST('state')) { - $url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state'))); + if ($apiService === null) { + dol_syslog("No API Service", LOG_ERR); + } else { + $url = $apiService->getAuthorizationUri(array('state' => GETPOST('state'))); + } } else { //$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated //https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 166ce8d95fe..940fb8ff905 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -708,7 +708,7 @@ class EcmDirectory extends CommonObject $this->buildPathFromId($key, 0); } - $this->cats = dol_sort_array($this->cats, 'fulllabel', 'asc', true, false); + $this->cats = dol_sort_array($this->cats, 'fulllabel', 'asc', 1, 0); $this->full_arbo_loaded = 1; return $this->cats; diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 8d37b0bd7d7..003cbf6effb 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -467,7 +467,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i', $act $htmltooltip = $langs->trans("ECMAreaDesc2"); $htmltooltip .= '
'.$langs->trans("ECMAreaDesc2b"); - $sectionauto = dol_sort_array($sectionauto, 'label', 'ASC', true, false); + $sectionauto = dol_sort_array($sectionauto, 'label', 'ASC', 1, 0); print ''; print ''; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 36ab9ea3f41..4d98b7841f0 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1246,7 +1246,7 @@ if ($resql) { $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); - $newcardbutton .= dolGetButtonTitle($langs->trans('NewSupplierOrderShort'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd); + $newcardbutton .= dolGetButtonTitle($langs->trans('NewSupplierOrderShort'), '', 'fa fa-plus-circle', $url, '', (int) $permissiontoadd); // Lines of title fields print ''; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index d96a15c0539..ac1c5148198 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -961,7 +961,7 @@ $param .= $hookmanager->resPrint; $arrayofmassactions = array( 'validate' => img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"), 'generate_doc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), - 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), + 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); @@ -1002,7 +1002,7 @@ $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); -$newcardbutton .= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer"))); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', (int) ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer"))); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_invoice', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -1515,8 +1515,8 @@ $totalarray['val']['f.total_vat'] = 0; $totalarray['val']['f.total_localtax1'] = 0; $totalarray['val']['f.total_localtax1'] = 0; $totalarray['val']['f.total_ttc'] = 0; -$totalarray['val']['totalam']=0; -$totalarray['val']['rtp']=0; +$totalarray['val']['totalam'] = 0; +$totalarray['val']['rtp'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 4ece09e079a..d34825a3757 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -5,6 +5,7 @@ * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2024 MDW * * 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 @@ -263,7 +264,7 @@ if ($optioncss != '') { $param = "&sref=".$sref."&snom=".$snom."&fourn_id=".$fourn_id.(isset($type) ? "&type=".$type : "").(empty($sRefSupplier) ? "" : "&srefsupplier=".$sRefSupplier); $newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/list.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); +$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/list.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', (int) $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, $newcardbutton); diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 342fb0720aa..e00c788484a 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -1483,7 +1483,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $parameters = array('morecss' => 'reposition'); if ($action != 'consumeorproduce' && $action != 'consumeandproduceall') { if ($nblinetoproduce == 0 || $object->mrptype == 1) { - $newcardbutton = dolGetButtonTitle($langs->trans('AddNewProduceLines'), '', 'fa fa-plus-circle size15x', $url, '', $permissiontoaddaproductline, $parameters); + $newcardbutton = dolGetButtonTitle($langs->trans('AddNewProduceLines'), '', 'fa fa-plus-circle size15x', $url, '', (int) $permissiontoaddaproductline, $parameters); } } diff --git a/htdocs/product/admin/price_rules.php b/htdocs/product/admin/price_rules.php index 87a33052cbb..c0754083e1e 100644 --- a/htdocs/product/admin/price_rules.php +++ b/htdocs/product/admin/price_rules.php @@ -1,6 +1,7 @@ * * 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 @@ -160,21 +161,21 @@ for ($i = 1; $i <= $produit_multiprices_limit; $i++) { trans('SellingPrice') ?> 1 - trans('PercentDiscountOver', $langs->trans('SellingPrice').' 1') ?> + trans('PercentDiscountOver', $langs->trans('SellingPrice').' 1') ?> trans('SellingPrice').' '.$i; - // Label of price - $keyforlabel = 'PRODUIT_MULTIPRICES_LABEL'.$i; + // Label of price + $keyforlabel = 'PRODUIT_MULTIPRICES_LABEL'.$i; if (getDolGlobalString($keyforlabel)) { print ' - '.$langs->trans(getDolGlobalString($keyforlabel)); } ?> - + - + trans('PercentDiscountOver', $langs->transnoentitiesnoconv('SellingPrice').' '.$i) ?> diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index 2ba9198484d..221ee22568f 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -6,6 +6,7 @@ * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2015 Marcos García + * Copyright (C) 2024 MDW * * 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 @@ -82,7 +83,7 @@ if ($id > 0 || !empty($ref)) { } // Security check -$socid =0; +$socid = 0; if ($user->socid) { $socid = $user->socid; } @@ -206,7 +207,7 @@ if (isModEnabled('agenda')) { } $linktocreatetimeBtnStatus = $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create'); - $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', $linktocreatetimeBtnStatus); + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', (int) $linktocreatetimeBtnStatus); } diff --git a/htdocs/product/messaging.php b/htdocs/product/messaging.php index 73470d4801c..c7f5e848289 100644 --- a/htdocs/product/messaging.php +++ b/htdocs/product/messaging.php @@ -6,6 +6,7 @@ * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2015 Marcos García + * Copyright (C) 2024 MDW * * 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 @@ -82,7 +83,7 @@ if ($id > 0 || !empty($ref)) { $hookmanager->initHooks(array('agendathirdparty', 'globalcard')); // Security check -$socid =0; +$socid = 0; if ($user->socid) { $socid = $user->socid; } @@ -148,7 +149,7 @@ llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-product page-messagi if (isModEnabled('notification')) { $langs->load("mails"); } - $type = $langs->trans('Product'); +$type = $langs->trans('Product'); if ($object->isService()) { $type = $langs->trans('Service'); } @@ -224,7 +225,7 @@ if (isModEnabled('agenda')) { } $linktocreatetimeBtnStatus = $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create'); - $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', $linktocreatetimeBtnStatus); + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', (int) $linktocreatetimeBtnStatus); } if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) { diff --git a/htdocs/projet/agenda.php b/htdocs/projet/agenda.php index 97e87e0ca30..f3be10dfb26 100644 --- a/htdocs/projet/agenda.php +++ b/htdocs/projet/agenda.php @@ -206,7 +206,7 @@ if (!empty($object->id)) { // Show link to add event if (isModEnabled('agenda')) { $addActionBtnRight = $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create'); - $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight); + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', (int) $addActionBtnRight); } $param = '&id='.$object->id; diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 09c6db42f3b..4438e2d860c 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -252,7 +252,7 @@ if ($user->hasRight('projet', 'all', 'creer') || $user->hasRight('projet', 'cree } } -$linktocreatetask = dolGetButtonTitle($langs->trans('AddTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id.'&action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id), '', $linktocreatetaskUserRight, $linktocreatetaskParam); +$linktocreatetask = dolGetButtonTitle($langs->trans('AddTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id.'&action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id), '', (int) $linktocreatetaskUserRight, $linktocreatetaskParam); $linktotasks = dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id, '', 1, array('morecss' => 'reposition')); $linktotasks .= dolGetButtonTitle($langs->trans('ViewGantt'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/projet/ganttview.php?id='.$object->id.'&withproject=1', '', 1, array('morecss' => 'reposition marginleftonly btnTitleSelected')); diff --git a/htdocs/projet/messaging.php b/htdocs/projet/messaging.php index 50c42c927c2..30bc60584f6 100644 --- a/htdocs/projet/messaging.php +++ b/htdocs/projet/messaging.php @@ -206,7 +206,7 @@ if (!empty($object->id)) { // Show link to add event if (isModEnabled('agenda')) { $addActionBtnRight = $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create'); - $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $addActionBtnRight); + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'&socid='.$object->socid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', (int) $addActionBtnRight); } $param = '&id='.$object->id; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 7709a3801b2..edfd2d2114a 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -150,7 +150,7 @@ $diroutputmassaction = $conf->project->dir_output.'/tasks/temp/massgeneration/'. $progress = GETPOSTINT('progress'); $budget_amount = GETPOSTFLOAT('budget_amount'); -$billable = (GETPOST('billable', 'aZ') == 'yes'? 1 : 0); +$billable = (GETPOST('billable', 'aZ') == 'yes' ? 1 : 0); $label = GETPOST('label', 'alpha'); $description = GETPOST('description', 'restricthtml'); $planned_workloadhour = (GETPOSTISSET('planned_workloadhour') ? GETPOSTINT('planned_workloadhour') : ''); @@ -893,7 +893,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object- } } - $linktocreatetask = dolGetButtonTitle($langs->trans('AddTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id), '', $linktocreatetaskUserRight, $linktocreatetaskParam); + $linktocreatetask = dolGetButtonTitle($langs->trans('AddTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id), '', (int) $linktocreatetaskUserRight, $linktocreatetaskParam); print ''; print ''; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 6df062c0619..9453d4f4940 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -492,6 +492,8 @@ if ($action == 'dopayment') { // Test on permission not required here (anonymous // When using the old Charge API architecture, this code is called after clicking the 'dopayment' with the Charge API architecture. // When using the PaymentIntent API architecture, the Stripe customer was already created when creating PaymentIntent when showing payment page, and the payment is already ok when action=charge. if ($action == 'charge' && isModEnabled('stripe')) { // Test on permission not required here (anonymous action protected by mitigation of /public/... urls) + $stripecu = null; + $amountstripe = (float) $amount; // Correct the amount according to unit of currency @@ -2328,7 +2330,6 @@ if (preg_match('/^dopayment/', $action)) { // If we chose/clicked on the payme $stripe = new Stripe($db); $stripeacc = $stripe->getStripeAccount($service); - $stripecu = null; if (is_object($object) && is_object($object->thirdparty)) { $stripecu = $stripe->customerStripe($object->thirdparty, $stripeacc, $servicestatus, 1); } diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 39a4b54c8dc..723c23b77d4 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -90,6 +90,9 @@ $permissiontoaddupdatepaymentinformation = ((!getDolGlobalString('MAIN_USE_ADVAN // Check permission on company $result = restrictedArea($user, 'societe', '', ''); +$stripe = null; // Stripe object +$stripeacc = null; // Stripe Account +$stripecu = null; // Remote stripe customer // Init Stripe objects if (isModEnabled('stripe')) { @@ -138,11 +141,11 @@ if (empty($reshook)) { if ($action == 'update' && $permissiontoaddupdatepaymentinformation) { // Update the bank account - if (!GETPOST('label', 'alpha') || !(GETPOST('bank', 'alpha') || (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')!=0))) { + if (!GETPOST('label', 'alpha') || !(GETPOST('bank', 'alpha') || (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') != 0))) { if (!GETPOST('label', 'alpha')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); } - if (!GETPOST('bank', 'alpha') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0)) { + if (!GETPOST('bank', 'alpha') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors'); } $action = 'edit'; @@ -155,7 +158,7 @@ if (empty($reshook)) { $action = 'edit'; $error++; } - if (!GETPOST('bic') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0)) { + if (!GETPOST('bic') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors'); $action = 'edit'; $error++; @@ -338,7 +341,7 @@ if (empty($reshook)) { $action = 'create'; $error++; } - if (!GETPOST('bic') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0)) { + if (!GETPOST('bic') && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors'); $action = 'create'; $error++; @@ -1974,7 +1977,7 @@ if ($socid && $action == 'edit' && $permissiontoaddupdatepaymentinformation) { print ''.$langs->trans("Label").''; print ''; - $required = (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0) ? "fieldrequired" : ""; + $required = (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0) ? "fieldrequired" : ""; print ''.$langs->trans("BankName").''; print ''; @@ -2012,7 +2015,7 @@ if ($socid && $action == 'edit' && $permissiontoaddupdatepaymentinformation) { $name = 'bic'; $size = 12; $content = $bankaccount->bic; - if ($bankaccount->needIBAN() && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0)) { + if ($bankaccount->needIBAN() && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0)) { $require = true; } $tooltip = $langs->trans("Example").': LIABLT2XXXX'; @@ -2184,7 +2187,7 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) { $name = 'bic'; $size = 12; $content = $companybankaccount->bic; - if ($companybankaccount->needIBAN() && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC')==0)) { + if ($companybankaccount->needIBAN() && (getDolGlobalInt('WITHDRAWAL_WITHOUT_BIC') == 0)) { $require = true; } $tooltip = $langs->trans("Example").': LIABLT2XXXX'; diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 947fccafdb3..0354b0b1f87 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -1,6 +1,7 @@ * Copyright (C) 2019 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -132,6 +133,7 @@ if (!$rowid) { $list = \Stripe\Charge::all($option); } + '@phan-var-force \Stripe\Charge $list'; // TStripeObject suggested, but is a template $num = count($list->data); @@ -149,6 +151,7 @@ if (!$rowid) { $i = 0; if (!empty($list)) { foreach ($list->data as $charge) { + '@phan-var-force \Stripe\Charge $charge'; // TStripeObject suggested, but is a template if ($i >= $limit) { break; } diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index e93609d8882..5eb73ac74eb 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -1362,6 +1362,7 @@ class Stripe extends CommonObject $charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$description", "stripe_account" => "$account")); } } + '@phan-var-force stdclass|\Stripe\Charge $charge'; if (isset($charge->id)) { } diff --git a/htdocs/stripe/payout.php b/htdocs/stripe/payout.php index 0abc7a5063d..eb64a0c0431 100644 --- a/htdocs/stripe/payout.php +++ b/htdocs/stripe/payout.php @@ -1,6 +1,7 @@ * Copyright (C) 2019 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -120,12 +121,14 @@ if (!$rowid) { try { if ($stripeacc) { - $payout = \Stripe\Payout::all(array("limit" => $limit), array("stripe_account" => $stripeacc)); + $payout_all = \Stripe\Payout::all(array("limit" => $limit), array("stripe_account" => $stripeacc)); } else { - $payout = \Stripe\Payout::all(array("limit" => $limit)); + $payout_all = \Stripe\Payout::all(array("limit" => $limit)); } + '@phan-var-force \Stripe\Payout $payout_all'; // TStripeObject suggested, but is a template - foreach ($payout->data as $payout) { + foreach ($payout_all->data as $payout) { + '@phan-var-force \Stripe\Payout $payout'; // TStripeObject suggested, but is a template print ''; // Ref diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index bdca6980414..7c5b8ddc72f 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -1,6 +1,7 @@ * Copyright (C) 2018-2021 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -117,12 +118,14 @@ if (!$rowid) { try { if ($stripeacc) { - $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit), array("stripe_account" => $stripeacc)); + $txn_all = \Stripe\BalanceTransaction::all(array("limit" => $limit), array("stripe_account" => $stripeacc)); } else { - $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit)); + $txn_all = \Stripe\BalanceTransaction::all(array("limit" => $limit)); } + '@phan-var-force \Stripe\BalanceTransaction $txn_all'; // TStripeObject is 'template' of StripeObject - foreach ($txn->data as $txn) { + foreach ($txn_all->data as $txn) { + '@phan-var-force \Stripe\BalanceTransaction $txn'; // TStripeObject is 'template' of StripeObject //$charge = $txn; //var_dump($txn); diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index b718e830f86..2288727a213 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -83,6 +83,8 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); type != $invoice::TYPE_CREDIT_NOTE) { + */ if (!defined('ISLOADEDBYSTEELSHEET')) { die('Must be call by steelsheet'); } @@ -208,10 +210,10 @@ a.badge-dark:focus, a.badge-dark:hover { + */ if (!defined('ISLOADEDBYSTEELSHEET')) { die('Must be call by steelsheet'); } @@ -211,10 +213,10 @@ a.badge-dark:focus, a.badge-dark:hover { + * Copyright (C) 2024 MDW * * 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 @@ -113,7 +114,7 @@ $permissiontoadd = $user->hasRight('ticket', 'write'); * Actions */ -$parameters = array('id'=>$socid); +$parameters = array('id' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -255,22 +256,22 @@ if (!empty($object->id)) { $messagingUrl = DOL_URL_ROOT.'/ticket/messaging.php?track_id='.$object->track_id; $morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); $messagingUrl = DOL_URL_ROOT.'/ticket/agenda.php?track_id='.$object->track_id; - $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1, array('morecss'=>'btnTitleSelected')); + $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1, array('morecss' => 'btnTitleSelected')); // Show link to send an email (if read and not closed) $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; - $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus); + $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', (int) $btnstatus); // Show link to add a message (if read and not closed) $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; - $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus); + $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', (int) $btnstatus); // Show link to add event (if read and not closed) $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep=now&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); - $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus); + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', (int) $btnstatus); require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; $cachekey = 'count_events_ticket_'.$object->id; diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index a239c3f2bb6..2338f84c075 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -344,7 +344,9 @@ if (empty($reshook)) { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } else $action = $ifErrorAction; + } else { + $action = $ifErrorAction; + } } // Mark as Read @@ -1582,12 +1584,12 @@ if ($action == 'create' || $action == 'presend') { // Show link to add a message (if read and not closed) $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage" && $action != "add_message"; $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init'; - $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus); + $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', (int) $btnstatus); // Show link to add event (if read and not closed) $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage" && $action != "add_message"; $url = dol_buildpath('/comm/action/card.php', 1).'?action=create&datep='.date('YmdHi').'&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id); - $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus); + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', (int) $btnstatus); print_barre_liste($langs->trans("ActionsOnTicket"), 0, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index d2b2d6688cc..32492112f8e 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -1,5 +1,6 @@ + * Copyright (C) 2024 MDW * * 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 @@ -111,7 +112,7 @@ $permissiontoadd = $user->hasRight('ticket', 'write'); * Actions */ -$parameters = array('id'=>$socid); +$parameters = array('id' => $socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -250,24 +251,24 @@ if (!empty($object->id)) { $morehtmlright = ''; $messagingUrl = DOL_URL_ROOT.'/ticket/messaging.php?track_id='.$object->track_id; - $morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1, array('morecss'=>'btnTitleSelected')); + $morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1, array('morecss' => 'btnTitleSelected')); $messagingUrl = DOL_URL_ROOT.'/ticket/agenda.php?track_id='.$object->track_id; $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1); // Show link to send an email (if read and not closed) $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&private_message=0&send_email=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; - $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', $btnstatus); + $morehtmlright .= dolGetButtonTitle($langs->trans('SendMail'), '', 'fa fa-paper-plane', $url, 'email-title-button', (int) $btnstatus); // Show link to add a private message (if read and not closed) $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id).'#formmailbeforetitle'; - $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus); + $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', (int) $btnstatus); // Show link to add event (if read and not closed) $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep=now&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?track_id='.$object->track_id); - $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus); + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', (int) $btnstatus); require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; $cachekey = 'count_events_ticket_'.$object->id; diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index 3ccb77503c4..6c191f47da3 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -5,6 +5,7 @@ * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2019-2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -112,7 +113,7 @@ if (($search_status != '' && $search_status >= 0)) { if (($search_employee != '' && $search_employee >= 0)) { $filters[] = "employee = ".((int) $search_employee); } -$sqlfilter= ''; +$sqlfilter = ''; if (!empty($filters)) { $sqlfilter = implode(' AND ', $filters); } @@ -136,7 +137,7 @@ if (!is_array($user_arbo) && $user_arbo < 0) { //var_dump($fulltree); // Define data (format for treeview) $data = array(); - $data[0] = array('rowid'=>0, 'fk_menu'=>-1, 'title'=>"racine", 'mainmenu'=>'', 'leftmenu'=>'', 'fk_mainmenu'=>'', 'fk_leftmenu'=>''); + $data[0] = array('rowid' => 0, 'fk_menu' => -1, 'title' => "racine", 'mainmenu' => '', 'leftmenu' => '', 'fk_mainmenu' => '', 'fk_leftmenu' => ''); foreach ($fulltree as $key => $val) { $userstatic->id = $val['id']; @@ -176,10 +177,10 @@ if (!is_array($user_arbo) && $user_arbo < 0) { $entry = '
'.$li.''.$userstatic->getLibStatut(2).'
'; $data[$val['rowid']] = array( - 'rowid'=>$val['rowid'], - 'fk_menu'=>$val['fk_user'], // TODO Replace fk_menu with fk_parent - 'statut'=>$val['statut'], - 'entry'=>$entry + 'rowid' => $val['rowid'], + 'fk_menu' => $val['fk_user'], // TODO Replace fk_menu with fk_parent + 'statut' => $val['statut'], + 'entry' => $entry ); } @@ -254,10 +255,10 @@ if (!is_array($user_arbo) && $user_arbo < 0) { $li = ''.$langs->trans("WarningParentIDDoesNotExistAnymore").''; $entry = '
'.$li.'
'; $data[-2] = array( - 'rowid'=>'-2', - 'fk_menu'=>null, - 'statut'=>'1', - 'entry'=>$entry + 'rowid' => '-2', + 'fk_menu' => null, + 'statut' => '1', + 'entry' => $entry ); } $parentfound = 1; @@ -273,11 +274,11 @@ if (!is_array($user_arbo) && $user_arbo < 0) { $param = "&contextpage=".urlencode($contextpage); $newcardbutton = ''; - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); - $newcardbutton .= dolGetButtonTitle($langs->trans('HierarchicView'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php?mode=hierarchy'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', (($mode == 'hierarchy') ? 2 : 1), array('morecss'=>'reposition')); - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', DOL_URL_ROOT.'/user/list.php?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss' => 'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('HierarchicView'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php?mode=hierarchy'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', (($mode == 'hierarchy') ? 2 : 1), array('morecss' => 'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', DOL_URL_ROOT.'/user/list.php?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); - $newcardbutton .= dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/card.php?action=create'.($mode == 'employee' ? '&employee=1' : '').'&leftmenu=', '', $permissiontoadd); + $newcardbutton .= dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/card.php?action=create'.($mode == 'employee' ? '&employee=1' : '').'&leftmenu=', '', (int) $permissiontoadd); $massactionbutton = ''; $num = 0; @@ -312,7 +313,7 @@ if (!is_array($user_arbo) && $user_arbo < 0) { print ' '; // Status print ''; - print $form->selectarray('search_status', array('-1'=>'', '0'=>$langs->trans('Disabled'), '1'=>$langs->trans('Enabled')), $search_status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp onrightofpage width100'); + print $form->selectarray('search_status', array('-1' => '', '0' => $langs->trans('Disabled'), '1' => $langs->trans('Enabled')), $search_status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp onrightofpage width100'); print ''; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 668f3d7f621..8ff8ccdcf9a 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -150,8 +150,8 @@ $arrayfields = array( ); if (getDolGlobalInt('MAIN_ENABLE_LOGINS_PRIVACY') == 0) { - $arrayfields['u.datelastlogin'] = array('label'=>"LastConnexion", 'checked'=>1, 'position'=>100); - $arrayfields['u.datepreviouslogin'] = array('label'=>"PreviousConnexion", 'checked'=>0, 'position'=>110); + $arrayfields['u.datelastlogin'] = array('label' => "LastConnexion", 'checked' => 1, 'position' => 100); + $arrayfields['u.datepreviouslogin'] = array('label' => "PreviousConnexion", 'checked' => 0, 'position' => 110); } // Extra fields @@ -679,7 +679,7 @@ $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars p $newcardbutton .= dolGetButtonTitle($langs->trans('HierarchicView'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php?mode=hierarchy'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', (($mode == 'hierarchy') ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss' => 'reposition')); $newcardbutton .= dolGetButtonTitleSeparator(); -$newcardbutton .= dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', $url, '', (int) $permissiontoadd); /*$moreparam = array('morecss'=>'btnTitleSelected'); $morehtmlright = dolGetButtonTitle($langs->trans("List"), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php'.(($search_status != '' && $search_status >= 0) ? '?search_status='.$search_status : ''), '', 1, $moreparam); diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 1c21ab6cdb4..57fe8bcf933 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -5,6 +5,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2016 Abbes Bahfir * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -270,7 +271,7 @@ if ($result > 0) { } $newcardbutton = ''; - $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); + $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', (int) $permissiontoadd); $titlelist = $langs->trans("ListOfActiveNotifications"); diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 61f7c7152e7..42b35c42426 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -84,20 +84,14 @@ parameters: - '#dol_move expects string, int given#' - '#expects int, float#' - '#expects int, array\|string given.#' - - '#expects int<0, 1>#' - - '#expects int<-2, 2>, bool given.#' + - "# (img_picto) expects int<0, 1>, (false|'') given.#" - '#expects float\|string#' - '#expects float\|null#' - '#expects float, string given.#' - '#expects string\|null,#' - '#expects string, \(float\|int\) given.#' - - '#expects string, array#' - - '#expects string, float#' - - '#expects string, true given.#' - - '#expects string, false given.#' - - '#expects string, null given.#' - - '#expects string, int<0, 10> given.#' - - '#expects string, DateTime given.#' + - '#expects string, (float(\|(int|array))(\<.*\>)?)+ given.#' + - '#expects string, (false|true|null|DateTime|float|array(<.*>)?) given.#' - '#expects string, bool\|mysqli_result\|resource given.#' - '#expects array\{#' - '#expects array