FIX: Resolve possibly-undefined-variable cases flagged by PHPStan (#39523)

* FIX: Resolve possibly-undefined-variable cases flagged by PHPStan

Fixes several cases of the variable.undefined PHPStan rule instead of
just excluding them via the baseline: a wrong variable used to build a
delete link (dir_add_card.php), an uninitialized $result across a
try/catch (CMailFile), missing GETPOST reads ($mode, $fk_project/$date
reset via unset() creating cross-branch ambiguity), a missing $r
contract check (commonfieldsinimport.inc.php), missing @var/global
annotations for $conf/$langs/$bc, dead extrafields-display code
guarded by the wrong condition (expedition/card.php), and an
undefined $soc passed to formAddObjectLine() where objects have no
buyer thirdparty (replaced with null). Corresponding entries removed
from dev/build/phpstan/phpstan-baseline.neon.

* FIX: Resolve more possibly-undefined-variable cases flagged by PHPStan

Second batch of variable.undefined fixes removed from the baseline:
- Complex conditional flows PHPStan can't prove exhaustive (Stripe key
  selection in commoninvoice.class.php, a situation-invoice loop var in
  pdf_sponge.modules.php, a product loop var in stock/movement_list.php)
  fixed by adding a definite initialization before the ambiguous branch.
- A commented-out $linkback assignment restored in
  expensereport/payment/info.php.
- Missing GETPOST reads added (holiday/list.php update-date filters,
  product/stock/info.php $action/$socid, projet/comment.php $mode).
- A dead-code $mesg call to dol_htmloutput_mesg() removed from
  admin_hrm.php (messages are already shown via setEventMessages()).
- Redundant isset() checks removed in product/reassort.php and
  reassortlot.php where $type is unconditionally set earlier in the
  same file, so the isset()-false branch was unreachable dead code.
- $user documented as always available in public/bookcal/index.php
  (NOREQUIREUSER is not defined on that page).
- A genuinely missing $tmpcode initialization fixed in
  attendee_new.php, suggestbooth.php and suggestconference.php: when
  an existing thirdparty is reused (or SOCIETE_CODECLIENT_ADDON has no
  auto-numbering), $tmpcode was never set before being assigned to
  code_client/code_fournisseur.

* add phan fix

* add phan fix

* fix

* fix

* fix
This commit is contained in:
Frédéric FRANCE 2026-08-15 18:33:12 +02:00 committed by GitHub
parent ae55b501c7
commit 840538d702
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 76 additions and 242 deletions

View file

@ -2550,12 +2550,6 @@ parameters:
count: 1
path: ../../../htdocs/core/actions_setmoduleoptions.inc.php
-
message: '#^Variable \$tmpdir might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/actions_setmoduleoptions.inc.php
-
message: '#^Loose comparison using \=\= between ''directory'' and ''directory'' will always evaluate to true\.$#'
identifier: equal.alwaysTrue
@ -2688,12 +2682,6 @@ parameters:
count: 1
path: ../../../htdocs/core/class/CMailFile.class.php
-
message: '#^Variable \$result might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/class/CMailFile.class.php
-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
@ -2718,12 +2706,6 @@ parameters:
count: 1
path: ../../../htdocs/core/class/commoninvoice.class.php
-
message: '#^Variable \$stripearrayofkeys might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../../htdocs/core/class/commoninvoice.class.php
-
message: '#^Call to function is_array\(\) with array\<mixed\> will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -3300,12 +3282,6 @@ parameters:
count: 1
path: ../../../htdocs/core/class/utils_diff.class.php
-
message: '#^Variable \$r might not be defined\.$#'
identifier: variable.undefined
count: 4
path: ../../../htdocs/core/commonfieldsinimport.inc.php
-
message: '#^Call to function is_array\(\) with non\-empty\-array\<string, mixed\> will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -3330,18 +3306,6 @@ parameters:
count: 1
path: ../../../htdocs/core/db/mysqli.class.php
-
message: '#^Variable \$conf might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/filemanagerdol/browser/default/browser.php
-
message: '#^Variable \$langs might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/filemanagerdol/browser/default/browser.php
-
message: '#^Variable \$_FILES in isset\(\) always exists and is not nullable\.$#'
identifier: isset.variable
@ -4002,12 +3966,6 @@ parameters:
count: 1
path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php
-
message: '#^Variable \$fac might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/modules/facture/doc/pdf_sponge.modules.php
-
message: '#^Access to constant TYPE_NON on an unknown class Sprain\\SwissQrBill\\DataGroup\\Element\\PaymentReference\.$#'
identifier: class.notFound
@ -4518,24 +4476,12 @@ parameters:
count: 1
path: ../../../htdocs/ecm/dir_add_card.php
-
message: '#^Variable \$object might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/ecm/dir_add_card.php
-
message: '#^If condition is always true\.$#'
identifier: if.alwaysTrue
count: 2
path: ../../../htdocs/ecm/index_medias.php
-
message: '#^Variable \$bc might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/ecm/search.php
-
message: '#^Call to function is_array\(\) with list\<non\-empty\-string\> will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -4584,12 +4530,6 @@ parameters:
count: 1
path: ../../../htdocs/eventorganization/conferenceorbooth_contact.php
-
message: '#^Variable \$mode might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/eventorganization/conferenceorbooth_contact.php
-
message: '#^Call to function method_exists\(\) with Project and ''fetchComments'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -4650,18 +4590,6 @@ parameters:
count: 1
path: ../../../htdocs/expedition/card.php
-
message: '#^Variable \$rowEnd might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/expedition/card.php
-
message: '#^Variable \$rowExtrafieldsView might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/expedition/card.php
-
message: '#^Left side of && is always true\.$#'
identifier: booleanAnd.leftAlwaysTrue
@ -4722,18 +4650,6 @@ parameters:
count: 3
path: ../../../htdocs/expensereport/card.php
-
message: '#^Variable \$date might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/expensereport/card.php
-
message: '#^Variable \$fk_project might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/expensereport/card.php
-
message: '#^Call to function method_exists\(\) with \$this\(PaymentExpenseReport\) and ''getLibStatut'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -4776,12 +4692,6 @@ parameters:
count: 1
path: ../../../htdocs/expensereport/class/paymentexpensereport.class.php
-
message: '#^Variable \$linkback might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/expensereport/payment/info.php
-
message: '#^Comparison operation "\>" between 1 and 1 is always false\.$#'
identifier: greater.alwaysFalse
@ -5142,18 +5052,6 @@ parameters:
count: 2
path: ../../../htdocs/holiday/define_holiday.php
-
message: '#^Variable \$search_month_update might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/holiday/list.php
-
message: '#^Variable \$search_year_update might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/holiday/list.php
-
message: '#^Ternary operator condition is always false\.$#'
identifier: ternary.alwaysFalse
@ -5166,12 +5064,6 @@ parameters:
count: 1
path: ../../../htdocs/hrm/admin/admin_hrm.php
-
message: '#^Variable \$mesg might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/hrm/admin/admin_hrm.php
-
message: '#^Call to function method_exists\(\) with \$this\(Position\) and ''getNomUrl'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -5382,12 +5274,6 @@ parameters:
count: 1
path: ../../../htdocs/hrm/job_card.php
-
message: '#^Variable \$soc might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/hrm/job_card.php
-
message: '#^Comparison operation "\<" between int\<0, max\> and 0 is always false\.$#'
identifier: smaller.alwaysFalse
@ -5484,12 +5370,6 @@ parameters:
count: 1
path: ../../../htdocs/intracommreport/card.php
-
message: '#^Variable \$soc might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/intracommreport/card.php
-
message: '#^Call to function method_exists\(\) with \$this\(IntracommReport\) and ''getNomUrl'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -6300,12 +6180,6 @@ parameters:
count: 1
path: ../../../htdocs/partnership/partnership_card.php
-
message: '#^Variable \$soc might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/partnership/partnership_card.php
-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
@ -6546,12 +6420,6 @@ parameters:
count: 1
path: ../../../htdocs/product/reassort.php
-
message: '#^Variable \$type might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/product/reassort.php
-
message: '#^Comparison operation "\<" between null and 0 is always false\.$#'
identifier: smaller.alwaysFalse
@ -6564,12 +6432,6 @@ parameters:
count: 1
path: ../../../htdocs/product/reassortlot.php
-
message: '#^Variable \$type might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/product/reassortlot.php
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
@ -6594,18 +6456,6 @@ parameters:
count: 1
path: ../../../htdocs/product/stock/class/productstockentrepot.class.php
-
message: '#^Variable \$action might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/product/stock/info.php
-
message: '#^Variable \$socid might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/product/stock/info.php
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
@ -6684,12 +6534,6 @@ parameters:
count: 1
path: ../../../htdocs/product/stock/movement_list.php
-
message: '#^Variable \$productlabelselected might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/product/stock/movement_list.php
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
@ -6912,12 +6756,6 @@ parameters:
count: 1
path: ../../../htdocs/projet/comment.php
-
message: '#^Variable \$mode might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/projet/comment.php
-
message: '#^Call to function method_exists\(\) with Project and ''fetchComments'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -7272,12 +7110,6 @@ parameters:
count: 1
path: ../../../htdocs/public/bookcal/bookcalAjax.php
-
message: '#^Variable \$user might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/public/bookcal/index.php
-
message: '#^Call to function is_numeric\(\) with int will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -7320,12 +7152,6 @@ parameters:
count: 2
path: ../../../htdocs/public/eventorganization/attendee_new.php
-
message: '#^Variable \$tmpcode might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/public/eventorganization/attendee_new.php
-
message: '#^Call to function is_numeric\(\) with int will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -7566,12 +7392,6 @@ parameters:
count: 1
path: ../../../htdocs/public/project/suggestbooth.php
-
message: '#^Variable \$tmpcode might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/public/project/suggestbooth.php
-
message: '#^Call to function is_numeric\(\) with int will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -7608,12 +7428,6 @@ parameters:
count: 2
path: ../../../htdocs/public/project/suggestconference.php
-
message: '#^Variable \$tmpcode might not be defined\.$#'
identifier: variable.undefined
count: 2
path: ../../../htdocs/public/project/suggestconference.php
-
message: '#^Call to function is_numeric\(\) with int will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType
@ -8850,12 +8664,6 @@ parameters:
count: 1
path: ../../../htdocs/webhook/class/target.class.php
-
message: '#^Variable \$soc might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/webhook/target_card.php
-
message: '#^Result of && is always false\.$#'
identifier: booleanAnd.alwaysFalse

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2014-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 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
@ -43,11 +43,17 @@
* @var ?int $nomessageinsetmoduleoptions
* @var ?string $modulepart
* @var ?string $websitetemplateconf
* @var ?string $upload_dir
* @var ?array<string,mixed> $arrayofparameters
*/
'
@phan-var-force FormSetup $formSetup
@phan-var-force string $action
@phan-var-force int $error
@phan-var-force ?string $modulepart
@phan-var-force ?string $websitetemplateconf
@phan-var-force ?string $upload_dir
';
if (($action == 'update' || !empty($websitetemplateconf)) && !empty($formSetup) && is_object($formSetup) && !empty($user->admin)) {
@ -55,8 +61,6 @@ if (($action == 'update' || !empty($websitetemplateconf)) && !empty($formSetup)
return;
}
$upload_dir = null;
if (($action == 'update' || !empty($websitetemplateconf)) && !empty($arrayofparameters) && is_array($arrayofparameters) && !empty($user->admin)) {
$db->begin();
@ -118,10 +122,12 @@ if ($action == 'deletefile' && $modulepart == 'doctemplates' && !empty($user->ad
}
}
$filetodelete = $tmpdir.'/'.GETPOST('file');
$result = dol_delete_file($filetodelete, 1);
if ($result > 0) {
setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
if ($upload_dir) {
$filetodelete = $upload_dir.'/'.GETPOST('file');
$result = dol_delete_file($filetodelete, 1);
if ($result > 0) {
setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
}
}
}

View file

@ -6,7 +6,7 @@
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Joachim Kueter <git-jk@bloxera.com>
*
@ -1435,6 +1435,7 @@ class CMailFile
// send mail
$failedRecipients = array();
$result = false;
try {
$result = $this->mailer->send($this->message, $failedRecipients);
} catch (Exception $e) {

View file

@ -1834,6 +1834,7 @@ abstract class CommonInvoice extends CommonObject
dol_syslog("makeStripeSepaRequest Current Saved Stripe environment is ".$savstripearrayofkeysbyenv[$servicestatus]['publishable_key']);
$foundalternativestripeaccount = '';
$stripearrayofkeys = array();
// Force stripe to another value (by default this value is empty)
if (! empty($forcestripe)) {

View file

@ -1,12 +1,13 @@
<?php
/* Copyright (C) 2026 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2026 Frédéric France <frederic.france@free.fr>
*/
'@phan-var-force DolibarrModules $this';
/** @var DolibarrModules $this */
if (empty($keyforclass) || empty($keyforclassfile) || empty($keyforelement)) {
if (empty($keyforclass) || empty($keyforclassfile) || empty($keyforelement) || empty($r)) {
//print $keyforclass.' - '.$keyforclassfile.' - '.$keyforelement;
dol_print_error(null, 'include of file commonfieldsinimport.inc.php was done but var $keyforclass or $keyforclassfile or $keyforelement was not set');
dol_print_error(null, 'include of file commonfieldsinimport.inc.php was done but var $keyforclass or $keyforclassfile or $keyforelement or $r was not set');
exit;
}
if (empty($keyforalias)) {

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2003-2010 Frederico Caldeira Knabben
* Copyright (C) 2026 Frédéric France <frederic.france@free.fr>
*
* Source modified from part of fckeditor (http://www.fckeditor.net)
* retrieved as GPL v2 or later
@ -23,7 +24,7 @@
//require '../../../../main.inc.php';
require '../../connectors/php/config.inc.php'; // This include the define('NOTOKENRENEWAL',1) and the require main.in.php
global $Config;
global $Config, $conf, $langs;
top_httphead();

View file

@ -2,6 +2,7 @@
/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2026 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
@ -56,7 +57,7 @@ function show_skin($fuser, $edit = 0)
print '<table class="noborder centpercent">';
$var = false;
$var = 0;
// Title
print '<tr class="liste_titre"><th width="35%">'.$langs->trans("DefaultSkin").'</th>';

View file

@ -1811,6 +1811,7 @@ class pdf_sponge extends ModelePDFFactures
}
$i = 1;
$fac = null;
if (!empty($TPreviousIncoice)) {
$pdf->setY($tab2_top);
$posy = $pdf->GetY();

View file

@ -2,7 +2,7 @@
/* Copyright (C) 2008-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025-2026 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -300,7 +300,7 @@ if (empty($action) || $action == 'delete_section') {
print '<div class="tabsAction">';
// Delete
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', $user->hasRight('ecm', 'setup'));
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?section='.$section.'&action=delete_section&token='.newToken(), '', $user->hasRight('ecm', 'setup'));
print '</div>';
}

View file

@ -2,7 +2,7 @@
/* Copyright (C) 2008-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 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
@ -38,8 +38,11 @@ require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php';
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
* @var array<int,string> $bc
*/
'
@phan-var-force array<int,string> $bc
';
// Load translation files required by the page
$langs->loadLangs(array("ecm", "companies", "other", "users", "orders", "propal", "bills", "contracts"));
@ -259,7 +262,7 @@ foreach ($sectionauto as $sectioncur) {
$butshown++;
}
print '<tr '.$bc[false].'><td colspan="4" class="center"><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
print '<tr '.$bc[0].'><td colspan="4" class="center"><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
print "</table></form>";
//print $langs->trans("ECMSectionAutoDesc");

View file

@ -2,7 +2,7 @@
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Florian HENRY <florian.henry@scopen.fr>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -65,6 +65,7 @@ $backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
$withproject = GETPOSTINT('withproject');
$mode = GETPOST('mode', 'aZ');
// Initialize a technical objects

View file

@ -3732,7 +3732,7 @@ if ($action == 'create' && $usercancreate) {
}
print '</td>';
// Display lines extrafields
if (!empty($rowExtrafieldsStart)) {
if (isset($rowExtrafieldsStart, $rowExtrafieldsView, $rowEnd)) { // @phan-suppress-current-line PhanPluginUndeclaredVariableIsset
print $rowExtrafieldsStart;
print $rowExtrafieldsView;
print $rowEnd;

View file

@ -1270,9 +1270,9 @@ if (empty($reshook)) {
unset($vatrate);
unset($comments);
unset($fk_c_type_fees);
unset($fk_project);
$fk_project = 0;
unset($date);
$date = false;
} else {
$error++;
setEventMessages($object->error, $object->errors, 'errors');

View file

@ -84,7 +84,7 @@ $head = payment_expensereport_prepare_head($object);
print dol_get_fiche_head($head, 'info', $langs->trans("ExpenseReportPayment"), -1, 'payment');
//$linkback = '<a href="' . DOL_URL_ROOT . '/expensereport/payment/list.php">' . $langs->trans("BackToList") . '</a>';
$linkback = '<a href="' . DOL_URL_ROOT . '/expensereport/payment/list.php">' . $langs->trans("BackToList") . '</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', '');

View file

@ -97,6 +97,8 @@ $search_ref = GETPOST('search_ref', 'alphanohtml');
$search_day_create = GETPOST('search_day_create', 'int');
$search_month_create = GETPOST('search_month_create', 'int');
$search_year_create = GETPOST('search_year_create', 'int');
$search_month_update = GETPOST('search_month_update', 'int');
$search_year_update = GETPOST('search_year_update', 'int');
$search_day_start = GETPOST('search_day_start', 'int');
$search_month_start = GETPOST('search_month_start', 'int');
$search_year_start = GETPOST('search_year_start', 'int');
@ -207,6 +209,8 @@ if (empty($reshook)) {
$search_ref = "";
$search_month_create = "";
$search_year_create = "";
$search_month_update = "";
$search_year_update = "";
$search_month_start = "";
$search_year_start = "";
$search_month_end = "";
@ -343,6 +347,8 @@ $sql .= dolSqlDateFilter("cp.date_debut", $search_day_start, $search_month_start
$sql .= dolSqlDateFilter("cp.date_fin", $search_day_end, $search_month_end, $search_year_end);
// Create date
$sql .= dolSqlDateFilter("cp.date_create", $search_day_create, $search_month_create, $search_year_create);
// Update date
$sql .= dolSqlDateFilter("cp.tms", 0, $search_month_update, $search_year_update);
// Employee
if (!empty($search_employee) && $search_employee != -1) {
$sql .= " AND cp.fk_user = '".$db->escape($search_employee)."'\n";
@ -437,6 +443,12 @@ if ($search_month_create) {
if ($search_year_create) {
$param .= '&search_year_create='.urlencode($search_year_create);
}
if ($search_month_update) {
$param .= '&search_month_update='.urlencode($search_month_update);
}
if ($search_year_update) {
$param .= '&search_year_update='.urlencode($search_year_update);
}
if ($search_day_start) {
$param .= '&search_day_start='.urlencode($search_day_start);
}

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software: you can redistribute it and/or modify
@ -98,8 +98,6 @@ llxHeader('', $title, '');
$form = new Form($db);
dol_htmloutput_mesg($mesg);
// Subheader
$linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/admin/modules.php', ['restore_lastsearch_values' => 1]).'">'.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').'<span class="hideonsmartphone">'.$langs->trans("BackToModuleList").'</span></a>';

View file

@ -5,7 +5,7 @@
* Copyright (C) 2021 Jean-Pascal BOUDET <jean-pascal.boudet@atm-consulting.fr>
* Copyright (C) 2021 Grégory BLEMAND <gregory.blemand@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 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
@ -426,7 +426,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
$object->formAddObjectLine(1, $mysoc, $soc);
$object->formAddObjectLine(1, $mysoc, null);
}
}
}

View file

@ -424,7 +424,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
$object->formAddObjectLine(1, $mysoc, $soc);
$object->formAddObjectLine(1, $mysoc, null);
}
}
}

View file

@ -2,7 +2,7 @@
/* Copyright (C) 2017-2021 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 NextGestion <contact@nextgestion.com>
* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 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
@ -576,7 +576,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
$object->formAddObjectLine(1, $mysoc, $soc);
$object->formAddObjectLine(1, $mysoc, null);
}
}
}

View file

@ -6,7 +6,7 @@
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2019 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2023 Vincent de Grandpré <vincent@de-grandpre.quebec>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2026 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -347,14 +347,10 @@ if ($resql) {
exit;
}
if (isset($type)) {
if ($type == 1) {
$texte = $langs->trans("Services");
} else {
$texte = $langs->trans("Products");
}
if ($type == 1) {
$texte = $langs->trans("Services");
} else {
$texte = $langs->trans("ProductsAndServices");
$texte = $langs->trans("Products");
}
$texte .= ' ('.$langs->trans("MenuStocks").')';

View file

@ -7,7 +7,7 @@
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2021 Noé Cendrier <noe.cendrier@altairis.fr>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2026 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -457,14 +457,10 @@ if ($num == 1 && GETPOST('autojumpifoneonly') && ($search_all || $snom || $sref)
exit;
}
if (isset($type)) {
if ($type == 1) {
$texte = $langs->trans("Services");
} else {
$texte = $langs->trans("Products");
}
if ($type == 1) {
$texte = $langs->trans("Services");
} else {
$texte = $langs->trans("ProductsAndServices");
$texte = $langs->trans("Products");
}
$texte .= ' ('.$langs->trans("StocksByLotSerial").')';

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -43,6 +43,8 @@ $langs->load("stocks");
$id = GETPOSTINT('id');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$socid = GETPOSTINT('socid');
// Security check
//$result=restrictedArea($user,'stock', $id, 'entrepot&stock');

View file

@ -4,7 +4,7 @@
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018-2022 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -1717,6 +1717,7 @@ if (count($arrayofuniqueproduct) == 1 && !empty($search_date_startyear) && is_nu
print "<br>";
$productidselected = 0;
$productlabelselected = '';
foreach ($arrayofuniqueproduct as $key => $val) {
$productidselected = $key;
$productlabelselected = $val;

View file

@ -3,7 +3,7 @@
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 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
@ -55,6 +55,7 @@ $objectref = GETPOST("taskref", 'alpha'); // task ref
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$withproject = GETPOSTINT('withproject');
$mode = GETPOST('mode', 'aZ');
// Security check
$socid = 0;

View file

@ -59,6 +59,7 @@ if (!isModEnabled('bookcal')) {
* @var Conf $conf
* @var DoliDB $db
* @var Translate $langs
* @var User $user
*
* @var string $dolibarr_main_url_root
*/

View file

@ -515,6 +515,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
$modCodeClient = new $module($db);
'@phan-var-force ModeleThirdPartyCode $modCodeClient';
$tmpcode = '';
if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
$tmpcode = $modCodeClient->getNextValue($thirdparty, 0);
}

View file

@ -249,6 +249,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he
$thirdparty = null;
$contact = null;
$tmpcode = '';
if (!$error) {
// Getting the thirdparty or creating it
$thirdparty = new Societe($db);

View file

@ -249,6 +249,7 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he
$errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
}
$tmpcode = '';
if (!$error) {
// Getting the thirdparty or creating it
$thirdparty = new Societe($db);

View file

@ -447,7 +447,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
$object->formAddObjectLine(1, $mysoc, $soc);
$object->formAddObjectLine(1, $mysoc, null);
}
}
}