2
0
forked from Wavyzz/dolibarr

Fix Phan notices introduced since 30/12/2024

This commit is contained in:
MDW
2025-01-13 20:04:35 +01:00
parent 4707d29f0a
commit 7150af31dc
50 changed files with 407 additions and 142 deletions

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
@@ -8,7 +9,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023 Nick Fragoulis
* 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
@@ -1491,6 +1492,7 @@ class FactureRec extends CommonInvoice
'facturerec' => $facturerec, // it's an object which PHP passes by "reference", so modifiable by hooks.
'this' => $this, // it's an object which PHP passes by "reference", so modifiable by hooks.
);
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$reshook = $hookmanager->executeHooks('afterCreationOfRecurringInvoice', $parameters, $facture); // note: $facture can be modified by hooks (warning: $facture can be null)
$i++;

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
@@ -6,7 +7,7 @@
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -931,7 +932,7 @@ if ($object->id > 0) {
$tmpuser = new User($db);
$num = $db->num_rows($result);
$num = $db->num_rows($resql);
while ($i < $num) {
$obj = $db->fetch_object($resql);

View File

@@ -1,10 +1,11 @@
<?php
/* Copyright (C) 2015-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2021 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019-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
@@ -1941,6 +1942,7 @@ $parameters['uploaddir'] = $uploaddir;
$parameters['massaction'] = $massaction;
$parameters['diroutputmassaction'] = isset($diroutputmassaction) ? $diroutputmassaction : null;
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$reshook = $hookmanager->executeHooks('doMassActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');

View File

@@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2011-2022 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2023 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@@ -161,7 +162,7 @@ class FileUpload
'options' => &$options,
'element' => $element
),
$object,
$object, // @phan-suppress-current-line PhanTypeMismatchArgumentNullable
$action
);

View File

@@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2010-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* 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

View File

@@ -2133,7 +2133,7 @@ class Form
* @param int $disabled If select list must be disabled
* @param int[]|''|'hierarchy'|'hierarchyme' $include Array list of users id to include. User '' for all users or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
* @param int[]|'' $enableonly Array list of users id to be enabled. If defined, it means that others will be disabled
* @param string $force_entity '0' or list of Ids of environment to force, separated by a coma, or 'default' = do no extend to all entities allowed to superadmin.
* @param string $force_entity '0' or list of Ids of environment to force, separated by a comma, or 'default' = do no extend to all entities allowed to superadmin.
* @param int $maxlength Maximum length of string into list (0=no limit)
* @param int<-1,1> $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
* @param string $morefilter Add more filters into sql request (Example: '(employee:=:1)'). This value must not come from user input.

View File

@@ -810,7 +810,7 @@ class FormCompany extends Form
/**
* Return a select list with types of contacts
*
* @param Object $object Object to use to find type of contact
* @param ?Object $object Object to use to find type of contact
* @param string $selected Default selected value
* @param string $htmlname HTML select name
* @param string $source Source ('internal' or 'external')

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2008-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
@@ -8,7 +9,7 @@
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
* Copyright (C) 2016-2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2019-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
@@ -310,6 +311,7 @@ class FormFile
}
$parameters = array('socid' => (isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id' => (isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'url' => $url, 'perm' => $perm, 'options' => $options);
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$res = $hookmanager->executeHooks('formattachOptionsUpload', $parameters, $object);
if (empty($res)) {
$out = '<div class="'.($usewithoutform ? 'inline-block valignmiddle' : (($nooutput == 2 ? '' : 'attacharea ').'attacharea'.$htmlname)).'">'.$out.'</div>';
@@ -1349,6 +1351,7 @@ class FormFile
'title' => $title,
'url' => $url
);
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$reshook = $hookmanager->executeHooks('showFilesList', $parameters, $object);
if (!empty($reshook)) { // null or '' for bypass

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2024 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
@@ -409,21 +410,21 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
$position = (empty($val['position']) ? 0 : intval($val['position']));
$arrayofgroupby[$tablealias.'.'.$key.'-year'] = array(
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.')</span>',
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.')</span>', // @phan-suppress-current-line PhanUndeclaredProperty
'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']),
'position' => ($position + ($count * 100000)).'.1',
'table' => $object->table_element,
'tablefromt' => $tablepath
);
$arrayofgroupby[$tablealias.'.'.$key.'-month'] = array(
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>',
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>', // @phan-suppress-current-line PhanUndeclaredProperty
'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']),
'position' => ($position + ($count * 100000)).'.2',
'table' => $object->table_element,
'tablefromt' => $tablepath
);
$arrayofgroupby[$tablealias.'.'.$key.'-day'] = array(
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.'-'.$DD.')</span>',
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$YYYY.'-'.$MM.'-'.$DD.')</span>', // @phan-suppress-current-line PhanUndeclaredProperty
'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']),
'position' => ($position + ($count * 100000)).'.3',
'table' => $object->table_element,
@@ -432,7 +433,7 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup
} else {
$position = (empty($val['position']) ? 0 : intval($val['position']));
$arrayofgroupby[$tablealias.'.'.$key] = array(
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']),
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), // @phan-suppress-current-line PhanUndeclaredProperty
'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']),
'position' => ($position + ($count * 100000)),
'table' => $object->table_element,
@@ -455,14 +456,14 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup
if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('timestamp', 'date', 'datetime'))) {
$position = (empty($extrafields->attributes[$object->table_element]['pos'][$key]) ? 0 : intval($extrafields->attributes[$object->table_element]['pos'][$key]));
$arrayofgroupby[preg_replace('/^t/', 'te', $tablealias).'.'.$key.'-year'] = array(
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val).' <span class="opacitymedium">('.$YYYY.')</span>',
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val).' <span class="opacitymedium">('.$YYYY.')</span>', // @phan-suppress-current-line PhanUndeclaredProperty
'labelnohtml' => $labelofobject.': '.$langs->trans($val),
'position' => ($position + ($count * 100000)).'.1',
'table' => $object->table_element,
'tablefromt' => $tablepath
);
$arrayofgroupby[preg_replace('/^t/', 'te', $tablealias).'.'.$key.'-month'] = array(
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>',
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val).' <span class="opacitymedium">('.$YYYY.'-'.$MM.')</span>', // @phan-suppress-current-line PhanUndeclaredProperty
'labelnohtml' => $labelofobject.': '.$langs->trans($val),
'position' => ($position + ($count * 100000)).'.2',
'table' => $object->table_element,
@@ -570,7 +571,7 @@ function fillArrayOfFilterFields($object, $tablealias, $labelofobject, &$arrayof
$position = (empty($val['position']) ? 0 : intval($val['position']));
$arrayoffields[$tablealias.'.'.$key] = array(
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']),
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), // @phan-suppress-current-line PhanUndeclaredProperty
'labelnohtml' => $labelofobject.': '.$langs->trans($val['label']),
'position' => ($position + ($count * 100000)),
'table' => $object->table_element,

View File

@@ -495,6 +495,7 @@ function getEntity($element, $shared = 1, $currentobject = null)
'currentobject' => $currentobject,
'out' => $out
);
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$reshook = $hookmanager->executeHooks('hookGetEntity', $parameters, $currentobject, $action); // Note that $action and $object may have been modified by some hooks
if (is_numeric($reshook)) {
@@ -11309,6 +11310,7 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type,
// No need to make a return $head. Var is modified as a reference
if (!empty($hookmanager)) {
$parameters = array('object' => $object, 'mode' => $mode, 'head' => &$head, 'filterorigmodule' => $filterorigmodule);
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$reshook = $hookmanager->executeHooks('completeTabsHead', $parameters, $object);
if ($reshook > 0) { // Hook ask to replace completely the array
$head = $hookmanager->resArray;

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
@@ -14,7 +15,7 @@
* Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2021-2022 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2023-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -454,6 +455,7 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t
if (is_object($hookmanager)) {
$parameters = array('sourcecompany' => &$sourcecompany, 'targetcompany' => &$targetcompany, 'targetcontact' => &$targetcontact, 'outputlangs' => $outputlangs, 'mode' => $mode, 'usecontact' => $usecontact);
$action = '';
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$reshook = $hookmanager->executeHooks('pdf_build_address', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
$stringaddress .= $hookmanager->resPrint;
}
@@ -2678,7 +2680,7 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
$reshook = $hookmanager->executeHooks('pdf_getLinkedObjects', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
$linkedobjects = array_replace($linkedobjects, $hookmanager->resArray); // array_replace is used to preserve keys
} elseif ($reshook>0) {
} elseif ($reshook > 0) {
// The array must be reinserted even if it is empty because clearing the array could be one of the actions performed by the hook.
$linkedobjects = $hookmanager->resArray;
}

View File

@@ -1,11 +1,12 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@ope-concept.pro>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* 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
@@ -617,11 +618,11 @@ class doc_generic_task_odt extends ModelePDFTask
// Replace tags of lines for contacts task
$sourcearray = array('internal', 'external');
$contact_arrray = array();
$contact_array = array();
foreach ($sourcearray as $source) {
$contact_temp = $object->liste_contact(-1, $source);
if ((is_array($contact_temp) && count($contact_temp) > 0)) {
$contact_arrray = array_merge($contact_arrray, $contact_temp);
$contact_array = array_merge($contact_array, $contact_temp);
}
}
// Check for segment
@@ -633,8 +634,8 @@ class doc_generic_task_odt extends ModelePDFTask
$foundtagforlines = 0;
dol_syslog($e->getMessage(), LOG_INFO);
}
if ($foundtagforlines && (is_array($contact_arrray) && count($contact_arrray) > 0)) {
foreach ($contact_arrray as $contact) {
if ($foundtagforlines && (is_array($contact_array) && count($contact_array) > 0)) {
foreach ($contact_array as $contact) {
if ($contact['source'] == 'internal') {
$objectdetail = new User($this->db);
$objectdetail->fetch($contact['id']);
@@ -646,6 +647,9 @@ class doc_generic_task_odt extends ModelePDFTask
$soc = new Societe($this->db);
$soc->fetch($contact['socid']);
$contact['socname'] = $soc->name;
} else {
dol_syslog(get_class().'::'.__METHOD__.' Unexpected contact source:'.$contact['source'], LOG_ERR);
continue;
}
$contact['fullname'] = is_object($objectdetail) ? $objectdetail->getFullName($outputlangs, 1) : null;
@@ -793,11 +797,11 @@ class doc_generic_task_odt extends ModelePDFTask
// Replace tags of lines for contacts
$sourcearray = array('internal', 'external');
$contact_arrray = array();
$contact_array = array();
foreach ($sourcearray as $source) {
$contact_temp = $project->liste_contact(-1, $source);
if ((is_array($contact_temp) && count($contact_temp) > 0)) {
$contact_arrray = array_merge($contact_arrray, $contact_temp);
$contact_array = array_merge($contact_array, $contact_temp);
}
}
// Check for segment
@@ -809,9 +813,9 @@ class doc_generic_task_odt extends ModelePDFTask
$foundtagforlines = 0;
dol_syslog($e->getMessage(), LOG_INFO);
}
if ($foundtagforlines && (is_array($contact_arrray) && count($contact_arrray) > 0)) {
if ($foundtagforlines && (is_array($contact_array) && count($contact_array) > 0)) {
try {
foreach ($contact_arrray as $contact) {
foreach ($contact_array as $contact) {
if ($contact['source'] == 'internal') {
$objectdetail = new User($this->db);
$objectdetail->fetch($contact['id']);
@@ -823,6 +827,9 @@ class doc_generic_task_odt extends ModelePDFTask
$soc = new Societe($this->db);
$soc->fetch($contact['socid']);
$contact['socname'] = $soc->name;
} else {
dol_syslog(get_class().'::'.__METHOD__.' Unexpected contact source:'.$contact['source'], LOG_ERR);
continue;
}
$contact['fullname'] = $objectdetail->getFullName($outputlangs, 1);

View File

@@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2004-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@@ -49,10 +50,19 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
*/
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
/**
* @var string Prefix customer accountancy code
*/
public $prefixcustomeraccountancycode;
/**
* @var string Prefix supplier accountancy code
*/
public $prefixsupplieraccountancycode;
/**
* @var int
*/
public $position = 20;

View File

@@ -1,9 +1,10 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2019-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
@@ -45,24 +46,31 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
/**
* Prefix customer accountancy code
* @var string
* @var string Prefix customer accountancy code
*/
public $prefixcustomeraccountancycode;
/**
* Prefix supplier accountancy code
* @var string
* @var string Prefix supplier accountancy code
*/
public $prefixsupplieraccountancycode;
/**
* @var int
*/
public $position = 30;
/**
* @var string
*/
public $code;
/**
* @var string
*/
public $customeraccountancycodecharacternumber;
/**
* @var string
*/
public $supplieraccountancycodecharacternumber;
@@ -178,7 +186,9 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
$s .= "<br>\n";
if (!isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL)) {
$thirdpartylabelexample = preg_replace('/([^a-z0-9])/i', '', $mysoc->name);
$thirdpartylabelexample = (string) preg_replace('/([^a-z0-9])/i', '', $mysoc->name);
} else {
$thirdpartylabelexample = '';
}
$s .= "<br>\n";
$s .= $this->prefixcustomeraccountancycode.strtoupper(substr($thirdpartylabelexample, 0, (int) $this->customeraccountancycodecharacternumber));
@@ -191,8 +201,8 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
/**
* Set accountancy account code for a third party into this->code
*
* @param DoliDB $db Database handler
* @param Societe $societe Third party object
* @param DoliDB $db Database handler
* @param Societe $societe Third party object
* @param string $type 'customer' or 'supplier'
* @return int >=0 if OK, <0 if KO
*/
@@ -209,11 +219,11 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
dol_syslog("mod_codecompta_digitaria::get_code search code for type=".$type." & company=".(!empty($societe->name) ? $societe->name : ''));
if ($type == 'supplier') {
$codetouse = $societe->name;
$codetouse = (string) $societe->name;
$prefix = $this->prefixsupplieraccountancycode;
$width = $this->supplieraccountancycodecharacternumber;
} elseif ($type == 'customer') {
$codetouse = $societe->name;
$codetouse = (string) $societe->name;
$prefix = $this->prefixcustomeraccountancycode;
$width = $this->customeraccountancycodecharacternumber;
} else {
@@ -228,11 +238,11 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
}
// Remove special char if COMPANY_DIGITARIA_REMOVE_SPECIAL is set to 1 or not set (default)
if (!isset($conf->global->COMPANY_DIGITARIA_REMOVE_SPECIAL) || getDolGlobalString('COMPANY_DIGITARIA_REMOVE_SPECIAL')) {
$codetouse = preg_replace('/([^a-z0-9])/i', '', $codetouse);
$codetouse = (string) preg_replace('/([^a-z0-9])/i', '', $codetouse);
}
// Apply a regex replacement pattern on code if COMPANY_DIGITARIA_CLEAN_REGEX is set. Value must be a regex with parenthesis. The part into parenthesis is kept, the rest removed.
if (getDolGlobalString('COMPANY_DIGITARIA_CLEAN_REGEX')) { // Example: $conf->global->COMPANY_DIGITARIA_CLEAN_REGEX='^..(..)..';
$codetouse = preg_replace('/' . getDolGlobalString('COMPANY_DIGITARIA_CLEAN_REGEX').'/', '\1\2\3', $codetouse);
$codetouse = (string) preg_replace('/' . getDolGlobalString('COMPANY_DIGITARIA_CLEAN_REGEX').'/', '\1\2\3', $codetouse);
}
$this->code = $prefix.strtoupper(substr($codetouse, 0, (int) $width));
@@ -248,11 +258,9 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
if ($i <= 9) {
$a = 1;
}
if ($i >= 10 && $i <= 99) {
} elseif ($i >= 10 && $i <= 99) {
$a = 2;
}
if ($i >= 100 && $i <= 999) {
} else { // ($i >= 100 && $i <= 999) {
$a = 3;
}

View File

@@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@stocks.sourceforge.net>
* Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2022 Nicolas Silobre <nsilobre@ns-info90.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>
* Copyright (C) 2024 Nick Fragoulis
*
@@ -41,16 +42,46 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
*/
class pdf_standard_stock extends ModelePDFStock
{
/**
* @var int
*/
public $wref;
/**
* @var float
*/
public $posxdesc;
/**
* @var float
*/
public $posxlabel;
/**
* @var float
*/
public $posxtva;
/**
* @var float
*/
public $posxqty;
/**
* @var float
*/
public $posxup;
/**
* @var float
*/
public $posxunit;
/**
* @var float
*/
public $posxdiscount;
/**
* @var float
*/
public $postotalht;
/**
* @var float
*/
public $tabTitleHeight;
@@ -390,6 +421,7 @@ class pdf_standard_stock extends ModelePDFStock
$pdf->MultiCell($this->posxdiscount - $this->posxunit - 0.8, 3, price(price2num($objp->ppmp * $objp->value, 'MT'), 0, $outputlangs), 0, 'R');
$totalvalue += price2num($objp->ppmp * $objp->value, 'MT');
$pricemin = 0;
// Price sell min
if (!getDolGlobalString('PRODUIT_MULTIPRICES')) {
$pricemin = $objp->price;
@@ -806,6 +838,7 @@ class pdf_standard_stock extends ModelePDFStock
$sql = "SELECT max(m.datem) as datem";
$sql .= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m";
$sql .= " WHERE m.fk_entrepot = ".((int) $object->id);
$lastmovementdate = 0;
$resqlbis = $this->db->query($sql);
if ($resqlbis) {
$obj = $this->db->fetch_object($resqlbis);

View File

@@ -1,11 +1,12 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Nick Fragoulis
*
* This program is free software; you can redistribute it and/or modify
@@ -1167,6 +1168,8 @@ class pdf_eagle extends ModelePDFStockTransfer
if (!empty($thirdparty)) {
$carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
} else {
$carac_emetteur_name = '';
}
if ($usecontact) {

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
@@ -9,7 +10,7 @@
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Nick Fragoulis
*
* This program is free software; you can redistribute it and/or modify
@@ -208,6 +209,7 @@ class pdf_eagle_proforma extends ModelePDFStockTransfer
}
$arephoto = false;
$realpath = null;
foreach ($pdir as $midir) {
if (!$arephoto) {
$dir = $conf->product->dir_output.'/'.$midir;
@@ -640,6 +642,8 @@ class pdf_eagle_proforma extends ModelePDFStockTransfer
$pmp = $object->lines[$i]->pmp;
$this->printStdColumnContent($pdf, $curY, 'subprice', price($pmp));
$nexY = max($pdf->GetY(), $nexY);
} else {
$pmp = 0;
}
// Quantity
@@ -1158,7 +1162,7 @@ class pdf_eagle_proforma extends ModelePDFStockTransfer
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
}
}
@@ -1376,6 +1380,8 @@ class pdf_eagle_proforma extends ModelePDFStockTransfer
if (!empty($thirdparty)) {
$carac_emetteur_name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
} else {
$carac_emetteur_name = '';
}
if ($usecontact) {

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
@@ -6,7 +7,7 @@
* Copyright (C) 2018-2019 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019 Tim Otte <otte@meuser.it>
* 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
@@ -244,6 +245,7 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices
if ($object->specimen) {
$dir = $conf->fournisseur->facture->dir_output;
$file = $dir."/SPECIMEN.pdf";
$objectref = 'SPECIMEN_REF';
} else {
$objectref = dol_sanitizeFileName($object->ref);
$objectrefsupplier = dol_sanitizeFileName($object->ref_supplier);

View File

@@ -1,9 +1,10 @@
<?php
/* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Nick Fragoulis
*
* This program is free software; you can redistribute it and/or modify
@@ -872,7 +873,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
}
}

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
@@ -6,7 +7,7 @@
* Copyright (C) 2018-2019 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019 Tim Otte <otte@meuser.it>
* 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
@@ -241,6 +242,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
if ($object->specimen) {
$dir = $conf->fournisseur->commande->dir_output;
$file = $dir."/SPECIMEN.pdf";
$objectref = "SPECIMEN_REF";
} else {
$objectref = dol_sanitizeFileName($object->ref);
$objectrefsupplier = dol_sanitizeFileName($object->ref_supplier);

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
@@ -7,7 +8,7 @@
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.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 Nick Fragoulis
*
* This program is free software; you can redistribute it and/or modify
@@ -313,7 +314,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
// Does we have at least one line with discount $this->atleastonediscount
foreach ($object->lines as $line) {
if ($line->remise_percent) {
$this->atleastonediscount = true;
$this->atleastonediscount = 1;
break;
}
}
@@ -1176,7 +1177,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
}
}

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
@@ -6,7 +7,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Nick Fragoulis
*
* This program is free software; you can redistribute it and/or modify
@@ -1030,7 +1031,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
$pdf->RoundedRect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, 5, $this->corner_radius, '1001', 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
}
}

View File

@@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -150,6 +151,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders
$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql .= " AND entity = ".$conf->entity;
$max = 0;
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
@@ -6,7 +7,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2011-2016 Philippe Grand <philippe.grand@atoo-net.com>
* 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>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@@ -40,21 +41,67 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
*/
abstract class ModelePDFSuppliersOrders extends CommonDocGenerator
{
/**
* @var float
*/
public $posxpicture;
/**
* @var float
*/
public $posxtva;
/**
* @var float
*/
public $posxup;
/**
* @var float
*/
public $posxqty;
/**
* @var float
*/
public $posxunit;
/**
* @var float
*/
public $posxdesc;
/**
* @var float
*/
public $posxdiscount;
/**
* @var float
*/
public $postotalht;
/**
* @var array<string,float>
*/
public $tva;
/**
* @var array<string,array{amount:float}>
*/
public $tva_array;
/**
* Local tax rates Array[tax_type][tax_rate]
*
* @var array<int,array<string,float>>
*/
public $localtax1;
/**
* Local tax rates Array[tax_type][tax_rate]
*
* @var array<int,array<string,float>>
*/
public $localtax2;
/**
* @var int<0,1>
*/
public $atleastoneratenotnull = 0;
/**
* @var int<0,1>
*/
public $atleastonediscount = 0;
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

View File

@@ -1,10 +1,11 @@
<?php
/* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2022 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>
* Copyright (C) 2024 Nick Fragoulis
*
* This program is free software; you can redistribute it and/or modify
@@ -73,12 +74,33 @@ class pdf_standard_supplierpayment extends ModelePDFSuppliersPayments
*/
public $version = 'dolibarr';
/**
* @var float
*/
public $posxdate;
/**
* @var float
*/
public $posxreffacturefourn;
/**
* @var float
*/
public $posxreffacture;
/**
* @var float
*/
public $posxtype;
/**
* @var float
*/
public $posxtotalht;
/**
* @var float
*/
public $posxtva;
/**
* @var float
*/
public $posxtotalttc;

View File

@@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -293,6 +294,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket
$result = $object->fetch_contact($arrayidcontact[0]);
}
$contactobject = null;
// Recipient name
if (!empty($usecontact)) {
// We can use the company of contact instead of thirdparty company

View File

@@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -327,6 +328,7 @@ class doc_generic_user_odt extends ModelePDFUser
$result = $object->fetch_contact($arrayidcontact[0]);
}
$contactobject = null;
// Recipient name
if (!empty($usecontact)) {
if ($object->contact->socid != $object->thirdparty->id && (!isset($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT) || getDolGlobalString('MAIN_USE_COMPANY_NAME_OF_CONTACT'))) {

View File

@@ -1,6 +1,8 @@
<?php
/* Copyright (C) 2005-2017 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 file is a modified version of datepicker.php from phpBSM to fix some
* bugs, to add new features and to dramatically increase speed.
@@ -128,7 +130,7 @@ $hookmanager->initHooks(array('searchform'));
// Define $searchform
$searchform = '';
if ($conf->use_javascript_ajax && 1 == 2) { // select2 is not best with smartphone
if ($conf->use_javascript_ajax && 1 == 2) { // select2 is not best with smartphone @phan-suppress-current-line PhanPluginBothLiteralsBinaryOp
if (!is_object($form)) {
$form = new Form($db);
}
@@ -142,7 +144,7 @@ if ($conf->use_javascript_ajax && 1 == 2) { // select2 is not best with smartp
$i = 0;
$accesskeyalreadyassigned = array();
foreach ($arrayresult as $key => $val) {
foreach ($arrayresult as $key => $val) { // @phan-suppress-current-line PhanEmptyForeach
$tmp = explode('?', $val['url']);
$urlaction = $tmp[0];
$keysearch = 'search_all';
@@ -162,7 +164,7 @@ if ($conf->use_javascript_ajax && 1 == 2) { // select2 is not best with smartp
// Execute hook printSearchForm
$parameters = array('searchform'=>$searchform);
$parameters = array('searchform' => $searchform);
$reshook = $hookmanager->executeHooks('printSearchForm', $parameters); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
$searchform .= $hookmanager->resPrint;

View File

@@ -2,6 +2,7 @@
/* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2016 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
@@ -41,6 +42,10 @@ if (empty($object) || !is_object($object)) {
print "Error, template page ".basename(__FILE__)." can't be called with no object defined.";
exit;
}
'
@phan-var-force ?string $fk_element
@phan-var-force ?Task[] $tasksarray
';
?>

View File

@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2017 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
@@ -39,6 +40,10 @@ if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit(1);
}
'
@phan-var-force ?string $keyforbreak
';
if (!is_object($form)) {
$form = new Form($db);
}
@@ -50,7 +55,7 @@ if (!is_object($form)) {
$object->fields = dol_sort_array($object->fields, 'position');
foreach ($object->fields as $key => $val) {
if (!empty($keyforbreak) && $key == $keyforbreak) {
if (isset($keyforbreak) && !empty($keyforbreak) && $key == $keyforbreak) {
break; // key used for break on second column
}
@@ -139,7 +144,7 @@ $rightpart = '';
$alreadyoutput = 1;
foreach ($object->fields as $key => $val) {
if ($alreadyoutput) {
if (!empty($keyforbreak) && $key == $keyforbreak) {
if (isset($keyforbreak) && !empty($keyforbreak) && $key == $keyforbreak) {
$alreadyoutput = 0; // key used for break on second column
} else {
continue;
@@ -166,7 +171,7 @@ foreach ($object->fields as $key => $val) {
if ($val['type'] == 'text' || $val['type'] == 'html') {
$rightpart .= ' tdtop';
}
$rightpart.= '">';
$rightpart .= '">';
$labeltoshow = '';
if (!empty($val['help'])) {
$labeltoshow .= $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help']));
@@ -206,7 +211,7 @@ foreach ($object->fields as $key => $val) {
$out = $object->showOutputField($val, $key, $value, '', '', '', 0);
$rightpart .= showValueWithClipboardCPButton($out, 0, $out);
} else {
$rightpart.= $object->showOutputField($val, $key, $value, '', '', '', 0);
$rightpart .= $object->showOutputField($val, $key, $value, '', '', '', 0);
}
}
if (preg_match('/^(text|html)/', $val['type'])) {

View File

@@ -3,7 +3,7 @@
* Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015-2016 Charlie BENKE <charlie@patas-monkey.com>
* Copyright (C) 2021-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -32,6 +32,12 @@
* @var User $user
* @var ?string $permission
*/
'
@phan-var-force ?CommonObject $object
@phan-var-force ?CommonObject $objectsrc
@phan-var-force ?string $permission
';
// Protection to avoid direct call of template
if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
@@ -39,11 +45,6 @@ if (empty($object) || !is_object($object)) {
}
'
@phan-var-force ?CommonObject $object
@phan-var-force ?CommonObject $objectsrc
@phan-var-force ?string $permission
';
if (empty($preselectedtypeofcontact)) {
$preselectedtypeofcontact = 0;
}
@@ -128,7 +129,7 @@ if ($permission) {
<div class="tagtd"><span class="paddingleft"><?php echo getDolGlobalString('MAIN_INFO_SOCIETE_NOM'); ?></span></div>
<!-- <div class="nowrap tagtd"><?php echo img_object('', 'user').' '.$langs->trans("Users"); ?></div> -->
<div class="tagtd maxwidthonsmartphone">
<?php echo img_object('', 'user', 'class="pictofixedwidth"').$form->select_dolusers($user->id, 'userid', 1, (!empty($userAlreadySelected) ? $userAlreadySelected : null), 0, '', '', 0, 56, 0, '', 0, '', 'minwidth100imp widthcentpercentminusxx maxwidth400 userselectcontact');
<?php echo img_object('', 'user', 'class="pictofixedwidth"').$form->select_dolusers($user->id, 'userid', 1, (!empty($userAlreadySelected) ? $userAlreadySelected : null), 0, '', '', '0', 56, 0, '', 0, '', 'minwidth100imp widthcentpercentminusxx maxwidth400 userselectcontact');
if (empty($hideaddcontactforgroups) && $module == 'project') {
print '<span> '.$langs->trans("or").' </span>';
echo img_object('', 'group', 'class="pictofixedwidth"').$form->select_dolgroups(0, 'groupid', 1, '', 0, '', array(), '0', false, 'minwidth100imp widthcentpercentminusxx maxwidth400 groupselectcontact');
@@ -384,6 +385,7 @@ print "<!-- TEMPLATE CONTACTS HOOK BEGIN HERE -->\n";
if (is_object($hookmanager)) {
$hookmanager->initHooks(array('contacttpl'));
$parameters = array();
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$reshook = $hookmanager->executeHooks('formContactTpl', $parameters, $object, $action);
}
print "<!-- END PHP TEMPLATE CONTACTS -->\n";

View File

@@ -1,9 +1,11 @@
<?php
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@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
@@ -40,6 +42,14 @@ if (empty($langs) || !is_object($langs)) {
print "Error, template page can't be called as URL";
exit(1);
}
'
@phan-var-force array<array{name:string,path:string,level1name:string,relativename:string,fullname:string,date:string,size:int,perm:int,type:string,position_name:string,cover:string,keywords:string,acl:string,rowid:int,label:string,share:string}> $filearray
@phan-var-force ?int<0,1> $permtoedit
@phan-var-force ?int<0,1> $permission
@phan-var-force int<0,1> $permissiontoadd
@phan-var-force ?string $savingdocmask
@phan-var-force ?string $param
';
$langs->load("link");
@@ -67,7 +77,7 @@ if (in_array($modulepart, array('product', 'produit', 'societe', 'user', 'ticket
$disablemove = 0;
}
$parameters = array();
$reshook = $hookmanager->executeHooks('isLinkedDocumentObjectNotMovable', $parameters, $object);
$reshook = $hookmanager->executeHooks('isLinkedDocumentObjectNotMovable', $parameters, $object); // @phan-suppress-current-line PhanTypeMismatchArgumentNullable
if ($reshook) {
$disablemove = $hookmanager->resArray['disablemove'];
}
@@ -191,7 +201,7 @@ $formfile->listOfLinks(
$object,
$permission,
$action,
GETPOSTINT('linkid'),
(string) GETPOSTINT('linkid'),
$param,
'formaddlink',
array('afterlinktitle' => $formToAddALink, 'showhideaddbutton' => 1)

View File

@@ -2,6 +2,7 @@
/* Copyright (C) 2014 Maxime Kohlhaas <support@atm-consulting.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* 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
@@ -24,15 +25,15 @@
* $parameters
*/
/**
* @var CommonObject $object
* @var Conf $conf
* @var ExtraFields $extrafields
* @var HookManager $hookmanager
* @var Translate $langs
* @var string $action
* @var array<string,mixed> $parameters
*/
/**
* @var CommonObject $object
* @var Conf $conf
* @var ExtraFields $extrafields
* @var HookManager $hookmanager
* @var Translate $langs
* @var string $action
* @var array<string,mixed> $parameters
*/
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
@@ -62,6 +63,7 @@ if (!isset($parameters)) {
@phan-var-force Conf $conf
@phan-var-force Translate $conf
@phan-var-force array<string,mixed> $parameters
@phan-var-force ?string $tpl_context
';
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook

View File

@@ -1,10 +1,16 @@
<?php
/* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*/
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
exit(1);
}
'
@phan-var-force ?int<0,1> $disablesortlink
';
if (empty($extrafieldsobjectkey) && is_object($object)) {
$extrafieldsobjectkey = $object->table_element;

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@@ -35,6 +35,14 @@ if (empty($conf) || !is_object($conf)) {
exit;
}
'
@phan-var-force Website $website
@phan-var-force string $filepathnoext
@phan-var-force string $pageid
@phan-var-force EcmDirectory $ecmdir
@phan-var-force int $section
';
?>
<!-- BEGIN PHP TEMPLATE core/tpl/filemanager.tpl.php -->
@@ -50,8 +58,6 @@ if (empty($module)) {
$module = 'ecm';
}
'@phan-var-force Website $website';
$permtoadd = 0;
$permtoupload = 0;
$showroot = 0;
@@ -106,6 +112,7 @@ if ($module == 'ecm') {
print '</a>';
}
if ($permtoadd && GETPOSTISSET('website')) { // If on file manager to manage medias of a web site
// @phan-suppress-next-line PhanTypeExpectedObjectPropAccess
print '<a id="agenerateimgwebp" href="'.$_SERVER["PHP_SELF"].'?action=confirmconvertimgwebp&token='.newToken().'&website='.urlencode($website->ref).'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans("GenerateImgWebp")).'">';
print img_picto('', 'images', '', 0, 0, 0, '', 'size15x flip marginrightonly');
print '</a>';
@@ -218,7 +225,7 @@ if ($action == 'confirmconvertimgwebp') {
$formquestion['section'] = array('type' => 'hidden', 'value' => $section, 'name' => 'section');
$formquestion['filetoregenerate'] = array('type' => 'hidden', 'value' => $file, 'name' => 'filetoregenerate');
if ($module == 'medias') {
$formquestion['website'] = array('type' => 'hidden', 'value' => $website->ref, 'name' => 'website');
$formquestion['website'] = array('type' => 'hidden', 'value' => $website->ref, 'name' => 'website'); // @phan-suppress-current-line PhanTypeExpectedObjectPropAccess
}
$param = '';
if (!empty($sortfield)) {

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2024 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
@@ -54,6 +54,9 @@ if (empty($htmlname)) {
@phan-var-force ?FormMail $formmail
@phan-var-force string $showlinktolayout
@phan-var-force string $showlinktolayoutlabel
@phan-var-force string $showlinktoai
@phan-var-force string $showlinktoailabel
@phan-var-force ?string $out
';
if (!isset($out)) {

View File

@@ -1,5 +1,7 @@
<?php
/* 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
@@ -21,7 +23,10 @@
* @var Form $form
* @var Translate $langs
*/
'@phan-var-force array{nbfield:int,type?:array<int,string>,pos?:array<int,int>,val?:array<int,float>} $totalarray';
'
@phan-var-force array{nbfield:int,type?:array<int,string>,pos?:array<int,int>,val?:array<int,float>} $totalarray
@phan-var-force ?string $sqlfields
';
if (!function_exists('printTotalValCell')) { // allow two list with total on same screen

View File

@@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 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>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@@ -55,8 +56,12 @@
* @var int[] $arrayofselected
*/
'
@phan-var-force string $string
@phan-var-force CommonObject $objecttmp
@phan-var-force int[] $toselect
@phan-var-force ?string $uploaddir
@phan-var-force int<0,1> $withmaindocfilemail
@phan-var-force string $sendto
';
if (!empty($sall) || !empty($search_all)) {
@@ -81,7 +86,7 @@ if ($massaction == 'preclonetasks') {
$formquestion = array(
// TODO If list of project is long and project is not on a thirdparty, the combo may be very long.
// Solution: Allow only sameproject for cloning tasks ?
array('type' => 'other', 'name' => 'projectid', 'label' => $langs->trans('Project') .': ', 'value' => $form->selectProjects($object->id, 'projectid', '', 0, 1, '', 0, array(), $object->socid, '1', 1, '', null, 1)),
array('type' => 'other', 'name' => 'projectid', 'label' => $langs->trans('Project') .': ', 'value' => $form->selectProjects($object->id, 'projectid', '', 0, 1, '', 0, array(), $object->socid, '1', 1, '', array(), 1)),
);
print $form->formconfirm($_SERVER['PHP_SELF'] . '?id=' . $object->id . $selected, $langs->trans('ConfirmMassClone'), '', 'clonetasks', $formquestion, '', 1, 300, 590);
}
@@ -113,7 +118,7 @@ if ($massaction == 'preaffecttag' && isModEnabled('category')) {
'type' => 'other',
'name' => 'affecttag_'.$categ_type['code'],
'label' => '',
'value' => $form->multiselectarray('contcats_'.$categ_type['code'], $categ_arbo_tmp, GETPOST('contcats_'.$categ_type['code'], 'array'), null, null, '', 0, '60%', '', '', $langs->transnoentitiesnoconv("SelectTheTagsToAssign"))
'value' => $form->multiselectarray('contcats_'.$categ_type['code'], $categ_arbo_tmp, GETPOST('contcats_'.$categ_type['code'], 'array'), 0, 0, '', 0, '60%', '', '', $langs->transnoentitiesnoconv("SelectTheTagsToAssign"))
);
}
$formquestion[] = array(
@@ -418,7 +423,7 @@ if ($massaction == 'presetcommercial') {
$formquestion[] = array('type' => 'other',
'name' => 'affectedcommercial',
'label' => $form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0),
'value' => $form->multiselectarray('commercial', $userlist, null, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1));
'value' => $form->multiselectarray('commercial', $userlist, array(), 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1));
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmAllocateCommercial"), $langs->trans("ConfirmAllocateCommercialQuestion", count($toselect)), "affectcommercial", $formquestion, 1, 0, 200, 500, 1);
}
if ($massaction == 'unsetcommercial') {
@@ -427,7 +432,7 @@ if ($massaction == 'unsetcommercial') {
$formquestion[] = array('type' => 'other',
'name' => 'unassigncommercial',
'label' => $form->editfieldkey('UnallocateCommercial', 'commercial_id', '', $object, 0),
'value' => $form->multiselectarray('commercial', $userlist, null, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1));
'value' => $form->multiselectarray('commercial', $userlist, array(), 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1));
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmUnallocateCommercial"), $langs->trans("ConfirmUnallocateCommercialQuestion", count($toselect)), "unassigncommercial", $formquestion, 1, 0, 200, 500, 1);
}
@@ -437,7 +442,7 @@ if ($massaction == 'preapproveleave') {
// Allow Pre-Mass-Action hook (eg for confirmation dialog)
if (empty($toselect)) {
$toselect=[];
$toselect = [];
}
$parameters = array(
'toselect' => &$toselect,
@@ -445,6 +450,7 @@ $parameters = array(
'massaction' => $massaction
);
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$reshook = $hookmanager->executeHooks('doPreMassActions', $parameters, $object, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');

View File

@@ -3,6 +3,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2020 Laurent Destailleur <eldy@destailleur.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,6 +32,11 @@ if (empty($object) || !is_object($object)) {
print "Error, template page can't be called as URL";
exit(1);
}
'
@phan-var-force ?int<0,1> $permissionnote
@phan-var-force string $moreparam
@phan-var-force ?int $colwidth
';
// $permissionnote must be defined by caller. For example $permissionnote=$user->rights->module->create
// $cssclass must be defined by caller. For example $cssclass='fieldtitle'
@@ -126,7 +132,7 @@ print '<div class="tagtable border table-border tableforfield centpercent">'."\n
print '<div class="tagtr table-border-row">'."\n";
$editmode = (GETPOST('action', 'aZ09') == 'edit'.$note_public);
print '<div class="tagtd tagtdnote tdtop'.($editmode ? '' : ' sensiblehtmlcontent').' table-key-border-col'.(empty($cssclass) ? '' : ' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
print $form->editfieldkey((empty($textNotePub) ? "NotePublic" : $textNotePub), $note_public, $value_public, $object, $permission, $typeofdatapub, $moreparam, '', 0);
print $form->editfieldkey((empty($textNotePub) ? "NotePublic" : $textNotePub), $note_public, $value_public, $object, $permission, $typeofdatapub, $moreparam, 0, 0);
print '</div>'."\n";
print '<div class="tagtd wordbreak table-val-border-col'.($editmode ? '' : ' sensiblehtmlcontent').'">'."\n";
print $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdatapub, '', null, null, $moreparam, 1)."\n";
@@ -137,7 +143,7 @@ if (empty($user->socid)) {
print '<div class="tagtr table-border-row">'."\n";
$editmode = (GETPOST('action', 'aZ09') == 'edit'.$note_private);
print '<div class="tagtd tagtdnote tdtop'.($editmode ? '' : ' sensiblehtmlcontent').' table-key-border-col'.(empty($cssclass) ? '' : ' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
print $form->editfieldkey((empty($textNotePrive) ? "NotePrivate" : $textNotePrive), $note_private, $value_private, $object, $permission, $typeofdatapriv, $moreparam, '', 0);
print $form->editfieldkey((empty($textNotePrive) ? "NotePrivate" : $textNotePrive), $note_private, $value_private, $object, $permission, $typeofdatapriv, $moreparam, 0, 0);
print '</div>'."\n";
print '<div class="tagtd wordbreak table-val-border-col'.($editmode ? '' : ' sensiblehtmlcontent').'">'."\n";
print $form->editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdatapriv, '', null, null, $moreparam, 1);

View File

@@ -1,6 +1,8 @@
<?php
/* Copyright (C) 2018 ATM Consulting <support@atm-consulting.fr>
* Copyright (C) 2021-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
@@ -17,7 +19,7 @@
*
* Needs the following variables defined:
* $object Proposal, order, invoice (including supplier versions)
* $thirdparty Thirdparty of object
* $thirdparty Third party of object
* $absolute_discount Amount of fixed discounts available
* $absolute_creditnote Amount of credit notes available
* $discount_type 0 => Customer discounts, 1 => Supplier discounts
@@ -30,6 +32,16 @@
*/
print '<!-- BEGIN object_discounts.tpl.php -->'."\n";
'
@phan-var-force Propal|Commande|CommandeFournisseur|Facture|FactureFournisseur $object
@phan-var-force Societe $thirdparty
@phan-var-force string $backtopage
@phan-var-force string $filtercreditnote
@phan-var-force string $filterabsolutediscount
@phan-var-force int<0,1> $discount_type
@phan-var-force int $resteapayer
';
$objclassname = get_class($object);
$isInvoice = in_array($object->element, array('facture', 'invoice', 'facture_fourn', 'invoice_supplier'));
$isNewObject = empty($object->id) && empty($object->rowid);
@@ -91,6 +103,7 @@ if ($absolute_discount > 0) {
} else {
// Discount available of type fixed amount (not credit note)
$more = $addabsolutediscount;
// TODO: Check $resteapayer - is '$maxvalue' in form_remise_dispo()
$form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, GETPOST('discountid'), 'remise_id', $thirdparty->id, $absolute_discount, $filterabsolutediscount, $resteapayer, $more, 0, $discount_type);
}
}

View File

@@ -12,6 +12,7 @@
* Copyright (C) 2022 OpenDSI <support@open-dsi.fr>
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -50,8 +51,13 @@ if (empty($object) || !is_object($object)) {
exit;
}
'@phan-var-force CommonObject $this
@phan-var-force CommonObject $object';
'
@phan-var-force CommonObject $this
@phan-var-force CommonObject $object
@phan-var-force Societe $buyer
@phan-var-force Societe $seller
@phan-var-force int<0,1> $usehm
';
$usemargins = 0;
if (isModEnabled('margin') && !empty($object->element) && in_array($object->element, array('facture', 'facturerec', 'propal', 'commande'))) {
@@ -457,6 +463,7 @@ if ($nolinesbefore) {
}
print '<td class="nobottom linecolvat right">';
$coldisplay++;
$type_tva = 0;
if ($object->element == 'propal' || $object->element == 'commande' || $object->element == 'facture' || $object->element == 'facturerec') {
$type_tva = 1;
} elseif ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier' || $object->element == 'invoice_supplier_rec') {
@@ -487,7 +494,7 @@ if ($nolinesbefore) {
<td class="nobottom linecoluttc right">
<input type="text" name="price_ttc" id="price_ttc" class="flat right width50" value="<?php echo(GETPOSTISSET("price_ttc") ? GETPOST("price_ttc", 'alpha', 2) : ''); ?>">
</td>
<?php
<?php
}
$coldisplay++;
?>
@@ -526,21 +533,21 @@ if ($nolinesbefore) {
$coldisplay++; ?>
<td class="nobottom margininfos linecolmargin right">
<!-- For predef product -->
<?php if (isModEnabled("product") || isModEnabled("service")) { ?>
<?php if (isModEnabled("product") || isModEnabled("service")) { ?>
<select id="fournprice_predef" name="fournprice_predef" class="flat minwidth75imp maxwidth150" style="display: none;"></select>
<?php } ?>
<?php } ?>
<!-- For free product -->
<input type="text" id="buying_price" name="buying_price" class="flat maxwidth75 right" value="<?php echo(GETPOSTISSET("buying_price") ? GETPOST("buying_price", 'alpha', 2) : ''); ?>">
</td>
<?php
if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
echo '<td class="nobottom nowraponall margininfos right"><input class="flat right width40" type="text" id="np_marginRate" name="np_marginRate" value="'.(GETPOSTISSET("np_marginRate") ? GETPOST("np_marginRate", 'alpha', 2) : '').'"><span class="np_marginRate opacitymedium hideonsmartphone">%</span></td>';
$coldisplay++;
}
if (getDolGlobalString('DISPLAY_MARK_RATES')) {
echo '<td class="nobottom nowraponall margininfos right"><input class="flat right width40" type="text" id="np_markRate" name="np_markRate" value="'.(GETPOSTISSET("np_markRate") ? GETPOST("np_markRate", 'alpha', 2) : '').'"><span class="np_markRate opacitymedium hideonsmartphone">%</span></td>';
$coldisplay++;
}
<?php
if (getDolGlobalString('DISPLAY_MARGIN_RATES')) {
echo '<td class="nobottom nowraponall margininfos right"><input class="flat right width40" type="text" id="np_marginRate" name="np_marginRate" value="'.(GETPOSTISSET("np_marginRate") ? GETPOST("np_marginRate", 'alpha', 2) : '').'"><span class="np_marginRate opacitymedium hideonsmartphone">%</span></td>';
$coldisplay++;
}
if (getDolGlobalString('DISPLAY_MARK_RATES')) {
echo '<td class="nobottom nowraponall margininfos right"><input class="flat right width40" type="text" id="np_markRate" name="np_markRate" value="'.(GETPOSTISSET("np_markRate") ? GETPOST("np_markRate", 'alpha', 2) : '').'"><span class="np_markRate opacitymedium hideonsmartphone">%</span></td>';
$coldisplay++;
}
}
}
$coldisplay += $colspan;
@@ -561,6 +568,8 @@ if ((isModEnabled("service") || ($object->element == 'contrat')) && $dateSelecto
$date_end = dol_mktime(GETPOSTINT('date_starthour'), GETPOSTINT('date_startmin'), 0, GETPOSTINT('date_endmonth'), GETPOSTINT('date_endday'), GETPOSTINT('date_endyear'));
$prefillDates = false;
$date_start_prefill = 0;
$date_end_prefill = 0;
if (getDolGlobalString('MAIN_FILL_SERVICE_DATES_FROM_LAST_SERVICE_LINE') && !empty($object->lines)) {
for ($i = count($object->lines) - 1; $i >= 0; $i--) {
@@ -815,7 +824,7 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) {
}
}
});
<?php
<?php
} ?>
/* When changing predefined product, we reload list of supplier prices required for margin combo */
@@ -932,7 +941,7 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) {
if (getDolGlobalInt('PRODUIT_AUTOFILL_DESC') == 1) {
if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { ?>
var proddesc = data.desc_trans;
<?php
<?php
} else { ?>
var proddesc = data.desc;
<?php
@@ -947,7 +956,7 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) {
editor.setData(proddesc);
}
}
<?php
<?php
} else { ?>
jQuery('#dp_desc').text(proddesc);
<?php
@@ -959,13 +968,13 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) {
jQuery.each(data.array_options, function( key, value ) {
jQuery('div[class*="det'+key.replace('options_','_extras_')+'"] > #'+key).val(value);
});
<?php
<?php
} ?>
},
'json'
);
}
<?php
<?php
}
if (!empty($usemargins) && $user->hasRight('margins', 'creer')) {

View File

@@ -7,7 +7,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2022 OpenDSI <support@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
@@ -75,6 +75,7 @@ if (empty($object) || !is_object($object)) {
@phan-var-force ?Product $product_static
@phan-var-force string $text
@phan-var-force string $description
@phan-var-force Object $objp
';
global $mysoc;
@@ -128,7 +129,7 @@ $coldisplay = 0;
<?php
$parameters = ['line' => $line, 'i' =>& $i, 'coldisplay' =>& $coldisplay];
$parameters = ['line' => $line, 'i' => & $i, 'coldisplay' => & $coldisplay];
$reshook = $hookmanager->executeHooks('objectLineView_BeforeProduct', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
@@ -274,7 +275,7 @@ if (($line->info_bits & 2) == 2) {
}
$parameters = ['line' => $line, 'i' =>& $i, 'coldisplay' =>& $coldisplay];
$parameters = ['line' => $line, 'i' => & $i, 'coldisplay' => & $coldisplay];
$reshook = $hookmanager->executeHooks('objectLineView_BeforeProductExtrafield', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Line extrafield
@@ -288,7 +289,7 @@ if (($line->info_bits & 2) == 2) {
}
}
$parameters = ['line' => $line, 'i' =>& $i, 'coldisplay' =>& $coldisplay];
$parameters = ['line' => $line, 'i' => & $i, 'coldisplay' => & $coldisplay];
$reshook = $hookmanager->executeHooks('objectLineView_ProductSupplier', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
@@ -7,7 +8,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2023-2024 Nick Fragoulis
*
* This program is free software; you can redistribute it and/or modify
@@ -1486,6 +1487,7 @@ class FactureFournisseurRec extends CommonInvoice
'facturerec' => $facturerec, // it's an object which PHP passes by "reference", so modifiable by hooks.
'this' => $this, // it's an object which PHP passes by "reference", so modifiable by hooks.
);
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$reshook = $hookmanager->executeHooks('afterCreationOfRecurringInvoice', $parameters, $new_fac_fourn); // note: $facture can be modified by hooks (warning: $facture can be null)
$i++;

View File

@@ -10,7 +10,7 @@
* Copyright (C) 2021 Greg Rastklan <greg.rastklan@atm-consulting.fr>
* Copyright (C) 2021 Jean-Pascal BOUDET <jean-pascal.boudet@atm-consulting.fr>
* Copyright (C) 2021 Grégory BLEMAND <gregory.blemand@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 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
@@ -72,6 +72,7 @@ $coldisplay = 0;
<?php } ?>
<td class="linecollabel"><?php $coldisplay++; ?><div id="line_<?php print $line->id; ?>"></div>
<?php
$resSkill = 0;
if ($line->fk_skill > 0) {
$skill = new Skill($this->db);
$resSkill = $skill->fetch($line->fk_skill);
@@ -93,9 +94,9 @@ if ($line->fk_skill > 0) {
<?php
// Add description in form
if ($line->fk_skill > 0 && $resSkill > 0) {
//print $skill->description;
}
//if ($line->fk_skill > 0 && $resSkill > 0) {
//print $skill->description;
//}
?>
</td>

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@inodbox.com>
@@ -7,7 +8,7 @@
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019-2021 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Vincent de Grandpré <vincent@de-grandpre.quebec>
* Copyright (C) 2024 Solution Libre SAS <contact@solution-libre.fr>
*
@@ -50,6 +51,9 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formintervention.class.php';
* @var Translate $langs
* @var User $user
*/
'
@phan-var-force ?string $uploaddir
';
// Load translation files required by the page
$langsLoad = array('projects', 'bills', 'orders', 'companies');

View File

@@ -7,7 +7,7 @@
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
* Copyright (C) 2021 Dorian Vabre <dorian.vabre@gmail.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
@@ -52,7 +52,7 @@ if (!defined('NOBROWSERNOTIF')) {
}
if (!defined('XFRAMEOPTIONS_ALLOWALL')) {
define('XFRAMEOPTIONS_ALLOWALL', '1');
define('XFRAMEOPTIONS_ALLOWALL', '1');
}
// For MultiCompany module.
@@ -2153,6 +2153,7 @@ if ($action != 'dopayment') {
'source' => $source,
'object' => $object
];
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$reshook = $hookmanager->executeHooks('doCheckStatus', $parameters, $object, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@@ -2816,6 +2817,7 @@ if (preg_match('/^dopayment/', $action)) { // If we chose/clicked on the payme
'tag' => GETPOST("tag", 'alpha'),
'dopayment' => GETPOST('dopayment', 'alpha')
];
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$reshook = $hookmanager->executeHooks('doPayment', $parameters, $object, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');

View File

@@ -1,10 +1,11 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2023-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Benjamin Falière <benjamin.faliere@altairis.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
@@ -642,6 +643,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_s
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.rowid = ee.fk_target";
// Add table from hooks
$parameters = array();
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " WHERE e.entity IN (".getEntity('reception').")";

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
@@ -9,7 +10,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -696,7 +697,7 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
if (empty($hidetop)) {
//$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230';
if (getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')) {
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', null, explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur - $this->marge_droite - $this->marge_gauche, $this->tabTitleHeight, 'F', array(), explode(',', getDolGlobalString('MAIN_PDF_TITLE_BACKGROUND_COLOR')));
}
}

View File

@@ -1,9 +1,10 @@
<?php
/* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Charlie BENKE <charlie@patas-monkey.com>
* Copyright (C) 2017-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.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
@@ -367,6 +368,7 @@ $sql .= " AND p.fk_salary = s.rowid";
$sql .= " AND s.entity IN (".getEntity('tax').")";
$sql .= " ORDER BY dp DESC";
$resteapayer = 0;
//print $sql;
$resql = $db->query($sql);
if ($resql) {
@@ -560,7 +562,7 @@ if ($resql) {
$tmpuser = new User($db);
$num = $db->num_rows($result);
$num = $db->num_rows($resql);
if ($num > 0) {
while ($i < $num) {
$obj = $db->fetch_object($resql);

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
@@ -7,7 +8,7 @@
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.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
@@ -114,8 +115,8 @@ if (empty($account->userid)) {
// Define value to know what current user can do on users
$selfpermission = ($user->id == $id && $user->hasRight('user', 'self', 'creer'));
$usercanadd = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write') );
$usercanread = (!empty($user->admin) || $user->hasRight('user', 'user', 'lire') || $user->hasRight('hrm', 'read_personal_information', 'read') );
$usercanadd = (!empty($user->admin) || $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write'));
$usercanread = (!empty($user->admin) || $user->hasRight('user', 'user', 'lire') || $user->hasRight('hrm', 'read_personal_information', 'read'));
$permissiontoaddbankaccount = ($user->hasRight('salaries', 'write') || $user->hasRight('hrm', 'employee', 'write') || $user->hasRight('user', 'user', 'creer') || $selfpermission);
$permissiontoreadhr = $user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write');
$permissiontowritehr = $user->hasRight('hrm', 'write_personal_information', 'write');
@@ -1035,6 +1036,10 @@ if ($id && ($action == 'edit' || $action == 'create') && $permissiontoaddbankacc
foreach ($bankaccount->getFieldsToShow(1) as $val) {
$require = false;
$tooltip = '';
$name = 'UNKNOWN';
$size = '8';
$content = 'UNKNOWN';
if ($val == 'BankCode') {
$name = 'code_banque';
$size = 8;