Qual: Fix phan notices (facture/3 + filefunc.inc) (#33383)

* Qual: Fix PhanMismatchType

* Finalize rename of $attrV into $value

* Correct getGlobalString into getGlobalInt

* Do not require some fields in the 'title' definition of $cols

* Qual: Fix phan notices (core/lib)

* Qual: Fix phan (contrat)

* Qual: Fix phan notices (facture/3 + filefunc.in)

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
MDW 2025-03-11 01:59:34 +01:00 committed by GitHub
parent a0f71fbe76
commit ee9e89efaa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 251 additions and 240 deletions

View file

@ -9,27 +9,25 @@
*/
return [
// # Issue statistics:
// PhanTypeMismatchArgument : 750+ occurrences
// PhanTypeMismatchArgument : 670+ occurrences
// PhanUndeclaredProperty : 470+ occurrences
// PhanTypeMismatchArgumentNullable : 220+ occurrences
// PhanTypeMismatchArgumentNullable : 200+ occurrences
// PhanTypeMismatchProperty : 140+ occurrences
// PhanUndeclaredGlobalVariable : 100+ occurrences
// PhanTypeExpectedObjectPropAccess : 20+ occurrences
// PhanTypeInvalidDimOffset : 20+ occurrences
// PhanTypeMismatchDimFetch : 20+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 15+ occurrences
// PhanUndeclaredConstant : 15+ occurrences
// PhanPluginUndeclaredVariableIsset : 10+ occurrences
// PhanTypeMismatchArgumentNullableInternal : 10+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 9 occurrences
// PhanTypeMismatchArgumentProbablyReal : 10+ occurrences
// PhanUndeclaredMethod : 9 occurrences
// PhanPossiblyUndeclaredGlobalVariable : 8 occurrences
// PhanTypeMismatchArgumentNullableInternal : 7 occurrences
// PhanPluginDuplicateExpressionBinaryOp : 6 occurrences
// PhanTypeArraySuspiciousNull : 6 occurrences
// PhanTypeComparisonFromArray : 6 occurrences
// PhanPluginUndeclaredVariableIsset : 5 occurrences
// PhanParamTooMany : 4 occurrences
// PhanPluginDuplicateArrayKey : 4 occurrences
// PhanEmptyFQSENInClasslike : 3 occurrences
// PhanInvalidFQSENInClasslike : 3 occurrences
// PhanPluginSuspiciousParamPosition : 2 occurrences
// PhanTypeMismatchDimAssignment : 2 occurrences
// PhanTypeMismatchReturn : 2 occurrences
@ -191,13 +189,7 @@ return [
'htdocs/compta/facture/card.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/facture/class/api_invoices.class.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/facture/class/facture.class.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'],
'htdocs/compta/facture/invoicetemplate_list.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'],
'htdocs/compta/facture/list.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'],
'htdocs/compta/facture/messaging.php' => ['PhanTypeMismatchArgument'],
'htdocs/compta/facture/note.php' => ['PhanTypeMismatchArgument'],
'htdocs/compta/facture/stats/index.php' => ['PhanTypeMismatchArgument'],
'htdocs/compta/facture/tpl/linkedobjectblock.tpl.php' => ['PhanEmptyFQSENInClasslike', 'PhanInvalidFQSENInClasslike', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/compta/facture/class/facture.class.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/localtax/card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/compta/localtax/clients.php' => ['PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument'],
@ -240,16 +232,7 @@ return [
'htdocs/contact/class/contact.class.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'],
'htdocs/contact/consumption.php' => ['PhanTypeMismatchArgument'],
'htdocs/contact/list.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'],
'htdocs/contrat/agenda.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/contrat/card.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredGlobalVariable'],
'htdocs/contrat/class/contrat.class.php' => ['PhanTypeMismatchArgument'],
'htdocs/contrat/class/contratligne.class.php' => ['PhanTypeMismatchArgument'],
'htdocs/contrat/contact.php' => ['PhanTypeMismatchArgument'],
'htdocs/contrat/document.php' => ['PhanTypeMismatchArgument'],
'htdocs/contrat/list.php' => ['PhanTypeMismatchArgument'],
'htdocs/contrat/messaging.php' => ['PhanTypeMismatchArgument'],
'htdocs/contrat/note.php' => ['PhanTypeMismatchArgument'],
'htdocs/contrat/services_list.php' => ['PhanTypeMismatchArgument'],
'htdocs/contrat/card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/core/actions_addupdatedelete.inc.php' => ['PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'],
'htdocs/core/actions_extrafields.inc.php' => ['PhanTypeMismatchArgument'],
'htdocs/core/actions_lineupdown.inc.php' => ['PhanTypeMismatchArgument'],
@ -328,10 +311,9 @@ return [
'htdocs/core/modules/expedition/doc/pdf_rouget.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'],
'htdocs/core/modules/expensereport/doc/pdf_standard_expensereport.modules.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
'htdocs/core/modules/expensereport/mod_expensereport_jade.php' => ['PhanTypeMismatchArgument'],
'htdocs/core/modules/facture/doc/pdf_crabe.modules.php' => ['PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'],
'htdocs/core/modules/facture/doc/pdf_octopus.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'],
'htdocs/core/modules/facture/doc/pdf_sponge.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'],
'htdocs/core/modules/facture/modules_facture.php' => ['PhanTypeMismatchArgument'],
'htdocs/core/modules/facture/doc/pdf_crabe.modules.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/facture/doc/pdf_octopus.modules.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredProperty'],
'htdocs/core/modules/facture/doc/pdf_sponge.modules.php' => ['PhanUndeclaredProperty'],
'htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable'],
'htdocs/core/modules/fichinter/mod_arctic.php' => ['PhanTypeMismatchArgumentNullable'],
'htdocs/core/modules/holiday/mod_holiday_immaculate.php' => ['PhanTypeMismatchArgument'],
@ -439,7 +421,7 @@ return [
'htdocs/fichinter/note.php' => ['PhanTypeMismatchArgument'],
'htdocs/fichinter/stats/index.php' => ['PhanTypeMismatchArgument'],
'htdocs/fichinter/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/filefunc.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/filefunc.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/fourn/card.php' => ['PhanTypeMismatchProperty'],
'htdocs/fourn/class/api_supplier_orders.class.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/fourn/class/fournisseur.commande.class.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullable', 'PhanUndeclaredProperty'],

View file

@ -223,7 +223,7 @@ class Facture extends CommonInvoice
public $fac_rec;
/**
* @var string
* @var ?int
*/
public $date_pointoftax;
@ -572,7 +572,7 @@ class Facture extends CommonInvoice
$nextdatewhen = null;
$previousdaynextdatewhen = null;
if ($originaldatewhen) {
$nextdatewhen = dol_time_plus_duree($originaldatewhen, $_facrec->frequency, $_facrec->unit_frequency);
$nextdatewhen = dol_time_plus_duree($originaldatewhen, (float) $_facrec->frequency, $_facrec->unit_frequency);
$previousdaynextdatewhen = dol_time_plus_duree($nextdatewhen, -1, 'd');
}
@ -722,8 +722,8 @@ class Facture extends CommonInvoice
$sql .= "'(PROV)'";
$sql .= ", ".(int) $this->entity;
$sql .= ", ".($this->ref_ext ? "'".$this->db->escape($this->ref_ext)."'" : "null");
$sql .= ", '".$this->db->escape($this->type)."'";
$sql .= ", ".($this->subtype ? "'".$this->db->escape($this->subtype)."'" : "null");
$sql .= ", '".$this->db->escape((string) $this->type)."'";
$sql .= ", ".($this->subtype ? "'".$this->db->escape((string) $this->subtype)."'" : "null");
$sql .= ", ".((int) $socid);
$sql .= ", '".$this->db->idate($this->date_creation)."'";
$sql .= ", '".$this->db->idate($this->date)."'";
@ -734,23 +734,23 @@ class Facture extends CommonInvoice
$sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL');
$sql .= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null");
$sql .= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null");
$sql .= ", ".($this->fk_fac_rec_source ? "'".$this->db->escape($this->fk_fac_rec_source)."'" : "null");
$sql .= ", ".($this->fk_facture_source ? "'".$this->db->escape($this->fk_facture_source)."'" : "null");
$sql .= ", ".($this->fk_fac_rec_source ? "'".$this->db->escape((string) $this->fk_fac_rec_source)."'" : "null");
$sql .= ", ".($this->fk_facture_source ? "'".$this->db->escape((string) $this->fk_facture_source)."'" : "null");
$sql .= ", ".($origin_user_author_id > 0 ? (int) $origin_user_author_id : "null");
$sql .= ", ".($this->fk_project ? (int) $this->fk_project : "null");
$sql .= ", ".((int) $this->cond_reglement_id);
$sql .= ", ".((int) $this->mode_reglement_id);
$sql .= ", '".$this->db->idate($this->date_lim_reglement)."'";
$sql .= ", ".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null");
$sql .= ", ".($this->situation_cycle_ref ? "'".$this->db->escape($this->situation_cycle_ref)."'" : "null");
$sql .= ", ".($this->situation_counter ? "'".$this->db->escape($this->situation_counter)."'" : "null");
$sql .= ", ".($this->situation_cycle_ref ? "'".$this->db->escape((string) $this->situation_cycle_ref)."'" : "null");
$sql .= ", ".($this->situation_counter ? "'".$this->db->escape((string) $this->situation_counter)."'" : "null");
$sql .= ", ".($this->situation_final ? (int) $this->situation_final : 0);
$sql .= ", ".(int) $this->fk_incoterms;
$sql .= ", '".$this->db->escape($this->location_incoterms)."'";
$sql .= ", ".(int) $this->fk_multicurrency;
$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
$sql .= ", ".(float) $this->multicurrency_tx;
$sql .= ", ".(empty($this->retained_warranty) ? "0" : $this->db->escape($this->retained_warranty));
$sql .= ", ".(empty($this->retained_warranty) ? "0" : $this->db->escape((string) $this->retained_warranty));
$sql .= ", ".(!empty($this->retained_warranty_date_limit) ? "'".$this->db->idate($this->retained_warranty_date_limit)."'" : 'NULL');
$sql .= ", ".(int) $this->retained_warranty_fk_cond_reglement;
$sql .= ")";
@ -2550,16 +2550,16 @@ class Facture extends CommonInvoice
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET";
$sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").",";
$sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").",";
$sql .= " type=".(isset($this->type) ? $this->db->escape($this->type) : "null").",";
$sql .= " subtype=".(isset($this->subtype) ? $this->db->escape($this->subtype) : "null").",";
$sql .= " type=".(isset($this->type) ? $this->db->escape((string) $this->type) : "null").",";
$sql .= " subtype=".(isset($this->subtype) ? $this->db->escape((string) $this->subtype) : "null").",";
$sql .= " ref_client=".(!empty($this->ref_customer) ? "'".$this->db->escape($this->ref_customer)."'" : (isset($this->ref_client) ? "'".$this->db->escape($this->ref_client)."'" : "null")).",";
$sql .= " increment=".(isset($this->increment) ? "'".$this->db->escape($this->increment)."'" : "null").",";
$sql .= " fk_soc=".(isset($this->socid) ? $this->db->escape($this->socid) : "null").",";
$sql .= " fk_soc=".(isset($this->socid) ? $this->db->escape((string) $this->socid) : "null").",";
$sql .= " datec=".(strval($this->date_creation) != '' ? "'".$this->db->idate($this->date_creation)."'" : 'null').",";
$sql .= " datef=".(strval($this->date) != '' ? "'".$this->db->idate($this->date)."'" : 'null').",";
$sql .= " date_pointoftax=".(strval($this->date_pointoftax) != '' ? "'".$this->db->idate($this->date_pointoftax)."'" : 'null').",";
$sql .= " date_valid=".(strval($this->date_validation) != '' ? "'".$this->db->idate($this->date_validation)."'" : 'null').",";
$sql .= " paye=".(isset($this->paye) ? $this->db->escape($this->paye) : 0).",";
$sql .= " paye=".(isset($this->paye) ? $this->db->escape((string) $this->paye) : 0).",";
$sql .= " close_code=".(isset($this->close_code) ? "'".$this->db->escape($this->close_code)."'" : "null").",";
$sql .= " close_note=".(isset($this->close_note) ? "'".$this->db->escape($this->close_note)."'" : "null").",";
$sql .= " total_tva=".(isset($this->total_tva) ? (float) $this->total_tva : "null").",";
@ -3476,8 +3476,8 @@ class Facture extends CommonInvoice
$is_batch_line = true;
$product_qty_remain = $this->lines[$i]->qty;
$sortfield = null;
$sortorder = null;
$sortfield = '';
$sortorder = '';
// find lot/serial by sellby (DLC) and eatby dates (DLUO) first
if ($batch_rule == Productbatch::BATCH_RULE_SELLBY_EATBY_DATES_FIRST) {
$sortfield = 'pl.sellby,pl.eatby,pb.qty,pl.rowid';
@ -3865,7 +3865,7 @@ class Facture extends CommonInvoice
* @param float|'' $pa_ht Buying price of line (to calculate margin) or ''
* @param string $label Label of the line (deprecated, do not use)
* @param array<string,mixed> $array_options extrafields array
* @param int $situation_percent Situation advance percentage
* @param float $situation_percent Situation advance percentage
* @param int $fk_prev_id Previous situation line id reference
* @param int|null $fk_unit Code of the unit to use. Null to use the default one
* @param float $pu_ht_devise Unit price in foreign currency

View file

@ -9,7 +9,7 @@
* Copyright (C) 2015-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
* Copyright (C) 2023 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 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -147,31 +147,30 @@ if (!$sortfield) {
}
$arrayfields = array(
'f.titre' => array('label' => "Ref", 'checked' => 1),
's.nom' => array('label' => "ThirdParty", 'checked' => 1),
'f.total_ht' => array('label' => "AmountHT", 'checked' => 1),
'f.total_tva' => array('label' => "AmountVAT", 'checked' => -1),
'f.total_ttc' => array('label' => "AmountTTC", 'checked' => 1),
'f.fk_mode_reglement' => array('label' => "PaymentMode", 'checked' => 0),
'f.fk_cond_reglement' => array('label' => "PaymentTerm", 'checked' => 0),
'recurring' => array('label' => "RecurringInvoice", 'checked' => 1),
'f.frequency' => array('label' => "Frequency", 'checked' => 1),
'f.unit_frequency' => array('label' => "FrequencyUnit", 'checked' => 1),
'f.nb_gen_done' => array('label' => "NbOfGenerationDoneShort", 'checked' => 1),
'f.date_last_gen' => array('label' => "DateLastGenerationShort", 'checked' => 1),
'f.date_when' => array('label' => "NextDateToExecutionShort", 'checked' => 1),
'f.fk_user_author' => array('label' => "UserCreation", 'checked' => 0, 'position' => 500),
'f.fk_user_modif' => array('label' => "UserModification", 'checked' => 0, 'position' => 505),
'f.datec' => array('label' => "DateCreation", 'checked' => 0, 'position' => 520),
'f.tms' => array('label' => "DateModificationShort", 'checked' => 0, 'position' => 525),
'status' => array('label' => "Status", 'checked' => 1, 'position' => 1000),
'f.titre' => array('label' => "Ref", 'checked' => '1'),
's.nom' => array('label' => "ThirdParty", 'checked' => '1'),
'f.total_ht' => array('label' => "AmountHT", 'checked' => '1'),
'f.total_tva' => array('label' => "AmountVAT", 'checked' => '-1'),
'f.total_ttc' => array('label' => "AmountTTC", 'checked' => '1'),
'f.fk_mode_reglement' => array('label' => "PaymentMode", 'checked' => '0'),
'f.fk_cond_reglement' => array('label' => "PaymentTerm", 'checked' => '0'),
'recurring' => array('label' => "RecurringInvoice", 'checked' => '1'),
'f.frequency' => array('label' => "Frequency", 'checked' => '1'),
'f.unit_frequency' => array('label' => "FrequencyUnit", 'checked' => '1'),
'f.nb_gen_done' => array('label' => "NbOfGenerationDoneShort", 'checked' => '1'),
'f.date_last_gen' => array('label' => "DateLastGenerationShort", 'checked' => '1'),
'f.date_when' => array('label' => "NextDateToExecutionShort", 'checked' => '1'),
'f.fk_user_author' => array('label' => "UserCreation", 'checked' => '0', 'position' => 500),
'f.fk_user_modif' => array('label' => "UserModification", 'checked' => '0', 'position' => 505),
'f.datec' => array('label' => "DateCreation", 'checked' => '0', 'position' => 520),
'f.tms' => array('label' => "DateModificationShort", 'checked' => '0', 'position' => 525),
'status' => array('label' => "Status", 'checked' => '1', 'position' => 1000),
);
// 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
if ($socid > 0) {
$tmpthirdparty = new Societe($db);
@ -611,7 +610,7 @@ if (!empty($arrayfields['f.titre']['checked'])) {
}
// Thirdparty
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="liste_titre left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag((string) $search_societe).'"></td>';
}
if (!empty($arrayfields['f.total_ht']['checked'])) {
// Amount net
@ -634,7 +633,7 @@ if (!empty($arrayfields['f.total_ttc']['checked'])) {
if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
// Payment term
print '<td class="liste_titre">';
print $form->getSelectConditionsPaiements($search_payment_term, 'search_payment_term', -1, 1, 1, 'maxwidth100');
print $form->getSelectConditionsPaiements((int) $search_payment_term, 'search_payment_term', -1, 1, 1, 'maxwidth100');
print "</td>";
}
if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) {
@ -927,7 +926,7 @@ while ($i < $imaxinloop) {
// Payment term
if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
print '<td class="tdoverflowmax150">';
$form->form_conditions_reglement(0, $objp->fk_cond_reglement, 'none');
$form->form_conditions_reglement('0', $objp->fk_cond_reglement, 'none');
print '</td>'."\n";
if (!$i) {
$totalarray['nbfield']++;

View file

@ -225,66 +225,66 @@ if (empty($user->socid)) {
$fieldstosearchall["f.note_private"] = "NotePrivate";
}
$checkedtypetiers = 0;
$checkedtypetiers = '0';
$arrayfields = array(
'f.ref' => array('label' => "Ref", 'checked' => 1, 'position' => 5),
'f.ref_client' => array('label' => "RefCustomer", 'checked' => -1, 'position' => 10),
'f.type' => array('label' => "Type", 'checked' => 0, 'position' => 15),
'f.subtype' => array('label' => "InvoiceSubtype", 'checked' => 0, 'position' => 17),
'f.datef' => array('label' => "DateInvoice", 'checked' => 1, 'position' => 20),
'f.date_valid' => array('label' => "DateValidation", 'checked' => 0, 'position' => 22),
'f.date_lim_reglement' => array('label' => "DateDue", 'checked' => 1, 'position' => 25),
'f.date_closing' => array('label' => "DateClosing", 'checked' => 0, 'position' => 30),
'p.ref' => array('label' => "ProjectRef", 'langs' => 'projects', 'checked' => 1, 'enabled' => (!isModEnabled('project') ? 0 : 1), 'position' => 40),
'p.title' => array('label' => "ProjectLabel", 'checked' => 0, 'enabled' => (!isModEnabled('project') ? 0 : 1), 'position' => 41),
's.nom' => array('label' => "ThirdParty", 'checked' => 1, 'position' => 50),
's.name_alias' => array('label' => "AliasNameShort", 'checked' => -1, 'position' => 51),
's.code_client' => array('label' => "CustomerCodeShort", 'checked' => -1, 'position' => 52),
's2.nom' => array('label' => 'ParentCompany', 'position' => 32, 'checked' => 0),
's.town' => array('label' => "Town", 'checked' => -1, 'position' => 55),
's.zip' => array('label' => "Zip", 'checked' => -1, 'position' => 60),
'state.nom' => array('label' => "StateShort", 'checked' => 0, 'position' => 65),
'country.code_iso' => array('label' => "Country", 'checked' => 0, 'position' => 70),
'f.ref' => array('label' => "Ref", 'checked' => '1', 'position' => 5),
'f.ref_client' => array('label' => "RefCustomer", 'checked' => '-1', 'position' => 10),
'f.type' => array('label' => "Type", 'checked' => '0', 'position' => 15),
'f.subtype' => array('label' => "InvoiceSubtype", 'checked' => '0', 'position' => 17),
'f.datef' => array('label' => "DateInvoice", 'checked' => '1', 'position' => 20),
'f.date_valid' => array('label' => "DateValidation", 'checked' => '0', 'position' => 22),
'f.date_lim_reglement' => array('label' => "DateDue", 'checked' => '1', 'position' => 25),
'f.date_closing' => array('label' => "DateClosing", 'checked' => '0', 'position' => 30),
'p.ref' => array('label' => "ProjectRef", 'langs' => 'projects', 'checked' => '1', 'enabled' => (!isModEnabled('project') ? '0' : '1'), 'position' => 40),
'p.title' => array('label' => "ProjectLabel", 'checked' => '0', 'enabled' => (!isModEnabled('project') ? '0' : '1'), 'position' => 41),
's.nom' => array('label' => "ThirdParty", 'checked' => '1', 'position' => 50),
's.name_alias' => array('label' => "AliasNameShort", 'checked' => '-1', 'position' => 51),
's.code_client' => array('label' => "CustomerCodeShort", 'checked' => '-1', 'position' => 52),
's2.nom' => array('label' => 'ParentCompany', 'position' => 32, 'checked' => '0'),
's.town' => array('label' => "Town", 'checked' => '-1', 'position' => 55),
's.zip' => array('label' => "Zip", 'checked' => '-1', 'position' => 60),
'state.nom' => array('label' => "StateShort", 'checked' => '0', 'position' => 65),
'country.code_iso' => array('label' => "Country", 'checked' => '0', 'position' => 70),
'typent.code' => array('label' => "ThirdPartyType", 'checked' => $checkedtypetiers, 'position' => 75),
'f.fk_mode_reglement' => array('label' => "PaymentMode", 'checked' => 1, 'position' => 80),
'f.fk_cond_reglement' => array('label' => "PaymentConditionsShort", 'checked' => 1, 'position' => 85),
'f.module_source' => array('label' => "POSModule", 'langs' => 'cashdesk', 'checked' => ($contextpage == 'poslist' ? 1 : 0), 'enabled' => "(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))", 'position' => 90),
'f.pos_source' => array('label' => "POSTerminal", 'langs' => 'cashdesk', 'checked' => ($contextpage == 'poslist' ? 1 : 0), 'enabled' => "(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))", 'position' => 91),
'f.total_ht' => array('label' => "AmountHT", 'checked' => 1, 'position' => 95),
'f.total_tva' => array('label' => "AmountVAT", 'checked' => 0, 'position' => 100),
'f.total_localtax1' => array('label' => $langs->transcountry("AmountLT1", $mysoc->country_code), 'checked' => 0, 'enabled' => ($mysoc->localtax1_assuj == "1"), 'position' => 110),
'f.total_localtax2' => array('label' => $langs->transcountry("AmountLT2", $mysoc->country_code), 'checked' => 0, 'enabled' => ($mysoc->localtax2_assuj == "1"), 'position' => 120),
'f.total_ttc' => array('label' => "AmountTTC", 'checked' => 0, 'position' => 130),
'dynamount_payed' => array('label' => "AlreadyPaid", 'checked' => 0, 'position' => 140),
'rtp' => array('label' => "RemainderToPay", 'checked' => 0, 'position' => 150), // Not enabled by default because slow
'f.multicurrency_code' => array('label' => 'Currency', 'checked' => 0, 'enabled' => (!isModEnabled('multicurrency') ? 0 : 1), 'position' => 280),
'f.multicurrency_tx' => array('label' => 'CurrencyRate', 'checked' => 0, 'enabled' => (!isModEnabled('multicurrency') ? 0 : 1), 'position' => 285),
'f.multicurrency_total_ht' => array('label' => 'MulticurrencyAmountHT', 'checked' => 0, 'enabled' => (!isModEnabled('multicurrency') ? 0 : 1), 'position' => 290),
'f.multicurrency_total_vat' => array('label' => 'MulticurrencyAmountVAT', 'checked' => 0, 'enabled' => (!isModEnabled('multicurrency') ? 0 : 1), 'position' => 291),
'f.multicurrency_total_ttc' => array('label' => 'MulticurrencyAmountTTC', 'checked' => 0, 'enabled' => (!isModEnabled('multicurrency') ? 0 : 1), 'position' => 292),
'multicurrency_dynamount_payed' => array('label' => 'MulticurrencyAlreadyPaid', 'checked' => 0, 'enabled' => (!isModEnabled('multicurrency') ? 0 : 1), 'position' => 295),
'multicurrency_rtp' => array('label' => 'MulticurrencyRemainderToPay', 'checked' => 0, 'enabled' => (!isModEnabled('multicurrency') ? 0 : 1), 'position' => 296), // Not enabled by default because slow
'total_pa' => array('label' => ((getDolGlobalString('MARGIN_TYPE') == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') ? 0 : 1)),
'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') ? 0 : 1)),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') || !getDolGlobalString('DISPLAY_MARGIN_RATES') ? 0 : 1)),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') || !getDolGlobalString('DISPLAY_MARK_RATES') ? 0 : 1)),
'f.datec' => array('label' => "DateCreation", 'checked' => 0, 'position' => 500),
'f.tms' => array('type' => 'timestamp', 'label' => 'DateModificationShort', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 502),
'u.login' => array('label' => "UserAuthor", 'checked' => 1, 'visible' => -1, 'position' => 504),
'sale_representative' => array('label' => "SaleRepresentativesOfThirdParty", 'checked' => 0, 'position' => 506),
'f.fk_mode_reglement' => array('label' => "PaymentMode", 'checked' => '1', 'position' => 80),
'f.fk_cond_reglement' => array('label' => "PaymentConditionsShort", 'checked' => '1', 'position' => 85),
'f.module_source' => array('label' => "POSModule", 'langs' => 'cashdesk', 'checked' => ($contextpage == 'poslist' ? '1' : '0'), 'enabled' => "(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))", 'position' => 90),
'f.pos_source' => array('label' => "POSTerminal", 'langs' => 'cashdesk', 'checked' => ($contextpage == 'poslist' ? '1' : '0'), 'enabled' => "(isModEnabled('cashdesk') || isModEnabled('takepos') || getDolGlobalInt('INVOICE_SHOW_POS'))", 'position' => 91),
'f.total_ht' => array('label' => "AmountHT", 'checked' => '1', 'position' => 95),
'f.total_tva' => array('label' => "AmountVAT", 'checked' => '0', 'position' => 100),
'f.total_localtax1' => array('label' => $langs->transcountry("AmountLT1", $mysoc->country_code), 'checked' => '0', 'enabled' => ($mysoc->localtax1_assuj == "1"), 'position' => 110),
'f.total_localtax2' => array('label' => $langs->transcountry("AmountLT2", $mysoc->country_code), 'checked' => '0', 'enabled' => ($mysoc->localtax2_assuj == "1"), 'position' => 120),
'f.total_ttc' => array('label' => "AmountTTC", 'checked' => '0', 'position' => 130),
'dynamount_payed' => array('label' => "AlreadyPaid", 'checked' => '0', 'position' => 140),
'rtp' => array('label' => "RemainderToPay", 'checked' => '0', 'position' => 150), // Not enabled by default because slow
'f.multicurrency_code' => array('label' => 'Currency', 'checked' => '0', 'enabled' => (!isModEnabled('multicurrency') ? '0' : '1'), 'position' => 280),
'f.multicurrency_tx' => array('label' => 'CurrencyRate', 'checked' => '0', 'enabled' => (!isModEnabled('multicurrency') ? '0' : '1'), 'position' => 285),
'f.multicurrency_total_ht' => array('label' => 'MulticurrencyAmountHT', 'checked' => '0', 'enabled' => (!isModEnabled('multicurrency') ? '0' : '1'), 'position' => 290),
'f.multicurrency_total_vat' => array('label' => 'MulticurrencyAmountVAT', 'checked' => '0', 'enabled' => (!isModEnabled('multicurrency') ? '0' : '1'), 'position' => 291),
'f.multicurrency_total_ttc' => array('label' => 'MulticurrencyAmountTTC', 'checked' => '0', 'enabled' => (!isModEnabled('multicurrency') ? '0' : '1'), 'position' => 292),
'multicurrency_dynamount_payed' => array('label' => 'MulticurrencyAlreadyPaid', 'checked' => '0', 'enabled' => (!isModEnabled('multicurrency') ? '0' : '1'), 'position' => 295),
'multicurrency_rtp' => array('label' => 'MulticurrencyRemainderToPay', 'checked' => '0', 'enabled' => (!isModEnabled('multicurrency') ? '0' : '1'), 'position' => 296), // Not enabled by default because slow
'total_pa' => array('label' => ((getDolGlobalString('MARGIN_TYPE') == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => '0', 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') ? '0' : '1')),
'total_margin' => array('label' => 'Margin', 'checked' => '0', 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') ? '0' : '1')),
'total_margin_rate' => array('label' => 'MarginRate', 'checked' => '0', 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') || !getDolGlobalString('DISPLAY_MARGIN_RATES') ? '0' : '1')),
'total_mark_rate' => array('label' => 'MarkRate', 'checked' => '0', 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->hasRight('margins', 'liretous') || !getDolGlobalString('DISPLAY_MARK_RATES') ? '0' : '1')),
'f.datec' => array('label' => "DateCreation", 'checked' => '0', 'position' => 500),
'f.tms' => array('type' => 'timestamp', 'label' => 'DateModificationShort', 'enabled' => '1', 'visible' => -1, 'notnull' => 1, 'position' => 502),
'u.login' => array('label' => "UserAuthor", 'checked' => '1', 'visible' => -1, 'position' => 504),
'sale_representative' => array('label' => "SaleRepresentativesOfThirdParty", 'checked' => '0', 'position' => 506),
//'f.fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>506),
//'f.fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'notnull'=>-1, 'position'=>508),
//'f.fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>510),
//'f.fk_user_closing' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
'f.note_public' => array('label' => 'NotePublic', 'checked' => 0, 'position' => 520, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))),
'f.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'position' => 521, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))),
'f.fk_fac_rec_source' => array('label' => 'GeneratedFromTemplate', 'checked' => 0, 'position' => 530, 'enabled' => '1'),
'f.import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 999),
'f.fk_statut' => array('label' => "Status", 'checked' => 1, 'position' => 1000),
'f.note_public' => array('label' => 'NotePublic', 'checked' => '0', 'position' => 520, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES'))),
'f.note_private' => array('label' => 'NotePrivate', 'checked' => '0', 'position' => 521, 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES'))),
'f.fk_fac_rec_source' => array('label' => 'GeneratedFromTemplate', 'checked' => '0', 'position' => 530, 'enabled' => '1'),
'f.import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => '1', 'visible' => -2, 'position' => 999),
'f.fk_statut' => array('label' => "Status", 'checked' => '1', 'position' => 1000),
);
if (getDolGlobalString("INVOICE_USE_SITUATION") && getDolGlobalString('INVOICE_USE_RETAINED_WARRANTY')) {
$arrayfields['f.retained_warranty'] = array('label' => $langs->trans("RetainedWarranty"), 'checked' => 0, 'position' => 86);
$arrayfields['f.retained_warranty'] = array('label' => $langs->trans("RetainedWarranty"), 'checked' => '0', 'position' => 86);
}
$subtypearray = $object->getArrayOfInvoiceSubtypes(0);
@ -309,8 +309,8 @@ foreach ($object->fields as $key => $val) {
if ($newkey) {
$arrayfields[$newkey] = array(
'label' => $val['label'],
'checked' => (($visible < 0) ? 0 : 1),
'enabled' => (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
'checked' => (($visible < 0) ? '0' : '1'),
'enabled' => (string) (int) (abs($visible) != 3 && (bool) dol_eval($val['enabled'], 1)),
'position' => $val['position'],
'help' => empty($val['help']) ? '' : $val['help'],
);
@ -323,7 +323,6 @@ 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
// Check only if it's an internal user, external users are already filtered by $socid
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
@ -1391,7 +1390,7 @@ if (isModEnabled('category') && $user->hasRight("categorie", "lire") && ($user->
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('IncludingProductWithTag');
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 0, 0, 1);
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300 widthcentpercentminusx', 1);
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, '', 'maxwidth300 widthcentpercentminusx', 1);
$moreforfilter .= '</div>';
}
if (isModEnabled('category') && $user->hasRight("categorie", "lire")) {
@ -1525,7 +1524,7 @@ if (!empty($arrayfields['p.title']['checked'])) {
}
// Thirdparty
if (!empty($arrayfields['s.nom']['checked'])) {
print '<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).'"'.($socid > 0 ? " disabled" : "").'></td>';
print '<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag((string) $search_company).'"'.($socid > 0 ? " disabled" : "").'></td>';
}
// Alias
if (!empty($arrayfields['s.name_alias']['checked'])) {
@ -1576,7 +1575,7 @@ if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) {
// Payment terms
if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) {
print '<td class="liste_titre left">';
print $form->getSelectConditionsPaiements($search_paymentterms, 'search_paymentterms', -1, 1, 1, 'minwidth100 maxwidth100');
print $form->getSelectConditionsPaiements((int) $search_paymentterms, 'search_paymentterms', -1, 1, 1, 'minwidth100 maxwidth100');
print '</td>';
}
// Module source

View file

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@ -164,7 +165,7 @@ if ($object->id > 0) {
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);

View file

@ -5,7 +5,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* 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
@ -55,7 +55,7 @@ $action = GETPOST('action', 'aZ09');
$object = new Facture($db);
// Load object
if ($id > 0 || !empty($ref)) {
$object->fetch($id, $ref, '', 0, getDolGlobalInt('INVOICE_USE_SITUATION'));
$object->fetch($id, $ref, '', 0, getDolGlobalBool('INVOICE_USE_SITUATION'));
}
$permissionnote = $user->hasRight('facture', 'creer'); // Used by the include of actions_setnotes.inc.php
@ -140,7 +140,7 @@ if ($id > 0 || !empty($ref)) {
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);

View file

@ -246,7 +246,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);

View file

@ -2,7 +2,7 @@
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* 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
@ -31,12 +31,11 @@ global $noMoreLinkedObjectBlockAfter;
$langs = $GLOBALS['langs'];
'@phan-var-force Translate $langs';
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
global $linkedObjectBlock;
$langs->load("bills");
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
'@phan-var-force array<string,CommonObject> $linkedObjectBlock';
$total = 0;
$ilink = 0;
@ -77,6 +76,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
print '<td class="linkedcol-date center">'.dol_print_date($objectlink->date, 'day').'</td>';
print '<td class="linkedcol-amount right nowraponall">';
if (!empty($objectlink) && $objectlink->element == 'facture' && $user->hasRight('facture', 'lire')) {
'@phan-var-force Facture $objectlink';
if ($objectlink->statut != 3) {
// If not abandoned
$total += $objectlink->total_ht;
@ -86,6 +86,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
}
}
'@phan-var-force CommonObject $objectlink'; // Workaround for false notices
print '</td>';
print '<td class="linkedcol-statut right">';
$totalallpayments = 0;

View file

@ -12,7 +12,7 @@
* Copyright (C) 2023 Lenin Rivas <lenin.rivas777@gmail.com>
* Copyright (C) 2023 Sylvain Legrand <technique@infras.fr>
* Copyright (C) 2023 William Mead <william.mead@manchenumerique.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-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
@ -120,7 +120,7 @@ if (empty($reshook)) {
$tmpinvoice = new Facture($db);
foreach ($_POST as $key => $value) {
if (substr($key, 0, 7) == 'amount_' && GETPOST($key) != '') {
$cursorfacid = substr($key, 7);
$cursorfacid = (int) substr($key, 7);
$amounts[$cursorfacid] = price2num(GETPOST($key));
if (!empty($amounts[$cursorfacid])) {
$totalpayment += (float) $amounts[$cursorfacid];
@ -346,8 +346,8 @@ $form = new Form($db);
llxHeader('', $langs->trans("Payment"));
$facture = new Facture($db);
$result = $facture->fetch($facid);
$facture = new Facture($db);
$result = $facture->fetch($facid);
if ($result >= 0) {
$facture->fetch_thirdparty();

View file

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

View file

@ -419,7 +419,7 @@ if (empty($reshook)) {
$lines[$i]->fk_fournprice,
$lines[$i]->pa_ht,
$array_options,
$lines[$i]->fk_unit,
(int) $lines[$i]->fk_unit,
$num + 1
);
@ -461,7 +461,7 @@ if (empty($reshook)) {
}
}
} elseif ($action == 'classin' && $user->hasRight('contrat', 'creer')) {
$object->setProject(GETPOST('projectid'));
$object->setProject(GETPOSTINT('projectid'));
} elseif ($action == 'addline' && $user->hasRight('contrat', 'creer')) {
// Add a new line
// Set if we used free entry or predefined product
@ -567,7 +567,7 @@ if (empty($reshook)) {
$prodcustprice = new ProductCustomerPrice($db);
$filter = array('t.fk_product' => $prod->id, 't.fk_soc' => $object->thirdparty->id);
$filter = array('t.fk_product' => (string) $prod->id, 't.fk_soc' => (string) $object->thirdparty->id);
$result = $prodcustprice->fetchAll('', '', 0, 0, $filter);
if ($result) {
@ -664,16 +664,16 @@ if (empty($reshook)) {
}
if (((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('produit', 'ignore_price_min_advance'))
|| !getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) && ($price_min && ((float) price2num($pu_ht) * (1 - (float) price2num($remise_percent) / 100) < (float) price2num($price_min)))) {
|| !getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) && ($price_min && ((float) price2num((string) $pu_ht) * (1 - (float) price2num($remise_percent) / 100) < (float) price2num($price_min)))) {
$object->error = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency));
$result = -1;
} else {
// Insert line
$result = $object->addline(
$desc,
$pu_ht,
$qty,
$tva_tx,
(float) $pu_ht,
(float) $qty,
(float) $tva_tx,
$localtax1_tx,
$localtax2_tx,
$idprod,
@ -681,12 +681,12 @@ if (empty($reshook)) {
$date_start,
$date_end,
$price_base_type,
$pu_ttc,
(float) $pu_ttc,
$info_bits,
$fk_fournprice,
$pa_ht,
(int) $fk_fournprice,
(float) $pa_ht,
$array_options,
$fk_unit,
(int) $fk_unit,
$rang
);
}
@ -1070,7 +1070,7 @@ if (empty($reshook)) {
if (getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) {
if ($action == 'addcontact' && $user->hasRight('contrat', 'creer')) {
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
$contactid = (GETPOST('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
$result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
@ -1315,13 +1315,13 @@ if ($action == 'create') {
}
print '<tr><td>'.$langs->trans("NotePublic").'</td><td class="tdtop">';
$doleditor = new DolEditor('note_public', $note_public, '', 100, 'dolibarr_notes', 'In', true, true, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%');
$doleditor = new DolEditor('note_public', (string) $note_public, '', 100, 'dolibarr_notes', 'In', true, true, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td></tr>';
if (empty($user->socid)) {
print '<tr><td>'.$langs->trans("NotePrivate").'</td><td class="tdtop">';
$doleditor = new DolEditor('note_private', $note_private, '', 100, 'dolibarr_notes', 'In', true, true, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%');
$doleditor = new DolEditor('note_private', (string) $note_private, '', 100, 'dolibarr_notes', 'In', true, true, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);
print '</td></tr>';
}
@ -1477,7 +1477,7 @@ if ($action == 'create') {
$morehtmlref .= $object->ref;
} else {
$morehtmlref .= $form->editfieldkey("", 'ref', $object->ref, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 3);
$morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->hasRight('contrat', 'creer'), 'string', '', null, 2);
$morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->hasRight('contrat', 'creer'), 'string', '', null, '2');
}
$morehtmlref .= '<div class="refidno">';
@ -1502,7 +1502,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);
@ -1705,7 +1705,7 @@ if ($action == 'create') {
$description = ''; // Already added into main visible desc
}
print $form->textwithtooltip($text, $description, 3, 0, 0, $cursorline, 3, (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : ''));
print $form->textwithtooltip($text, $description, 3, 0, '0', (string) $cursorline, 3, (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : ''));
print '</td>';
} else {
@ -1809,7 +1809,7 @@ if ($action == 'create') {
$line = new ContratLigne($db);
$line->id = $objp->rowid;
$line->fetch_optionals();
print $line->showOptionals($extrafields, 'view', array('class' => 'oddeven', 'style' => $moreparam, 'colspan' => $colspan, 'tdclass' => 'notitlefieldcreate'), '', '', 1);
print $line->showOptionals($extrafields, 'view', array('class' => 'oddeven', 'style' => $moreparam, 'colspan' => $colspan, 'tdclass' => 'notitlefieldcreate'), '', '', '1');
}
} else {
// Line in mode update
@ -1861,7 +1861,7 @@ if ($action == 'create') {
// VAT
print '<td class="right">';
print $form->load_tva("eltva_tx", $objp->tva_tx.($objp->vat_src_code ? (' ('.$objp->vat_src_code.')') : ''), $mysoc, $object->thirdparty, $currentLineProductId, $objp->info_bits, $objp->product_type, 0, 1);
print $form->load_tva("eltva_tx", $objp->tva_tx.($objp->vat_src_code ? (' ('.$objp->vat_src_code.')') : ''), $mysoc, $object->thirdparty, $currentLineProductId, $objp->info_bits, $objp->product_type, false, 1);
print '</td>';
// Price
@ -1921,7 +1921,7 @@ if ($action == 'create') {
$line->id = $objp->rowid;
$line->fetch_optionals();
print $line->showOptionals($extrafields, 'edit', array('style' => 'class="oddeven"', 'colspan' => $colspan, 'tdclass' => 'notitlefieldcreate'), '', '', 1);
print $line->showOptionals($extrafields, 'edit', array('style' => 'class="oddeven"', 'colspan' => $colspan, 'tdclass' => 'notitlefieldcreate'), '', '', '1');
}
}
@ -2365,7 +2365,7 @@ if ($action == 'create') {
$delallowed = $user->hasRight('contrat', 'creer');
print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, ($object->model_pdf ? $object->model_pdf : getDolGlobalString('CONTRACT_ADDON_PDF')), 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object);
print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, ($object->model_pdf ? $object->model_pdf : getDolGlobalString('CONTRACT_ADDON_PDF')), 1, 0, 0, 28, 0, '', '0', '', $soc->default_lang, '', $object);
// Show links to link elements

View file

@ -1471,9 +1471,9 @@ class Contrat extends CommonObject
* @param float $pu_ttc Prix unitaire TTC
* @param int $info_bits Bits of type of lines
* @param int $fk_fournprice Fourn price id
* @param int $pa_ht Buying price HT
* @param float $pa_ht Buying price HT
* @param array<string,mixed> $array_options extrafields array
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param ?int $fk_unit Code of the unit to use. Null to use the default one
* @param int $rang Position
* @return int Return integer <0 if KO, >0 if OK
*/
@ -1640,7 +1640,7 @@ class Contrat extends CommonObject
if ($date_end > 0) {
$sql .= ",'".$this->db->idate($date_end)."'";
}
$sql .= ", ".($fk_unit ? "'".$this->db->escape($fk_unit)."'" : "null");
$sql .= ", ".($fk_unit ? "'".$this->db->escape((string) $fk_unit)."'" : "null");
$sql .= ", ".(!empty($rang) ? (int) $rang : "0");
$sql .= ")";
@ -1761,7 +1761,7 @@ class Contrat extends CommonObject
$localtaxes_type = getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc);
$tvatx = preg_replace('/\s*\(.*\)/', '', $tvatx); // Remove code into vatrate.
$tabprice = calcul_price_total($qty, $pu, $remise_percent, (float) price2num($tvatx), $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, $mysoc, $localtaxes_type);
$tabprice = calcul_price_total((float) $qty, $pu, $remise_percent, (float) price2num($tvatx), (float) $localtax1tx, (float) $localtax2tx, 0, $price_base_type, $info_bits, 1, $mysoc, $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];

View file

@ -12,7 +12,7 @@
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2015-2018 Ferran Marcet <fmarcet@2byte.es>
* 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
@ -674,7 +674,7 @@ class ContratLigne extends CommonObjectLine
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$localtaxes_type = getLocalTaxesFromRate($this->tva_tx, 0, $this->thirdparty, $mysoc);
$tabprice = calcul_price_total($this->qty, $this->price_ht, $this->remise_percent, $this->tva_tx, $this->localtax1_tx, $this->localtax2_tx, 0, 'HT', 0, 1, $mysoc, $localtaxes_type);
$tabprice = calcul_price_total($this->qty, $this->price_ht, $this->remise_percent, (float) $this->tva_tx, $this->localtax1_tx, $this->localtax2_tx, 0, 'HT', 0, 1, $mysoc, $localtaxes_type);
$this->total_ht = (float) $tabprice[0];
$this->total_tva = (float) $tabprice[1];
$this->total_ttc = (float) $tabprice[2];
@ -732,7 +732,7 @@ class ContratLigne extends CommonObjectLine
$sql .= " total_ttc = ".((float) $this->total_ttc).",";
$sql .= " fk_product_fournisseur_price = ".(!empty($this->fk_fournprice) ? $this->fk_fournprice : "NULL").",";
$sql .= " buy_price_ht = '".price2num($this->pa_ht)."',";
$sql .= " info_bits = '".$this->db->escape($this->info_bits)."',";
$sql .= " info_bits = '".$this->db->escape((string) $this->info_bits)."',";
$sql .= " fk_user_author = ".($this->fk_user_author >= 0 ? $this->fk_user_author : "NULL").",";
$sql .= " fk_user_ouverture = ".($this->fk_user_ouverture > 0 ? $this->fk_user_ouverture : "NULL").",";
$sql .= " fk_user_cloture = ".($this->fk_user_cloture > 0 ? $this->fk_user_cloture : "NULL").",";
@ -867,7 +867,7 @@ class ContratLigne extends CommonObjectLine
}
$sql .= ") VALUES ($this->fk_contrat, '', '".$this->db->escape($this->description)."',";
$sql .= ($this->fk_product > 0 ? $this->fk_product : "null").",";
$sql .= " '".$this->db->escape($this->qty)."',";
$sql .= " '".$this->db->escape((string) $this->qty)."',";
$sql .= " '".$this->db->escape($this->vat_src_code)."',";
$sql .= " '".$this->db->escape($this->tva_tx)."',";
$sql .= " '".$this->db->escape($this->localtax1_tx)."',";
@ -876,7 +876,7 @@ class ContratLigne extends CommonObjectLine
$sql .= " '".$this->db->escape($this->localtax2_type)."',";
$sql .= " ".price2num($this->remise_percent).",".price2num($this->subprice).",";
$sql .= " ".price2num($this->total_ht).",".price2num($this->total_tva).",".price2num($this->total_localtax1).",".price2num($this->total_localtax2).",".price2num($this->total_ttc).",";
$sql .= " '".$this->db->escape($this->info_bits)."',";
$sql .= " '".$this->db->escape((string) $this->info_bits)."',";
$sql .= " ".(empty($this->rang) ? '0' : (int) $this->rang).",";
$sql .= " ".price2num($this->price_ht).",".price2num($this->remise).",";
if ($this->fk_fournprice > 0) {

View file

@ -6,6 +6,7 @@
* Copyright (C) 2023 Christian Foellmann <christian@foellmann.de>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* 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
@ -73,7 +74,7 @@ $result = restrictedArea($user, 'contrat', $object->id);
* Actions
*/
$parameters = array('id'=>$id);
$parameters = array('id' => $id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -85,7 +86,7 @@ if (empty($reshook)) {
$result = $object->fetch($id);
if ($result > 0 && $id > 0) {
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
$contactid = (GETPOST('userid') ? GETPOSTINT('userid') : GETPOSTINT('contactid'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
$result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
}
@ -191,7 +192,7 @@ if ($id > 0 || !empty($ref)) {
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);

View file

@ -8,6 +8,7 @@
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 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
@ -166,7 +167,7 @@ if ($object->id) {
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);

View file

@ -188,29 +188,28 @@ if ($reshook > 0) {
}
$arrayfields = array(
'c.ref' => array('label' => $langs->trans("Ref"), 'checked' => 1, 'position' => 10),
'c.ref_customer' => array('label' => $langs->trans("RefCustomer"), 'checked' => 1, 'position' => 12),
'c.ref_supplier' => array('label' => $langs->trans("RefSupplier"), 'checked' => 1, 'position' => 14),
's.nom' => array('label' => $langs->trans("ThirdParty"), 'checked' => 1, 'position' => 30),
's.email' => array('label' => $langs->trans("ThirdPartyEmail"), 'checked' => 0, 'position' => 30),
's.town' => array('label' => $langs->trans("Town"), 'checked' => 0, 'position' => 31),
's.zip' => array('label' => $langs->trans("Zip"), 'checked' => 1, 'position' => 32),
'state.nom' => array('label' => $langs->trans("StateShort"), 'checked' => 0, 'position' => 33),
'country.code_iso' => array('label' => $langs->trans("Country"), 'checked' => 0, 'position' => 34),
'sale_representative' => array('label' => $langs->trans("SaleRepresentativesOfThirdParty"), 'checked' => -1, 'position' => 80),
'c.date_contrat' => array('label' => $langs->trans("DateContract"), 'checked' => 1, 'position' => 45),
'c.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => 0, 'position' => 500),
'c.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => 0, 'position' => 500),
'lower_planned_end_date' => array('label' => $langs->trans("LowerDateEndPlannedShort"), 'checked' => 1, 'position' => 900, 'help' => $langs->trans("LowerDateEndPlannedShort")),
'status' => array('label' => $langs->trans("Status"), 'checked' => 1, 'position' => 1000),
'c.signed_status' => array('label' => $langs->trans('SignedStatus'), 'checked' => 0, 'position' => 1001),
'c.ref' => array('label' => $langs->trans("Ref"), 'checked' => '1', 'position' => 10),
'c.ref_customer' => array('label' => $langs->trans("RefCustomer"), 'checked' => '1', 'position' => 12),
'c.ref_supplier' => array('label' => $langs->trans("RefSupplier"), 'checked' => '1', 'position' => 14),
's.nom' => array('label' => $langs->trans("ThirdParty"), 'checked' => '1', 'position' => 30),
's.email' => array('label' => $langs->trans("ThirdPartyEmail"), 'checked' => '0', 'position' => 30),
's.town' => array('label' => $langs->trans("Town"), 'checked' => '0', 'position' => 31),
's.zip' => array('label' => $langs->trans("Zip"), 'checked' => '1', 'position' => 32),
'state.nom' => array('label' => $langs->trans("StateShort"), 'checked' => '0', 'position' => 33),
'country.code_iso' => array('label' => $langs->trans("Country"), 'checked' => '0', 'position' => 34),
'sale_representative' => array('label' => $langs->trans("SaleRepresentativesOfThirdParty"), 'checked' => '-1', 'position' => 80),
'c.date_contrat' => array('label' => $langs->trans("DateContract"), 'checked' => '1', 'position' => 45),
'c.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => '0', 'position' => 500),
'c.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => '0', 'position' => 500),
'lower_planned_end_date' => array('label' => $langs->trans("LowerDateEndPlannedShort"), 'checked' => '1', 'position' => 900, 'help' => $langs->trans("LowerDateEndPlannedShort")),
'status' => array('label' => $langs->trans("Status"), 'checked' => '1', 'position' => 1000),
'c.signed_status' => array('label' => $langs->trans('SignedStatus'), 'checked' => '0', 'position' => 1001),
);
// 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
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$search_sale = $user->id;
@ -837,7 +836,7 @@ if (isModEnabled('category') && $user->hasRight('categorie', 'lire') && ($user->
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('IncludingProductWithTag');
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 2);
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'widthcentpercentminusx maxwidth300', 1);
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth300', 1);
$moreforfilter .= '</div>';
}
// Filter on customer categories

View file

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

View file

@ -5,6 +5,7 @@
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 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
@ -137,7 +138,7 @@ if ($id > 0 || !empty($ref)) {
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);
@ -193,7 +194,7 @@ if ($id > 0 || !empty($ref)) {
//print '<br>';
$cssclass='titlefield';
$cssclass = 'titlefield';
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
print dol_get_fiche_end();

View file

@ -7,7 +7,7 @@
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019 Juanjo Menent <jmenent@2byte.es>
* 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
@ -140,28 +140,27 @@ $staticcontratligne = new ContratLigne($db);
$companystatic = new Societe($db);
$arrayfields = array(
'c.ref' => array('label' => "Contract", 'checked' => 1, 'position' => 80),
'p.description' => array('label' => "Service", 'checked' => 1, 'position' => 80),
's.nom' => array('label' => "ThirdParty", 'checked' => 1, 'position' => 90),
'cd.tva_tx' => array('label' => "VATRate", 'checked' => -1, 'position' => 100),
'cd.subprice' => array('label' => "PriceUHT", 'checked' => -1, 'position' => 105),
'cd.qty' => array('label' => "Qty", 'checked' => 1, 'position' => 108),
'cd.total_ht' => array('label' => "TotalHT", 'checked' => -1, 'position' => 109, 'isameasure' => 1),
'cd.total_tva' => array('label' => "TotalVAT", 'checked' => -1, 'position' => 110),
'cd.date_ouverture_prevue' => array('label' => "DateStartPlannedShort", 'checked' => 1, 'position' => 150),
'cd.date_ouverture' => array('label' => "DateStartRealShort", 'checked' => 1, 'position' => 160),
'cd.date_fin_validite' => array('label' => "DateEndPlannedShort", 'checked' => 1, 'position' => 170),
'cd.date_cloture' => array('label' => "DateEndRealShort", 'checked' => 1, 'position' => 180),
'c.ref' => array('label' => "Contract", 'checked' => '1', 'position' => 80),
'p.description' => array('label' => "Service", 'checked' => '1', 'position' => 80),
's.nom' => array('label' => "ThirdParty", 'checked' => '1', 'position' => 90),
'cd.tva_tx' => array('label' => "VATRate", 'checked' => '-1', 'position' => 100),
'cd.subprice' => array('label' => "PriceUHT", 'checked' => '-1', 'position' => 105),
'cd.qty' => array('label' => "Qty", 'checked' => '1', 'position' => 108),
'cd.total_ht' => array('label' => "TotalHT", 'checked' => '-1', 'position' => 109, 'isameasure' => 1),
'cd.total_tva' => array('label' => "TotalVAT", 'checked' => '-1', 'position' => 110),
'cd.date_ouverture_prevue' => array('label' => "DateStartPlannedShort", 'checked' => '1', 'position' => 150),
'cd.date_ouverture' => array('label' => "DateStartRealShort", 'checked' => '1', 'position' => 160),
'cd.date_fin_validite' => array('label' => "DateEndPlannedShort", 'checked' => '1', 'position' => 170),
'cd.date_cloture' => array('label' => "DateEndRealShort", 'checked' => '1', 'position' => 180),
//'cd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'cd.tms' => array('label' => "DateModificationShort", 'checked' => 0, 'position' => 500),
'status' => array('label' => "Status", 'checked' => 1, 'position' => 1000)
'cd.tms' => array('label' => "DateModificationShort", 'checked' => '0', 'position' => 500),
'status' => array('label' => "Status", 'checked' => '1', 'position' => 1000)
);
// 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
$permissiontoread = $user->hasRight('contrat', 'lire');
$permissiontoadd = $user->hasRight('contrat', 'creer');
@ -577,7 +576,7 @@ if (isModEnabled('category') && ($user->hasRight('produit', 'lire') || $user->ha
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('IncludingProductWithTag');
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 0, 0, 1);
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'widthcentpercentminusx maxwidth300', 1);
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, '', 'widthcentpercentminusx maxwidth300', 1);
$moreforfilter .= '</div>';
}
// alert on late date

View file

@ -545,7 +545,7 @@ class pdf_crabe extends ModelePDFFactures
// Extrafields in note
$extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
if (!empty($extranote)) {
$notetoshow = dol_concatdesc($notetoshow, $extranote);
$notetoshow = dol_concatdesc((string) $notetoshow, $extranote);
}
if ($notetoshow) {
$tab_top -= 2;
@ -2277,7 +2277,7 @@ class pdf_crabe extends ModelePDFFactures
$thirdparty = $object->thirdparty;
}
$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client_name = is_object($thirdparty) ? pdfBuildThirdpartyName($thirdparty, $outputlangs) : '';
$mode = 'target';
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), ($usecontact ? 1 : 0), $mode, $object);

View file

@ -635,7 +635,7 @@ class pdf_octopus extends ModelePDFFactures
// Extrafields in note
$extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
if (!empty($extranote)) {
$notetoshow = dol_concatdesc($notetoshow, $extranote);
$notetoshow = dol_concatdesc((string) $notetoshow, $extranote);
}
$pagenb = $pdf->getPage();
@ -1327,7 +1327,7 @@ class pdf_octopus extends ModelePDFFactures
* @param Facture $object Object to show
* @param float $posy Y
* @param Translate $outputlangs Langs object
* @param Translate $outputlangsbis Object lang for output bis
* @param ?Translate $outputlangsbis Object lang for output bis
* @return float Pos y
*/
protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs, $outputlangsbis)
@ -1492,7 +1492,7 @@ class pdf_octopus extends ModelePDFFactures
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($this->db);
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
$bac->fetch(0, $object->thirdparty->id);
$bac->fetch(0, (string) $object->thirdparty->id);
$iban = $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
$lib_mode_reg .= ' '.$outputlangs->trans("PaymentTypePREdetails", dol_trunc($iban, 6, 'right', 'UTF-8', 1));
}
@ -1632,7 +1632,7 @@ class pdf_octopus extends ModelePDFFactures
* @param float $deja_regle Amount already paid (in the currency of invoice)
* @param float $posy Position depart
* @param Translate $outputlangs Object langs
* @param Translate $outputlangsbis Object lang for output bis
* @param ?Translate $outputlangsbis Object lang for output bis
* @return float Position pour suite
*/
protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis)
@ -2217,7 +2217,7 @@ class pdf_octopus extends ModelePDFFactures
}
if ($this->situationinvoice) {
$title = $outputlangs->transnoentities("PDFInvoiceSituation");
$subtitle = $outputlangs->transnoentities("PDFSituationTitle", $object->situation_counter);
$subtitle = $outputlangs->transnoentities("PDFSituationTitle", (string) $object->situation_counter);
}
if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE') && is_object($outputlangsbis)) {
$title .= ' - ';
@ -2446,7 +2446,7 @@ class pdf_octopus extends ModelePDFFactures
$thirdparty = $object->thirdparty;
}
$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client_name = is_object($thirdparty) ? pdfBuildThirdpartyName($thirdparty, $outputlangs) : 0;
$mode = 'target';
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), ($usecontact ? 1 : 0), $mode, $object);
@ -2913,7 +2913,7 @@ class pdf_octopus extends ModelePDFFactures
$pdf->line($this->posx_current - 1, $tab_top, $this->posx_current - 1, $tab_top + $tab_height);
if (empty($hidetop)) {
$pdf->SetXY($this->posx_current - 1, $tab_top + 0.5);
$pdf->MultiCell(36, 2, $outputlangs->transnoentities("CurrentSituationTotal", $object->situation_counter), '', 'C');
$pdf->MultiCell(36, 2, $outputlangs->transnoentities("CurrentSituationTotal", (string) $object->situation_counter), '', 'C');
}
// ADD HORIZONTAL LINES
@ -2971,7 +2971,7 @@ class pdf_octopus extends ModelePDFFactures
if ($displayWarranty) {
$pdf->SetXY($this->marge_gauche + 2, $tab_top + 74);
$pdf->MultiCell(80, 2, $outputlangs->trans("TotalSituationInvoiceWithRetainedWarranty", $object->retained_warranty), '', 'L');
$pdf->MultiCell(80, 2, $outputlangs->trans("TotalSituationInvoiceWithRetainedWarranty", (string) $object->retained_warranty), '', 'L');
$nextY = $tab_top + 93;
} else {
$nextY = $tab_top + 74;
@ -3450,7 +3450,7 @@ class pdf_octopus extends ModelePDFFactures
* @param int $deja_regle Amount already paid (in the currency of invoice)
* @param int $posy Position depart
* @param Translate $outputlangs Object langs
* @param Translate $outputlangsbis Object lang for output bis
* @param ?Translate $outputlangsbis Object lang for output bis
* @return void
*/
public function resumeLastPage(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis)
@ -3681,7 +3681,7 @@ class pdf_octopus extends ModelePDFFactures
$pdf->SetXY($posx, $posy + $height * $index);
$pdf->SetTextColor(0, 0, 60);
$pdf->SetFillColor(241, 241, 241);
$pdf->MultiCell($width, $height, $outputlangs->transnoentities("RetainedWarrantyShort", $retainedWarrantyRate), $useborder, 'L', true);
$pdf->MultiCell($width, $height, $outputlangs->transnoentities("RetainedWarrantyShort", (string) $retainedWarrantyRate), $useborder, 'L', true);
$total_ht_rg = (float) price2num(price($total_ht * $retainedWarrantyRate / 100), 'MT');
$total_ttc_rg = (float) price2num(price($total_ttc * $retainedWarrantyRate / 100), 'MT');

View file

@ -563,7 +563,7 @@ class pdf_sponge extends ModelePDFFactures
// Extrafields in note
$extranote = $this->getExtrafieldsInHtml($object, $outputlangs);
if (!empty($extranote)) {
$notetoshow = dol_concatdesc($notetoshow, $extranote);
$notetoshow = dol_concatdesc((string) $notetoshow, $extranote);
}
$pagenb = $pdf->getPage();
@ -1257,7 +1257,7 @@ class pdf_sponge extends ModelePDFFactures
* @param Facture $object Object to show
* @param float $posy Y
* @param Translate $outputlangs Langs object
* @param Translate $outputlangsbis Object lang for output bis
* @param ?Translate $outputlangsbis Object lang for output bis
* @return float Pos y
*/
protected function drawInfoTable(&$pdf, $object, $posy, $outputlangs, $outputlangsbis)
@ -1573,7 +1573,7 @@ class pdf_sponge extends ModelePDFFactures
* @param float $deja_regle Amount already paid (in the currency of invoice)
* @param float $posy Position depart
* @param Translate $outputlangs Object langs
* @param Translate $outputlangsbis Object lang for output bis
* @param ?Translate $outputlangsbis Object lang for output bis
* @return float Position pour suite
*/
protected function drawTotalTable(&$pdf, $object, $deja_regle, $posy, $outputlangs, $outputlangsbis)
@ -1672,7 +1672,7 @@ class pdf_sponge extends ModelePDFFactures
$index++;
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $fac->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', true);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", (string) $fac->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', true);
$pdf->SetXY($col2x, $posy);
@ -1694,7 +1694,7 @@ class pdf_sponge extends ModelePDFFactures
// Display current total
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $object->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', true);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", (string) $object->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', true);
$pdf->SetXY($col2x, $posy);
$facSign = '';
@ -1716,7 +1716,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->SetFillColor(255, 255, 255);
$pdf->SetXY($col1x, $posy);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("SituationTotalProgress", $avancementGlobal), 0, 'L', true);
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("SituationTotalProgress", (string) $avancementGlobal), 0, 'L', true);
$pdf->SetXY($col2x, $posy);
$pdf->MultiCell($largcol2, $tab2_hl, price($total_a_payer * $avancementGlobal / 100, 0, $outputlangs), 0, 'R', true);
@ -1921,13 +1921,13 @@ class pdf_sponge extends ModelePDFFactures
$totalvat = $outputlangs->transcountrynoentities("TotalVAT", $mysoc->country_code).(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transcountrynoentities("TotalVAT", $mysoc->country_code) : '');
$totalvat .= ' ';
if (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'rateonly') {
$totalvat .= vatrate($tvaval['vatrate'], true).$tvacompl;
$totalvat .= vatrate((string) $tvaval['vatrate'], true).$tvacompl;
} elseif (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'codeonly') {
$totalvat .= $tvaval['vatcode'].$tvacompl;
} elseif (getDolGlobalString('PDF_VAT_LABEL_IS_CODE_OR_RATE') == 'nocodenorate') {
$totalvat .= $tvacompl;
} else {
$totalvat .= vatrate($tvaval['vatrate'], true).($tvaval['vatcode'] ? ' ('.$tvaval['vatcode'].')' : '').$tvacompl;
$totalvat .= vatrate((string) $tvaval['vatrate'], true).($tvaval['vatcode'] ? ' ('.$tvaval['vatcode'].')' : '').$tvacompl;
}
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', true);
@ -2526,7 +2526,7 @@ class pdf_sponge extends ModelePDFFactures
$thirdparty = $object->thirdparty;
}
$carac_client_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client_name = is_object($thirdparty) ? pdfBuildThirdpartyName($thirdparty, $outputlangs) : '';
$mode = 'target';
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ($usecontact ? $object->contact : ''), ($usecontact ? 1 : 0), $mode, $object);

View file

@ -225,7 +225,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator
// Add payment amount, with currency
$pai = SwissQrBill\DataGroup\Element\PaymentAmountInformation::create($currencyinvoicecode, $object->total_ttc);
if (!$pai->isValid()) {
$this->error = $langs->transnoentities("SwissQrPaymentInformationInvalid", $object->total_ttc, (string) $pai->getViolations());
$this->error = $langs->transnoentities("SwissQrPaymentInformationInvalid", (string) $object->total_ttc, (string) $pai->getViolations());
return false;
}
$qrBill->setPaymentAmountInformation($pai);

View file

@ -4,7 +4,7 @@
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2022-2024 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2023 Alexandre Janniaux <alexandre.janniaux@gmail.com>
* Copyright (C) 2024-2025 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
@ -106,7 +106,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if (isModEnabled('invoice') && getDolGlobalString('WORKFLOW_ORDER_AUTOCREATE_INVOICE')) {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
'@phan-var-force Facture $object';
'@phan-var-force Commande $object';
$newobject = new Facture($this->db);
$newobject->context['createfromorder'] = 'createfromorder';

View file

@ -9,7 +9,7 @@
* Copyright (C) 2006 Andre Cianfarani <andre.cianfarani@acdeveloppement.net>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
* 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
@ -32,6 +32,33 @@
* \brief File that include conf.php file and commons lib like functions.lib.php
*/
/**
* @var ?string $dolibarr_font_DOL_DEFAULT_TTF
* @var ?string $dolibarr_font_DOL_DEFAULT_TTF_BOLD
* @var ?string $dolibarr_js_CKEDITOR
* @var ?string $dolibarr_js_JQUERY
* @var ?string $dolibarr_js_JQUERY_UI
* @var ?string $dolibarr_lib_NUSOAP_PATH
* @var ?string $dolibarr_lib_ODTPHP_PATH
* @var ?string $dolibarr_lib_ODTPHP_PATHTOPCLZIP
* @var ?string $dolibarr_lib_PHPEXCELNEW_PATH
* @var ?string $dolibarr_lib_TCPDF_PATH
* @var ?string $dolibarr_lib_TCPDI_PATH
*/
'
@phan-var-force ?string $dolibarr_font_DOL_DEFAULT_TTF
@phan-var-force ?string $dolibarr_font_DOL_DEFAULT_TTF_BOLD
@phan-var-force ?string $dolibarr_js_CKEDITOR
@phan-var-force ?string $dolibarr_js_JQUERY
@phan-var-force ?string $dolibarr_js_JQUERY_UI
@phan-var-force ?string $dolibarr_lib_NUSOAP_PATH
@phan-var-force ?string $dolibarr_lib_ODTPHP_PATH
@phan-var-force ?string $dolibarr_lib_ODTPHP_PATHTOPCLZIP
@phan-var-force ?string $dolibarr_lib_PHPEXCELNEW_PATH
@phan-var-force ?string $dolibarr_lib_TCPDF_PATH
@phan-var-force ?string $dolibarr_lib_TCPDI_PATH
';
if (!defined('DOL_APPLICATION_TITLE')) {
define('DOL_APPLICATION_TITLE', 'Dolibarr');
}
@ -354,6 +381,7 @@ if (!empty($_SERVER["DOCUMENT_ROOT"])) {
$paths = explode('/', str_replace('\\', '/', $_SERVER["SCRIPT_NAME"])); // C) Value reported by web server, to say full path on filesystem of a file. Ex: /dolibarr/htdocs/admin/system/phpinfo.php
// Try to detect if $_SERVER["DOCUMENT_ROOT"]+start of $_SERVER["SCRIPT_NAME"] is $dolibarr_main_document_root. If yes, relative url to add before dol files is this start part.
$concatpath = '';
$tmp3 = '';
foreach ($paths as $tmppath) { // We check to find (B+start of C)=A
if (empty($tmppath)) {
continue;