Merge branch 'develop' into patch-2

This commit is contained in:
Laurent Destailleur 2025-02-02 02:00:17 +01:00 committed by GitHub
commit f9d5723101
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 558 additions and 283 deletions

View file

@ -9540,12 +9540,6 @@ parameters:
count: 1
path: ../../../htdocs/core/class/dolgraph.class.php
-
message: '#^Comparison operation "\>" between 0 and 0 is always false\.$#'
identifier: greater.alwaysFalse
count: 3
path: ../../../htdocs/core/class/dolgraph.class.php
-
message: '#^If condition is always false\.$#'
identifier: if.alwaysFalse
@ -9564,24 +9558,6 @@ parameters:
count: 1
path: ../../../htdocs/core/class/dolgraph.class.php
-
message: '#^Loose comparison using \=\= between 0 and 0 will always evaluate to true\.$#'
identifier: equal.alwaysTrue
count: 2
path: ../../../htdocs/core/class/dolgraph.class.php
-
message: '#^Loose comparison using \=\= between 1 and 3 will always evaluate to false\.$#'
identifier: equal.alwaysFalse
count: 1
path: ../../../htdocs/core/class/dolgraph.class.php
-
message: '#^Offset 0 on array\{array\{stacknum\: int, legend\: mixed, legendwithgroup\: non\-falsy\-string\}\} in empty\(\) always exists and is not falsy\.$#'
identifier: empty.offset
count: 1
path: ../../../htdocs/core/class/dolgraph.class.php
-
message: '#^Ternary operator condition is always true\.$#'
identifier: ternary.alwaysTrue
@ -14670,24 +14646,12 @@ parameters:
count: 12
path: ../../../htdocs/core/tpl/card_presend.tpl.php
-
message: '#^Variable \$hidedesc might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/card_presend.tpl.php
-
message: '#^Variable \$hidedetails might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/card_presend.tpl.php
-
message: '#^Variable \$hideref might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/core/tpl/card_presend.tpl.php
-
message: '#^Variable \$hookmanager might not be defined\.$#'
identifier: variable.undefined
@ -15444,12 +15408,6 @@ parameters:
count: 1
path: ../../../htdocs/cron/list.php
-
message: '#^Variable \$texttoshow might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/cron/list.php
-
message: '#^Offset ''css'' on array\{css\: ''minwidth200'', picto\: mixed\} in empty\(\) always exists and is not falsy\.$#'
identifier: empty.offset
@ -15510,12 +15468,6 @@ parameters:
count: 1
path: ../../../htdocs/delivery/card.php
-
message: '#^Variable \$arrayoptions might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/delivery/card.php
-
message: '#^Variable \$hidedesc might not be defined\.$#'
identifier: variable.undefined
@ -15786,42 +15738,12 @@ parameters:
count: 1
path: ../../../htdocs/don/paiement/list.php
-
message: '#^Variable \$morecss might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/don/paiement/list.php
-
message: '#^Variable \$morejs might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/don/paiement/list.php
-
message: '#^Variable \$outputlangs might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/don/payment/card.php
-
message: '#^Negated boolean expression is always true\.$#'
identifier: booleanNot.alwaysTrue
count: 1
path: ../../../htdocs/don/payment/payment.php
-
message: '#^Variable \$sumpaid might not be defined\.$#'
identifier: variable.undefined
count: 3
path: ../../../htdocs/don/payment/payment.php
-
message: '#^Variable \$objectlink might not be defined\.$#'
identifier: variable.undefined
count: 1
path: ../../../htdocs/don/tpl/linkedobjectblock.tpl.php
-
message: '#^Property EcmFiles\:\:\$acl \(string\) in isset\(\) is not nullable\.$#'
identifier: isset.property

View file

@ -10,14 +10,14 @@
return [
// # Issue statistics:
// PhanUndeclaredProperty : 540+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 250+ occurrences
// PhanUndeclaredGlobalVariable : 220+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 210+ occurrences
// PhanUndeclaredGlobalVariable : 210+ occurrences
// PhanPluginUnknownArrayMethodReturnType : 180+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 180+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 160+ occurrences
// PhanTypeMismatchProperty : 140+ occurrences
// PhanPluginUnknownArrayMethodParamType : 120+ occurrences
// PhanPluginUndeclaredVariableIsset : 45+ occurrences
// PhanRedefineFunction : 45+ occurrences
// PhanPluginUndeclaredVariableIsset : 40+ occurrences
// PhanTypeExpectedObjectPropAccess : 40+ occurrences
// PhanTypeInvalidDimOffset : 25+ occurrences
// PhanTypeMismatchDimFetch : 25+ occurrences
@ -32,7 +32,7 @@ return [
// PhanPluginDuplicateExpressionBinaryOp : 6 occurrences
// PhanTypeArraySuspiciousNull : 6 occurrences
// PhanParamTooMany : 5 occurrences
// PhanPluginBothLiteralsBinaryOp : 5 occurrences
// PhanPluginBothLiteralsBinaryOp : 4 occurrences
// PhanPluginDuplicateArrayKey : 4 occurrences
// PhanEmptyFQSENInClasslike : 3 occurrences
// PhanInvalidFQSENInClasslike : 3 occurrences
@ -203,41 +203,25 @@ return [
'htdocs/don/info.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/don/list.php' => ['PhanTypeMismatchProperty'],
'htdocs/don/note.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/ecm/dir_card.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/ecm/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanUndeclaredProperty'],
'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/eventorganization/conferenceorbooth_card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/eventorganization/conferenceorbooth_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/eventorganization/conferenceorboothattendee_card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/eventorganization/conferenceorboothattendee_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/eventorganization/conferenceorboothattendee_card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/eventorganization/core/actions_massactions_mail.inc.php' => ['PhanUndeclaredProperty'],
'htdocs/expedition/card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/expedition/class/api_shipments.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/expedition/class/expedition.class.php' => ['PhanUndeclaredProperty'],
'htdocs/expedition/contact.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/expedition/dispatch.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/expedition/document.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/expedition/list.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/expedition/note.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/expedition/shipment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/expensereport/card.php' => ['PhanPluginBothLiteralsBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/expensereport/card.php' => ['PhanUndeclaredProperty'],
'htdocs/expensereport/class/api_expensereports.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/expensereport/payment/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/expensereport/payment/card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/expensereport/payment/info.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/expensereport/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/expensereport/stats/index.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/expensereport/tpl/expensereport_addfile.tpl.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/expensereport/tpl/expensereport_linktofile.tpl.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/expensereport/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/externalsite/frames.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/fichinter/card-rec.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/fichinter/class/api_interventions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'],
'htdocs/fichinter/card-rec.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/fichinter/class/api_interventions.class.php' => ['PhanUndeclaredProperty'],
'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanUndeclaredProperty'],
'htdocs/fichinter/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/fichinter/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/filefunc.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/fourn/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/fourn/class/api_supplier_invoices.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/fourn/class/api_supplier_orders.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/fourn/class/fournisseur.commande.class.php' => ['PhanUndeclaredProperty'],
@ -294,7 +278,7 @@ return [
'htdocs/loan/card.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/loan/document.php' => ['PhanUndeclaredProperty'],
'htdocs/loan/note.php' => ['PhanUndeclaredProperty'],
'htdocs/loan/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/loan/payment/payment.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/margin/customerMargins.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/margin/productMargins.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/master.inc.php' => ['PhanUndeclaredGlobalVariable'],
@ -476,7 +460,6 @@ return [
'htdocs/ticket/class/cticketcategory.class.php' => ['PhanUndeclaredProperty'],
'htdocs/ticket/class/ticket.class.php' => ['PhanUndeclaredProperty'],
'htdocs/ticket/index.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/ticket/list.php' => ['PhanTypeComparisonFromArray'],
'htdocs/user/card.php' => ['PhanTypeMismatchProperty'],
'htdocs/user/class/api_users.class.php' => ['PhanTypeMismatchProperty'],
'htdocs/user/class/user.class.php' => ['PhanUndeclaredProperty'],

View file

@ -9,7 +9,7 @@
* Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 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
@ -136,6 +136,9 @@ $result = restrictedArea($user, 'adherent', $rowid, 'adherent_type');
*/
$error = 0;
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
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 = "";
$search_lastname = "";
@ -283,6 +286,9 @@ $help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_M
llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-member page-type');
$arrayofselected = is_array($toselect) ? $toselect : array();
$totalarray = [
'nbfield' => 0,
];
// List of members type
if (!$rowid && $action != 'create' && $action != 'edit') {
@ -329,8 +335,14 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
// $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1);
@ -341,19 +353,48 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '<tr class="liste_titre">';
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<th>&nbsp;</th>';
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.rowid']['checked'])) {
print '<th>'.$langs->trans("Ref").'</th>';
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.libelle']['checked'])) {
print '<th>'.$langs->trans($arrayfields['t.libelle']['label']).'</th>';
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.morphy']['checked'])) {
print '<th class="center">'.$langs->trans("MembersNature").'</th>';
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.duration']['checked'])) {
print '<th class="center">'.$langs->trans("MembershipDuration").'</th>';
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.subscription']['checked'])) {
print '<th class="center">'.$langs->trans("SubscriptionRequired").'</th>';
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.amount']['checked'])) {
print '<th class="center">'.$langs->trans("Amount").'</th>';
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.caneditamount']['checked'])) {
print '<th class="center">'.$langs->trans("CanEditAmountShort").'</th>';
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.vote']['checked'])) {
print '<th class="center">'.$langs->trans("VoteAllowed").'</th>';
$totalarray['nbfield']++;
}
if (!empty($arrayfields['t.statut']['checked'])) {
print '<th class="center">'.$langs->trans("Status").'</th>';
$totalarray['nbfield']++;
}
print '<th>'.$langs->trans("Ref").'</th>';
print '<th>'.$langs->trans("Label").'</th>';
print '<th class="center">'.$langs->trans("MembersNature").'</th>';
print '<th class="center">'.$langs->trans("MembershipDuration").'</th>';
print '<th class="center">'.$langs->trans("SubscriptionRequired").'</th>';
print '<th class="center">'.$langs->trans("Amount").'</th>';
print '<th class="center">'.$langs->trans("CanEditAmountShort").'</th>';
print '<th class="center">'.$langs->trans("VoteAllowed").'</th>';
print '<th class="center">'.$langs->trans("Status").'</th>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<th>&nbsp;</th>';
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
$totalarray['nbfield']++;
}
print "</tr>\n";
@ -397,47 +438,55 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
print '<td class="center"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
}
}
print '<td class="nowraponall">';
print $membertype->getNomUrl(1);
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
print '</td>';
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
print '<td class="center">';
if ($objp->morphy == 'phy') {
print $langs->trans("Physical");
} elseif ($objp->morphy == 'mor') {
print $langs->trans("Moral");
} else {
print $langs->trans("MorAndPhy");
if (!empty($arrayfields['t.rowid']['checked'])) {
print '<td class="nowraponall">';
print $membertype->getNomUrl(1);
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
print '</td>';
}
print '</td>';
print '<td class="center nowrap">';
if ($objp->duration) {
$duration_value = intval($objp->duration);
if ($duration_value > 1) {
$dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years"));
if (!empty($arrayfields['t.libelle']['checked'])) {
print '<td>'.dol_escape_htmltag($objp->label).'</td>';
}
if (!empty($arrayfields['t.morphy']['checked'])) {
print '<td class="center">';
if ($objp->morphy == 'phy') {
print $langs->trans("Physical");
} elseif ($objp->morphy == 'mor') {
print $langs->trans("Moral");
} else {
$dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year"));
print $langs->trans("MorAndPhy");
}
$unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration);
print max(1, $duration_value).' '.$dur[$unit];
print '</td>';
}
if (!empty($arrayfields['t.duration']['checked'])) {
print '<td class="center nowrap">';
if ($objp->duration) {
$duration_value = intval($objp->duration);
if ($duration_value > 1) {
$dur = array("i" => $langs->trans("Minutes"), "h" => $langs->trans("Hours"), "d" => $langs->trans("Days"), "w" => $langs->trans("Weeks"), "m" => $langs->trans("Months"), "y" => $langs->trans("Years"));
} else {
$dur = array("i" => $langs->trans("Minute"), "h" => $langs->trans("Hour"), "d" => $langs->trans("Day"), "w" => $langs->trans("Week"), "m" => $langs->trans("Month"), "y" => $langs->trans("Year"));
}
$unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration);
print max(1, $duration_value).' '.$dur[$unit];
}
print '</td>';
}
if (!empty($arrayfields['t.subscription']['checked'])) {
print '<td class="center">'.yn($objp->subscription).'</td>';
}
if (!empty($arrayfields['t.amount']['checked'])) {
print '<td class="center"><span class="amount">'.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).'</span></td>';
}
if (!empty($arrayfields['t.caneditamount']['checked'])) {
print '<td class="center">'.yn($objp->caneditamount).'</td>';
}
if (!empty($arrayfields['t.vote']['checked'])) {
print '<td class="center">'.yn($objp->vote).'</td>';
}
if (!empty($arrayfields['t.statut']['checked'])) {
print '<td class="center">'.$membertype->getLibStatut(5).'</td>';
}
print '</td>';
print '<td class="center">'.yn($objp->subscription).'</td>';
print '<td class="center"><span class="amount">'.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).'</span></td>';
print '<td class="center">'.yn($objp->caneditamount).'</td>';
print '<td class="center">'.yn($objp->vote).'</td>';
print '<td class="center">'.$membertype->getLibStatut(5).'</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
if ($user->hasRight('adherent', 'configurer')) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';

View file

@ -1500,14 +1500,14 @@ abstract class CommonObject
$sql = "SELECT ec.rowid, ec.statut as statuslink, ec.fk_socpeople as id, ec.fk_c_type_contact"; // This field contains id of llx_socpeople or id of llx_user
if ($source == 'internal') {
$sql .= ", '-1' as socid, t.statut as statuscontact, t.login, t.photo, t.gender";
$sql .= ", '-1' as socid, t.statut as statuscontact, t.login, t.photo, t.gender, t.fk_country as country_id";
}
if ($source == 'external' || $source == 'thirdparty') {
$sql .= ", t.fk_soc as socid, t.statut as statuscontact";
$sql .= ", t.fk_soc as socid, t.statut as statuscontact, t.fk_pays as country_id";
}
$sql .= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email";
$sql .= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email, t.address, t.zip, t.town";
if (empty($arrayoftcids)) {
$sql .= ", tc.source, tc.element, tc.code, tc.libelle as type_label";
$sql .= ", tc.source, tc.element, tc.code, tc.libelle as type_label, co.label as country";
}
$sql .= " FROM";
if (empty($arrayoftcids)) {
@ -1516,9 +1516,11 @@ abstract class CommonObject
$sql .= " ".$this->db->prefix()."element_contact as ec";
if ($source == 'internal') { // internal contact (user)
$sql .= " LEFT JOIN ".$this->db->prefix()."user as t on ec.fk_socpeople = t.rowid";
$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as co ON co.rowid = t.fk_country";
}
if ($source == 'external' || $source == 'thirdparty') { // external contact (socpeople)
$sql .= " LEFT JOIN ".$this->db->prefix()."socpeople as t on ec.fk_socpeople = t.rowid";
$sql .= " LEFT JOIN ".$this->db->prefix()."c_country as co ON co.rowid = t.fk_pays";
}
$sql .= " WHERE ec.element_id = ".((int) $this->id);
if (empty($arrayoftcids)) {
@ -1566,6 +1568,11 @@ abstract class CommonObject
'lastname' => $obj->lastname,
'firstname' => $obj->firstname,
'email' => $obj->email,
'address' => $obj->address,
'zip' => $obj->zip,
'town' => $obj->town,
'country_id' => $obj->country_id,
'country' => $obj->country,
'login' => (empty($obj->login) ? '' : $obj->login),
'photo' => (empty($obj->photo) ? '' : $obj->photo),
'gender' => (empty($obj->gender) ? '' : $obj->gender),

View file

@ -3109,7 +3109,7 @@ class Form
$sql .= $hookmanager->resPrint;
// Add criteria on ref/label
if ($filterkey != '') {
$sqlSupplierSearch= '';
$sqlSupplierSearch = '';
$sql .= ' AND (';
$prefix = !getDolGlobalString('PRODUCT_DONOTSEARCH_ANYWHERE') ? '%' : ''; // Can use index if PRODUCT_DONOTSEARCH_ANYWHERE is on
@ -3139,7 +3139,7 @@ class Form
// include search in supplier ref
if (getDolGlobalString('MAIN_SEARCH_PRODUCT_BY_FOURN_REF')) {
$sqlSupplierSearch .= !empty($sqlSupplierSearch) ? ' OR ':'';
$sqlSupplierSearch .= !empty($sqlSupplierSearch) ? ' OR ' : '';
$sqlSupplierSearch .= " pfp.ref_fourn LIKE '" . $this->db->escape($prefix . $crit) . "%'";
}
$sql .= ")";
@ -5648,7 +5648,7 @@ class Form
* @param string $title Title
* @param string $question Question
* @param string $action Action
* @param array<array{name:string,value:string,values?:string[],default?:string,label:string,type:string,size?:string,morecss?:string,moreattr?:string,style?:string,inputko?:int<0,1>}>|string|null $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...'))
* @param array<array{name:string,value?:string,values?:string[],default?:string,label:string,type:string,size?:string,morecss?:string,moreattr?:string,style?:string,inputko?:int<0,1>}>|string|null $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...'))
* 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss',
* 'other', 'onecolumn' or 'hidden'...
* @param int<0,1>|''|'no'|'yes'|'1'|'0' $selectedchoice '' or 'no', or 'yes' or '1', 1, '0' or 0
@ -8500,7 +8500,7 @@ class Form
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
* @param int<0,1> $disabled 1=Html component is disabled
* @param string $selected_input_value Value of preselected input text (for use with ajax)
* @param string|array $objectfield 'Object:Field' that contains the definition of parent (in table $fields or $extrafields). Example: 'Object:xxx' or 'Object@module:xxx' or 'Object:options_xxx' or 'Object@module:options_xxx' or, better, the full entry array in ->fields
* @param string|array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int<-5,5>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array<int|string,string>,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>} $objectfield 'Object:Field' that contains the definition of parent (in table $fields or $extrafields). Example: 'Object:xxx' or 'Object@module:xxx' or 'Object:options_xxx' or 'Object@module:options_xxx' or, better, the full entry array in ->fields
* @return string Return HTML string
* @see selectForFormsList(), select_thirdparty_list()
*/

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2012-2018 Charlene BENKE <charlie@patas-monkey.com>
* Copyright (C) 2025 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
@ -180,17 +181,17 @@ class FormContract
/**
* Show a form to select a contract
*
* @param int $page Page
* @param string $page Page
* @param int $socid Id third party (-1=all, 0=only contracts not linked to a third party, id=contracts not linked or linked to third party id)
* @param int $selected Id contract preselected
* @param string $htmlname Nom de la zone html
* @param int $maxlength Maximum length of label
* @param int $showempty Show empty line
* @param int $showRef Show customer and supplier reference on each contract (when found)
* @param int $noouput 1=Return the output instead of display
* @param int<0,1> $nooutput 1=Return the output instead of display
* @return string|void html string
*/
public function formSelectContract($page, $socid = -1, $selected = 0, $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0, $noouput = 0)
public function formSelectContract($page, $socid = -1, $selected = 0, $htmlname = 'contrattid', $maxlength = 16, $showempty = 1, $showRef = 0, $nooutput = 0)
{
global $langs;
@ -201,7 +202,7 @@ class FormContract
$ret .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
$ret .= '</form>';
if ($noouput) {
if ($nooutput) {
return $ret;
}

View file

@ -1013,6 +1013,274 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
return $nbFerie;
}
/**
* Return the list of public holidays including Friday, Saturday and Sunday (or not) between 2 dates in timestamp.
* Dates must be UTC with hour, min, sec to 0.
* TODO Not used yet. Must be shared with num_public_holiday()
*
* @param int $timestampStart Timestamp start (UTC with hour, min, sec = 0)
* @param int $timestampEnd Timestamp end (UTC with hour, min, sec = 0)
* @param string $country_code Country code
* @param int $lastday Last day is included, 0: no, 1:yes
* @param int $excludesaturday Exclude saturday as non working day (-1=use setup, 0=no, 1=yes)
* @param int $excludesunday Exclude sunday as non working day (-1=use setup, 0=no, 1=yes)
* @param int $excludefriday Exclude friday as non working day (-1=use setup, 0=no, 1=yes)
* @param int $excludemonday Exclude monday as non working day (-1=use setup, 0=no, 1=yes)
* @return string|int[] List of public holidays timestamps or error message string if error
* @see num_public_holiday(), num_open_day()
*/
function listPublicHoliday($timestampStart, $timestampEnd, $country_code = '', $lastday = 0, $excludesaturday = -1, $excludesunday = -1, $excludefriday = -1, $excludemonday = -1)
{
global $conf, $db, $mysoc;
// Check to ensure we use correct parameters
if (($timestampEnd - $timestampStart) % 86400 != 0) {
return 'Error Dates must use same hours and must be GMT dates';
}
if (empty($country_code)) {
$country_code = $mysoc->country_code;
}
if ($excludemonday < 0) {
$excludemonday = getDolGlobalInt('MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY', 0);
}
if ($excludefriday < 0) {
$excludefriday = getDolGlobalInt('MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY', 0);
}
if ($excludesaturday < 0) {
$excludesaturday = getDolGlobalInt('MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', 1);
}
if ($excludesunday < 0) {
$excludesunday = getDolGlobalInt('MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', 1);
}
$country_id = dol_getIdFromCode($db, $country_code, 'c_country', 'code', 'rowid');
if (empty($conf->cache['arrayOfActivePublicHolidays_' . $country_id])) {
// Loop on public holiday defined into hrm_public_holiday for the day, month and year analyzed
$tmpArrayOfPublicHolidays = array();
$sql = "SELECT id, code, entity, fk_country, dayrule, year, month, day, active";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_hrm_public_holiday";
$sql .= " WHERE active = 1 and fk_country IN (0" . ($country_id > 0 ? ", " . $country_id : 0) . ")";
$sql .= " AND entity IN (0," . getEntity('holiday') . ")";
$resql = $db->query($sql);
if ($resql) {
$num_rows = $db->num_rows($resql);
$i = 0;
while ($i < $num_rows) {
$obj = $db->fetch_object($resql);
$tmpArrayOfPublicHolidays[$obj->id] = array('dayrule' => $obj->dayrule, 'year' => $obj->year, 'month' => $obj->month, 'day' => $obj->day);
$i++;
}
} else {
dol_syslog($db->lasterror(), LOG_ERR);
return 'Error sql ' . $db->lasterror();
}
//var_dump($tmpArrayOfPublicHolidays);
$conf->cache['arrayOfActivePublicHolidays_' . $country_id] = $tmpArrayOfPublicHolidays;
}
$arrayOfPublicHolidays = $conf->cache['arrayOfActivePublicHolidays_' . $country_id];
$listFeries = [];
$i = 0;
while ((($lastday == 0 && $timestampStart < $timestampEnd) || ($lastday && $timestampStart <= $timestampEnd))
&& ($i < 50000)) { // Loop end when equals (Test on i is a security loop to avoid infinite loop)
$nonWorkingDay = false;
$ferie = false;
$specialdayrule = array();
$jour = (int) gmdate("d", $timestampStart);
$mois = (int) gmdate("m", $timestampStart);
$annee = (int) gmdate("Y", $timestampStart);
// If we have to exclude Friday, Saturday and Sunday
if ($excludefriday || $excludesaturday || $excludesunday) {
$jour_julien = unixtojd($timestampStart);
$jour_semaine = jddayofweek($jour_julien, 0);
if ($excludefriday) { //Friday (5), Saturday (6) and Sunday (0)
if ($jour_semaine == 5) {
$nonWorkingDay = true;
}
}
if ($excludesaturday) { //Friday (5), Saturday (6) and Sunday (0)
if ($jour_semaine == 6) {
$nonWorkingDay = true;
}
}
if ($excludesunday) { //Friday (5), Saturday (6) and Sunday (0)
if ($jour_semaine == 0) {
$nonWorkingDay = true;
}
}
}
//print "ferie=".$nonWorkingDay."\n";
if (!$nonWorkingDay) {
//print "jour=".$jour." month=".$mois." year=".$annee." includesaturday=".$excludesaturday." includesunday=".$excludesunday."\n";
foreach ($arrayOfPublicHolidays as $entrypublicholiday) {
if (!empty($entrypublicholiday['dayrule']) && $entrypublicholiday['dayrule'] != 'date') { // For example 'easter', '...'
$specialdayrule[$entrypublicholiday['dayrule']] = $entrypublicholiday['dayrule'];
} else {
$match = 1;
if (!empty($entrypublicholiday['year']) && $entrypublicholiday['year'] != $annee) {
$match = 0;
}
if ($entrypublicholiday['month'] != $mois) {
$match = 0;
}
if ($entrypublicholiday['day'] != $jour) {
$match = 0;
}
if ($match) {
$ferie = true;
$listFeries[] = $timestampStart;
}
}
$i++;
}
//var_dump($specialdayrule)."\n";
//print "ferie=".$nonWorkingDay."\n";
}
if (!$nonWorkingDay && !$ferie) {
// Special dayrules
if (in_array('easter', $specialdayrule)) {
// Calculation for easter date
$date_paques = getGMTEasterDatetime($annee);
$jour_paques = gmdate("d", $date_paques);
$mois_paques = gmdate("m", $date_paques);
if ($jour_paques == $jour && $mois_paques == $mois) {
$ferie = true;
$listFeries[] = $timestampStart;
}
// Easter (sunday)
}
if (in_array('eastermonday', $specialdayrule)) {
// Calculation for the monday of easter date
$date_paques = getGMTEasterDatetime($annee);
//print 'PPP'.$date_paques.' '.dol_print_date($date_paques, 'dayhour', 'gmt')." ";
$date_lundi_paques = $date_paques + (3600 * 24);
$jour_lundi_paques = gmdate("d", $date_lundi_paques);
$mois_lundi_paques = gmdate("m", $date_lundi_paques);
if ($jour_lundi_paques == $jour && $mois_lundi_paques == $mois) {
$ferie = true;
$listFeries[] = $timestampStart;
}
// Easter (monday)
//print 'annee='.$annee.' $jour='.$jour.' $mois='.$mois.' $jour_lundi_paques='.$jour_lundi_paques.' $mois_lundi_paques='.$mois_lundi_paques."\n";
}
//Good Friday
if (in_array('goodfriday', $specialdayrule)) {
// Pulls the date of Easter
$easter = getGMTEasterDatetime($annee);
// Calculates the date of Good Friday based on Easter
$date_good_friday = $easter - (2 * 3600 * 24);
$dom_good_friday = gmdate("d", $date_good_friday);
$month_good_friday = gmdate("m", $date_good_friday);
if ($dom_good_friday == $jour && $month_good_friday == $mois) {
$ferie = true;
$listFeries[] = $timestampStart;
}
}
if (in_array('ascension', $specialdayrule)) {
// Calcul du jour de l'ascension (39 days after easter day)
$date_paques = getGMTEasterDatetime($annee);
$date_ascension = $date_paques + (3600 * 24 * 39);
$jour_ascension = gmdate("d", $date_ascension);
$mois_ascension = gmdate("m", $date_ascension);
if ($jour_ascension == $jour && $mois_ascension == $mois) {
$ferie = true;
$listFeries[] = $timestampStart;
}
// Ascension (thursday)
}
if (in_array('pentecost', $specialdayrule)) {
// Calculation of "Pentecote" (49 days after easter day)
$date_paques = getGMTEasterDatetime($annee);
$date_pentecote = $date_paques + (3600 * 24 * 49);
$jour_pentecote = gmdate("d", $date_pentecote);
$mois_pentecote = gmdate("m", $date_pentecote);
if ($jour_pentecote == $jour && $mois_pentecote == $mois) {
$ferie = true;
$listFeries[] = $timestampStart;
}
// "Pentecote" (sunday)
}
if (in_array('pentecotemonday', $specialdayrule)) {
// Calculation of "Pentecote" (49 days after easter day)
$date_paques = getGMTEasterDatetime($annee);
$date_pentecote = $date_paques + (3600 * 24 * 50);
$jour_pentecote = gmdate("d", $date_pentecote);
$mois_pentecote = gmdate("m", $date_pentecote);
if ($jour_pentecote == $jour && $mois_pentecote == $mois) {
$ferie = true;
$listFeries[] = $timestampStart;
}
// "Pentecote" (monday)
}
if (in_array('viernessanto', $specialdayrule)) {
// Viernes Santo
$date_paques = getGMTEasterDatetime($annee);
$date_viernes = $date_paques - (3600 * 24 * 2);
$jour_viernes = gmdate("d", $date_viernes);
$mois_viernes = gmdate("m", $date_viernes);
if ($jour_viernes == $jour && $mois_viernes == $mois) {
$ferie = true;
$listFeries[] = $timestampStart;
}
//Viernes Santo
}
if (in_array('fronleichnam', $specialdayrule)) {
// Fronleichnam (60 days after easter sunday)
$date_paques = getGMTEasterDatetime($annee);
$date_fronleichnam = $date_paques + (3600 * 24 * 60);
$jour_fronleichnam = gmdate("d", $date_fronleichnam);
$mois_fronleichnam = gmdate("m", $date_fronleichnam);
if ($jour_fronleichnam == $jour && $mois_fronleichnam == $mois) {
$ferie = true;
$listFeries[] = $timestampStart;
}
// Fronleichnam
}
if (in_array('genevafast', $specialdayrule)) {
// Geneva fast in Switzerland (Thursday after the first sunday in September)
$date_1sunsept = strtotime('next thursday', strtotime('next sunday', mktime(0, 0, 0, 9, 1, $annee)));
$jour_1sunsept = date("d", $date_1sunsept);
$mois_1sunsept = date("m", $date_1sunsept);
if ($jour_1sunsept == $jour && $mois_1sunsept == $mois) {
$ferie = true;
$listFeries[] = $timestampStart;
}
// Geneva fast in Switzerland
}
}
//print "ferie=".$nonWorkingDay."\n";
// Increase number of days (on go up into loop)
$timestampStart = dol_time_plus_duree($timestampStart, 1, 'd');
//var_dump($jour.' '.$mois.' '.$annee.' '.$timestampStart);
$i++;
}
//print "nbFerie=".$nbFerie."\n";
return $listFeries;
}
/**
* Function to return number of days between two dates (date must be UTC date !)
* Example: 2012-01-01 2012-01-02 => 1 if lastday=0, 2 if lastday=1

View file

@ -232,7 +232,7 @@ function fichinter_rec_prepare_head($object)
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/fichinter/card-rec.php?id='.$object->id;
$head[$h][1] = $langs->trans("CardFichinter");
$head[$h][1] = $langs->trans("InterventionCard");
$head[$h][2] = 'card';
$h++;

View file

@ -3565,9 +3565,19 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
dol_print_error(null, 'Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')');
exit;
}
if ($fuser->hasRight($tmpmodule, $lire) || preg_match('/^specimen/i', $original_file)) {
// Check fuser->rights->modulepart->myobject->read and fuser->rights->modulepart->read
$partsofdirinoriginalfile = explode('/', $original_file);
if (!empty($partsofdirinoriginalfile[1])) { // If original_file is xxx/filename (xxx is a part we will use)
$partofdirinoriginalfile = $partsofdirinoriginalfile[0];
if (($partofdirinoriginalfile && $fuser->hasRight($tmpmodule, $partofdirinoriginalfile, 'read')) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
}
if ($fuser->hasRight($tmpmodule, $read) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = $conf->$tmpmodule->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
} else {
if (empty($conf->$modulepart->dir_output)) { // modulepart not supported

View file

@ -6052,7 +6052,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss
if ($picto == 'warning') {
$fa = 'exclamation-triangle';
}
$result = ($nodiv ? '' : '<div class="wordbreak '.$class.($morecss ? ' '.$morecss : '').($textfordropdown ? ' hidden' : '').'">').'<span class="fa fa-'.$fa.'" title="'.dol_escape_htmltag($admin ? $langs->trans('InfoAdmin') : $langs->trans('Note')).'"></span> ';
$result = ($nodiv ? '' : '<div class="wordbreakall '.$class.($morecss ? ' '.$morecss : '').($textfordropdown ? ' hidden' : '').'">').'<span class="fa fa-'.$fa.'" title="'.dol_escape_htmltag($admin ? $langs->trans('InfoAdmin') : $langs->trans('Note')).'"></span> ';
$result .= dol_escape_htmltag($text, 1, 0, 'div,span,b,br,a');
$result .= ($nodiv ? '' : '</div>');

View file

@ -48,7 +48,7 @@
* @param string $price_base_type 'HT'=Unit price parameter $pu is HT, 'TTC'=Unit price parameter $pu is TTC (HT+VAT but not Localtax. TODO Add also mode 'INCT' when pu is price HT+VAT+LT1+LT2)
* @param int $info_bits Miscellaneous information on line
* @param int<0,1> $type 0/1=Product/service
* @param string|Societe|string $seller Third party seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc.
* @param string|Societe|null $seller Third party seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc.
* @param array{0:string,1:int|string,2:string,3:string}|array{0:string,1:int|string,2:string,3:int|string,4:string,5:string} $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function).
* @param float $progress Situation invoices progress (value from 0 to 100, 100 by default)
* @param float $multicurrency_tx Currency rate (1 by default)
@ -87,7 +87,7 @@
*
* @phan-suppress PhanTypeMismatchDefault
*/
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = '', $localtaxes_array = [], $progress = 100, $multicurrency_tx = 1, $pu_devise = 0, $multicurrency_code = '') // @phpstan-ignore-line
function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocaltax1_rate, $uselocaltax2_rate, $remise_percent_global, $price_base_type, $info_bits, $type, $seller = null, $localtaxes_array = [], $progress = 100, $multicurrency_tx = 1, $pu_devise = 0, $multicurrency_code = '') // @phpstan-ignore-line
{
global $conf, $mysoc, $db;

View file

@ -365,13 +365,13 @@ if (!empty($withproject)) {
print '<tr><td class="valuefield">';
print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print '</td><td class="valuefield">';
print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid');
print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid');
print "</td></tr>";
print '<tr><td class="valuefield">';
print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print '</td><td class="valuefield">';
print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid');
print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid');
print "</td></tr>";
print '<tr><td class="titlefield">';

View file

@ -373,7 +373,7 @@ if (!empty($withproject)) {
print '<tr><td>';
print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid');
print '</td><td>';
print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, 0, '', 0, '', 'projectid');
print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', $projectstatic->price_booth, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid');
print "</td></tr>";
print '<tr><td>';

View file

@ -734,7 +734,7 @@ if ($id > 0 || !empty($ref)) {
$text .= ' - '.$label;
$description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description)).'<br>';
$description .= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80);
print $form->textwithtooltip($text, $description, 3, '', 0, (string) $i);
print $form->textwithtooltip($text, $description, 3, 0, '', (string) $i);
// Show range
print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -130,6 +130,7 @@ print '<tr><td>'.$langs->trans('Amount').'</td><td>'.price($object->amount, 0, $
print '<tr><td class="tdtop">'.$langs->trans('Note').'</td><td class="valeur sensiblehtmlcontent">'.dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_public)).'</td></tr>';
$disable_delete = 0;
$title_button = '';
// Bank account
if (isModEnabled("bank")) {
if ($object->bank_account) {

View file

@ -4,6 +4,7 @@
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 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
* it under the terms of the GNU General Public License as published by
@ -42,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('bills', 'trips'));
$id = GETPOST('id');
$id = GETPOSTINT('id');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');

View file

@ -2,7 +2,7 @@
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -225,6 +225,7 @@ if ($action == 'create' || empty($action)) {
$sql .= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p, ".MAIN_DB_PREFIX."expensereport as e";
$sql .= " WHERE p.fk_expensereport = e.rowid AND p.fk_expensereport = ".((int) $id);
$sql .= ' AND e.entity IN ('.getEntity('expensereport').')';
$sumpaid = 0;
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);

View file

@ -2,8 +2,8 @@
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.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-2025 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
@ -159,6 +159,7 @@ if (!$mesg) {
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
$fileurl_avg = null;
if (!$user->hasRight('societe', 'client', 'voir')) {
$filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
if ($mode == 'customer') {
@ -179,7 +180,7 @@ if (!$user->hasRight('societe', 'client', 'voir')) {
$px3 = new DolGraph();
$mesg = $px3->isGraphKo();
if (!$mesg) {
if (!$mesg && $fileurl_avg !== null) {
$px3->SetData($data);
$i = $startyear;
$legend = array();
@ -190,7 +191,7 @@ if (!$mesg) {
$px3->SetLegend($legend);
$px3->SetYLabel($langs->trans("AmountAverage"));
$px3->SetMaxValue($px3->GetCeilMaxValue());
$px3->SetMinValue($px3->GetFloorMinValue());
$px3->SetMinValue((int) $px3->GetFloorMinValue());
$px3->SetWidth($WIDTH);
$px3->SetHeight($HEIGHT);
$px3->SetShading(3);
@ -248,7 +249,7 @@ if (!$user->hasRight('expensereport', 'readall') && !$user->hasRight('expenserep
$include = 'hierarchy';
}
print img_picto('', 'user', 'class="pictofixedwidth"');
print $form->select_dolusers($userid, 'userid', 1, '', 0, $include, '', 0, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300');
print $form->select_dolusers($userid, 'userid', 1, null, 0, $include, '', '', 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300');
print '</td></tr>';
// Status
print '<tr><td class="left">'.$langs->trans("Status").'</td><td class="left">';

View file

@ -1,4 +1,13 @@
<?php
/* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*/
/**
* @var int $colspan
*/
'
@phan-var-force int $colspan
';
// Add line to upload new file
print '<!-- expensereport_addfile.tpl.php -->'."\n";

View file

@ -1,6 +1,12 @@
<?php
/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
/* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*/
/**
* @var int $colspan
*/
'
@phan-var-force int $colspan
';
// Add line to select existing file
if (!getDolGlobalString('EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES')) {
@ -29,6 +35,7 @@ if (!getDolGlobalString('EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES')) {
$maxheightmini = 48;
$relativepath = (!empty($object->ref) ? dol_sanitizeFileName($object->ref) : '').'/';
$filei = 0;
$minifile = null;
// Loop on each attached file
foreach ($arrayoffiles as $file) {
$urlforhref = array();
@ -95,7 +102,8 @@ if (!getDolGlobalString('EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES')) {
}
print '<div class="photoref backgroundblank">';
print $thumbshown ? $thumbshown : img_mime($minifile);
// TODO: Check that $minifile has a proper value here (set in true part of if, not else part).
print $thumbshown ? $thumbshown : ($minifile ? img_mime($minifile) : null);
print '</div>';
if (empty($urlforhref) || empty($thumbshown)) {

View file

@ -10,7 +10,7 @@
* Copyright (C) 2016-2018 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -121,7 +121,7 @@ $result = restrictedArea($user, 'ficheinter', $id, $objecttype);
$permissiontoadd = $user->hasRight('ficheinter', 'creer');
$permissiontodelete = $user->hasRight('ficheinter', 'supprimer');
$objp = null;
/*
* Actions
@ -215,7 +215,7 @@ if ($action == 'add' && $permissiontoadd) {
}
$newinter->entity = $object->entity;
$newinter->duree = $object->duree;
$newinter->duration = $object->duration;
$newinter->description = $object->description;
$newinter->note_private = $object->note_private;
@ -254,7 +254,7 @@ if ($action == 'add' && $permissiontoadd) {
} elseif ($action == 'setfrequency' && $permissiontoadd) {
// Set frequency and unit frequency
$object->fetch($id);
$object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha'));
$object->setFrequencyAndUnit(GETPOSTINT('frequency'), GETPOST('unit_frequency', 'alpha'));
} elseif ($action == 'setdate_when' && $permissiontoadd) {
// Set next date of execution
$object->fetch($id);
@ -280,6 +280,8 @@ llxHeader('', $langs->trans("RepeatableIntervention"), $help_url, '', 0, 0, '',
$form = new Form($db);
$fichinterrecstatic = new FichinterRec($db);
$companystatic = new Societe($db);
$contratstatic = null;
$projectstatic = null;
if (isModEnabled('contract')) {
$contratstatic = new Contrat($db);
}
@ -508,7 +510,7 @@ if ($action == 'create') {
$object->fetch_thirdparty();
$author = new User($db);
$author->fetch($object->user_author);
$author->fetch((int) $object->user_author);
$head = fichinter_rec_prepare_head($object);
@ -535,11 +537,11 @@ if ($action == 'create') {
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= $formproject->select_projects($object->socid, (string) $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
}
} else {
if (!empty($object->fk_project)) {
@ -577,7 +579,7 @@ if ($action == 'create') {
print '<tr><td>'.$langs->trans("Description").'</td><td colspan="3">'.nl2br($object->description)."</td></tr>";
// Contract
if (isModEnabled('contract')) {
if (isModEnabled('contract') && $contratstatic !== null) {
$langs->load('contracts');
print '<tr>';
print '<td>';
@ -599,7 +601,7 @@ if ($action == 'create') {
if ($object->fk_contrat) {
$contratstatic = new Contrat($db);
$contratstatic->fetch($object->fk_contrat);
print $contratstatic->getNomUrl(0, '', 1);
print $contratstatic->getNomUrl(0, 0, 1);
} else {
print "&nbsp;";
}
@ -666,7 +668,7 @@ if ($action == 'create') {
// Max period / Rest period
print '<tr><td>';
if ($user->hasRight('ficheinter', 'creer') && ($action == 'nb_gen_max' || $object->frequency > 0)) {
print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->hasRight('facture', 'creer'));
print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', (string) $object->nb_gen_max, $object, $user->hasRight('facture', 'creer'));
} else {
print $langs->trans("MaxPeriodNumber");
}
@ -743,7 +745,8 @@ if ($action == 'create') {
$type = $object->lines[$i]->product_type;
} // else { $object->lines[$i]->fk_product_type; }
if (isset($objp) && is_object($objp)) {
// TODO: $objp is not set here, so why test?
if (isset($objp) && is_object($objp)) { // $objp always null @phpstan-ignore-line
// Try to enhance type detection using date_start and date_end for free lines when type
// was not saved.
if (!empty($objp->date_start)) {
@ -871,7 +874,7 @@ if ($action == 'create') {
print '<td>'.$langs->trans("None").'</td>';
}
if (isModEnabled('contract')) {
if (isModEnabled('contract') && $contratstatic !== null) {
print '<td>';
if ($objp->fk_contrat > 0) {
$contratstatic->fetch($objp->fk_contrat);
@ -879,7 +882,7 @@ if ($action == 'create') {
}
print '</td>';
}
if (isModEnabled('project')) {
if (isModEnabled('project') && $projectstatic !== null) {
print '<td>';
if ($objp->fk_project > 0) {
$projectstatic->fetch($objp->fk_project);

View file

@ -11,7 +11,7 @@
* Copyright (C) 2020-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023 Benjamin Grembi <benjamin@oarces.fr>
* Copyright (C) 2023-2024 William Mead <william.mead@manchenumerique.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
@ -937,7 +937,7 @@ if ($action == 'create') {
$classname = ucfirst($subelement);
$objectsrc = new $classname($db);
'@phan-var-force Commande|Propal|Contrat $objectsrc';
$objectsrc->fetch(GETPOST('originid'));
$objectsrc->fetch(GETPOSTINT('originid'));
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) {
$objectsrc->fetch_lines();
$lines = $objectsrc->lines;
@ -1048,7 +1048,7 @@ if ($action == 'create') {
print '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td>';
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%');
$doleditor = new DolEditor('note_public', (string) $note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
//print '<textarea name="note_public" cols="80" rows="'.ROWS_3.'">'.$note_public.'</textarea>';
print '</td></tr>';
@ -1058,7 +1058,7 @@ if ($action == 'create') {
print '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
print '<td>';
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%');
$doleditor = new DolEditor('note_private', (string) $note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
//print '<textarea name="note_private" cols="80" rows="'.ROWS_3.'">'.$note_private.'</textarea>';
print '</td></tr>';
@ -1316,7 +1316,7 @@ if ($action == 'create') {
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
}
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);
@ -1509,13 +1509,11 @@ if ($action == 'create') {
$extrafields->fetch_name_optionals_label($objectline->table_element);
if (!empty($extrafields)) {
$temps = $objectline->showOptionals($extrafields, 'view', array(), '', '', 1, 'line');
if (!empty($temps)) {
print '<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.'" name="extrafield_lines_area_'.$line->id.'">';
print $temps;
print '</div>';
}
$temps = $objectline->showOptionals($extrafields, 'view', array(), '', '', '1', 'line');
if (!empty($temps)) {
print '<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.'" name="extrafield_lines_area_'.$line->id.'">';
print $temps;
print '</div>';
}
print '</td>';
@ -1581,13 +1579,11 @@ if ($action == 'create') {
$extrafields->fetch_name_optionals_label($objectline->table_element);
if (!empty($extrafields)) {
$temps = $objectline->showOptionals($extrafields, 'edit', array(), '', '', 1, 'line');
if (!empty($temps)) {
print '<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.'" name="extrafield_lines_area_'.$line->id.'">';
print $temps;
print '</div>';
}
$temps = $objectline->showOptionals($extrafields, 'edit', array(), '', '', '1', 'line');
if (!empty($temps)) {
print '<div style="padding-top: 10px" id="extrafield_lines_area_'.$line->id.'" name="extrafield_lines_area_'.$line->id.'">';
print $temps;
print '</div>';
}
print '</td>';
@ -1663,7 +1659,7 @@ if ($action == 'create') {
$extrafields->fetch_name_optionals_label($objectline->table_element);
if (is_object($objectline)) {
$temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', 1, 'line');
$temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', '1', 'line');
if (!empty($temps)) {
print '<div style="padding-top: 10px" id="extrafield_lines_area_create" name="extrafield_lines_area_create">';

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2025 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
@ -35,25 +36,25 @@ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
class Interventions extends DolibarrApi
{
/**
* @var array $FIELDS Mandatory fields, checked when create and update object
* @var string[] Mandatory fields, checked when create and update object
*/
public static $FIELDS = array(
'socid',
'fk_project',
'description',
'socid',
'fk_project',
'description',
);
/**
* @var array $FIELDS Mandatory fields, checked when create and update object
* @var string[] Mandatory fields, checked when create and update object
*/
public static $FIELDSLINE = array(
'description',
'date',
'duree',
'description',
'date',
'duree',
);
/**
* @var Fichinter $fichinter {@type fichinter}
* @var Fichinter {@type fichinter}
*/
public $fichinter;
@ -107,6 +108,8 @@ class Interventions extends DolibarrApi
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
* @return array Array of order objects
* @phan-return array<object>
* @phpstan-return array<object>
*
* @throws RestException
*/
@ -186,6 +189,8 @@ class Interventions extends DolibarrApi
* Create intervention object
*
* @param array $request_data Request data
* @phan-param ?array<string,string> $request_data
* @phpstan-param ?array<string,string> $request_data
* @return int ID of intervention
*/
public function post($request_data = null)
@ -251,6 +256,8 @@ class Interventions extends DolibarrApi
*
* @param int $id Id of intervention to update
* @param array $request_data Request data
* @phan-param ?array<string,string> $request_data
* @phpstan-param ?array<string,string> $request_data
*
* @url POST {id}/lines
*
@ -287,7 +294,7 @@ class Interventions extends DolibarrApi
$id,
$this->fichinter->description,
$this->fichinter->date,
$this->fichinter->duree
$this->fichinter->duration
);
if ($updateRes > 0) {
@ -302,6 +309,8 @@ class Interventions extends DolibarrApi
*
* @param int $id Order ID
* @return array
* @phan-return array<string,array{code:int,message:string}>
* @phpstan-return array<string,array{code:int,message:string}>
*/
public function delete($id)
{
@ -411,8 +420,8 @@ class Interventions extends DolibarrApi
/**
* Validate fields before create or update object
*
* @param array $data Data to validate
* @return array
* @param ?array<null|int|float|string> $data Data to validate
* @return array<string,null|int|float|string>
*
* @throws RestException
*/
@ -450,8 +459,8 @@ class Interventions extends DolibarrApi
/**
* Validate fields before create or update object
*
* @param array $data Data to validate
* @return array
* @param array<string,null|int|float|string> $data Data to validate
* @return array<string,null|int|float|string> Return array with validated mandatory fields and their value
*
* @throws RestException
*/

View file

@ -9,7 +9,7 @@
* Copyright (C) 2016-2018 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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,7 +91,7 @@ class FichinterRec extends Fichinter
public $date_last_gen;
/**
* @var datetime|string
* @var int|string
*/
public $date_when;
@ -255,7 +255,7 @@ class FichinterRec extends Fichinter
$fichintsrc->lines[$i]->product_type,
$fichintsrc->lines[$i]->special_code,
!empty($fichintsrc->lines[$i]->label) ? $fichintsrc->lines[$i]->label : "",
$fichintsrc->lines[$i]->fk_unit
(string) $fichintsrc->lines[$i]->fk_unit
);
if ($result_insert < 0) {
@ -527,7 +527,7 @@ class FichinterRec extends Fichinter
// qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits, $type, $mysoc);
$tabprice = calcul_price_total($qty, (float) $pu, (float) $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits, $type, $mysoc);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
@ -609,7 +609,7 @@ class FichinterRec extends Fichinter
// phpcs:enable
if ($user->hasRight('fichinter', 'creer')) {
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter_rec ";
$sql .= " SET frequency='".$this->db->escape($freq)."'";
$sql .= " SET frequency='".$this->db->escape((string) $freq)."'";
$sql .= ", date_last_gen='".$this->db->escape($courant)."'";
$sql .= " WHERE rowid = ".((int) $this->id);
@ -749,7 +749,7 @@ class FichinterRec extends Fichinter
}
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET frequency = '.($frequency ? $this->db->escape($frequency) : 'null');
$sql .= ' SET frequency = '.($frequency ? $this->db->escape((string) $frequency) : 'null');
if (!empty($unit)) {
$sql .= ', unit_frequency = "'.$this->db->escape($unit).'"';
}
@ -771,8 +771,8 @@ class FichinterRec extends Fichinter
/**
* Update the next date of execution
*
* @param datetime $date date of execution
* @param int $increment_nb_gen_done 0 do nothing more, >0 increment nb_gen_done
* @param int $date date of execution
* @param int<0,max> $increment_nb_gen_done 0 do nothing more, >0 increment nb_gen_done
* @return int Return integer <0 if KO, >0 if OK
*/
public function setNextDate($date, $increment_nb_gen_done = 0)

View file

@ -9,7 +9,7 @@
* Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2022 Charlène Benke <charlene@patas-monkey.com>
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Benjamin Falière <benjamin.faliere@altairis.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -139,29 +139,29 @@ if (getDolGlobalString('FICHINTER_DISABLE_DETAILS')) {
// Definition of fields for list
$arrayfields = array(
'f.ref' => array('label' => 'Ref', 'checked' => 1),
'f.ref_client' => array('label' => 'RefCustomer', 'checked' => 1),
's.nom' => array('label' => 'ThirdParty', 'checked' => 1),
'pr.ref' => array('label' => 'Project', 'checked' => 1, 'enabled' => (!isModEnabled('project') ? 0 : 1)),
'c.ref' => array('label' => 'Contract', 'checked' => 1, 'enabled' => (empty($conf->contrat->enabled) ? 0 : 1)),
'f.description' => array('label' => 'Description', 'checked' => 1),
'f.datec' => array('label' => 'DateCreation', 'checked' => 0, 'position' => 500),
'f.tms' => array('label' => 'DateModificationShort', 'checked' => 0, 'position' => 500),
'f.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'position' => 510, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))),
'f.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'position' => 511, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))),
'f.fk_statut' => array('label' => 'Status', 'checked' => 1, 'position' => 1000),
'f.signed_status' => array('label' => 'SignedStatus', 'checked' => 0, 'position' => 1001),
'fd.description' => array('label' => "DescriptionOfLine", 'checked' => 1, 'enabled' => getDolGlobalString('FICHINTER_DISABLE_DETAILS') != '1' ? 1 : 0),
'fd.date' => array('label' => 'DateOfLine', 'checked' => 1, 'enabled' => getDolGlobalString('FICHINTER_DISABLE_DETAILS') != '1' ? 1 : 0),
'fd.duree' => array('label' => 'DurationOfLine', 'type' => 'duration', 'checked' => 1, 'enabled' => !getDolGlobalString('FICHINTER_DISABLE_DETAILS') ? 1 : 0), //type duration is here because in database, column 'duree' is double
'f.ref' => array('label' => 'Ref', 'checked' => '1'),
'f.ref_client' => array('label' => 'RefCustomer', 'checked' => '1'),
's.nom' => array('label' => 'ThirdParty', 'checked' => '1'),
'pr.ref' => array('label' => 'Project', 'checked' => '1', 'enabled' => (!isModEnabled('project') ? '0' : '1')),
'c.ref' => array('label' => 'Contract', 'checked' => '1', 'enabled' => (empty($conf->contrat->enabled) ? '0' : '1')),
'f.description' => array('label' => 'Description', 'checked' => '1'),
'f.datec' => array('label' => 'DateCreation', 'checked' => '0', 'position' => 500),
'f.tms' => array('label' => 'DateModificationShort', 'checked' => '0', 'position' => 500),
'f.note_public' => array('label' => 'NotePublic', 'checked' => '0', 'position' => 510, 'enabled' => (string) (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))),
'f.note_private' => array('label' => 'NotePrivate', 'checked' => '0', 'position' => 511, 'enabled' => (string) (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))),
'f.fk_statut' => array('label' => 'Status', 'checked' => '1', 'position' => 1000),
'f.signed_status' => array('label' => 'SignedStatus', 'checked' => '0', 'position' => 1001),
'fd.description' => array('label' => "DescriptionOfLine", 'checked' => '1', 'enabled' => getDolGlobalString('FICHINTER_DISABLE_DETAILS') != '1' ? '1' : '0'),
'fd.date' => array('label' => 'DateOfLine', 'checked' => '1', 'enabled' => getDolGlobalString('FICHINTER_DISABLE_DETAILS') != '1' ? '1' : '0'),
'fd.duree' => array('label' => 'DurationOfLine', 'type' => 'duration', 'checked' => '1', 'enabled' => !getDolGlobalString('FICHINTER_DISABLE_DETAILS') ? '1' : '0'), //type duration is here because in database, column 'duree' is double
);
'@phan-var-force array{label:string,type?:string,checked:int,position?:int,enabled?:int,langfile?:string,help:string} $arrayfields';
'@phan-var-force array{label:string,type?:string,checked:string,position?:int,enabled?:string,langfile?:string,help:string} $arrayfields';
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
'@phan-var-force array{label:string,type?:string,checked:string,position?:int,enabled?:string,langfile?:string,help:string} $arrayfields'; // dol_sort_array looses type for Phan
// Security check
$id = GETPOSTINT('id');
@ -237,6 +237,8 @@ $form = new Form($db);
$formfile = new FormFile($db);
$objectstatic = new Fichinter($db);
$companystatic = new Societe($db);
$projetstatic = null;
$contratstatic = null;
if (isModEnabled('project')) {
$projetstatic = new Project($db);
}
@ -921,7 +923,7 @@ while ($i < $imaxinloop) {
}
}
// Project ref
if (!empty($arrayfields['pr.ref']['checked'])) {
if (!empty($arrayfields['pr.ref']['checked']) && $projetstatic !== null) {
print '<td class="tdoverflowmax150">';
$projetstatic->id = $obj->projet_id;
$projetstatic->ref = $obj->projet_ref;
@ -935,14 +937,14 @@ while ($i < $imaxinloop) {
}
}
// Contract
if (!empty($arrayfields['c.ref']['checked'])) {
if (!empty($arrayfields['c.ref']['checked']) && $contratstatic !== null) {
print '<td class="tdoverflowmax150">';
$contratstatic->id = $obj->contrat_id;
$contratstatic->ref = $obj->contrat_ref;
$contratstatic->ref_customer = $obj->contrat_ref_customer;
$contratstatic->ref_supplier = $obj->contrat_ref_supplier;
if ($contratstatic->id > 0) {
print $contratstatic->getNomUrl(1, '');
print $contratstatic->getNomUrl(1, 0);
print '</td>';
}
if (!$i) {

View file

@ -8,7 +8,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
@ -363,9 +363,9 @@ if ($object->id > 0) {
print '</tr></table>';
print '</td><td>';
if ($action == 'editconditions') {
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_supplier_id, 'cond_reglement_supplier_id', 1);
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->cond_reglement_supplier_id, 'cond_reglement_supplier_id', 1);
} else {
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_supplier_id, 'none');
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->cond_reglement_supplier_id, 'none');
}
print "</td>";
print '</tr>';
@ -381,9 +381,9 @@ if ($object->id > 0) {
print '</tr></table>';
print '</td><td>';
if ($action == 'editmode') {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_supplier_id, 'mode_reglement_supplier_id', 'DBIT', 1, 1);
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->mode_reglement_supplier_id, 'mode_reglement_supplier_id', 'DBIT', 1, 1);
} else {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_supplier_id, 'none');
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->mode_reglement_supplier_id, 'none');
}
print "</td>";
print '</tr>';
@ -400,9 +400,9 @@ if ($object->id > 0) {
print '</tr></table>';
print '</td><td>';
if ($action == 'editbankaccount') {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'fk_account', 1);
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->fk_account, 'fk_account', 1);
} else {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'none');
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, (string) $object->fk_account, 'none');
}
print "</td>";
print '</tr>';
@ -432,7 +432,7 @@ if ($object->id > 0) {
print '</td></tr></table>';
print '</td>';
print '<td>';
$amount_discount = $object->getAvailableDiscounts('', '', 0, 1);
$amount_discount = $object->getAvailableDiscounts(null, '', 0, 1);
if ($amount_discount < 0) {
dol_print_error($db, $object->error);
}
@ -474,7 +474,7 @@ if ($object->id > 0) {
print '<tr><td>'.$langs->trans("LinkedToDolibarrMember").'</td>';
print '<td>';
$adh = new Adherent($db);
$result = $adh->fetch('', '', $object->id);
$result = $adh->fetch(0, '', $object->id);
if ($result > 0) {
$adh->ref = $adh->getFullName($langs);
print $adh->getNomUrl(1);
@ -493,7 +493,7 @@ if ($object->id > 0) {
$boxstat = '';
// Nbre max d'elements des petites listes
$MAXLIST = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT');
$MAXLIST = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT');
print '<div class="underbanner underbanner-before-box clearboth"></div>';
print '<br>';
@ -614,7 +614,7 @@ if ($object->id > 0) {
print $boxstat;
$MAXLIST = getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT');
$MAXLIST = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT');
/*
@ -762,6 +762,7 @@ if ($object->id > 0) {
* Latest supplier orders
*/
$orderstatic = new CommandeFournisseur($db);
$orders2invoice = 0;
if ($user->hasRight("fournisseur", "commande", "lire")) {
// TODO move to DAO class
@ -775,7 +776,7 @@ if ($object->id > 0) {
$sql2 .= ' AND s.rowid = '.((int) $object->id);
// Show orders we can bill
if (!getDolGlobalString('SUPPLIER_ORDER_TO_INVOICE_STATUS')) {
$sql2 .= " AND c.fk_statut IN (".$db->sanitize(CommandeFournisseur::STATUS_RECEIVED_COMPLETELY).")"; // Must match filter in htdocs/fourn/commande/list.php
$sql2 .= " AND c.fk_statut IN (".$db->sanitize((string) CommandeFournisseur::STATUS_RECEIVED_COMPLETELY).")"; // Must match filter in htdocs/fourn/commande/list.php
} else {
// CommandeFournisseur::STATUS_ORDERSENT.", ".CommandeFournisseur::STATUS_RECEIVED_PARTIALLY.", ".CommandeFournisseur::STATUS_RECEIVED_COMPLETELY
$sql2 .= " AND c.fk_statut IN (".$db->sanitize(getDolGlobalString('SUPPLIER_ORDER_TO_INVOICE_STATUS')).")";

View file

@ -86,3 +86,4 @@ TypeContact_fichinter_external_BILLING=Customer contact of intervention billing
TypeContact_fichinter_external_CUSTOMER=Customer contact of intervention follow-up
NotARecurringInterventionalTemplate=Not a recurring intervention template
ShowInterventionModel=Show intervention model
CreateRepeatableIntervention=Create recurring intervention

View file

@ -191,7 +191,7 @@ MembersStatisticsByRegion=Members statistics by region
NbOfMembers=Total number of members
NbOfActiveMembers=Total number of current active members
NoValidatedMemberYet=No validated members found
MembersByCountryDesc=This screen shows you the statistics of members by countries.
MembersByCountryDesc=This screen shows you the statistics of members by countries.
MembersByCountryDesc2=Graphs and charts depend on the availability of the Google online graph service as well as on the availability of a working internet connection.
MembersByStateDesc=This screen show you statistics of members by state/provinces/canton.
MembersByTownDesc=This screen show you statistics of members by town.
@ -251,3 +251,5 @@ XSubsriptionErrors=%s subscription(s) where in error
CreateSubscription=Create subscription
WarningNoComplementaryActionDone=No Complementary action on recording will be executed with this massaction
NewMembership=New membership
Caneditamount=Can edit amount
Morphy=Moral or physical

View file

@ -3,7 +3,7 @@
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -41,7 +41,7 @@ if (!defined('NOBROWSERNOTIF')) {
}
if (!defined('XFRAMEOPTIONS_ALLOWALL')) {
define('XFRAMEOPTIONS_ALLOWALL', '1');
define('XFRAMEOPTIONS_ALLOWALL', '1');
}
// For MultiCompany module.
@ -204,7 +204,7 @@ if (!empty($_SESSION['ipaddress'])) { // To avoid to make action twice
// Send warning of error to administrator
if ($sendemail) {
// Get default language to use for the company for supervision emails
$myCompanyDefaultLang = $mysoc->default_lang;
$myCompanyDefaultLang = (string) $mysoc->default_lang;
if (empty($myCompanyDefaultLang) || $myCompanyDefaultLang === 'auto') {
// We must guess the language from the company country. We must not use the language of the visitor. This is a technical email for supervision
// so it must always be into the same language.

View file

@ -589,7 +589,7 @@ if ($ispaymentok) {
// Set output language
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? (string) $mysoc->default_lang : (string) $object->thirdparty->default_lang);
$paymentdate = $now;
$amount = $FinalPaymentAmt;
$formatteddate = dol_print_date($paymentdate, 'dayhour', 'auto', $outputlangs);
@ -1446,7 +1446,7 @@ if ($ispaymentok) {
$formmail = new FormMail($db);
// Set output language
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
$outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? (string) $mysoc->default_lang : (string) $thirdparty->default_lang);
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "members", "eventorganization"));
// Get email content from template

View file

@ -387,7 +387,7 @@ if (!empty($object->socialnetworks) && is_array($object->socialnetworks)) {
$listOfSocialNetworks = $object->socialnetworks;
foreach ($listOfSocialNetworks as $key => $value) {
if (!getDolUserString('USER_HIDE_SOCIALNETWORK_'.strtoupper($key), 0, $object)) {
$usersection .= '<div class="flexitemsmall">'.dol_print_socialnetworks($key, 0, $object->id, strtolower($key), $socialnetworksdict).'</div>';
$usersection .= '<div class="flexitemsmall">'.dol_print_socialnetworks($value, 0, $object->id, strtolower($key), $socialnetworksdict).'</div>';
}
}
}

View file

@ -5,7 +5,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@ -416,7 +416,7 @@ if (!empty($sql_select)) {
$sql .= $where;
$sql .= dolSqlDateFilter($dateprint, 0, $month, $year);
if ($sref) {
$sql .= " AND ".$db->sanitize($doc_number)." LIKE '%".$db->escape($sref)."%'";
$sql .= " AND ".$db->sanitize((string) $doc_number)." LIKE '%".$db->escape($sref)."%'";
}
if ($sprod_fulldescr) {
// We test both case description is correctly saved of was save after dol_escape_htmltag().