diff --git a/dev/build/phpstan/phpstan-baseline.neon b/dev/build/phpstan/phpstan-baseline.neon index 2d9c290b25a..740e50d80c5 100644 --- a/dev/build/phpstan/phpstan-baseline.neon +++ b/dev/build/phpstan/phpstan-baseline.neon @@ -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 diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 7007834787e..f69251c12c0 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -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'], diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 91f105c48b8..7db9917b1d2 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -9,7 +9,7 @@ * Copyright (C) 2020 Josep Lluís Amador * Copyright (C) 2021 Waël Almoman * Copyright (C) 2024 MDW - * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024-2025 Frédéric France * * 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érents|ES:Mó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 ''; print ''; print ''; + print ''; + print ''; print ''; + $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 ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ' '; + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn '); + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.rowid']['checked'])) { + print ''.$langs->trans("Ref").''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.libelle']['checked'])) { + print ''.$langs->trans($arrayfields['t.libelle']['label']).''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.morphy']['checked'])) { + print ''.$langs->trans("MembersNature").''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.duration']['checked'])) { + print ''.$langs->trans("MembershipDuration").''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.subscription']['checked'])) { + print ''.$langs->trans("SubscriptionRequired").''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.amount']['checked'])) { + print ''.$langs->trans("Amount").''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.caneditamount']['checked'])) { + print ''.$langs->trans("CanEditAmountShort").''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.vote']['checked'])) { + print ''.$langs->trans("VoteAllowed").''; + $totalarray['nbfield']++; + } + if (!empty($arrayfields['t.statut']['checked'])) { + print ''.$langs->trans("Status").''; + $totalarray['nbfield']++; } - print ''.$langs->trans("Ref").''; - print ''.$langs->trans("Label").''; - print ''.$langs->trans("MembersNature").''; - print ''.$langs->trans("MembershipDuration").''; - print ''.$langs->trans("SubscriptionRequired").''; - print ''.$langs->trans("Amount").''; - print ''.$langs->trans("CanEditAmountShort").''; - print ''.$langs->trans("VoteAllowed").''; - print ''.$langs->trans("Status").''; if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ' '; + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); + $totalarray['nbfield']++; } print "\n"; @@ -397,47 +438,55 @@ if (!$rowid && $action != 'create' && $action != 'edit') { print 'rowid.'">'.img_edit().''; } } - - print ''; - print $membertype->getNomUrl(1); - //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' - print ''; - - print ''.dol_escape_htmltag($objp->label).''; - - print ''; - 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 ''; + print $membertype->getNomUrl(1); + //'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.' + print ''; } - print ''; - - print ''; - 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 ''.dol_escape_htmltag($objp->label).''; + } + if (!empty($arrayfields['t.morphy']['checked'])) { + print ''; + 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 ''; + } + if (!empty($arrayfields['t.duration']['checked'])) { + print ''; + 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 ''; + } + if (!empty($arrayfields['t.subscription']['checked'])) { + print ''.yn($objp->subscription).''; + } + if (!empty($arrayfields['t.amount']['checked'])) { + print ''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''; + } + if (!empty($arrayfields['t.caneditamount']['checked'])) { + print ''.yn($objp->caneditamount).''; + } + if (!empty($arrayfields['t.vote']['checked'])) { + print ''.yn($objp->vote).''; + } + if (!empty($arrayfields['t.statut']['checked'])) { + print ''.$membertype->getLibStatut(5).''; } - print ''; - - print ''.yn($objp->subscription).''; - - print ''.(is_null($objp->amount) || $objp->amount === '' ? '' : price($objp->amount)).''; - - print ''.yn($objp->caneditamount).''; - - print ''.yn($objp->vote).''; - - print ''.$membertype->getLibStatut(5).''; - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if ($user->hasRight('adherent', 'configurer')) { print 'rowid.'">'.img_edit().''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 6ba5e3e730f..18dfa4645f5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -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), diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 2c5ce861d47..5dee9316b1e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -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}>|string|null $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) + * @param array}>|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,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() */ diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index b9be63dee34..11eca55e4b6 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2025 MDW * * 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 .= ''; $ret .= ''; - if ($noouput) { + if ($nooutput) { return $ret; } diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 1005cc70941..897a6f5711d 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -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 diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index 64b91da0206..2eeb365cc62 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -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++; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 07345626981..345d170ff2d 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -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 diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0a8cab279a9..23780903360 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6052,7 +6052,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss if ($picto == 'warning') { $fa = 'exclamation-triangle'; } - $result = ($nodiv ? '' : '
').' '; + $result = ($nodiv ? '' : '
').' '; $result .= dol_escape_htmltag($text, 1, 0, 'div,span,b,br,a'); $result .= ($nodiv ? '' : '
'); diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 11df59e893a..ec5ff384592 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -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; diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index ff6d66b04f3..2a35ceb8dfb 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -365,13 +365,13 @@ if (!empty($withproject)) { print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - 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 ""; print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - 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 ""; print ''; diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 041e671a8f0..899debd01d4 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -373,7 +373,7 @@ if (!empty($withproject)) { print ''; print $form->editfieldkey($form->textwithpicto($langs->trans('PriceOfBooth'), $langs->trans("PriceOfBoothHelp")), 'price_booth', '', $projectstatic, 0, 'amount', '', 0, 0, 'projectid'); print ''; - 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 ""; print ''; diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index e7ecf387ec1..c0d84059027 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -734,7 +734,7 @@ if ($id > 0 || !empty($ref)) { $text .= ' - '.$label; $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description)).'
'; $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)); diff --git a/htdocs/expensereport/payment/card.php b/htdocs/expensereport/payment/card.php index bd58dbaad93..9aa1c990e47 100644 --- a/htdocs/expensereport/payment/card.php +++ b/htdocs/expensereport/payment/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -130,6 +130,7 @@ print ''.$langs->trans('Amount').''.price($object->amount, 0, $ print ''.$langs->trans('Note').''.dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_public)).''; $disable_delete = 0; +$title_button = ''; // Bank account if (isModEnabled("bank")) { if ($object->bank_account) { diff --git a/htdocs/expensereport/payment/info.php b/htdocs/expensereport/payment/info.php index cb83c850443..5b6fa16191c 100644 --- a/htdocs/expensereport/payment/info.php +++ b/htdocs/expensereport/payment/info.php @@ -4,6 +4,7 @@ * Copyright (C) 2013 Marcos García * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2024 Frédéric France + * Copyright (C) 2025 MDW * * 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'); diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index 2c69d7af7c9..b0045757bab 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -2,7 +2,7 @@ /* Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2015 Laurent Destailleur * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * 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); diff --git a/htdocs/expensereport/stats/index.php b/htdocs/expensereport/stats/index.php index 0ddaee0be92..e5bb55b9438 100644 --- a/htdocs/expensereport/stats/index.php +++ b/htdocs/expensereport/stats/index.php @@ -2,8 +2,8 @@ /* Copyright (C) 2003-2006 Rodolphe Quiedeville * Copyright (c) 2004-2012 Laurent Destailleur * Copyright (C) 2012 Marcos García - * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2018-2024 Frédéric France + * Copyright (C) 2024-2025 MDW * * 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 ''; // Status print ''.$langs->trans("Status").''; diff --git a/htdocs/expensereport/tpl/expensereport_addfile.tpl.php b/htdocs/expensereport/tpl/expensereport_addfile.tpl.php index ff2fd3d4285..b0442bd9a10 100644 --- a/htdocs/expensereport/tpl/expensereport_addfile.tpl.php +++ b/htdocs/expensereport/tpl/expensereport_addfile.tpl.php @@ -1,4 +1,13 @@ + */ + +/** + * @var int $colspan + */ +' +@phan-var-force int $colspan +'; // Add line to upload new file print ''."\n"; diff --git a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php index 2e02e7b8808..c565fe32894 100644 --- a/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php +++ b/htdocs/expensereport/tpl/expensereport_linktofile.tpl.php @@ -1,6 +1,12 @@ +/* Copyright (C) 2024-2025 MDW */ +/** + * @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 '
'; - 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 '
'; if (empty($urlforhref) || empty($thumbshown)) { diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index 93b6157ea19..8ad1c46c169 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -10,7 +10,7 @@ * Copyright (C) 2016-2018 Charlie Benke * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * 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 .= '
'; $morehtmlref .= ''; $morehtmlref .= ''; - $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 .= ''; $morehtmlref .= '
'; } 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 ''.$langs->trans("Description").''.nl2br($object->description).""; // Contract - if (isModEnabled('contract')) { + if (isModEnabled('contract') && $contratstatic !== null) { $langs->load('contracts'); print ''; print ''; @@ -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 " "; } @@ -666,7 +668,7 @@ if ($action == 'create') { // Max period / Rest period print ''; 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 ''.$langs->trans("None").''; } - if (isModEnabled('contract')) { + if (isModEnabled('contract') && $contratstatic !== null) { print ''; if ($objp->fk_contrat > 0) { $contratstatic->fetch($objp->fk_contrat); @@ -879,7 +882,7 @@ if ($action == 'create') { } print ''; } - if (isModEnabled('project')) { + if (isModEnabled('project') && $projectstatic !== null) { print ''; if ($objp->fk_project > 0) { $projectstatic->fetch($objp->fk_project); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 07311a5ca20..f3c6ca5250f 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -11,7 +11,7 @@ * Copyright (C) 2020-2024 Frédéric France * Copyright (C) 2023 Benjamin Grembi * Copyright (C) 2023-2024 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro * * 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 ''; print ''.$langs->trans('NotePublic').''; print ''; - $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 ''; print ''; @@ -1058,7 +1058,7 @@ if ($action == 'create') { print ''; print ''.$langs->trans('NotePrivate').''; print ''; - $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 ''; print ''; @@ -1316,7 +1316,7 @@ if ($action == 'create') { if ($action != 'classify') { $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; } - $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 '
'; - print $temps; - print '
'; - } + $temps = $objectline->showOptionals($extrafields, 'view', array(), '', '', '1', 'line'); + if (!empty($temps)) { + print '
'; + print $temps; + print '
'; } print ''; @@ -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 '
'; - print $temps; - print '
'; - } + $temps = $objectline->showOptionals($extrafields, 'edit', array(), '', '', '1', 'line'); + if (!empty($temps)) { + print '
'; + print $temps; + print '
'; } print ''; @@ -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 '
'; diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index 08697cc34c2..7a86225622e 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2016 Laurent Destailleur + * Copyright (C) 2025 MDW * * 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 + * @phpstan-return array * * @throws RestException */ @@ -186,6 +189,8 @@ class Interventions extends DolibarrApi * Create intervention object * * @param array $request_data Request data + * @phan-param ?array $request_data + * @phpstan-param ?array $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 $request_data + * @phpstan-param ?array $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 + * @phpstan-return array */ 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 $data Data to validate + * @return array * * @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 $data Data to validate + * @return array Return array with validated mandatory fields and their value * * @throws RestException */ diff --git a/htdocs/fichinter/class/fichinterrec.class.php b/htdocs/fichinter/class/fichinterrec.class.php index a623c2d7237..bcd1916c744 100644 --- a/htdocs/fichinter/class/fichinterrec.class.php +++ b/htdocs/fichinter/class/fichinterrec.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2016-2018 Charlie Benke * Copyright (C) 2024 William Mead * Copyright (C) 2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * 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) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index a2270349bab..308af88fce9 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -9,7 +9,7 @@ * Copyright (C) 2021-2024 Frédéric France * Copyright (C) 2022 Charlène Benke * Copyright (C) 2024 William Mead - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Benjamin Falière * * 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,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 ''; $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 ''; $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 ''; } if (!$i) { diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 026901afa32..b42f5a557ef 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -8,7 +8,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2021-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -363,9 +363,9 @@ if ($object->id > 0) { print ''; print ''; 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 ""; print ''; @@ -381,9 +381,9 @@ if ($object->id > 0) { print ''; print ''; 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 ""; print ''; @@ -400,9 +400,9 @@ if ($object->id > 0) { print ''; print ''; 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 ""; print ''; @@ -432,7 +432,7 @@ if ($object->id > 0) { print ''; print ''; print ''; - $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 ''.$langs->trans("LinkedToDolibarrMember").''; print ''; $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 '
'; print '
'; @@ -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')).")"; diff --git a/htdocs/langs/en_US/interventions.lang b/htdocs/langs/en_US/interventions.lang index 1d7b2ada84f..2e3e1d1f510 100644 --- a/htdocs/langs/en_US/interventions.lang +++ b/htdocs/langs/en_US/interventions.lang @@ -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 diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 4d1c90f9e1b..a4cecf6be82 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -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 diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index 5f833ed119d..74fd7762873 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -3,7 +3,7 @@ * Copyright (C) 2006-2013 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2024-2025 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * 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. diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 6d415d7820f..26b2db6e80b 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -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 diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index e87dcdbd08e..94c94a778f7 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -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 .= '
'.dol_print_socialnetworks($key, 0, $object->id, strtolower($key), $socialnetworksdict).'
'; + $usersection .= '
'.dol_print_socialnetworks($value, 0, $object->id, strtolower($key), $socialnetworksdict).'
'; } } } diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 2a6d965b012..a84b221ab06 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -5,7 +5,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2015-2017 Ferran Marcet * Copyright (C) 2021-2024 Frédéric France - * Copyright (C) 2024 MDW + * Copyright (C) 2024-2025 MDW * * 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().