diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index abb5ebfd6ba..fcbc01abef1 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -427,7 +427,7 @@ if ($mode == 'overwrite') { print '   '; print ''; } else { - print ''.img_edit().''; + print ''.img_edit().''; print '   '; print ''.img_delete().''; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a6eac03cadc..a8a96fb7c07 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -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 (!empty($conf->dol_no_mouse_hover) && !empty($tooltiptrigger)) //{ - //if ($type == 'info' || $type == 'help') return ''.$text.'''; + //if ($type == 'info' || $type == 'help') return ''.$text.''; //} $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 .= " 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); if ($result2) { $objp2 = $this->db->fetch_object($result2); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 25393c6ee56..47525ab5328 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -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) { $out .= ''; $contact = new Contact($db); - foreach ($histo[$key]['socpeopleassigned'] as $cid => $value) { + foreach ($histo[$key]['socpeopleassigned'] as $cid => $cvalue) { $result = $contact->fetch($cid); if ($result < 0) { diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php index 7078d7488ad..ccce2ec7f94 100644 --- a/htdocs/core/lib/cron.lib.php +++ b/htdocs/core/lib/cron.lib.php @@ -128,7 +128,7 @@ function dol_print_cron_urls() $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 '
\n"; print '
'; @@ -145,7 +145,7 @@ function dol_print_cron_urls() if ($linuxlike) { print $langs->trans("CronExplainHowToRunUnix"); print '
'; - print '
'; + print '
'; } else { print $langs->trans("CronExplainHowToRunWin"); } diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index b6932c2cf09..9928b8af33b 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -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('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 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) - 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 ''."\n"; } diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 0125becd21c..81da058b919 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1470,7 +1470,7 @@ class Holiday extends CommonObject $sql .= " value = '".$this->db->escape($value)."'"; $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); if ($result) { return true; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index a14467c0184..b804f3d9c8f 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -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) dol_delete_dir_recursive($destdir.'/build/doxygen'); 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/triggers'); dol_delete_dir_recursive($destdir.'/doc'); diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index ac5d612394b..43760d808b2 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -834,7 +834,7 @@ class MouvementStock extends CommonObject $sql .= " WHERE fk_product = ".((int) $productidselected); $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); if ($resql) { $obj = $this->db->fetch_object($resql); diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index ffe59b01d61..1f9ad46cdb0 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -279,9 +279,9 @@ class Stripe extends CommonObject global $stripearrayofkeysbyenv; \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$status]['secret_key']); 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 { - $stripepaymentmethod = \Stripe\PaymentMethod::retrieve(''.$paymentmethod->id.'', array("stripe_account" => $key)); + $stripepaymentmethod = \Stripe\PaymentMethod::retrieve((string) $paymentmethod->id, array("stripe_account" => $key)); } } catch (Exception $e) { $this->error = $e->getMessage(); @@ -307,9 +307,9 @@ class Stripe extends CommonObject global $stripearrayofkeysbyenv; \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$status]['secret_key']); 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 { - $stripepaymentmethod = \Stripe\Terminal\Reader::retrieve(''.$reader.'', array("stripe_account" => $key)); + $stripepaymentmethod = \Stripe\Terminal\Reader::retrieve((string) $reader, array("stripe_account" => $key)); } } catch (Exception $e) { $this->error = $e->getMessage(); diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index ea262a1562f..27b340249c3 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -1424,7 +1424,7 @@ if (!empty($_SESSION["basiclayout"]) && $_SESSION["basiclayout"] == 1) { $htmlforlines .= '" onclick="AddProduct(\''.$place.'\', '.$row->id.')">'; if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { $htmlforlines .= '
'; - $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 .= ''."\n"; } else { $htmlforlines .= ''; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 4c4dce5a428..79db9e0e73e 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -836,15 +836,15 @@ foreach ($object->fields as $key => $val) { print ''; } elseif ($key == 'type_code') { print ''; - $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 ''; } elseif ($key == 'category_code') { print ''; - $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 ''; } elseif ($key == 'severity_code') { print ''; - $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 ''; } elseif ($key == 'fk_user_assign' || $key == 'fk_user_create') { print ''; diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 65357174019..0f0eb79d10e 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -741,9 +741,9 @@ function createOrder($authentication, $order) $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($elementtype, true); 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) { - $key = 'options_'.$key; - $newline->array_options[$key] = $line[$key]; + foreach ($extrafields->attributes[$elementtype]['label'] as $tmpkey => $tmplabel) { + $tmpkey = 'options_'.$tmpkey; + $newline->array_options[$tmpkey] = $line[$tmpkey]; } } diff --git a/qodana.yaml b/qodana.yaml index 5ed80e029f3..853ee69fab5 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -64,4 +64,6 @@ exclude: - name: PhpArrayWriteIsNotUsedInspection - name: PhpUndefinedNamespaceInspection - name: PhpArraySearchInBooleanContextInspection - - name: PhpPropertyOnlyWrittenInspection \ No newline at end of file + - name: PhpLoopCanBeReplacedWithStrRepeatInspection + - name: PhpPropertyOnlyWrittenInspection + - name: PhpCoveredCharacterInClassInspection \ No newline at end of file diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index 67c14a4ee5d..2fe89b92ccb 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -176,17 +176,17 @@ if ($result >= 0) { // 1 - Association des utilisateurs du groupe LDAP au groupe Dolibarr $userList = array(); $userIdList = array(); - foreach ($ldapgroup[$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS] as $key => $userdn) { - if ($key === 'count') { + foreach ($ldapgroup[getDolGlobalString('LDAP_GROUP_FIELD_GROUPMEMBERS')] as $tmpkey => $userdn) { + if ($tmpkey === 'count') { continue; } 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 - if ($conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS === 'memberUid') { + if (getDolGlobalString('LDAP_GROUP_FIELD_GROUPMEMBERS') === 'memberUid') { $userKey = array($userdn); } else { // Pour les autres schémas, les membres sont listés sous forme de DN complets $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)) { continue; @@ -194,9 +194,9 @@ if ($result >= 0) { $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 - } 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 }