Merge branch '17.0' into 17_fix_quicksearch_intervention

This commit is contained in:
HENRY Florian 2023-09-01 11:41:38 +02:00 committed by GitHub
commit fd481eee32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 70 additions and 51 deletions

View file

@ -1674,6 +1674,9 @@ if ($id > 0) {
}
if (in_array($value, array('label', 'libelle', 'libelle_facture')) && empty($tabcomplete[$tabname[$id]]['help'][$value])) {
if (!is_array($tabcomplete[$tabname[$id]]['help'])) { // protection when $tabcomplete[$tabname[$id]]['help'] is a an empty string, we must force it into an array
$tabcomplete[$tabname[$id]]['help'] = array();
}
$tabcomplete[$tabname[$id]]['help'][$value] = $langs->trans('LabelUsedByDefault');
}

View file

@ -300,7 +300,7 @@ if ($action == 'update') {
$_SESSION["mainmenu"] = ""; // The menu manager may have changed
if (GETPOST('dol_resetcache')) {
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", ((int) $conf->global->MAIN_IHM_PARAMS_REV) + 1, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
}
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".'&mode='.$mode.(GETPOSTISSET('page_y') ? '&page_y='.GETPOST('page_y', 'int') : ''));

View file

@ -656,7 +656,7 @@ if ($action == 'edit') {
if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
// Force e-mail recipient
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>'.getDolGlobalString('MAIN_MAIL_FORCE_SENDTO');
if (!empty(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) {
if (getDolGlobalString('MAIN_MAIL_FORCE_SENDTO')) {
if (!isValidEmail(getDolGlobalString('MAIN_MAIL_FORCE_SENDTO'))) {
print img_warning($langs->trans("ErrorBadEMail"));
} else {

View file

@ -258,7 +258,7 @@ if ($action == 'install') {
if ($action == 'set' && $user->admin) {
$resarray = activateModule($value);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
if (!empty($resarray['errors'])) {
setEventMessages('', $resarray['errors'], 'errors');
} else {
@ -282,7 +282,7 @@ if ($action == 'set' && $user->admin) {
exit;
} elseif ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes') {
$result = unActivateModule($value);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
if ($result) {
setEventMessages($result, null, 'errors');
}

View file

@ -221,7 +221,7 @@ if ($action == 'edit') {
// Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>';
$text = empty(getDolGlobalString('MAIN_SMS_SENDMODE')) ? '' : $listofmethods[getDolGlobalString('MAIN_SMS_SENDMODE')];
$text = getDolGlobalString('MAIN_SMS_SENDMODE') ? $listofmethods[getDolGlobalString('MAIN_SMS_SENDMODE')] : '';
if (empty($text)) {
$text = $langs->trans("Undefined").' '.img_warning();
}

View file

@ -318,7 +318,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
// Check if email exists
print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailMustExist").'</td>';
print '<td class="left">';
if (empty(getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS'))) {
if (!getDolGlobalInt('TICKET_EMAIL_MUST_EXISTS')) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
} else {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_EMAIL_MUST_EXISTS&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
@ -334,7 +334,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
/*
print '<tr class="oddeven"><td>'.$langs->trans("TicketCreateThirdPartyWithContactIfNotExist").'</td>';
print '<td class="left">';
if (empty(getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST'))) {
if (!getDolGlobalInt('TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST')) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST&token='.newToken().'">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
} else {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST&token='.newToken().'">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';

View file

@ -521,7 +521,7 @@ if (empty($reshook)) {
$pu_ht = $datapriceofproduct['pu_ht'];
$pu_ttc = $datapriceofproduct['pu_ttc'];
$price_min = $datapriceofproduct['price_min'];
$price_base_type = $datapriceofproduct['price_base_type'];
$price_base_type = empty($datapriceofproduct['price_base_type']) ? 'HT' : $datapriceofproduct['price_base_type'];
$tva_tx = $datapriceofproduct['tva_tx'];
$tva_npr = $datapriceofproduct['tva_npr'];

View file

@ -2161,8 +2161,7 @@ if (empty($reshook)) {
$pu_ttc = $datapriceofproduct['pu_ttc'];
$price_min = $datapriceofproduct['price_min'];
$price_min_ttc = (isset($datapriceofproduct['price_min_ttc'])) ? $datapriceofproduct['price_min_ttc'] : null;
$price_base_type = $datapriceofproduct['price_base_type'];
$price_base_type = empty($datapriceofproduct['price_base_type']) ? 'HT' : $datapriceofproduct['price_base_type'];
$tva_tx = $datapriceofproduct['tva_tx'];
$tva_npr = $datapriceofproduct['tva_npr'];

View file

@ -522,8 +522,13 @@ if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) {
}
}
$params = array();
if (! empty($title_button)) {
$params['attr'] = array('title' => $title_button);
}
if ($user->socid == 0 && $action == '') {
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $user->rights->facture->paiement && !$disable_delete);
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $user->rights->facture->paiement && !$disable_delete, $params);
}
print '</div>';

View file

@ -480,7 +480,7 @@ class Translate
if (!$found && !empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) {
// Overwrite translation with database read
$sql = "SELECT transkey, transvalue FROM ".$db->prefix()."overwrite_trans where lang='".$db->escape($this->defaultlang)."' OR lang IS NULL";
$sql = "SELECT transkey, transvalue FROM ".$db->prefix()."overwrite_trans where (lang='".$db->escape($this->defaultlang)."' OR lang IS NULL)";
$sql .= " AND entity IN (0, ".getEntity('overwrite_trans').")";
$sql .= $db->order("lang", "DESC");
$resql = $db->query($sql);

View file

@ -1330,14 +1330,14 @@ function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tab
// We discard modules according to features level (PS: if module is activated we always show it)
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
if ($objMod->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2 && empty(getDolGlobalString($const_name))) {
if ($objMod->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2 && !getDolGlobalString($const_name)) {
$modulequalified = 0;
}
if ($objMod->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1 && empty(getDolGlobalString($const_name))) {
if ($objMod->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1 && !getDolGlobalString($const_name)) {
$modulequalified = 0;
}
//If module is not activated disqualified
if (empty(getDolGlobalString($const_name))) {
// If module is not activated disqualified
if (!getDolGlobalString($const_name)) {
$modulequalified = 0;
}

View file

@ -200,7 +200,7 @@ function invoice_admin_prepare_head()
$head[$h][2] = 'attributeslinesrec';
$h++;
if (!empty($conf->global->INVOICE_USE_SITUATION)) { // Warning, implementation is seriously bugged and a new one not compatible is expected to become stable
if (getDolGlobalInt('INVOICE_USE_SITUATION') > 0) { // Warning, implementation with value 1 is seriously bugged and a new one not compatible is expected to become stable
$head[$h][0] = DOL_URL_ROOT.'/admin/facture_situation.php';
$head[$h][1] = $langs->trans("InvoiceSituation");
$head[$h][2] = 'situation';

View file

@ -239,7 +239,7 @@ class doc_generic_reception_odt extends ModelePdfReception
$outputlangs->loadLangs(array("main", "dict", "companies", "bills"));
if ($conf->reception->dir_output."/reception") {
if ($conf->reception->dir_output) {
// If $object is id instead of object
if (!is_object($object)) {
$id = $object;
@ -253,7 +253,7 @@ class doc_generic_reception_odt extends ModelePdfReception
$object->fetch_thirdparty();
$dir = $conf->reception->dir_output."/reception";
$dir = !empty($conf->reception->multidir_output[$object->entity]) ? $conf->reception->multidir_output[$object->entity] : $conf->reception->dir_output;
$objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) {
$dir .= "/".$objectref;
@ -426,7 +426,7 @@ class doc_generic_reception_odt extends ModelePdfReception
$linenumber = 0;
foreach ($object->lines as $line) {
$linenumber++;
$tmparray = $this->get_substitutionarray_reception_lines($line, $outputlangs);
$tmparray = $this->get_substitutionarray_lines($line, $outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
// Call the ODTSubstitutionLine hook
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line);

View file

@ -775,7 +775,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
// Now set the VAT
var stringforvatrateselection = tva_tx;
if (typeof default_vat_code != 'undefined' && default_vat_code != null) {
if (typeof default_vat_code != 'undefined' && default_vat_code != null && default_vat_code != '') {
stringforvatrateselection = stringforvatrateselection+' ('+default_vat_code+')';
}
// Set vat rate if field is an input box
@ -896,7 +896,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
}
options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>';
});
options += '<option value="inputprice" price="'+defaultprice+'"><?php echo $langs->trans("InputPrice").'...'; ?></option>';
options += '<option value="inputprice" price="'+defaultprice+'"><?php echo dol_escape_js($langs->trans("InputPrice").'...'); ?></option>';
console.log("finally selected defaultkey="+defaultkey+" defaultprice for buying price="+defaultprice);
@ -997,7 +997,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
if (typeof default_vat_code === 'undefined') { default_vat_code = jQuery('#idprodfournprice').attr('data-default-vat-code');} // When select is done from HTML input with ajax autocomplete
var stringforvatrateselection = tva_tx;
if (typeof default_vat_code != 'undefined' && default_vat_code != null) {
if (typeof default_vat_code != 'undefined' && default_vat_code != null && default_vat_code != '') {
stringforvatrateselection = stringforvatrateselection+' ('+default_vat_code+')';
}
@ -1059,7 +1059,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
if (typeof default_vat_code === 'undefined') { default_vat_code = jQuery('#idprodfournprice').attr('data-default-vat-code');} // When select is done from HTML input with ajax autocomplete
var stringforvatrateselection = tva_tx;
if (typeof default_vat_code != 'undefined' && default_vat_code != null) {
if (typeof default_vat_code != 'undefined' && default_vat_code != null && default_vat_code != '') {
stringforvatrateselection = stringforvatrateselection+' ('+default_vat_code+')';
}
@ -1072,7 +1072,6 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
$('#tva_tx option').removeAttr('selected');
console.log("stringforvatrateselection="+stringforvatrateselection+" -> value of option label for this key="+$('#tva_tx option[value="'+stringforvatrateselection+'"]').val());
$('#tva_tx option[value="'+stringforvatrateselection+'"]').prop('selected', true);
<?php
if (getDolGlobalInt('PRODUIT_AUTOFILL_DESC') == 1) {
if (!empty($conf->global->FCKEDITOR_ENABLE_DETAILS)) {

View file

@ -548,7 +548,7 @@ if (empty($reshook)) {
$pu_ht = $datapriceofproduct['pu_ht'];
$pu_ttc = $datapriceofproduct['pu_ttc'];
$price_min = $datapriceofproduct['price_min'];
$price_base_type = $datapriceofproduct['price_base_type'];
$price_base_type = empty($datapriceofproduct['price_base_type']) ? 'HT' : $datapriceofproduct['price_base_type'];
$tva_tx = $datapriceofproduct['tva_tx'];
$tva_npr = $datapriceofproduct['tva_npr'];

View file

@ -519,7 +519,7 @@ if (empty($reshook)) {
if (!empty($moreforfilter)) {
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters = array('type'=>$type);
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';

View file

@ -1673,7 +1673,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
}
// Refresh value of MAIN_IHM_PARAMS_REV before forging the parameter line.
if (GETPOST('dol_resetcache')) {
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", ((int) $conf->global->MAIN_IHM_PARAMS_REV) + 1, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
}
$themeparam = '?lang='.$langs->defaultlang.'&amp;theme='.$conf->theme.(GETPOST('optioncss', 'aZ09') ? '&amp;optioncss='.GETPOST('optioncss', 'aZ09', 1) : '').(empty($user->id) ? '' : ('&amp;userid='.$user->id)).'&amp;entity='.$conf->entity;

View file

@ -141,17 +141,18 @@ if ($id > 0 || !empty($ref)) {
if ($result < 0) {
dol_print_error($db, $object->error, $object->errors);
}
$entity = (!empty($object->entity) ? $object->entity : $conf->entity);
if (isModEnabled("product")) {
$upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
$upload_dir = $conf->product->multidir_output[$entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
} elseif (isModEnabled("service")) {
$upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
$upload_dir = $conf->service->multidir_output[$entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
}
if (getDolGlobalInt('PRODUCT_USE_OLD_PATH_FOR_PHOTO')) { // For backward compatiblity, we scan also old dirs
if (isModEnabled("product")) {
$upload_dirold = $conf->product->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2), 1, 1).'/'.substr(substr("000".$object->id, -2), 0, 1).'/'.$object->id."/photos";
$upload_dirold = $conf->product->multidir_output[$entity].'/'.substr(substr("000".$object->id, -2), 1, 1).'/'.substr(substr("000".$object->id, -2), 0, 1).'/'.$object->id."/photos";
} else {
$upload_dirold = $conf->service->multidir_output[$object->entity].'/'.substr(substr("000".$object->id, -2), 1, 1).'/'.substr(substr("000".$object->id, -2), 0, 1).'/'.$object->id."/photos";
$upload_dirold = $conf->service->multidir_output[$entity].'/'.substr(substr("000".$object->id, -2), 1, 1).'/'.substr(substr("000".$object->id, -2), 0, 1).'/'.$object->id."/photos";
}
}
}
@ -497,10 +498,11 @@ if (empty($reshook)) {
if (!$error) {
$units = GETPOST('units', 'int');
$object->ref = $ref;
$object->label = GETPOST('label', $label_security_check);
$object->price_base_type = GETPOST('price_base_type', 'aZ09');
$object->mandatory_period = !empty(GETPOST("mandatoryperiod", 'alpha')) ? 1 : 0;
$object->entity = $conf->entity;
$object->ref = $ref;
$object->label = GETPOST('label', $label_security_check);
$object->price_base_type = GETPOST('price_base_type', 'aZ09');
$object->mandatory_period = !empty(GETPOST("mandatoryperiod", 'alpha')) ? 1 : 0;
if ($object->price_base_type == 'TTC') {
$object->price_ttc = GETPOST('price');
} else {

View file

@ -770,7 +770,7 @@ class Product extends CommonObject
$sql .= ", mandatory_period";
$sql .= ") VALUES (";
$sql .= "'".$this->db->idate($now)."'";
$sql .= ", ".((int) $conf->entity);
$sql .= ", ".(!empty($this->entity) ? (int) $this->entity : (int) $conf->entity);
$sql .= ", '".$this->db->escape($this->ref)."'";
$sql .= ", ".(!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null");
$sql .= ", ".price2num($price_min_ht);

View file

@ -381,7 +381,7 @@ class Reception extends CommonObject
return -1;
}
$sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_supplier, e.ref_ext, e.fk_user_author, e.fk_statut";
$sql = "SELECT e.rowid, e.entity, e.ref, e.fk_soc as socid, e.date_creation, e.ref_supplier, e.ref_ext, e.fk_user_author, e.fk_statut";
$sql .= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height";
$sql .= ", e.date_reception as date_reception, e.model_pdf, e.date_delivery";
$sql .= ", e.fk_shipping_method, e.tracking_number";
@ -410,6 +410,7 @@ class Reception extends CommonObject
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->ref = $obj->ref;
$this->socid = $obj->socid;
$this->ref_supplier = $obj->ref_supplier;

View file

@ -500,7 +500,7 @@ if (empty($reshook)) {
$price = $datapriceofproduct['pu_ht'];
$price_ttc = $datapriceofproduct['pu_ttc'];
//$price_min = $datapriceofproduct['price_min'];
$price_base_type = $datapriceofproduct['price_base_type'];
$price_base_type = empty($datapriceofproduct['price_base_type']) ? 'HT' : $datapriceofproduct['price_base_type'];
$tva_tx = $datapriceofproduct['tva_tx'];
$tva_npr = $datapriceofproduct['tva_npr'];

View file

@ -110,12 +110,12 @@ if (!empty($hookmanager->resPrint)) {
<br>
<p class="left">
<?php
$constFreeText = 'TAKEPOS_HEADER'.$_SESSION['takeposterminal'];
if (!empty($conf->global->TAKEPOS_HEADER) || getDolGlobalString($constFreeText)) {
$constFreeText = 'TAKEPOS_HEADER'.(empty($_SESSION['takeposterminal']) ? '0' : $_SESSION['takeposterminal']);
if (getDolGlobalString('TAKEPOS_HEADER') || getDolGlobalString($constFreeText)) {
$newfreetext = '';
$substitutionarray = getCommonSubstitutionArray($langs);
if (!empty($conf->global->TAKEPOS_HEADER)) {
$newfreetext .= make_substitutions($conf->global->TAKEPOS_HEADER, $substitutionarray);
if (getDolGlobalString('TAKEPOS_HEADER')) {
$newfreetext .= make_substitutions(getDolGlobalString('TAKEPOS_HEADER'), $substitutionarray);
}
if (getDolGlobalString($constFreeText)) {
$newfreetext .= make_substitutions(getDolGlobalString($constFreeText), $substitutionarray);
@ -336,15 +336,15 @@ if ($conf->global->TAKEPOS_PRINT_PAYMENT_METHOD) {
<br>
<br>
<?php
$constFreeText = 'TAKEPOS_FOOTER'.$_SESSION['takeposterminal'];
if (!empty($conf->global->TAKEPOS_FOOTER) || !empty($conf->global->{$constFreeText})) {
$constFreeText = 'TAKEPOS_FOOTER'.(empty($_SESSION['takeposterminal']) ? '0' : $_SESSION['takeposterminal']);
if (getDolGlobalString('TAKEPOS_FOOTER') || getDolGlobalString($constFreeText)) {
$newfreetext = '';
$substitutionarray = getCommonSubstitutionArray($langs);
if (!empty($conf->global->{$constFreeText})) {
$newfreetext .= make_substitutions($conf->global->{$constFreeText}, $substitutionarray);
if (getDolGlobalString($constFreeText)) {
$newfreetext .= make_substitutions(getDolGlobalString($constFreeText), $substitutionarray);
}
if (!empty($conf->global->TAKEPOS_FOOTER)) {
$newfreetext .= make_substitutions($conf->global->TAKEPOS_FOOTER, $substitutionarray);
if (getDolGlobalString('TAKEPOS_FOOTER')) {
$newfreetext .= make_substitutions(getDolGlobalString('TAKEPOS_FOOTER'), $substitutionarray);
}
print $newfreetext;
}

View file

@ -565,7 +565,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
$ok=false;
break;
}
$this->assertTrue($ok, 'Found code empty($user->hasRight in file '.$file['relativename'].'. empty() must not be used with hasRight.');
$this->assertTrue($ok, 'Found code empty($user->hasRight in file '.$file['relativename'].'. empty() must not be used on a var not on a function.');
// Test we don't have empty(DolibarrApiAccess::$user->hasRight
$ok=true;
@ -575,7 +575,17 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
$ok=false;
break;
}
$this->assertTrue($ok, 'Found code empty(DolibarrApiAccess::$user->hasRight in file '.$file['relativename'].'. empty() must not be used with hasRight.');
$this->assertTrue($ok, 'Found code empty(DolibarrApiAccess::$user->hasRight in file '.$file['relativename'].'. empty() must not be used on a var not on a function.');
// Test we don't have empty($user->hasRight
$ok=true;
$matches=array();
preg_match_all('/empty\(getDolGlobal/', $filecontent, $matches, PREG_SET_ORDER);
foreach ($matches as $key => $val) {
$ok=false;
break;
}
$this->assertTrue($ok, 'Found code empty(getDolGlobal... in file '.$file['relativename'].'. empty() must be used on a var not on a function.');
// Test we don't have @var array(
$ok=true;