Fix warning

This commit is contained in:
Laurent Destailleur
2022-12-31 13:23:09 +01:00
parent 15c05d9b7d
commit e977a95cc7
14 changed files with 31 additions and 29 deletions

View File

@@ -427,7 +427,7 @@ if ($mode == 'overwrite') {
print '   '; print '   ';
print '<input type="submit" class="button buttongen button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">'; print '<input type="submit" class="button buttongen button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
} else { } else {
print '<a class="reposition editfielda paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.urlencode($mode).'&action=edit&token='.newToken().''.((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>'; print '<a class="reposition editfielda paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.urlencode($mode).'&action=edit&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
print ' &nbsp; '; print ' &nbsp; ';
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.urlencode($mode).'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>'; print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.urlencode($mode).'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
} }

View File

@@ -751,7 +751,7 @@ class Form
// If info or help with smartphone, show only text (tooltip on click does not works with dialog on smaprtphone) // If info or help with smartphone, show only text (tooltip on click does not works with dialog on smaprtphone)
//if (!empty($conf->dol_no_mouse_hover) && !empty($tooltiptrigger)) //if (!empty($conf->dol_no_mouse_hover) && !empty($tooltiptrigger))
//{ //{
//if ($type == 'info' || $type == 'help') return '<a href="'..'">'.$text.''</a>'; //if ($type == 'info' || $type == 'help') return '<a href="'..'">'.$text.'</a>';
//} //}
$img = ''; $img = '';
@@ -3041,7 +3041,7 @@ class Form
$sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid. $sql .= " ORDER BY date_price DESC, rowid DESC"; // Warning DESC must be both on date_price and rowid.
$sql .= " LIMIT 1"; $sql .= " LIMIT 1";
dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level.'', LOG_DEBUG); dol_syslog(get_class($this).'::constructProductListOption search price for product '.$objp->rowid.' AND level '.$price_level, LOG_DEBUG);
$result2 = $this->db->query($sql); $result2 = $this->db->query($sql);
if ($result2) { if ($result2) {
$objp2 = $this->db->fetch_object($result2); $objp2 = $this->db->fetch_object($result2);

View File

@@ -1988,7 +1988,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
if (isset($histo[$key]['socpeopleassigned']) && is_array($histo[$key]['socpeopleassigned']) && count($histo[$key]['socpeopleassigned']) > 0) { if (isset($histo[$key]['socpeopleassigned']) && is_array($histo[$key]['socpeopleassigned']) && count($histo[$key]['socpeopleassigned']) > 0) {
$out .= '<td class="valignmiddle">'; $out .= '<td class="valignmiddle">';
$contact = new Contact($db); $contact = new Contact($db);
foreach ($histo[$key]['socpeopleassigned'] as $cid => $value) { foreach ($histo[$key]['socpeopleassigned'] as $cid => $cvalue) {
$result = $contact->fetch($cid); $result = $contact->fetch($cid);
if ($result < 0) { if ($result < 0) {

View File

@@ -128,7 +128,7 @@ function dol_print_cron_urls()
$pathtoscript = $conf->global->MAIN_DOL_SCRIPTS_ROOT; $pathtoscript = $conf->global->MAIN_DOL_SCRIPTS_ROOT;
} }
$file = $pathtoscript.'/scripts/cron/cron_run_jobs.php '.(empty($conf->global->CRON_KEY) ? 'securitykey' : ''.$conf->global->CRON_KEY.'').' '.$logintouse.' [cronjobid]'; $file = $pathtoscript.'/scripts/cron/cron_run_jobs.php '.(empty($conf->global->CRON_KEY) ? 'securitykey' : ''.$conf->global->CRON_KEY).' '.$logintouse.' [cronjobid]';
print '<textarea class="quatrevingtpercent">'.$file."</textarea><br>\n"; print '<textarea class="quatrevingtpercent">'.$file."</textarea><br>\n";
print '<br>'; print '<br>';
@@ -145,7 +145,7 @@ function dol_print_cron_urls()
if ($linuxlike) { if ($linuxlike) {
print $langs->trans("CronExplainHowToRunUnix"); print $langs->trans("CronExplainHowToRunUnix");
print '<br>'; print '<br>';
print '<textarea class="quatrevingtpercent">*/5 * * * * '.$pathtoscript.'/scripts/cron/cron_run_jobs.php '.(empty($conf->global->CRON_KEY) ? 'securitykey' : ''.$conf->global->CRON_KEY.'').' '.$logintouse.' &gt; '.DOL_DATA_ROOT.'/cron_run_jobs.php.log</textarea><br>'; print '<textarea class="quatrevingtpercent">*/5 * * * * '.$pathtoscript.'/scripts/cron/cron_run_jobs.php '.(empty($conf->global->CRON_KEY) ? 'securitykey' : ''.$conf->global->CRON_KEY).' '.$logintouse.' &gt; '.DOL_DATA_ROOT.'/cron_run_jobs.php.log</textarea><br>';
} else { } else {
print $langs->trans("CronExplainHowToRunWin"); print $langs->trans("CronExplainHowToRunWin");
} }

View File

@@ -568,13 +568,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.$withProjectUrl.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle'); print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.$withProjectUrl.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
} }
print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.$withProjectUrl.'&action=edit&token='.newToken().'', '', $permissiontoadd); print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.$withProjectUrl.'&action=edit&token='.newToken(), '', $permissiontoadd);
// Clone // Clone
print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.$withProjectUrl.'&socid='.$object->socid.'&action=clone&token='.newToken().'&object=scrumsprint', '', $permissiontoadd); print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.$withProjectUrl.'&socid='.$object->socid.'&action=clone&token='.newToken().'&object=scrumsprint', '', $permissiontoadd);
// Delete (need delete permission, or if draft, just need create/modify permission) // Delete (need delete permission, or if draft, just need create/modify permission)
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.$withProjectUrl.'&action=delete&token='.newToken().'', '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.$withProjectUrl.'&action=delete&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));
} }
print '</div>'."\n"; print '</div>'."\n";
} }

View File

@@ -1470,7 +1470,7 @@ class Holiday extends CommonObject
$sql .= " value = '".$this->db->escape($value)."'"; $sql .= " value = '".$this->db->escape($value)."'";
$sql .= " WHERE name = '".$this->db->escape($name)."'"; $sql .= " WHERE name = '".$this->db->escape($name)."'";
dol_syslog(get_class($this).'::updateConfCP name='.$name.'', LOG_DEBUG); dol_syslog(get_class($this).'::updateConfCP name='.$name, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
return true; return true;

View File

@@ -281,7 +281,7 @@ if ($dirins && $action == 'initmodule' && $modulename) {
// Delete dir and files that can be generated in sub tabs later if we need them (we want a minimal module first) // Delete dir and files that can be generated in sub tabs later if we need them (we want a minimal module first)
dol_delete_dir_recursive($destdir.'/build/doxygen'); dol_delete_dir_recursive($destdir.'/build/doxygen');
dol_delete_dir_recursive($destdir.'/core/modules/mailings'); dol_delete_dir_recursive($destdir.'/core/modules/mailings');
dol_delete_dir_recursive($destdir.'/core/modules/'.strtolower($modulename).''); dol_delete_dir_recursive($destdir.'/core/modules/'.strtolower($modulename));
dol_delete_dir_recursive($destdir.'/core/tpl'); dol_delete_dir_recursive($destdir.'/core/tpl');
dol_delete_dir_recursive($destdir.'/core/triggers'); dol_delete_dir_recursive($destdir.'/core/triggers');
dol_delete_dir_recursive($destdir.'/doc'); dol_delete_dir_recursive($destdir.'/doc');

View File

@@ -834,7 +834,7 @@ class MouvementStock extends CommonObject
$sql .= " WHERE fk_product = ".((int) $productidselected); $sql .= " WHERE fk_product = ".((int) $productidselected);
$sql .= " AND datem < '".$this->db->idate($datebefore)."'"; $sql .= " AND datem < '".$this->db->idate($datebefore)."'";
dol_syslog(get_class($this).__METHOD__.'', LOG_DEBUG); dol_syslog(get_class($this).__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);

View File

@@ -279,9 +279,9 @@ class Stripe extends CommonObject
global $stripearrayofkeysbyenv; global $stripearrayofkeysbyenv;
\Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$status]['secret_key']); \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$status]['secret_key']);
if (empty($key)) { // If the Stripe connect account not set, we use common API usage if (empty($key)) { // If the Stripe connect account not set, we use common API usage
$stripepaymentmethod = \Stripe\PaymentMethod::retrieve(''.$paymentmethod->id.''); $stripepaymentmethod = \Stripe\PaymentMethod::retrieve((string) $paymentmethod->id);
} else { } else {
$stripepaymentmethod = \Stripe\PaymentMethod::retrieve(''.$paymentmethod->id.'', array("stripe_account" => $key)); $stripepaymentmethod = \Stripe\PaymentMethod::retrieve((string) $paymentmethod->id, array("stripe_account" => $key));
} }
} catch (Exception $e) { } catch (Exception $e) {
$this->error = $e->getMessage(); $this->error = $e->getMessage();
@@ -307,9 +307,9 @@ class Stripe extends CommonObject
global $stripearrayofkeysbyenv; global $stripearrayofkeysbyenv;
\Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$status]['secret_key']); \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$status]['secret_key']);
if (empty($key)) { // If the Stripe connect account not set, we use common API usage if (empty($key)) { // If the Stripe connect account not set, we use common API usage
$selectedreader = \Stripe\Terminal\Reader::retrieve(''.$reader.''); $selectedreader = \Stripe\Terminal\Reader::retrieve((string) $reader);
} else { } else {
$stripepaymentmethod = \Stripe\Terminal\Reader::retrieve(''.$reader.'', array("stripe_account" => $key)); $stripepaymentmethod = \Stripe\Terminal\Reader::retrieve((string) $reader, array("stripe_account" => $key));
} }
} catch (Exception $e) { } catch (Exception $e) {
$this->error = $e->getMessage(); $this->error = $e->getMessage();

View File

@@ -1424,7 +1424,7 @@ if (!empty($_SESSION["basiclayout"]) && $_SESSION["basiclayout"] == 1) {
$htmlforlines .= '" onclick="AddProduct(\''.$place.'\', '.$row->id.')">'; $htmlforlines .= '" onclick="AddProduct(\''.$place.'\', '.$row->id.')">';
if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
$htmlforlines .= '<img class="imgwrapper" width="33%" src="'.DOL_URL_ROOT.'/takepos/public/auto_order.php?genimg=pro&query=pro&id='.$row->id.'"><br>'; $htmlforlines .= '<img class="imgwrapper" width="33%" src="'.DOL_URL_ROOT.'/takepos/public/auto_order.php?genimg=pro&query=pro&id='.$row->id.'"><br>';
$htmlforlines .= $row->label.''.price($row->price_ttc, 1, $langs, 1, -1, -1, $conf->currency); $htmlforlines .= $row->label.' '.price($row->price_ttc, 1, $langs, 1, -1, -1, $conf->currency);
$htmlforlines .= '</div>'."\n"; $htmlforlines .= '</div>'."\n";
} else { } else {
$htmlforlines .= '<td class="left">'; $htmlforlines .= '<td class="left">';

View File

@@ -836,15 +836,15 @@ foreach ($object->fields as $key => $val) {
print '</td>'; print '</td>';
} elseif ($key == 'type_code') { } elseif ($key == 'type_code') {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
$formTicket->selectTypesTickets(dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]), 'search_'.$key.'', '', 2, 1, 1, 0, (!empty($val['css']) ? $val['css'] : 'maxwidth150'), 1); $formTicket->selectTypesTickets(dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]), 'search_'.$key, '', 2, 1, 1, 0, (!empty($val['css']) ? $val['css'] : 'maxwidth150'), 1);
print '</td>'; print '</td>';
} elseif ($key == 'category_code') { } elseif ($key == 'category_code') {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
$formTicket->selectGroupTickets(dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]), 'search_'.$key.'', '', 2, 1, 1, 0, (!empty($val['css']) ? $val['css'] : 'maxwidth150')); $formTicket->selectGroupTickets(dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]), 'search_'.$key, '', 2, 1, 1, 0, (!empty($val['css']) ? $val['css'] : 'maxwidth150'));
print '</td>'; print '</td>';
} elseif ($key == 'severity_code') { } elseif ($key == 'severity_code') {
print '<td class="liste_titre center'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre center'.($cssforfield ? ' '.$cssforfield : '').'">';
$formTicket->selectSeveritiesTickets(dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]), 'search_'.$key.'', '', 2, 1, 1, 0, (!empty($val['css']) ? $val['css'] : 'maxwidth150')); $formTicket->selectSeveritiesTickets(dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]), 'search_'.$key, '', 2, 1, 1, 0, (!empty($val['css']) ? $val['css'] : 'maxwidth150'));
print '</td>'; print '</td>';
} elseif ($key == 'fk_user_assign' || $key == 'fk_user_create') { } elseif ($key == 'fk_user_assign' || $key == 'fk_user_create') {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';

View File

@@ -741,9 +741,9 @@ function createOrder($authentication, $order)
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label($elementtype, true); $extrafields->fetch_name_optionals_label($elementtype, true);
if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) { if (isset($extrafields->attributes[$elementtype]['label']) && is_array($extrafields->attributes[$elementtype]['label']) && count($extrafields->attributes[$elementtype]['label'])) {
foreach ($extrafields->attributes[$elementtype]['label'] as $key => $label) { foreach ($extrafields->attributes[$elementtype]['label'] as $tmpkey => $tmplabel) {
$key = 'options_'.$key; $tmpkey = 'options_'.$tmpkey;
$newline->array_options[$key] = $line[$key]; $newline->array_options[$tmpkey] = $line[$tmpkey];
} }
} }

View File

@@ -64,4 +64,6 @@ exclude:
- name: PhpArrayWriteIsNotUsedInspection - name: PhpArrayWriteIsNotUsedInspection
- name: PhpUndefinedNamespaceInspection - name: PhpUndefinedNamespaceInspection
- name: PhpArraySearchInBooleanContextInspection - name: PhpArraySearchInBooleanContextInspection
- name: PhpLoopCanBeReplacedWithStrRepeatInspection
- name: PhpPropertyOnlyWrittenInspection - name: PhpPropertyOnlyWrittenInspection
- name: PhpCoveredCharacterInClassInspection

View File

@@ -176,17 +176,17 @@ if ($result >= 0) {
// 1 - Association des utilisateurs du groupe LDAP au groupe Dolibarr // 1 - Association des utilisateurs du groupe LDAP au groupe Dolibarr
$userList = array(); $userList = array();
$userIdList = array(); $userIdList = array();
foreach ($ldapgroup[$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS] as $key => $userdn) { foreach ($ldapgroup[getDolGlobalString('LDAP_GROUP_FIELD_GROUPMEMBERS')] as $tmpkey => $userdn) {
if ($key === 'count') { if ($tmpkey === 'count') {
continue; continue;
} }
if (empty($userList[$userdn])) { // Récupération de l'utilisateur if (empty($userList[$userdn])) { // Récupération de l'utilisateur
// Schéma rfc2307: les membres sont listés dans l'attribut memberUid sous form de login uniquement // Schéma rfc2307: les membres sont listés dans l'attribut memberUid sous form de login uniquement
if ($conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS === 'memberUid') { if (getDolGlobalString('LDAP_GROUP_FIELD_GROUPMEMBERS') === 'memberUid') {
$userKey = array($userdn); $userKey = array($userdn);
} else { // Pour les autres schémas, les membres sont listés sous forme de DN complets } else { // Pour les autres schémas, les membres sont listés sous forme de DN complets
$userFilter = explode(',', $userdn); $userFilter = explode(',', $userdn);
$userKey = $ldap->getAttributeValues('('.$userFilter[0].')', $conf->global->LDAP_KEY_USERS); $userKey = $ldap->getAttributeValues('('.$userFilter[0].')', getDolGlobalString('LDAP_KEY_USERS'));
} }
if (!is_array($userKey)) { if (!is_array($userKey)) {
continue; continue;
@@ -194,9 +194,9 @@ if ($result >= 0) {
$fuser = new User($db); $fuser = new User($db);
if ($conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_SID) { if (getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_SID')) {
$fuser->fetch('', '', $userKey[0]); // Chargement du user concerné par le SID $fuser->fetch('', '', $userKey[0]); // Chargement du user concerné par le SID
} elseif ($conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_LOGIN) { } elseif (getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_LOGIN')) {
$fuser->fetch('', $userKey[0]); // Chargement du user concerné par le login $fuser->fetch('', $userKey[0]); // Chargement du user concerné par le login
} }