Qual: Fix phan notices (#31996)

# Qual: Fix phan notices

Fix phan notices up to htdocs\core\ajax\selectsearchbox.php.
This commit is contained in:
MDW 2024-11-19 03:07:18 +01:00 committed by GitHub
parent 0777540ee7
commit 7304048afb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 93 additions and 63 deletions

View File

@ -10,15 +10,15 @@
return [
// # Issue statistics:
// PhanUndeclaredProperty : 560+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 390+ occurrences
// PhanUndeclaredGlobalVariable : 310+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 240+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 370+ occurrences
// PhanUndeclaredGlobalVariable : 300+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 230+ occurrences
// PhanPluginUnknownArrayMethodReturnType : 180+ occurrences
// PhanTypeMismatchProperty : 140+ occurrences
// PhanPluginUnknownPropertyType : 130+ occurrences
// PhanPluginUnknownArrayMethodParamType : 120+ occurrences
// PhanPossiblyUndeclaredVariable : 110+ occurrences
// PhanPluginUndeclaredVariableIsset : 65+ occurrences
// PhanPluginUndeclaredVariableIsset : 60+ occurrences
// PhanRedefineFunction : 45+ occurrences
// PhanTypeExpectedObjectPropAccess : 45+ occurrences
// PhanTypeMismatchArgumentNullableInternal : 40+ occurrences
@ -26,15 +26,15 @@ return [
// PhanTypeMismatchDimFetch : 30+ occurrences
// PhanPluginEmptyStatementIf : 15+ occurrences
// PhanUndeclaredConstant : 15+ occurrences
// PhanEmptyForeach : 10+ occurrences
// PhanPluginUnknownObjectMethodCall : 10+ occurrences
// PhanTypeArraySuspiciousNull : 10+ occurrences
// PhanTypeComparisonFromArray : 10+ occurrences
// PhanTypeMismatchDimFetchNullable : 10+ occurrences
// PhanUndeclaredMethod : 10+ occurrences
// PhanPluginBothLiteralsBinaryOp : 8 occurrences
// PhanEmptyForeach : 9 occurrences
// PhanPluginBothLiteralsBinaryOp : 7 occurrences
// PhanPluginDuplicateExpressionBinaryOp : 7 occurrences
// PhanPluginSuspiciousParamPosition : 7 occurrences
// PhanTypeArraySuspiciousNull : 7 occurrences
// PhanPossiblyNullTypeMismatchProperty : 5 occurrences
// PhanParamTooMany : 4 occurrences
// PhanPluginDuplicateArrayKey : 4 occurrences
@ -125,31 +125,19 @@ return [
'htdocs/compta/paiement/cheque/list.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/compta/paiement/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredGlobalVariable'],
'htdocs/compta/sociales/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'],
'htdocs/compta/tva/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/compta/tva/class/paymentvat.class.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/tva/clients.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchProperty'],
'htdocs/compta/tva/payments.php' => ['PhanTypeMismatchArgumentNullableInternal'],
'htdocs/compta/tva/quadri_detail.php' => ['PhanTypeArraySuspiciousNull', 'PhanTypeInvalidDimOffset', 'PhanTypeMismatchProperty'],
'htdocs/contact/card.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/contact/consumption.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/contact/perso.php' => ['PhanTypeMismatchProperty'],
'htdocs/contrat/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/contrat/card.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/contrat/card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/contrat/class/api_contracts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/contrat/messaging.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/contrat/services_list.php' => ['PhanEmptyForeach', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanTypeMismatchDimFetch', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/core/actions_comments.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/core/actions_lineupdown.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/actions_linkedfiles.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/actions_massactions.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'],
'htdocs/core/actions_massactions.inc.php' => ['PhanUndeclaredProperty'],
'htdocs/core/actions_printing.inc.php' => ['PhanUndeclaredProperty'],
'htdocs/core/actions_sendmails.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/core/actions_setmoduleoptions.inc.php' => ['PhanPluginUnknownObjectMethodCall'],
'htdocs/core/ajax/ajaxdirpreview.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/core/ajax/ajaxdirtree.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/ajax/selectobject.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/ajax/selectsearchbox.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/core/ajax/ajaxdirtree.php' => ['PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/boxes/box_actions.php' => ['PhanPossiblyUndeclaredVariable'],
'htdocs/core/boxes/box_actions_future.php' => ['PhanPossiblyUndeclaredVariable'],
'htdocs/core/boxes/box_external_rss.php' => ['PhanPluginUnknownPropertyType'],
@ -263,7 +251,6 @@ return [
'htdocs/core/modules/workstation/mod_workstation_advanced.php' => ['PhanUndeclaredProperty'],
'htdocs/core/search_page.php' => ['PhanEmptyForeach', 'PhanPluginBothLiteralsBinaryOp'],
'htdocs/core/tpl/ajaxrow.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/bloc_comment.tpl.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/commonfields_view.tpl.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/core/tpl/document_actions_post_headers.tpl.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/tpl/extrafields_edit.tpl.php' => ['PhanPluginUndeclaredVariableIsset'],

View File

@ -106,10 +106,13 @@ if (!empty($user->socid)) {
$result = restrictedArea($user, 'tax', $object->id, 'tva', 'charges');
$resteapayer = 0;
/*
* Actions
*/
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
@ -279,6 +282,7 @@ if (empty($reshook)) {
$ret = $object->delete($user);
if ($ret > 0) {
$accountline = null;
if ($object->fk_bank) {
$accountline = new AccountLine($db);
$result = $accountline->fetch($object->fk_bank);
@ -292,7 +296,7 @@ if (empty($reshook)) {
header("Location: ".DOL_URL_ROOT.'/compta/tva/list.php');
exit;
} else {
$object->error = $accountline->error;
$object->error = $accountline !== null ? $accountline->error : 'No account line (no bank)';
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
}

View File

@ -269,7 +269,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
$company_static->name = $x_coll[$my_coll_thirdpartyid]['company_name'][$id];
$company_static->name_alias = $x_coll[$my_coll_thirdpartyid]['company_alias'][$id];
$company_static->email = $x_coll[$my_coll_thirdpartyid]['company_email'][$id];
$company_static->tva_intra = isset($x_coll[$my_coll_thirdpartyid]['tva_intra'][$id]) ? $x_coll[$my_coll_thirdpartyid]['tva_intra'][$id] : '0'; // @phan-suppress-current-line PhanTypeInvalidDimOffset
$company_static->tva_intra = isset($x_coll[$my_coll_thirdpartyid]['tva_intra'][$id]) ? $x_coll[$my_coll_thirdpartyid]['tva_intra'][$id] : '0'; // @phan-suppress-current-line PhanTypeInvalidDimOffset,PhanTypeArraySuspiciousNull
$company_static->client = $x_coll[$my_coll_thirdpartyid]['company_client'][$id];
$company_static->fournisseur = $x_coll[$my_coll_thirdpartyid]['company_fournisseur'][$id];
$company_static->status = $x_coll[$my_coll_thirdpartyid]['company_status'][$id];
@ -285,8 +285,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
'pid' => $x_coll[$my_coll_thirdpartyid]['pid'][$id],
'pref' => isset($x_coll[$my_coll_thirdpartyid]['pref'][$id]) ? $x_coll[$my_coll_thirdpartyid]['pref'][$id] : '',
'ptype' => $x_coll[$my_coll_thirdpartyid]['ptype'][$id],
'pstatus' => isset($x_paye[$my_coll_thirdpartyid]['pstatus'][$id]) ? $x_paye[$my_coll_thirdpartyid]['pstatus'][$id] : '', // @phan-suppress-current-line PhanTypeInvalidDimOffset
'pstatusbuy' => isset($x_paye[$my_coll_thirdpartyid]['pstatusbuy'][$id]) ? $x_paye[$my_coll_thirdpartyid]['pstatusbuy'][$id] : '', // @phan-suppress-current-line PhanTypeInvalidDimOffset
'pstatus' => isset($x_paye[$my_coll_thirdpartyid]['pstatus'][$id]) ? $x_paye[$my_coll_thirdpartyid]['pstatus'][$id] : '', // @phan-suppress-current-line PhanTypeInvalidDimOffset,PhanTypeArraySuspiciousNull
'pstatusbuy' => isset($x_paye[$my_coll_thirdpartyid]['pstatusbuy'][$id]) ? $x_paye[$my_coll_thirdpartyid]['pstatusbuy'][$id] : '', // @phan-suppress-current-line PhanTypeInvalidDimOffset,PhanTypeArraySuspiciousNull
'payment_id' => $x_coll[$my_coll_thirdpartyid]['payment_id'][$id],
'payment_ref' => isset($x_coll[$my_coll_thirdpartyid]['payment_ref'][$id]) ? $x_coll[$my_coll_thirdpartyid]['payment_ref'][$id] : '',

View File

@ -67,7 +67,7 @@ if (empty($page) || $page == -1) {
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) {
if (empty($sortfield)) {
$sortfield = "ptva.datep";
}
if (!$sortorder) {

View File

@ -276,7 +276,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
$company_static->name = $x_coll[$my_coll_rate]['company_name'][$id];
$company_static->name_alias = $x_coll[$my_coll_rate]['company_alias'][$id];
$company_static->email = $x_coll[$my_coll_rate]['company_email'][$id];
$company_static->tva_intra = isset($x_coll[$my_coll_rate]['tva_intra'][$id]) ? $x_coll[$my_coll_rate]['tva_intra'][$id] : '0';
$company_static->tva_intra = isset($x_coll[$my_coll_rate]['tva_intra'][$id]) ? $x_coll[$my_coll_rate]['tva_intra'][$id] : '0'; // @phan-suppress-current-line PhanTypeArraySuspiciousNull,PhanTypeInvalidDimOffset
$company_static->client = $x_coll[$my_coll_rate]['company_client'][$id];
$company_static->fournisseur = $x_coll[$my_coll_rate]['company_fournisseur'][$id];
$company_static->status = $x_coll[$my_coll_rate]['company_status'][$id];

View File

@ -716,7 +716,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</td></tr>';
} else {
print '<tr><td><label for="socid">'.$langs->trans("ThirdParty").'</label></td><td colspan="3" class="maxwidthonsmartphone">';
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($socid, 'socid', '', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company($socid, 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
print '</td></tr>';
}
}
@ -888,7 +888,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Default language
if (getDolGlobalInt('MAIN_MULTILANGS')) {
print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).'</td><td colspan="3" class="maxwidthonsmartphone">'."\n";
print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language(GETPOST('default_lang', 'alpha') ? GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone');
print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language(GETPOST('default_lang', 'alpha') ? GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, array(), 1, 0, 0, 'maxwidth200onsmartphone');
print '</td>';
print '</tr>';
}
@ -897,7 +897,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
print '<tr><td>'.$form->editfieldkey('Categories', 'contcats', '', $object, 0).'</td><td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, '', 'parent', 64, 0, 3);
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), null, null, null, null, '90%');
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), 0, 0, '', 0, '90%');
print "</td></tr>";
}
@ -1176,7 +1176,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Default language
if (getDolGlobalInt('MAIN_MULTILANGS')) {
print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).'</td><td colspan="3" class="maxwidthonsmartphone">'."\n";
print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language(GETPOST('default_lang', 'alpha') ? GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone');
print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language(GETPOST('default_lang', 'alpha') ? GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, array(), 1, 0, 0, 'maxwidth200onsmartphone');
print '</td>';
print '</tr>';
}
@ -1210,7 +1210,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('contcats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%');
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('contcats', $cate_arbo, $arrayselected, 0, 0, '', 0, '90%');
print "</td></tr>";
}

View File

@ -6,6 +6,7 @@
* Copyright (C) 2015-2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -212,7 +213,13 @@ print '<br>';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?id='.$id.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
$documentstatic = null;
$documentstaticline = null;
$sql_select = '';
$doc_number = '';
$dateprint = '';
$tables_from = '';
$where = '';
if ($type_element == 'fichinter') { // Customer : show products from invoices
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
$documentstatic = new Fichinter($db);
@ -318,6 +325,8 @@ if ($type_element == 'fichinter') { // Customer : show products from invoices
}
$parameters = array();
$totalnboflines = 0;
$sql = '';
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
if (!empty($sql_select)) {
@ -343,7 +352,7 @@ if (!empty($sql_select)) {
// if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid ';
$sql .= $where;
$sql .= dolSqlDateFilter($dateprint, 0, $month, $year);
if ($sref) {
if ($sref && !empty($doc_number)) {
$sql .= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'";
}
if ($sprod_fulldescr) {
@ -386,7 +395,7 @@ $param .= "&type_element=".urlencode($type_element);
$total_qty = 0;
$num = 0;
if ($sql_select) {
if ($sql_select && $documentstatic !== null) {
$resql = $db->query($sql);
if (!$resql) {
dol_print_error($db);
@ -584,7 +593,7 @@ if ($sql_select) {
}
} else {
if ($objp->fk_product > 0) {
echo $form->textwithtooltip($text, $description, 3, '', '', $i, 0, '');
echo $form->textwithtooltip($text, $description, 3, 0, '', $i, 0, '');
// Show range
echo get_date_range($objp->date_start, $objp->date_end);
@ -603,7 +612,7 @@ if ($sql_select) {
if (!empty($objp->label)) {
$text .= ' <strong>'.$objp->label.'</strong>';
echo $form->textwithtooltip($text, dol_htmlentitiesbr($objp->description), 3, '', '', $i, 0, '');
echo $form->textwithtooltip($text, dol_htmlentitiesbr($objp->description), 3, 0, '', $i, 0, '');
} else {
echo $text.' '.dol_htmlentitiesbr($objp->description);
}

View File

@ -75,7 +75,7 @@ if ($action == 'update' && !GETPOST("cancel") && $user->hasRight('societe', 'con
$result = $object->update_perso($id, $user);
if ($result > 0) {
$object->oldcopy = dol_clone($object, 2);
$object->oldcopy = dol_clone($object, 2); // @phan-suppres-current-line PhanTypeMismatchProperty
// Logo/Photo save
$dir = $conf->societe->dir_output.'/contact/'.get_exdir($object->id, 0, 0, 1, $object, 'contact').'/photos';

View File

@ -3,6 +3,7 @@
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -181,7 +182,7 @@ if ($object->id > 0) {
$morehtmlref .= $object->ref;
} else {
$morehtmlref .= $form->editfieldkey("", 'ref', $object->ref, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 3);
$morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 2);
$morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->hasRight('contrat', 'creer'), 'string', null, 0, 2);
}
$permtoedit = 0;

View File

@ -795,7 +795,7 @@ if (empty($reshook)) {
if (GETPOST('buying_price')) {
$pa_ht = price2num(GETPOST('buying_price'), '', 2);
} else {
$pa_ht = null;
$pa_ht = 0;
}
$fk_unit = GETPOSTINT('unit');
@ -811,9 +811,9 @@ if (empty($reshook)) {
$objectline->fk_product = GETPOSTINT('idprod');
$objectline->description = GETPOST('product_desc', 'restricthtml');
$objectline->price_ht = $price_ht;
$objectline->subprice = price2num(GETPOST('elprice'), 'MU');
$objectline->qty = price2num(GETPOST('elqty'), 'MS');
$objectline->price_ht = (float) $price_ht;
$objectline->subprice = (float) price2num(GETPOST('elprice'), 'MU');
$objectline->qty = (float) price2num(GETPOST('elqty'), 'MS');
$objectline->remise_percent = $remise_percent;
$objectline->tva_tx = ($txtva ? $txtva : 0); // Field may be disabled, so we use vat rate 0
$objectline->vat_src_code = $vat_src_code;

View File

@ -8,6 +8,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -177,7 +178,7 @@ if (!empty($modCodeContract->code_auto)) {
$morehtmlref .= $object->ref;
} else {
$morehtmlref .= $form->editfieldkey("", 'ref', $object->ref, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 3);
$morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 2);
$morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->hasRight('contrat', 'creer'), 'string', '', null, 2);
}
$permtoedit = 0;

View File

@ -555,7 +555,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort
if (!empty($sall)) {
$fieldstosearchall = array();
foreach ($fieldstosearchall as $key => $val) {
foreach ($fieldstosearchall as $key => $val) { // @phan-suppress-current-line PhanEmptyForeach
$fieldstosearchall[$key] = $langs->trans($val);
}
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).implode(', ', $fieldstosearchall).'</div>';
@ -569,7 +569,7 @@ if (isModEnabled('category') && ($user->hasRight('produit', 'lire') || $user->ha
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('IncludingProductWithTag');
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 0, 0, 1);
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'widthcentpercentminusx maxwidth300', 1);
$moreforfilter .= '</div>';
}

View File

@ -416,7 +416,7 @@ if (preg_match('/^set(\w+)$/', $action, $reg) && GETPOSTINT('id') > 0 && !empty(
if ($action == "update_extras" && GETPOSTINT('id') > 0 && !empty($permissiontoadd)) {
$object->fetch(GETPOSTINT('id'));
$object->oldcopy = dol_clone($object, 2);
$object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
$attribute = GETPOST('attribute', 'alphanohtml');
@ -644,6 +644,7 @@ if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) {
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes' && !empty($permissiontoadd)) {
// @phan-suppress-next-line PhanPluginBothLiteralsBinaryOp
if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers')) {
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
} else {

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2011-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -32,6 +33,12 @@
* @var string $contextpage
*/
// Next should be define in the including php source file
'
@phan-var-force int $withproject
@phan-var-force int $idcomment
';
require_once DOL_DOCUMENT_ROOT.'/core/class/comment.class.php';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -27,7 +28,11 @@
// $permissiontoedit must be defined to permission to edit object
// $object must be defined
// $langs must be defined
// $hidedetails, $hidedesc, $hideref must de defined
// $hidedetails, $hidedesc, $hideref must defined
'
@phan-var-force bool $permissiontoedit
@phan-var-force CommonObject $object
';
/**
* @var CommonObject $object
* @var Conf $conf

View File

@ -3,6 +3,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -37,6 +38,10 @@
* @var string $confirm
* @var string $forceFullTextIndexation
*/
'
@phan-var-force string $upload_dir
@phan-var-force string $forceFullTextIndexation
';
// Protection to understand what happen when submitting files larger than post_max_size
if (GETPOSTINT('uploadform') && empty($_POST) && empty($_FILES)) {

View File

@ -923,6 +923,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto
$pdf->SetCompression(false);
}
$pagecount = 0;
// Add all others
foreach ($files as $file) {
// Charge un document PDF depuis un fichier.
@ -1924,7 +1925,7 @@ if (!$error && ($massaction == 'clonetasks' || ($action == 'clonetasks' && $conf
}
if (empty($toselect)) {
$toselect=[];
$toselect = [];
}
$parameters['toselect'] = &$toselect;
$parameters['uploaddir'] = $uploaddir;

View File

@ -138,10 +138,11 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
$langs->load('mails');
$sendtosocid = 0; // Id of related thirdparty
if (is_object($object)) {
$result = $object->fetch($id);
$sendtosocid = 0; // Id of related thirdparty
if (method_exists($object, "fetch_thirdparty") && !in_array($object->element, array('member', 'user', 'expensereport', 'societe', 'contact'))) {
$resultthirdparty = $object->fetch_thirdparty();
$thirdparty = $object->thirdparty;
@ -436,7 +437,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
// Call of triggers (you should have set $triggersendname to execute trigger. $trigger_name is deprecated)
if (!empty($triggersendname) || !empty($trigger_name)) {
// Call trigger
$result = $object->call_trigger(empty($triggersendname) ? $trigger_name : $triggersendname, $user);
$result = $object->call_trigger(empty($triggersendname) ? $trigger_name : $triggersendname, $user); // @phan-suppress-current-line PhanPossiblyUndeclaredGlobalVariable
if ($result < 0) {
$error++;
}
@ -454,7 +455,8 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
setEventMessages($mesg, null, 'mesgs');
$moreparam = '';
if (isset($paramval2)) {
if (isset($paramval2)) { // @phan-var-suppress-current-line PhanPluginUndeclaredVariableIsset
// @phan-var-suppress-next-line PhanUndeclaredGlobalVariable
$moreparam .= '&'.($paramname2 ? $paramname2 : 'mid').'='.$paramval2;
}
header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname ?? 'id').'='.(is_object($object) ? $object->id : '').$moreparam);

View File

@ -41,15 +41,15 @@
* @var ?int $nomessageinsetmoduleoptions
*/
'
@phan-var-force FormSetup $formSetup
';
if ($action == 'update' && !empty($formSetup) && is_object($formSetup) && !empty($user->admin)) {
$formSetup->saveConfFromPost();
return;
}
'
@phan-var-force FormSetup $formSetup
';
$upload_dir = null;
if ($action == 'update' && !empty($arrayofparameters) && is_array($arrayofparameters) && !empty($user->admin)) {

View File

@ -67,6 +67,8 @@ if (!isset($mode) || $mode != 'noajax') { // For ajax call
$sortfield = GETPOST("sortfield", 'aZ09comma');
$sortorder = GETPOST("sortorder", 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
$showonrightsize = '';
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1

View File

@ -90,6 +90,7 @@ $langs->load("ecm");
// Define fullpathselecteddir.
$fullpathselecteddir = '<none>';
$fullpathpreopened = '';
if ($modulepart == 'ecm') {
$fullpathselecteddir = $conf->ecm->dir_output.'/'.($selecteddir != '/' ? $selecteddir : '');
$fullpathpreopened = $conf->ecm->dir_output.'/'.($preopened != '/' ? $preopened : '');
@ -367,7 +368,7 @@ if ((!isset($mode) || $mode != 'noajax') && is_object($db)) {
/**
* treeOutputForAbsoluteDir
*
* @param array<int,array{id:int,id_mere:int,fulllabel:string,fullpath:string,fullrelativename:string,label:string,description:string,cachenbofdoc:int,date_c:int,fk_user_c:int,statut_c:int,login_c:int,id_children?:int[],level:int}> $sqltree Sqltree
* @param array<int,array{id:int,id_mere:int,fulllabel:string,fullpath:string,fullrelativename:string,label:string,description:string,cachenbofdoc:int,date_c:int,fk_user_c:int,statut_c:int,login_c:string,id_children?:int[],level:int}> $sqltree Sqltree
* @param string $selecteddir Selected dir
* @param string $fullpathselecteddir Full path of selected dir
* @param string $modulepart Modulepart

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -91,6 +92,7 @@ if (!empty($objectfield)) {
}
}
$objecttmp = null;
if ($objectdesc) {
// Example of value for $objectdesc:
// Bom:bom/class/bom.class.php:0:t.status=1
@ -145,10 +147,10 @@ if ($usesublevelpermission && !isset($user->rights->$module->$element)) { // The
$searchkey = (($id && GETPOST((string) $id, 'alpha')) ? GETPOST((string) $id, 'alpha') : (($htmlname && GETPOST($htmlname, 'alpha')) ? GETPOST($htmlname, 'alpha') : ''));
// Add a security test to avoid to get content of all tables
if (!empty($objecttmp->module)) {
if ($objecttmp !== null && !empty($objecttmp->module)) {
restrictedArea($user, $objecttmp->module, $id, $objecttmp->table_element, $objecttmp->element);
} else {
restrictedArea($user, $objecttmp->element, $id);
restrictedArea($user, $objecttmp !== null ? $objecttmp->element : '', $id);
}
@ -162,7 +164,7 @@ top_httphead($outjson ? 'application/json' : 'text/html');
//print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
$arrayresult = $form->selectForFormsList($objecttmp, $htmlname, '', 0, $searchkey, '', '', '', 0, 1, 0, '', $filter);
$arrayresult = $form->selectForFormsList($objecttmp, $htmlname, 0, 0, $searchkey, '', '', '', 0, 1, 0, '', $filter);
$db->close();

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2015-2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -30,6 +31,7 @@
* @var Translate $langs
* @var User $user
*/
'@phan-var-force ?int<0,1> $usedbyinclude';
if (!isset($usedbyinclude) || empty($usedbyinclude)) {
if (!defined('NOTOKENRENEWAL')) {
@ -127,7 +129,7 @@ if (((isModEnabled('fournisseur') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERM
$arrayresult['searchintosupplierorder'] = array('position' => 110, 'img' => 'object_supplier_order', 'label' => $langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text' => img_picto('', 'object_supplier_order', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url' => DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (isModEnabled('reception') && !getDolGlobalString('MAIN_SEARCHFORM_SUPPLIER_RECEPTION_DISABLED') && $user->hasRight('reception', 'lire')) {
$arrayresult['searchintoreception'] = array('position'=>115, 'img'=>'object_reception', 'label'=>$langs->trans("SearchIntoSupplierReceptions", $search_boxvalue), 'text'=>img_picto('', 'object_reception', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierReceptions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/reception/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
$arrayresult['searchintoreception'] = array('position' => 115, 'img' => 'object_reception', 'label' => $langs->trans("SearchIntoSupplierReceptions", $search_boxvalue), 'text' => img_picto('', 'object_reception', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierReceptions", $search_boxvalue), 'url' => DOL_URL_ROOT.'/reception/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (((isModEnabled('fournisseur') && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight('fournisseur', 'facture', 'lire')) || (isModEnabled('supplier_invoice') && $user->hasRight('supplier_invoice', 'lire'))) && !getDolGlobalString('MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED')) {
$arrayresult['searchintosupplierinvoice'] = array('position' => 120, 'img' => 'object_supplier_invoice', 'label' => $langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text' => img_picto('', 'object_supplier_invoice', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url' => DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));