fix phpstan and fix CI (#31739)

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan
This commit is contained in:
Frédéric FRANCE 2024-11-10 11:16:23 +01:00 committed by GitHub
parent 27224afa9f
commit 15490b292f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
108 changed files with 207 additions and 986 deletions

File diff suppressed because it is too large Load Diff

View File

@ -132,8 +132,9 @@ if (isModEnabled('societe')) {
* Actions
*/
$error = 0;
if ($action == 'update') {
$error = 0;
// Process $list_account_main
foreach ($list_account_main as $constname) {
$constvalue = GETPOST($constname, 'alpha');

View File

@ -118,14 +118,14 @@ if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
$error = 0;
if ($cancel) {
header("Location: ".DOL_URL_ROOT.'/accountancy/bookkeeping/list.php');
exit;
}
if ($action == "confirm_update" && $permissiontoadd) {
$error = 0;
if (((float) $debit != 0.0) && ((float) $credit != 0.0)) {
$error++;
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
@ -180,8 +180,6 @@ if (empty($reshook)) {
}
}
} elseif ($action == "add" && $permissiontoadd) {
$error = 0;
if (((float) $debit != 0.0) && ((float) $credit != 0.0)) {
$error++;
setEventMessages($langs->trans('ErrorDebitCredit'), null, 'errors');
@ -263,8 +261,6 @@ if (empty($reshook)) {
}
$action = '';
} elseif ($action == "confirm_create" && $permissiontoadd) {
$error = 0;
$object = new BookKeeping($db);
if (!$journal_code || $journal_code == '-1') {

View File

@ -2,8 +2,8 @@
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2018-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

View File

@ -84,6 +84,7 @@ if (!$user->hasRight('accounting', 'bind', 'write')) {
/*
* Actions
*/
$error = 0;
if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('accounting', 'bind', 'write')) {
// Clean database by removing binding done on non existing or no more existing accounts
@ -110,7 +111,6 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('acc
}
if ($action == 'validatehistory' && $user->hasRight('accounting', 'bind', 'write')) {
$error = 0;
$nbbinddone = 0;
$nbbindfailed = 0;
$notpossible = 0;

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 Thibault FOUCART<support@ptibogxiv.net>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
/* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2020-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

View File

@ -238,6 +238,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
$permissiontoread = 0;
$permissiontodelete = 0;
$permissiontoadd = 0;
$error = 0;
$parameters = array('socid' => isset($socid) ? $socid : null, 'arrayfields' => &$arrayfields);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@ -291,7 +292,6 @@ if (empty($reshook)) {
// Close
if ($massaction == 'close' && $user->hasRight('adherent', 'creer')) {
$tmpmember = new Adherent($db);
$error = 0;
$nbclose = 0;
$db->begin();
@ -321,7 +321,6 @@ if (empty($reshook)) {
// Create external user
if ($massaction == 'createexternaluser' && $user->hasRight('adherent', 'creer') && $user->hasRight('user', 'user', 'creer')) {
$tmpmember = new Adherent($db);
$error = 0;
$nbcreated = 0;
$db->begin();
@ -358,7 +357,6 @@ if (empty($reshook)) {
if ($action == 'createsubscription_confirm' && $confirm == "yes" && $user->hasRight('adherent', 'creer')) {
$tmpmember = new Adherent($db);
$adht = new AdherentType($db);
$error = 0;
$nbcreated = 0;
$now = dol_now();
$amount = price2num(GETPOST('amount', 'alpha'));

View File

@ -134,6 +134,7 @@ $result = restrictedArea($user, 'adherent', $rowid, 'adherent_type');
/*
* Actions
*/
$error = 0;
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$search_ref = "";

View File

@ -80,6 +80,7 @@ if ($resql) {
/*
* Actions
*/
$error = 0;
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers

View File

@ -58,6 +58,7 @@ $type = 'bom';
/*
* Actions
*/
$error = 0;
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';

View File

@ -63,6 +63,7 @@ if (!getDolGlobalString('CHEQUERECEIPTS_ADDON')) {
/*
* Actions
*/
$error = 0;
if ($action == 'updateMask') {
$maskconstchequereceipts = GETPOST('maskconstchequereceipts', 'aZ09');

View File

@ -64,6 +64,7 @@ $type = 'delivery';
/*
* Actions
*/
$error = 0;
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';

View File

@ -69,6 +69,7 @@ if (!getDolGlobalString('EXPEDITION_ADDON_NUMBER')) {
/*
* Actions
*/
$error = 0;
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';

View File

@ -64,6 +64,7 @@ $type = 'expensereport';
/*
* Actions
*/
$error = 0;
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';

View File

@ -59,6 +59,7 @@ if (!$user->admin) {
/*
* Actions
*/
$error = 0;
// positionne la variable pour le nombre de rss externes
$sql = "SELECT ".$db->decrypt('name')." as name FROM ".MAIN_DB_PREFIX."const";

View File

@ -65,6 +65,7 @@ $type = 'ficheinter';
/*
* Actions
*/
$error = 0;
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';

View File

@ -64,6 +64,7 @@ if (!getDolGlobalString('HOLIDAY_ADDON')) {
/*
* Actions
*/
$error = 0;
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';

View File

@ -53,6 +53,7 @@ $form = new Form($db);
/*
* Actions
*/
$error = 0;
if ($action == 'setvalue') {
$db->begin();

View File

@ -84,9 +84,10 @@ complete_substitutions_array($substitutionarrayfortest, $langs);
/*
* Actions
*/
$error = 0;
if ($action == 'update' && !$cancel) {
if (!$error && !GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml')) {
if (!GETPOST("MAIN_MAIL_EMAIL_FROM", 'alphanohtml')) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MAIN_MAIL_EMAIL_FROM")), null, 'errors');
$action = 'edit';

View File

@ -59,6 +59,7 @@ $type = 'mrp';
/*
* Actions
*/
$error = 0;
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';

View File

@ -70,23 +70,20 @@ if (!$user->admin) {
/*
* Action
*/
$error = 0;
/*if (($mode == 'test' || $mode == 'setup') && empty($driver))
{
/*if (($mode == 'test' || $mode == 'setup') && empty($driver)) {
setEventMessages($langs->trans('PleaseSelectaDriverfromList'), null);
header("Location: ".$_SERVER['PHP_SELF'].'?mode=config');
exit;
}*/
if ($action == 'setconst' && $user->admin) {
$error = 0;
$db->begin();
$setupconstarray = GETPOST('setupdriver', 'array');
foreach ($setupconstarray as $setupconst) {
//print '<pre>'.print_r($setupconst, true).'</pre>';
$constname = dol_escape_htmltag($setupconst['varname']);
$constvalue = dol_escape_htmltag($setupconst['value']);
$consttype = dol_escape_htmltag($setupconst['type']);

View File

@ -67,6 +67,7 @@ $type = 'order';
/*
* Actions
*/
$error = 0;
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
@ -112,8 +113,8 @@ if ($action == 'updateMask') {
$module = new $classname($db);
'@phan-var-force ModelePDFCommandes $module';
/** @var ModelePDFCommandes $module */
if ($module->write_file($commande, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf");
return;

View File

@ -60,6 +60,7 @@ if (!getDolGlobalString('PAYMENT_ADDON')) {
/*
* Actions
*/
$error = 0;
if ($action == 'updateMask') {
$maskconstpayment = GETPOST('maskconstpayment', 'aZ09');

View File

@ -55,6 +55,7 @@ $type = 'paymentorder';
/*
* Actions
*/
$error = 0;
if ($action == "set") {
$db->begin();

View File

@ -49,6 +49,7 @@ $upload_dir = $conf->admin->dir_temp;
/*
* Actions
*/
$error = 0;
if (GETPOST('action', 'aZ09') == 'set_proxy') {
if (GETPOST("MAIN_USE_CONNECT_TIMEOUT") && !is_numeric(GETPOST("MAIN_USE_CONNECT_TIMEOUT"))) {

View File

@ -72,6 +72,7 @@ if (!getDolGlobalString('RECEPTION_ADDON_NUMBER')) {
/*
* Actions
*/
$error = 0;
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';

View File

@ -91,7 +91,7 @@ print load_fiche_titre($langs->trans("SecuritySetup"), '', 'title_setup');
print '<span class="opacitymedium">'.$langs->trans("CaptchaDesc")."</span><br>\n";
print "<br>\n";
$dirModCaptcha = array_merge(array('/core/modules/security/captcha/'), is_array($conf->modules_parts['captcha']) ? $conf->modules_parts['captcha'] : array());
$dirModCaptcha = array_merge(array('/core/modules/security/captcha/'), (isset($conf->modules_parts['captcha']) && is_array($conf->modules_parts['captcha'])) ? $conf->modules_parts['captcha'] : array());
// Load array with all captcha generation modules
$arrayhandler = array();
@ -112,6 +112,7 @@ foreach ($dirModCaptcha as $dirroot) {
$obj = new $classname($db, $conf, $langs, $user);
'@phan-var-force ModeleCaptcha $obj';
/** @var ModeleCaptcha $obj */
$arrayhandler[$obj->id] = $obj;
$i++;
}

View File

@ -57,6 +57,7 @@ $action = GETPOST('action', 'aZ09');
/*
* Actions
*/
$error = 0;
// Action mise a jour ou ajout d'une constante
if ($action == 'update' || $action == 'add') {

View File

@ -59,6 +59,8 @@ $type = 'stock';
/*
* Action
*/
$error = 0;
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
$reg = array();

View File

@ -85,6 +85,7 @@ $hookmanager->initHooks(array('admintranslation', 'globaladmin'));
/*
* Actions
*/
$error = 0;
if (GETPOST('cancel', 'alpha')) {
$action = 'list';

View File

@ -139,6 +139,7 @@ if (!$user->admin) {
/*
* Actions
*/
$error = 0;
// Actions add or modify a website
if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) {

View File

@ -75,6 +75,7 @@ if (empty($user->admin)) {
/*
* Actions
*/
$error = 0;
// Define barcode template for third-party
if (getDolGlobalString('BARCODE_THIRDPARTY_ADDON_NUM')) {

View File

@ -41,6 +41,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_db_name
*/
// Load translation files required by the page

View File

@ -148,6 +148,7 @@ $result = restrictedArea($user, 'bom');
/*
* Actions
*/
$error = 0;
if (GETPOST('cancel', 'alpha')) {
$action = 'list';
@ -194,7 +195,7 @@ if (empty($reshook)) {
// Validate records
if (!$error && $massaction == 'disable' && $permissiontoadd) {
if ($massaction == 'disable' && $permissiontoadd) {
$objecttmp = new $objectclass($db);
if (!$error) {
@ -277,7 +278,6 @@ if (empty($reshook)) {
} else {
$db->rollback();
}
//var_dump($listofobjectthirdparties);exit;
}
}
}

View File

@ -119,13 +119,10 @@ if (!$permissiontoread) {
}
/*
* Actions
*/
$error = 0;
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@ -134,8 +131,6 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
$error = 0;
$backurlforlist = dol_buildpath('/bookcal/availabilities_list.php', 1);
if (empty($backtopage) || ($cancel && empty($id))) {
@ -150,7 +145,6 @@ if (empty($reshook)) {
$triggermodname = 'BOOKCAL_AVAILABILITIES_MODIFY'; // Name of trigger action code to execute when we modify record
$startday = GETPOST('startday', 'int');
$startmonth = GETPOST('startmonth', 'int');
$startyear = GETPOST('startyear', 'int');
@ -236,22 +230,6 @@ $title = $langs->trans("Availabilities");
$help_url = '';
llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-bookcal page-card_availabilities');
// Example : Adding jquery code
// print '<script type="text/javascript">
// jQuery(document).ready(function() {
// function init_myfunc()
// {
// jQuery("#myid").removeAttr(\'disabled\');
// jQuery("#myid").attr(\'disabled\',\'disabled\');
// }
// init_myfunc();
// jQuery("#mybutton").click(function() {
// init_myfunc();
// });
// });
// </script>';
// Part to create
if ($action == 'create') {
if (empty($permissiontoadd)) {

View File

@ -44,6 +44,11 @@ if (!$user->admin) {
$action = GETPOST('action', 'aZ09');
/*
* Actions
*/
$error = 0;
if ($action == 'setvalue') {
$showmenu = GETPOST('BOOKMARKS_SHOW_IN_MENU', 'alpha');
$res = dolibarr_set_const($db, "BOOKMARKS_SHOW_IN_MENU", $showmenu, 'chaine', 0, '', $conf->entity);

View File

@ -163,6 +163,7 @@ $result = restrictedArea($user, 'societe', $object->id, '&societe', '', 'fk_soc'
/*
* Actions
*/
$error = 0;
$parameters = array('id' => $id, 'socid' => $id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some

View File

@ -329,6 +329,9 @@ llxHeader('', $langs->trans("Mailing"), 'EN:Module_EMailing|FR:Module_Mailing|ES
$form = new Form($db);
$formmailing = new FormMailing($db);
$arrayofselected = is_array($toselect) ? $toselect : array();
$totalarray = [
'nbfield' => 0,
];
if ($object->fetch($id) >= 0) {
$head = emailing_prepare_head($object);
@ -380,8 +383,7 @@ if ($object->fetch($id) >= 0) {
print dol_print_email($object->email_from, 0, 0, 0, 0, 1);
}
}
//print dol_print_email($object->email_from, 0, 0, 0, 0, 1);
//var_dump($object->email_from);
print '</td></tr>';
// Errors to
@ -799,6 +801,7 @@ if ($object->fetch($id) >= 0) {
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("ConfirmResetMailingTargetMassaction"), $langs->trans("ConfirmResetMailingTargetMassactionQuestion"), "confirm_reset_target", null, '', 0, 0, 500, 1);
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup
$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');

View File

@ -52,6 +52,7 @@ $lineid = GETPOSTINT('lineid');
$action = GETPOST('action', 'aZ09');
$object = new Propal($db);
$error = 0;
// Load object
if ($id > 0 || !empty($ref)) {

View File

@ -319,6 +319,7 @@ if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
/*
* Actions
*/
$error = 0;
if (GETPOST('cancel', 'alpha')) {
$action = 'list';
@ -424,10 +425,9 @@ if ($action == 'validate' && $permissiontovalidate) {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked) > 0) {
if ($tmpproposal->statut == $tmpproposal::STATUS_DRAFT) {
if ($tmpproposal->status == $tmpproposal::STATUS_DRAFT) {
if ($tmpproposal->valid($user) > 0) {
setEventMessages($langs->trans('hasBeenValidated', $tmpproposal->ref), null, 'mesgs');
} else {
@ -456,11 +456,10 @@ if ($action == "sign" && $permissiontoclose) {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked) > 0) {
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED) {
$tmpproposal->statut = $tmpproposal::STATUS_SIGNED;
if ($tmpproposal->status == $tmpproposal::STATUS_VALIDATED) {
$tmpproposal->status = $tmpproposal::STATUS_SIGNED;
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_SIGNED) >= 0) {
setEventMessages($tmpproposal->ref." ".$langs->trans('Signed'), null, 'mesgs');
} else {
@ -488,11 +487,10 @@ if ($action == "nosign" && $permissiontoclose) {
if (GETPOST('confirm') == 'yes') {
$tmpproposal = new Propal($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($tmpproposal->fetch($checked) > 0) {
if ($tmpproposal->statut == $tmpproposal::STATUS_VALIDATED || (getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE') && $tmpproposal->statut == $tmpproposal::STATUS_DRAFT)) {
$tmpproposal->statut = $tmpproposal::STATUS_NOTSIGNED;
if ($tmpproposal->status == $tmpproposal::STATUS_VALIDATED || (getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE') && $tmpproposal->statut == $tmpproposal::STATUS_DRAFT)) {
$tmpproposal->status = $tmpproposal::STATUS_NOTSIGNED;
if ($tmpproposal->closeProposal($user, $tmpproposal::STATUS_NOTSIGNED) > 0) {
setEventMessage($tmpproposal->ref." ".$langs->trans('NoSigned'), 'mesgs');
} else {

View File

@ -74,6 +74,7 @@ if (!$year_start) {
/*
* View
*/
$error = 0;
$form = new Form($db);

View File

@ -97,6 +97,7 @@ $extrafields->fetch_name_optionals_label($object->element);
/*
* Actions
*/
$error = 0;
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@ -138,8 +139,6 @@ if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->hasRight('b
}
if ($user->hasRight('banque', 'modifier') && $action == "update") {
$error = 0;
$result = $object->fetch($rowid);
if ($result <= 0) {
dol_syslog('Failed to read bank line with id '.$rowid, LOG_WARNING); // This happens due to old bug that has set fk_account to null.

View File

@ -117,6 +117,7 @@ $permissiontodelete = ($user->hasRight("cashdesk", "run") || $user->hasRight("ta
/*
* Actions
*/
$error = 0;
if (empty($backtopage)) {
$backtopage = DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?id='.(!empty($id) && $id > 0 ? $id : '__ID__');
@ -147,7 +148,6 @@ if ($action == "reopen" && $permissiontoadd) {
}
if ($action == "start" && $permissiontoadd) {
$error = 0;
if (!GETPOST('posmodule', 'alpha') || GETPOST('posmodule', 'alpha') == '-1') {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Module")), null, 'errors');
$action = 'create';
@ -169,7 +169,6 @@ if ($action == "start" && $permissiontoadd) {
$action = 'start';
$error++;
}
$error = 0;
foreach ($arrayofpaymentmode as $key => $val) {
$object->$key = (float) price2num(GETPOST($key.'_amount', 'alpha'));
}

View File

@ -200,6 +200,7 @@ $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', 'rowid
/*
* Actions
*/
$error = 0;
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@ -523,8 +524,6 @@ if (empty($reshook)) {
$object->cond_reglement_code = 0; // To clean property
$object->cond_reglement_id = 0; // To clean property
$error = 0;
$db->begin();
if (!$error) {
@ -1060,7 +1059,6 @@ if (empty($reshook)) {
$db->begin();
$error = 0;
$originentity = GETPOSTINT('originentity');
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);

View File

@ -12,7 +12,7 @@
* Copyright (C) 2023 Lenin Rivas <lenin.rivas777@gmail.com>
* Copyright (C) 2023 Sylvain Legrand <technique@infras.fr>
* Copyright (C) 2023 William Mead <william.mead@manchenumerique.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* 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
@ -98,6 +98,7 @@ $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $field
/*
* Actions
*/
$error = 0;
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
@ -107,8 +108,6 @@ if ($reshook < 0) {
if (empty($reshook)) {
if (($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm == 'yes')) && $usercanissuepayment) {
$error = 0;
$datepaye = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
$paiement_id = 0;
$totalpayment = 0;
@ -223,8 +222,6 @@ if (empty($reshook)) {
* Action confirm_paiement
*/
if ($action == 'confirm_paiement' && $confirm == 'yes' && $usercanissuepayment) {
$error = 0;
$datepaye = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'), 'tzuser');
$db->begin();

View File

@ -1089,11 +1089,11 @@ class BonPrelevement extends CommonObject
$error = 0;
// Pre-store some values into variables to simplify following sql requests
if ($sourcetype != 'salary') {
$entity = $type != 'bank-transfer' ? getEntity('invoice') : getEntity('supplier_invoice');
$entities = $type != 'bank-transfer' ? getEntity('invoice') : getEntity('supplier_invoice');
$socOrUser = 'fk_soc';
$societeOrUser = 'societe';
} else {
$entity = getEntity('salary');
$entities = getEntity('salary');
$sqlTable = 'salary';
$socOrUser = 'fk_user';
$societeOrUser = 'user';
@ -1173,7 +1173,7 @@ class BonPrelevement extends CommonObject
// TODO Add 'AND sr.default_rib = 1' in sourcetype salary too Note: the column has been created in v21 in llx_user_rib and default to 0
// If we add a test on sr.default_rib = 1, we must also check we have a correct error management to stop if no default BAN is found.
}
$sql .= " WHERE f.entity IN (".((int) $entity).')';
$sql .= " WHERE f.entity IN (".$this->db->escape($entities).')';
if ($sourcetype != 'salary') {
$sql .= " AND f.fk_statut = 1"; // Invoice validated
$sql .= " AND f.paye = 0";

View File

@ -103,6 +103,7 @@ if ($type == 'bank-transfer') {
/*
* Actions
*/
$error = 0;
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$search_ref = "";

View File

@ -74,7 +74,7 @@
$hidedetails = isset($hidedetails) ? $hidedetails : '';
$hidedesc = isset($hidedesc) ? $hidedesc : '';
$hideref = isset($hideref) ? $hideref : '';
$error = 0;
if (!empty($permissionedit) && empty($permissiontoadd)) {
$permissiontoadd = $permissionedit; // For backward compatibility

View File

@ -56,6 +56,7 @@ if ((GETPOST('sendit', 'alpha')
die;
}
$error = 0;
// Submit file/link
if (GETPOST('sendit', 'alpha') && getDolGlobalString('MAIN_UPLOAD_DOC') && !empty($permissiontoadd)) {

View File

@ -56,6 +56,7 @@
* @var ?string $option
* @var ?int $deliveryreceipt
* @var string $massaction
* @var string $objectclass
* @var string $uploaddir
* @var string $confirm
*/
@ -711,7 +712,7 @@ if (!$error && $massaction == 'confirm_presend') {
// End call triggers
if ($error) {
setEventMessages($db->lasterror(), $errors, 'errors');
setEventMessages($db->lasterror(), null, 'errors');
dol_syslog("Error in trigger ".$triggername.' '.$db->lasterror(), LOG_ERR);
}
}

View File

@ -35,6 +35,7 @@
* @var CommonObject $object
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Societe $mysoc
* @var Translate $langs
*
@ -47,6 +48,8 @@
@phan-var-force CommonObject $object
';
$error = 0;
/*
* Add file in email form
*/

View File

@ -28,7 +28,13 @@
// $nomessageinupdate can be set to 1
// $nomessageinsetmoduleoptions can be set to 1
// $formSetup may be defined
/**
* @var FormSetup $formSetup
* @var string $action
* @var int $error
* @var ?int $nomessageinupdate
* @var ?int $nomessageinsetmoduleoptions
*/
if ($action == 'update' && !empty($formSetup) && is_object($formSetup) && !empty($user->admin)) {
$formSetup->saveConfFromPost();

View File

@ -8488,7 +8488,7 @@ class Form
return 'selectForForms: Error bad setup of field objectdescorig=' . $objectdescorig.', objectfield='.$objectfield.', objectdesc='.$objectdesc;
}
'@phan-var-force CommonObject $objecttmp';
/** @var CommonObject $objecttmp */
//var_dump($filter);
$prefixforautocompletemode = $objecttmp->element;
if ($prefixforautocompletemode == 'societe') {

View File

@ -2189,6 +2189,7 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo
$textforfulltextindex = '';
$keywords = '';
$cmd = 'unknown';
if (preg_match('/\.pdf/i', $filename)) {
// TODO Move this into external submodule files

View File

@ -287,7 +287,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = 0)
global $dolibarr_main_url_root, $dolibarr_main_data_root;
global $website;
global $includehtmlcontentopened;
'@phan-var-force WebSite $website';
'@phan-var-force Website $website';
$nbrep = 0;
@ -519,7 +519,7 @@ function dolWebsiteSaveContent($content)
function redirectToContainer($containerref, $containeraliasalt = '', $containerid = 0, $permanent = 0, $parameters = array())
{
global $db, $website;
'@phan-var-force WebSite $website';
'@phan-var-force Website $website';
$newurl = '';
$result = 0;
@ -604,7 +604,7 @@ function includeContainer($containerref)
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running included containers.
global $includehtmlcontentopened;
global $websitekey, $websitepagefile;
'@phan-var-force WebSite $website';
'@phan-var-force Website $website';
$MAXLEVEL = 20;
@ -660,7 +660,7 @@ function includeContainer($containerref)
function getStructuredData($type, $data = array())
{
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs, $pagelangs; // Very important. Required to have var available when running included containers.
'@phan-var-force WebSite $website';
'@phan-var-force Website $website';
$type = strtolower($type);
@ -868,7 +868,7 @@ function getStructuredData($type, $data = array())
function getSocialNetworkHeaderCards($params = null)
{
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running included containers.
'@phan-var-force WebSite $website';
'@phan-var-force Website $website';
$out = '';
@ -944,7 +944,7 @@ function getSocialNetworkHeaderCards($params = null)
function getSocialNetworkSharingLinks($socialnetworks = '')
{
global $website, $websitepage; // Very important. Required to have var available when running included containers.
'@phan-var-force WebSite $website';
'@phan-var-force Website $website';
$out = '<!-- section for social network sharing of page -->'."\n";
@ -1172,7 +1172,7 @@ function getPublicFilesOfObject($object)
function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $sortfield = 'date_creation', $sortorder = 'DESC', $langcode = '', $otherfilters = [], $status = 1)
{
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running included containers.
'@phan-var-force WebSite $website';
'@phan-var-force Website $website';
$error = 0;
$arrayresult = array('code' => '', 'list' => array());

View File

@ -133,19 +133,19 @@ class modCaptchaStandard extends ModeleCaptcha
function submitFormFromCaptcha(event) {
console.log("submitFormFromCaptcha");
// Prevent the default action of the link
event.preventDefault();
// Search the form
// Prevent the default action of the link
event.preventDefault();
// Search the form
const form = event.target.closest("form");
// Submit the form if found
if (form) {
// Submit the form if found
if (form) {
console.log("we set actionlogin to value \"disabled\"");
document.getElementById("actionlogin").value = "disabled";
form.submit();
}
}
form.submit();
}
}
</script>
<!-- End code for Captcha -->'."\n";
@ -164,7 +164,7 @@ class modCaptchaStandard extends ModeleCaptcha
{
$sessionkey = 'dol_antispam_value'; // The same key than set into the /core/antispamimage.php file.
$ok = (array_key_exists($sessionkey, $_SESSION) && (strtolower($_SESSION[$sessionkey]) === strtolower(GETPOST('code', 'restricthtml'))));
$ok = (array_key_exists($sessionkey, $_SESSION) && (strtolower($_SESSION[$sessionkey]) === strtolower(GETPOST('code', 'restricthtml')))) ? 1 : 0;
return $ok;
}

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2014 Maxime Kohlhaas <support@atm-consulting.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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 Conf $conf
* @var DoliDB $db
* @var ExtraFields $extrafields
* @var HookManager $hookmanager
* @var Translate $langs
*
* @var Societe $thirdpartytopropagateextrafieldsfrom

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2014 Maxime Kohlhaas <support@atm-consulting.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -26,6 +27,8 @@
/**
* @var CommonObject $object
* @var Conf $conf
* @var ExtraFields $extrafields
* @var HookManager $hookmanager
* @var Translate $langs
* @var string $action
* @var array<string,mixed> $parameters

View File

@ -27,6 +27,7 @@
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
* @var Website $website
*/
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
@ -49,11 +50,13 @@ if (empty($module)) {
$module = 'ecm';
}
'@phan-var-force WebSite $website';
'@phan-var-force Website $website';
$permtoadd = 0;
$permtoupload = 0;
$showroot = 0;
$error = 0;
if ($module == 'ecm') {
$permtoadd = $user->hasRight("ecm", "setup");
$permtoupload = $user->hasRight("ecm", "upload");

View File

@ -44,6 +44,7 @@
* @var CommonObject $object
* @var CommonObject $this
* @var CommonObjectLine $line
* @var Conf $conf
* @var HookManager $hookmanager
* @var ?Product $product_static
* @var Societe $mysoc

View File

@ -109,6 +109,7 @@ $permissiontoexecute = $user->hasRight('cron', 'execute');
/*
* Actions
*/
$error = 0;
if (GETPOST('cancel', 'alpha')) {
$action = 'list';

View File

@ -100,6 +100,7 @@ if (!$user->admin) {
*/
$nbdone = 0;
$error = 0;
foreach ($arrayofparameters as $title => $tab) {
foreach ($tab as $key => $val) {

View File

@ -62,6 +62,7 @@ $type = 'donation';
/*
* Action
*/
$error = 0;
if ($action == 'specimen') {
$modele = GETPOST('module', 'alpha');

View File

@ -105,6 +105,8 @@ $permissiontodelete = $user->hasRight('don', 'supprimer');
* Actions
*/
$error = 0;
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
@ -180,8 +182,6 @@ if (empty($reshook)) {
exit;
}
$error = 0;
if (empty($donation_date)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = "create";
@ -235,8 +235,6 @@ if (empty($reshook)) {
exit;
}
$error = 0;
if (isModEnabled("societe") && getDolGlobalString('DONATION_USE_THIRDPARTIES') && !(GETPOSTINT("socid") > 0)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")), null, 'errors');
$action = "create";

View File

@ -97,7 +97,7 @@ class EcmFiles extends CommonObject
public $keywords;
/**
* @var string content
* @var ?string content
*/
public $content;

View File

@ -62,6 +62,8 @@ if (empty($objectclass) || empty($uploaddir)) {
@phan-var-force array<string,mixed> $parameters
';
$error = 0;
// Mass actions. Controls on number of lines checked.
$maxformassaction = (!getDolGlobalString('MAIN_LIMIT_FOR_MASS_ACTIONS') ? 1000 : $conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS);
if (!empty($massaction) && is_array($toselect) && count($toselect) < 1) {

View File

@ -144,7 +144,7 @@ $typeobject = null;
/*
* Actions
*/
$error = 0;
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
@ -240,8 +240,6 @@ if (empty($reshook)) {
// Create shipment
if ($action == 'add' && $permissiontoadd) {
$error = 0;
$db->begin();
$object->note = GETPOST('note', 'restricthtml');

View File

@ -102,7 +102,7 @@ $permissiondellink = $user->hasRight('expedition', 'creer'); // Used by the incl
/*
* Actions
*/
$error = 0;
$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) {

View File

@ -169,6 +169,8 @@ $permissiontoadd = $user->hasRight('expensereport', 'creer'); // Used by the inc
/*
* Actions
*/
$error = 0;
$value_unit_ht = price2num(GETPOST('value_unit_ht', 'alpha'), 'MU');
$value_unit = price2num(GETPOST('value_unit', 'alpha'), 'MU');
$qty = price2num(GETPOST('qty', 'alpha'));
@ -265,8 +267,6 @@ if (empty($reshook)) {
}
if ($action == 'add' && $permissiontoadd) {
$error = 0;
$object = new ExpenseReport($db);
$object->date_debut = $date_start;
@ -387,8 +387,6 @@ if (empty($reshook)) {
}
if ($action == "confirm_validate" && GETPOST("confirm", 'alpha') == "yes" && $id > 0 && $permissiontoadd) {
$error = 0;
$db->begin();
$object = new ExpenseReport($db);
@ -1128,8 +1126,6 @@ if (empty($reshook)) {
}
if ($action == "addline" && $user->hasRight('expensereport', 'creer')) {
$error = 0;
// First save uploaded file
$fk_ecm_files = 0;
if (GETPOSTISSET('attachfile')) {

View File

@ -126,9 +126,9 @@ $permissiontodelete = $user->hasRight('ficheinter', 'supprimer');
/*
* Actions
*/
$error = 0;
if ($cancel) {
/*var_dump($cancel);var_dump($backtopage);var_dump($backtopageforcancel);exit;*/
if (!empty($backtopageforcancel)) {
header("Location: ".$backtopageforcancel);
exit;

View File

@ -105,7 +105,7 @@ if ($object->id > 0) {
/*
* Action
*/
$error = 0;
$parameters = array('id' => $id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {

View File

@ -111,13 +111,15 @@ if (!isModEnabled('stock')) {
}
$usercancreate = ($user->hasRight("fournisseur", "commande", "creer") || $user->hasRight("supplier_order", "creer"));
$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php
$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php
/*
* Actions
*/
$error = 0;
$errors = [];
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
@ -125,7 +127,6 @@ if ($reshook < 0) {
}
if ($action == 'checkdispatchline' && $permissiontocontrol) {
$error = 0;
$supplierorderdispatch = new CommandeFournisseurDispatch($db);
$db->begin();
@ -162,7 +163,6 @@ if ($action == 'checkdispatchline' && $permissiontocontrol) {
}
if ($action == 'uncheckdispatchline' && $permissiontocontrol) {
$error = 0;
$supplierorderdispatch = new CommandeFournisseurDispatch($db);
$db->begin();
@ -198,7 +198,6 @@ if ($action == 'uncheckdispatchline' && $permissiontocontrol) {
}
if ($action == 'denydispatchline' && $permissiontocontrol) {
$error = 0;
$supplierorderdispatch = new CommandeFournisseurDispatch($db);
$db->begin();
@ -235,7 +234,6 @@ if ($action == 'denydispatchline' && $permissiontocontrol) {
$saveprice = "savepriceIsNotSet";
if ($action == 'dispatch' && $permissiontoreceive) {
$error = 0;
$notrigger = 0;
$db->begin();
@ -461,7 +459,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && $permissiontoreceive
}
if ($error > 0) {
$db->rollback();
setEventMessages($error, $errors, 'errors');
setEventMessages(null, $errors, 'errors');
} else {
$db->commit();
}
@ -470,7 +468,6 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && $permissiontoreceive
// Update a dispatched line
if ($action == 'updateline' && $permissiontoreceive && empty($cancel)) {
$db->begin();
$error = 0;
$supplierorderdispatch = new CommandeFournisseurDispatch($db);
$result = $supplierorderdispatch->fetch($lineid);

View File

@ -248,7 +248,7 @@ $permissiontodelete = ($user->hasRight("fournisseur", "facture", "supprimer") ||
/*
* Actions
*/
$error = 0;
if (GETPOST('cancel', 'alpha')) {
$action = 'list';
$massaction = '';

View File

@ -124,6 +124,7 @@ $permissiontoadd = ($user->hasRight("fournisseur", "facture", "creer") || $user-
/*
* Actions
*/
$error = 0;
if ($cancel) {
if (!empty($backtopageforcancel)) {
@ -158,8 +159,6 @@ if ($reshook < 0) {
if (empty($reshook)) {
if (($action == 'add_paiement' || ($action == 'confirm_paiement' && $confirm == 'yes')) && $permissiontoadd) {
$error = 0;
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$paiement_id = 0;
$totalpayment = 0;
@ -277,8 +276,6 @@ if (empty($reshook)) {
* Action confirm_paiement
*/
if ($action == 'confirm_paiement' && $confirm == 'yes') {
$error = 0;
$datepaye = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
$multicurrency_code = array();

View File

@ -67,6 +67,7 @@ $socid = GETPOSTINT('socid');
$langs->loadLangs(array("other", "holiday", "mails", "trips"));
$error = 0;
$errors = [];
$now = dol_now();
@ -973,6 +974,7 @@ if (empty($reshook)) {
*/
$form = new Form($db);
$formfile = new FormFile($db);
$object = new Holiday($db);
$listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon"));
@ -1021,7 +1023,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
break;
}
setEventMessages($errors, null, 'errors');
setEventMessages(null, $errors, 'errors');
}
@ -1029,9 +1031,9 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
$( document ).ready(function() {
$("input.button-save").click("submit", function(e) {
console.log("Call valider()");
if (document.demandeCP.date_debut_.value != "")
{
if(document.demandeCP.date_fin_.value != "")
if (document.demandeCP.date_debut_.value != "")
{
if(document.demandeCP.date_fin_.value != "")
{
if(document.demandeCP.valideur.value != "-1") {
return true;
@ -1052,7 +1054,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
alert("'.dol_escape_js($langs->transnoentities('NoDateDebut')).'");
return false;
}
});
});
});
</script>'."\n";
@ -1275,7 +1277,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
break;
}
setEventMessages($errors, null, 'errors');
setEventMessages(null, $errors, 'errors');
}
// check if the user has the right to read this request

View File

@ -57,3 +57,4 @@ ECMParentDirectory=Parent directory
ShowFile=Show file
FullPathOrig=Full path origin
GenOrUpload=File origin
FileHasAnIndexedTextContent=File has an indexed text content

View File

@ -5273,7 +5273,7 @@ if ($module == 'initmodule') {
// Search all files of modules mentioned by menu
$listODifferentUrlsInMenu = array();
foreach ($menus as $obj) {
if (preg_match('/^\/'.preg_quote(strtolower($module), '/').'\//', $obj['url'])) {
if (preg_match('/^\/'.preg_quote(strtolower($module), '/').'\//', $obj['url']) && !empty($pathoffile)) {
if (!empty($listODifferentUrlsInMenu[$pathoffile])) { // Test to avoid to show same file twice.
continue;
}

View File

@ -60,6 +60,7 @@ $nblines = $object->fetch_lines();
/*
* Actions
*/
$error = 0;
// Return to the results
if (GETPOST('cancel')) {

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -48,7 +48,7 @@ if (!$user->admin) {
}
$action = GETPOST('action', 'aZ09');
$error = 0;
if ($action == 'setvalue' && $user->admin) {
$db->begin();

View File

@ -51,6 +51,7 @@ if (!$user->admin) {
}
$action = GETPOST('action', 'aZ09');
$error = 0;
if ($action == 'setvalue' && $user->admin) {
$db->begin();

View File

@ -67,6 +67,7 @@ if (!$user->admin) {
/*
* Action
*/
$error = 0;
if (($mode == 'test' || $mode == 'setup') && empty($driver)) {
setEventMessages($langs->trans('PleaseSelectaDriverfromList'), null);
@ -75,7 +76,6 @@ if (($mode == 'test' || $mode == 'setup') && empty($driver)) {
}
if ($action == 'setconst' && $user->admin) {
$error = 0;
$db->begin();
foreach ($_POST['setupdriver'] as $setupconst) {
'@phan-var-force array<string,string> $setupconst';

View File

@ -316,7 +316,6 @@ if (getDolGlobalString('PRODUIT_MULTIPRICES')) {
}
}
//var_dump($arraypricelevel);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -337,6 +336,7 @@ if ($search_type == '0') {
/*
* Actions
*/
$error = 0;
if (GETPOST('cancel', 'alpha')) {
$action = 'list';
@ -407,7 +407,7 @@ if (empty($reshook)) {
$uploaddir = $conf->product->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
if (!$error && $massaction == 'switchonsalestatus' && $permissiontoadd) {
if ($massaction == 'switchonsalestatus' && $permissiontoadd) {
$product = new Product($db);
foreach ($toselect as $toselectid) {
$result = $product->fetch($toselectid);
@ -418,7 +418,7 @@ if (empty($reshook)) {
}
}
}
if (!$error && $massaction == 'switchonpurchasestatus' && $permissiontoadd) {
if ($massaction == 'switchonpurchasestatus' && $permissiontoadd) {
$product = new Product($db);
foreach ($toselect as $toselectid) {
$result = $product->fetch($toselectid);

View File

@ -619,10 +619,8 @@ if ($action == 'create') {
print "</div>";
// Show list of products into warehouse
$totalarray = array();
$totalarray['val'] = array();
$totalarray['pos'] = array();
@ -743,6 +741,7 @@ if ($action == 'create') {
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$units = 0;
$sameunits = true;
while ($i < $num) {
@ -854,8 +853,6 @@ if ($action == 'create') {
print "</tr>";
$i++;
// Define $unit and $sameunits
if (getDolGlobalString('PRODUCT_USE_UNITS')) {
if ($i == 0) {
@ -864,6 +861,8 @@ if ($action == 'create') {
$sameunits = false;
}
}
$i++;
}
$db->free($resql);

View File

@ -53,6 +53,7 @@ $lineid = GETPOSTINT('lineid');
$action = GETPOST('action', 'alpha');
$object = new StockTransfer($db);
$error = 0;
// Load object
//include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'.

View File

@ -164,7 +164,7 @@ $search_array_options_task = $extrafields->getOptionalsFromPost($object->table_e
/*
* Actions
*/
$error = 0;
$parameters = array('id' => $id, 'taskid' => $taskid, 'projectid' => $projectid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {

View File

@ -64,7 +64,7 @@ $type = 'project';
/*
* Actions
*/
$error = 0;
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask') {
@ -89,7 +89,7 @@ if ($action == 'updateMask') {
if ($action == 'updateMaskTask') {
$maskconstmasktask = GETPOST('maskconsttask', 'aZ09');
$masktaskt = GETPOST('masktask', 'alpha');
$res = 0;
if ($maskconstmasktask && preg_match('/_MASK$/', $maskconstmasktask)) {
$res = dolibarr_set_const($db, $maskconstmasktask, $masktaskt, 'chaine', 0, '', $conf->entity);
}
@ -125,15 +125,15 @@ if ($action == 'updateMaskTask') {
require_once $file;
$module = new $classname($db);
'@phan-var-force ModelePDFProjects $module';
/** @var ModelePDFProjects $module */
if ($module->write_file($project, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=project&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($obj->error, $obj->errors, 'errors');
dol_syslog($obj->error, LOG_ERR);
setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
@ -161,15 +161,15 @@ if ($action == 'updateMaskTask') {
require_once $file;
$module = new $classname($db);
'@phan-var-force ModelePDFTask $module';
/** @var ModelePDFTask $module */
if ($module->write_file($project, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=project_task&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($obj->error, $obj->errors, 'errors');
dol_syslog($obj->error, LOG_ERR);
setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
@ -435,6 +435,7 @@ if (!getDolGlobalString('PROJECT_HIDE_TASKS')) {
$module = new $file();
'@phan-var-force ModeleNumRefTask $module';
/** @var ModeleNumRefTask $module */
// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {

View File

@ -126,7 +126,7 @@ $permissiondellink = $user->hasRight('projet', 'creer'); // Used by the include
/*
* Actions
*/
$error = 0;
$parameters = array('id' => $socid, 'objcanvas' => $objcanvas);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
@ -303,8 +303,6 @@ if (empty($reshook)) {
}
if ($action == 'update' && empty(GETPOST('cancel')) && $permissiontoadd) {
$error = 0;
if (empty($ref)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref")), null, 'errors');
@ -419,7 +417,6 @@ if (empty($reshook)) {
}
if ($action == 'set_opp_status' && $user->hasRight('projet', 'creer')) {
$error = 0;
if (GETPOSTISSET('opp_status')) {
$object->opp_status = $opp_status;
}

View File

@ -81,7 +81,7 @@ $permissiontoadd = $user->hasRight('projet', 'creer');
/*
* Actions
*/
$error = 0;
$parameters = array('id' => $id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
if ($reshook < 0) {

View File

@ -346,7 +346,7 @@ if ($mode == 'kanban' && $groupby) {
/*
* Actions
*/
$error = 0;
if (GETPOST('cancel', 'alpha')) {
$action = 'list';
$massaction = '';

View File

@ -204,6 +204,7 @@ $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
/*
* Actions
*/
$error = 0;
if ($cancel) {
if (!empty($backtopageforcancel)) {
@ -339,8 +340,6 @@ if (count($morewherefilterarray) > 0) {
}
if ($action == 'createtask' && $user->hasRight('projet', 'creer')) {
$error = 0;
// If we use user timezone, we must change also view/list to use user timezone everywhere
$date_start = dol_mktime(GETPOSTINT('date_starthour'), GETPOSTINT('date_startmin'), 0, GETPOSTINT('date_startmonth'), GETPOSTINT('date_startday'), GETPOSTINT('date_startyear'));
$date_end = dol_mktime(GETPOSTINT('date_endhour'), GETPOSTINT('date_endmin'), 0, GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear'));

View File

@ -94,10 +94,9 @@ restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
/*
* Actions
*/
$error = 0;
if ($action == 'update' && !GETPOST("cancel") && $user->hasRight('projet', 'creer')) {
$error = 0;
if (empty($taskref)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref")), null, 'errors');

View File

@ -161,6 +161,7 @@ if ($object->fk_project > 0) {
/*
* Actions
*/
$error = 0;
if (GETPOST('cancel', 'alpha')) {
$action = '';
@ -212,8 +213,6 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
}
if ($action == 'addtimespent' && $user->hasRight('projet', 'time')) {
$error = 0;
$timespent_durationhour = GETPOSTINT('timespent_durationhour');
$timespent_durationmin = GETPOSTINT('timespent_durationmin');
if (empty($timespent_durationhour) && empty($timespent_durationmin)) {
@ -278,8 +277,6 @@ if ($action == 'addtimespent' && $user->hasRight('projet', 'time')) {
}
if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $user->hasRight('projet', 'lire')) {
$error = 0;
if (!GETPOST("new_durationhour") && !GETPOST("new_durationmin")) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Duration")), null, 'errors');
$error++;
@ -788,8 +785,6 @@ if ($action == 'confirm_generateinvoice') {
$mesg = str_replace('{s1}', $urltoinvoice, $mesg);
setEventMessages($mesg, null, 'mesgs');
//var_dump($tmpinvoice);
$db->commit();
} else {
$db->rollback();

View File

@ -81,14 +81,14 @@ $nbcolonnes = substr_count($object->sujet, ',') + 1;
$listofvoters = explode(',', $_SESSION["savevoter"]);
$error = 0;
// Add comment
if (GETPOST('ajoutcomment', 'alpha')) {
if (!$canbemodified) {
httponly_accessforbidden('ErrorForbidden');
}
$error = 0;
$comment = GETPOST("comment", 'alphanohtml');
$comment_user = GETPOST('commentuser', 'alphanohtml');

View File

@ -72,6 +72,7 @@ $langs->loadLangs(array("other", "dict", "bills", "companies", "errors", "paybox
// No check on module enabled. Done later according to $validpaymentmethod
$errmsg = '';
$error = 0;
$action = GETPOST('action', 'aZ09');
$id = GETPOSTINT('id');
$securekeyreceived = GETPOST("securekey", 'alpha');

View File

@ -72,6 +72,7 @@ global $dolibarr_main_url_root;
$errmsg = '';
$num = 0;
$error = 0;
$errors = [];
$backtopage = GETPOST('backtopage', 'alpha');
$action = GETPOST('action', 'aZ09');

View File

@ -77,6 +77,7 @@ $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors",
// No check on module enabled. Done later according to $validpaymentmethod
$errmsg = '';
$error = 0;
$action = GETPOST('action', 'aZ09');
$id = GETPOST('id');
$securekeyreceived = GETPOST("securekey");

View File

@ -169,6 +169,7 @@ restrictedArea($user, 'salaries', 0, 'salary', '');
/*
* Actions
*/
$error = 0;
if (GETPOST('cancel', 'alpha')) {
$action = 'list';

View File

@ -60,6 +60,7 @@ $formcompany = new FormCompany($db);
/*
* Actions
*/
$error = 0;
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';

View File

@ -61,6 +61,7 @@ $action = GETPOST('action', 'aZ09');
/*
* Actions
*/
$error = 0;
if ($action == 'setvalue' && $user->admin) {
$db->begin();

View File

@ -49,6 +49,7 @@ $langs->loadLangs(array("admin", "cashdesk", "commercial"));
/*
* Actions
*/
$error = 0;
if (GETPOST('action', 'alpha') == 'set') {
$db->begin();

Some files were not shown because too many files have changed in this diff Show More