Qual: Fix Phan notices

# Qual: Fix phan notices
This commit is contained in:
MDW 2025-01-18 23:15:39 +01:00
parent c631d66751
commit f250f7caa5
No known key found for this signature in database
30 changed files with 216 additions and 115 deletions

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
/* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* Note: in this context Entity == Company.
*/
@ -31,7 +31,7 @@ class ActionsMulticompany
}
/**
* @param string $entity
* @param int $entity
* @return void
*/
public function getInfo($entity)

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (c) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2004-2015 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
@ -55,7 +55,9 @@ class DolGraph
private $_library; // Graphic library to use (jflot, chart, artichow)
/**
* @var array<array{0:string,1:float,1:float}> Array of data
* @var array<array<string|int|float>> Array of data
* @phpstan-var array<array{0:string|int,1:float,2?:float,3?:float,...}>
* @phan-var array<array{0:string|int,1:float,2?:float,3?:float,4?:float}>
*/
public $data; // Data of graph: array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...)
/**
@ -364,7 +366,7 @@ class DolGraph
/**
* Set data
*
* @param array<array{0:string,1:float,2:float}> $data Data
* @param array<array{0:string|int,1:float,2?:float}> $data Data
* @return void
* @see draw_jflot() for syntax of data array
*/

View File

@ -1,6 +1,7 @@
<?php
/*
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* 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
@ -53,12 +54,12 @@ class FormCron extends Form
/**
* Display On Off selector
*
* @param string $htmlname Html control name
* @param integer $selected selected value
* @param integer $readonly Select is read only or not
* @return string HTML select field
* @param string $htmlname Html control name
* @param string $selected Selected value
* @param int<0,1> $readonly Select is read only or not
* @return string HTML select field
*/
public function select_typejob($htmlname, $selected = 0, $readonly = 0)
public function select_typejob($htmlname, $selected = '', $readonly = 0)
{
// phpcs:enable
global $langs;

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@destailleur.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
@ -19,6 +20,9 @@
* @var Translate $langs
* @var string $servicename
*/
'
@phan-var-force string $servicename
';
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2009-2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2024 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
@ -34,13 +34,25 @@ if (!defined('NOBROWSERNOTIF')) {
* @var string $disabled
* @var string $dol_url_root
* @var string $focus_element
* @var string $mode
* @var string $mode Contains (list of) authentication methods - example "http","dolibarr","openid,dolibarr"
* @var string $message
* @var string $title
* @var string $urllogo
* @var string $user
* @var User $user
* @var string $username
*/
'
@phan-var-force string $captcha
@phan-var-force string $disabled
@phan-var-force string $dol_url_root
@phan-var-force string $focus_element
@phan-var-force string $mode
@phan-var-force string $message
@phan-var-force string $title
@phan-var-force string $urllogo
@phan-var-force User $user
@phan-var-force string $username
';
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
@ -130,10 +142,10 @@ $(document).ready(function () {
<div class="login_center center"<?php
if (!getDolGlobalString('ADD_UNSPLASH_LOGIN_BACKGROUND')) {
$backstyle = 'background: linear-gradient('.($conf->browser->layout == 'phone' ? '0deg' : '4deg').', rgb(240,240,240) 52%, rgb('.$colorbackhmenu1.') 52.1%);';
// old style: $backstyle = 'background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));';
$backstyle = getDolGlobalString('MAIN_LOGIN_BACKGROUND_STYLE', $backstyle);
print !getDolGlobalString('MAIN_LOGIN_BACKGROUND') ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; '.$backstyle.'"' : '';
$backstyle = 'background: linear-gradient('.($conf->browser->layout == 'phone' ? '0deg' : '4deg').', rgb(240,240,240) 52%, rgb('.$colorbackhmenu1.') 52.1%);';
// old style: $backstyle = 'background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));';
$backstyle = getDolGlobalString('MAIN_LOGIN_BACKGROUND_STYLE', $backstyle);
print !getDolGlobalString('MAIN_LOGIN_BACKGROUND') ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; '.$backstyle.'"' : '';
}
?>>
<div class="login_vertical_align">

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2022 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
@ -40,11 +41,27 @@ if (!defined('NOBROWSERNOTIF')) {
* @var string $passworduidhash
* @var string $title
* @var string $urllogo
* @var string $user
* @var User $user
* @var string $username
*
* @var int $setnewpassword
*/
// Only vars provided by including page - htdocs/user/passwordforgotten.php:
// $newpass1 and $newpass2 are not set!!!
'
@phan-var-force string $captcha
@phan-var-force string $disabled
@phan-var-force string $dol_url_root
@phan-var-force string $focus_element
@phan-var-force string $mode
@phan-var-force string $message
@phan-var-force string $title
@phan-var-force string $urllogo
@phan-var-force User $user
@phan-var-force string $username
@phan-var-force string $setnewpassword
@phan-var-force string $passworduidhash
';
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
@ -163,10 +180,10 @@ $(document).ready(function () {
<div class="login_center center"<?php
if (!getDolGlobalString('ADD_UNSPLASH_LOGIN_BACKGROUND')) {
$backstyle = 'background: linear-gradient('.($conf->browser->layout == 'phone' ? '0deg' : '4deg').', rgb(240,240,240) 52%, rgb('.$colorbackhmenu1.') 52.1%);';
// old style: $backstyle = 'background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));';
$backstyle = getDolGlobalString('MAIN_LOGIN_BACKGROUND_STYLE', $backstyle);
print !getDolGlobalString('MAIN_LOGIN_BACKGROUND') ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; '.$backstyle.'"' : '';
$backstyle = 'background: linear-gradient('.($conf->browser->layout == 'phone' ? '0deg' : '4deg').', rgb(240,240,240) 52%, rgb('.$colorbackhmenu1.') 52.1%);';
// old style: $backstyle = 'background-image: linear-gradient(rgb('.$colorbackhmenu1.',0.3), rgb(240,240,240));';
$backstyle = getDolGlobalString('MAIN_LOGIN_BACKGROUND_STYLE', $backstyle);
print !getDolGlobalString('MAIN_LOGIN_BACKGROUND') ? ' style="background-size: cover; background-position: center center; background-attachment: fixed; background-repeat: no-repeat; '.$backstyle.'"' : '';
}
?>>
<div class="login_vertical_align">

View File

@ -1,6 +1,7 @@
<!-- BEGIN TEMPLATE resource_add.tpl.php -->
<?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
@ -25,6 +26,11 @@
* @var int $element_id
* @var string $element_ref
*/
'
@phan-var-force string $element
@phan-var-force int $element_id
@phan-var-force string $element_ref
';
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
print "Error, template page can't be called as URL";
@ -56,7 +62,7 @@ $out .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline
$out .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
$events = array();
$out .= img_picto('', 'resource', 'class="pictofixedwidth"');
$out .= $formresources->select_resource_list(0, 'fk_resource', [], 1, 1, 0, $events, '', 2, 0);
$out .= $formresources->select_resource_list(0, 'fk_resource', '', 1, 1, 0, $events, '', 2, 0);
$out .= '</div>';
$out .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block marginleftonly"><label for="resbusy">'.$langs->trans('Busy').'</label> ';

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2021 Regis Houssin <regis.houssin@inodbox.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>
*
* 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
@ -308,7 +308,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
if ($result > 0) {
if (empty($object->oldcopy) || !is_object($object->oldcopy)) {
dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING);
$object->oldcopy = clone $object;
$object->oldcopy = clone $object; // @phan-suppress-current-line PhanTypeMismatchProperty
}
$oldinfo = $object->oldcopy->_load_ldap_info();
@ -529,7 +529,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
if (!method_exists($object->oldcopy, '_load_ldap_info')) {
dol_syslog("Trigger ".$action." was called by a function that did not set previously the method ->_load_ldap_info onto object", LOG_WARNING);
$object->oldcopy = clone $object;
$object->oldcopy = clone $object; // @phan-suppress-current-line PhanTypeMismatchProperty
}
$oldinfo = $object->oldcopy->_load_ldap_info();

View File

@ -88,7 +88,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
$body_assignee = 'TicketAssignedEmailBody';
$see_ticket_assignee = 'SeeThisTicketIntomanagementInterface';
$old_MAIN_MAIL_AUTO_COPY_TO = null; // For static analysis
$old_MAIN_MAIL_AUTOCOPY_TO = null; // For static analysis
if (getDolGlobalString('TICKET_DISABLE_MAIL_AUTOCOPY_TO')) {
$old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString('MAIN_MAIL_AUTOCOPY_TO');
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
@ -300,15 +300,41 @@ class InterfaceTicketEmail extends DolibarrTriggers
}
$contactid = empty($object->context['contactid']) ? 0 : $object->context['contactid'];
$res = 0;
$contactObj = null;
if ($contactid > 0) {
// TODO This security test has no sens. We must check that $contactid is inside $linked_contacts[]['id'] when $linked_contacts[]['source'] = 'external' or 'thirdparty'
// Refuse email if not
$contactObj = new Contact($this->db);
$res = $contactObj->fetch($contactid);
if (! in_array($contactObj, $linked_contacts)) {
// Security test:
// Check that $contactid is inside $linked_contacts[]['id'] when $linked_contacts[]['source'] = 'external' or 'thirdparty'
$is_linked_contact_id = in_array(
$contactid,
array_column( // Get 'id' value from contacts (that are external or thirdparty)
array_filter( // Filter contacts with 'external' or 'thirdparty' source:
$linked_contacts,
/**
* Return if contact source is external or thirdparty
*
* @param array{source:string,id:int,rowid:int,email:string,civility:string,firstname:string,lastname:string,labeltype:string,libelle:string,socid:int,code:string,status:int,statuscontact:string,fk_c_typecontact:string,phone:string,phone_mobile:string,nom:string} $contact
* @return bool
*/
static function ($contact) {
return in_array($contact['source'], ['external', 'thirdparty']);
}
),
'id'
)
);
if ($is_linked_contact_id) {
// Seems accepted contact, try to fetch it.
$contactObj = new Contact($this->db);
$res = $contactObj->fetch($contactid);
if ($res <= 0) {
// Could not fetch contact, so bad contact anyway (should not happen)
$contactObj = null;
}
}
if ($contactObj === null) {
$error_msg = $langs->trans('Error'). ': ';
$error_msg .= $langs->transnoentities('TicketWrongContact');
setEventMessages($error_msg, [], 'errors');
@ -318,7 +344,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
}
$sendto = '';
if ($contactObj !== null && $res > 0 && !empty($contactObj->email) && !empty($contactObj->statut)) {
if ($contactObj !== null && !empty($contactObj->email) && !empty($contactObj->statut)) {
$sendto = $contactObj->email;
} elseif (!empty($linked_contacts) && ($contactid == -2 || (GETPOST('massaction', 'alpha') == 'close' && GETPOST('confirm', 'alpha') == 'yes'))) {
// if sending to all contacts or sending to contacts while mass closing

View File

@ -4,6 +4,7 @@
* Copyright (C) 2013-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.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
@ -235,7 +236,7 @@ if ($action == 'inactive' && $permissiontoadd) {
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd) {
if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers')) {
if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers')) { // @phan-suppress-current-line PhanPluginBothLiteralsBinaryOp
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
} else {
$objectutil = dol_clone($object, 1); // We clone to avoid to denaturate loaded object when setting some properties for clone or if createFromClone modifies the object. We use the native clone to keep this->db valid.

View File

@ -3,7 +3,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2021 Laurent Destailleur <eldy@users.sourceforge.net>
* 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>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
@ -616,6 +616,9 @@ if ($num > 0) {
$texttoshow .= $langs->trans('CronCommand').': '.dol_trunc($obj->command);
$texttoshow .= '<br>'.$langs->trans('CronArgs').': '.$obj->params;
$texttoshow .= '<br>'.$langs->trans('Comment').': '.$langs->trans($obj->note);
} else {
$texttoshow = '';
$texttoshow = '';
}
print '<span class="classfortooltip" title="'.dol_escape_htmltag($texttoshow, 1, 1).'">'.$text.'</a>';
print '</td>';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2023 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>
*
* 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,7 +32,7 @@ class DolMemoryCollector extends MemoryCollector
/**
* Return value of indicator
*
* @return array{peak_usage:string,peak_usage_str:string} Array
* @return array{peak_usage:int,peak_usage_str:string} Array
*/
public function collect()
{

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2023 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
@ -102,7 +102,7 @@ class DolQueryCollector extends DataCollector implements Renderable, AssetProvid
/**
* Return widget settings
*
* @return array<string,array{icon?:string,widget?:string,tooltip?:string,map:string,default:string}> Array
* @return array<string,array{icon?:string,widget?:string,tooltip?:string,map:string,default:int|string}> Array
*/
public function getWidgets()
{

View File

@ -7,6 +7,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* 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
@ -113,6 +114,7 @@ $permissiondellink = $user->hasRight('expedition', 'delivery', 'supprimer'); //
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be 'include', not 'include_once'
if ($action == 'add' && $permissiontoadd) {
$array_options = array();
$db->begin();
$object->date_delivery = dol_now();
@ -134,9 +136,9 @@ if ($action == 'add' && $permissiontoadd) {
for ($i = 0; $i < $num; $i++) {
$qty = "qtyl".$i;
$idl = "idl".$i;
$qtytouse = price2num(GETPOST($qty));
$qtytouse = price2num(GETPOSTFLOAT($qty));
if ($qtytouse > 0) {
$object->addline(GETPOST($idl), price2num($qtytouse), $arrayoptions);
$object->addline(GETPOSTINT($idl), (float) price2num($qtytouse), $array_options);
}
}
@ -171,6 +173,7 @@ if ($action == 'add' && $permissiontoadd) {
$model = $object->model_pdf;
$ret = $object->fetch($id); // Reload to get new records
// Phan does not use suggested tyhpe for $hide*, ignore: @phan-suppress-next-line PhanTypeMismatchArgument
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) {
dol_print_error($db, $object->error, $object->errors);
@ -238,7 +241,7 @@ if ($action == 'update_extras_line' && $permissiontoadd) {
for ($i = 0; $i < $num; $i++) {
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
$array_options[$i] = $extrafields->getOptionalsFromPost($extralabelsline, $i);
$array_options[$i] = $extrafields->getOptionalsFromPost($extralabelsline, (string) $i);
// Unset extrafield
if (is_array($extralabelsline)) {
// Get extra fields
@ -259,6 +262,12 @@ if ($action == 'update_extras_line' && $permissiontoadd) {
// Actions to build doc
$upload_dir = $conf->expedition->dir_output.'/receipt';
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
// Provided by include of ...builddoc...:
'
@phan-var-force int<0,1> $hidedetails
@phan-var-force int<0,1> $hidedesc
@phan-var-force int<0,1> $hideref
';
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
@ -352,7 +361,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, $objectsrc->socid, $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, (string) $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($objectsrc->fk_project)) {
$proj = new Project($db);
@ -583,7 +592,7 @@ if ($action == 'create') {
$text .= ' - '.$label;
$description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($object->lines[$i]->description));
//print $description;
print $form->textwithtooltip($text, $description, 3, '', '', $i);
print $form->textwithtooltip($text, $description, 3, 0, '', (string) $i);
//print_date_range($object->lines[$i]->date_start, $object->lines[$i]->date_end);
if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
print (!empty($object->lines[$i]->description) && $object->lines[$i]->description != $object->lines[$i]->product_label) ? '<br>'.dol_htmlentitiesbr($object->lines[$i]->description) : '';
@ -598,7 +607,7 @@ if ($action == 'create') {
if (!empty($object->lines[$i]->label)) {
$text .= ' <strong>'.$object->lines[$i]->label.'</strong>';
print $form->textwithtooltip($text, $object->lines[$i]->description, 3, '', '', $i);
print $form->textwithtooltip($text, $object->lines[$i]->description, 3, 0, '', (string) $i);
} else {
print $text.' '.nl2br($object->lines[$i]->description);
}

View File

@ -7,7 +7,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2023-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
@ -770,8 +770,8 @@ class Delivery extends CommonObject
/**
* Return clickable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @param int<0,2> $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int<-1,1> $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/
public function getNomUrl($withpicto = 0, $save_lastsearch_value = -1)

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
@ -44,6 +44,7 @@ $total = 0;
$ilink = 0;
foreach ($linkedObjectBlock as $key => $objectlink) {
/** @var Delivery $objectlink */
'@phan-var-force Delivery $objectlink';
$ilink++;
$trclass = 'oddeven';
@ -53,7 +54,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
echo '<tr class="'.$trclass.'" >';
echo '<td class="linkedcol-element tdoverflowmax100">'.$langs->trans("Delivery");
if (!empty($showImportButton) && getDolGlobalString('MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES')) {
print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, '', 0, 1).'&amp;action=selectlines&amp;token='.newToken().'" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a';
print '<a class="objectlinked_importbtn" href="'.$objectlink->getNomUrl(0, 0).'&amp;action=selectlines&amp;token='.newToken().'" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a';
}
echo '</td>';
echo '<td class="linkedcol-name tdoverflowmax150" >'.$objectlink->getNomUrl(1).'</td>';

View File

@ -7,6 +7,7 @@
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2022 Ferran Marcet <fmarcet@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
@ -94,6 +95,7 @@ if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias')) {
* @param int $disablenofollow Disable the "nofollow" on meta robot header
* @param int $disablenoindex Disable the "noindex" on meta robot header
* @return void
* @phan-suppress PhanRedefineFunction
*/
function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $morecssonbody = '', $replacemainareaby = '', $disablenofollow = 0, $disablenoindex = 0)
{
@ -106,6 +108,7 @@ function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disab
* @param string $zone 'private' (for private pages) or 'public' (for public pages)
* @param int $disabledoutputofmessages Clear all messages stored into session without displaying them
* @return void
* @phan-suppress PhanRedefineFunction
*/
function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = 0)
{
@ -168,7 +171,7 @@ if (in_array($modulepart, array('facture_paiement', 'unpaid'))) {
*/
// If we have a hash public (hashp), we guess the original_file.
$ecmfile='';
$ecmfile = '';
if (!empty($hashp)) {
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
$ecmfile = new EcmFiles($db);
@ -210,7 +213,7 @@ if (preg_match('/\.(html|htm)$/i', $original_file)) {
$attachment = false;
}
if (isset($_GET["attachment"])) {
$attachment = GETPOST("attachment", 'alpha') ?true:false;
$attachment = GETPOST("attachment", 'alpha') ? true : false;
}
if (getDolGlobalString('MAIN_DISABLE_FORCE_SAVEAS')) {
$attachment = false;

View File

@ -5,7 +5,7 @@
* Copyright (C) 2015-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Benoit Bruchard <benoitb21@gmail.com>
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.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
@ -298,7 +298,7 @@ if (is_resource($handle)) {
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, -1, 0);
print $form->textwithpicto('', $htmltooltip, -1, 'info');
print '</td>';
// Preview

View File

@ -6,6 +6,7 @@
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2018-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
@ -74,6 +75,7 @@ if ($id > 0 || $ref) {
$object->fetch($id, $ref);
}
$soc = null;
if (!empty($socid) && $socid > 0) {
$soc = new Societe($db);
if ($socid > 0) {
@ -374,6 +376,7 @@ llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-donation page-card')
$form = new Form($db);
$formfile = new FormFile($db);
$formcompany = new FormCompany($db);
$formproject = null;
if (isModEnabled('project')) {
$formproject = new FormProjets($db);
}
@ -397,7 +400,7 @@ if ($action == 'create') {
// Company
if (isModEnabled("societe") && getDolGlobalString('DONATION_USE_THIRDPARTIES')) {
// Thirdparty
if (!empty($soc) && $soc->id > 0) {
if (is_object($soc) && $soc->id > 0) {
print '<td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
print '<td>';
print $soc->getNomUrl(1);
@ -419,7 +422,7 @@ if ($action == 'create') {
print '<td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
print '<td>';
$filter = '((s.client:IN:1,2,3) AND (status:=:1))';
print $form->select_company('', 'socid', $filter, 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
print $form->select_company('', 'socid', $filter, 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
// Option to reload page to retrieve customer information. Note, this clear other input
if (getDolGlobalString('RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED')) {
print '<script type="text/javascript">
@ -483,14 +486,14 @@ if ($action == 'create') {
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>\n";
$selected = GETPOSTINT('modepayment');
print img_picto('', 'payment', 'class="pictofixedwidth"');
print $form->select_types_paiements($selected, 'modepayment', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
print $form->select_types_paiements((string) $selected, 'modepayment', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
print "</td></tr>\n";
// Public note
print '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td>';
if (!isset($note_public)) {
if (!isset($note_public)) { // Does not seem set before! @phan-suppress-current-line PhanPluginUndeclaredVariableIsset
$note_public = $object->getDefaultCreateValueFor('note_public');
}
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_3, '90%');
@ -502,7 +505,7 @@ if ($action == 'create') {
print '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
print '<td>';
if (!isset($note_private)) {
if (!isset($note_private)) { // Does not seem set before! @phan-suppress-current-line PhanPluginUndeclaredVariableIsset
$note_private = $object->getDefaultCreateValueFor('note_private');
}
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', false, false, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_3, '90%');
@ -510,10 +513,10 @@ if ($action == 'create') {
print '</td></tr>';
}
if (isModEnabled('project')) {
if (isModEnabled('project') && $formproject !== null) {
print "<tr><td>".$langs->trans("Project")."</td><td>";
print img_picto('', 'project', 'class="pictofixedwidth"');
print $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
print $formproject->select_projects(-1, (string) $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
print "</td></tr>\n";
}
@ -635,7 +638,7 @@ if (!empty($id) && $action == 'edit') {
$langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td>';
$formproject->select_projects(-1, $object->fk_project, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500');
$formproject->select_projects(-1, (string) $object->fk_project, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500');
print '</td></tr>';
}
@ -695,7 +698,7 @@ if (!empty($id) && $action != 'edit') {
$morehtmlref = '<div class="refidno">';
// Project
if (isModEnabled('project')) {
if (isModEnabled('project') && $formproject !== null) {
$langs->load("projects");
$morehtmlref .= $langs->trans('Project').' ';
if ($user->hasRight('don', 'creer')) {
@ -708,11 +711,11 @@ if (!empty($id) && $action != 'edit') {
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500');
$morehtmlref .= $formproject->select_projects($object->socid, (string) $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500');
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
}
} else {
if (!empty($object->fk_project)) {
@ -769,7 +772,7 @@ if (!empty($id) && $action != 'edit') {
// Payment mode
print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
$form->form_modes_reglement(null, $object->mode_reglement_id, 'none');
$form->form_modes_reglement('', (string) $object->mode_reglement_id, 'none');
print "</td></tr>\n";
// Other attributes
@ -937,7 +940,7 @@ if (!empty($id) && $action != 'edit') {
$filename = dol_sanitizeFileName((string) $object->id);
$filedir = $conf->don->dir_output."/".dol_sanitizeFileName((string) $object->id);
$urlsource = $_SERVER['PHP_SELF'].'?rowid='.$object->id;
$genallowed = (($object->paid == 0 || $user->admin) && $user->hasRight('don', 'lire'));
$genallowed = (int) (($object->paid == 0 || $user->admin) && $user->hasRight('don', 'lire'));
$delallowed = $user->hasRight('don', 'creer');
print $formfile->showdocuments('donation', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf);

View File

@ -3,7 +3,7 @@
* Copyright (c) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 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
@ -91,7 +91,7 @@ class DonationStats extends Stats
$this->join = '';
if ($status == 0 || $status == 1 || $status == 2) {
$this->where = ' d.fk_statut IN ('.$this->db->sanitize($status).')';
$this->where = ' d.fk_statut IN ('.((int) $status).')';
} elseif ($status == 3) {
$this->where = ' d.fk_statut IN (-1)';
} elseif ($status == 4) {
@ -140,7 +140,6 @@ class DonationStats extends Stats
* Return shipments number per year
*
* @return array<array{0:int,1:int}> Array of nb each year
*
*/
public function getNbByYear()
{

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -637,7 +637,7 @@ class PaymentDonation extends CommonObject
// Insert payment into llx_bank
$bank_line_id = $acc->addline(
$this->datep,
$this->paymenttype, // Payment mode id or code ("CHQ or VIR for example")
(string) $this->paymenttype, // Payment mode id or code ("CHQ or VIR for example")
$label,
$amount,
$this->num_payment,

View File

@ -8,6 +8,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -76,6 +77,8 @@ if (!$sortfield) {
$sortfield = "name";
}
$formproject = null;
$object = new Don($db);
if ($id > 0 || !empty($ref)) {
$object->fetch($id, $ref);
@ -142,23 +145,23 @@ if ($object->id) {
$morehtmlref = '<div class="refidno">';
// Project
if (isModEnabled('project')) {
if (isModEnabled('project') && $formproject !== null) {
$langs->load("projects");
$morehtmlref .= $langs->trans('Project').' ';
if ($user->hasRight('don', 'creer')) {
if ($action != 'classify') {
// $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
}
//if ($action != 'classify') {
// $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
//}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= $formproject->select_projects($object->socid, (string) $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
}
} else {
if (!empty($object->fk_project)) {

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@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 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -99,10 +99,8 @@ print load_fiche_titre($langs->trans("DonationsArea"), '', 'object_donation');
print '<div class="fichecenter"><div class="fichethirdleft">';
if (!isset($listofsearchfields) || !is_array($listofsearchfields)) {
// Ensure $listofsearchfields is an array
$listofsearchfields = array();
}
$listofsearchfields = array();
if (getDolGlobalString('MAIN_SEARCH_FORM_ON_HOME_AREAS')) { // TODO Add a search into global search combo so we can remove this
if (isModEnabled('don') && $user->hasRight('don', 'lire')) {
$listofsearchfields['search_donation'] = array('text' => 'Donation');

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -80,6 +81,7 @@ $help_url = 'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Donaciones|DE:M
llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-donation page-card_info');
$formproject = null;
$form = new Form($db);
if (isModEnabled('project')) {
$formproject = new FormProjets($db);
@ -95,23 +97,23 @@ $linkback = '<a href="'.DOL_URL_ROOT.'/don/list.php'.(!empty($socid) ? '?socid='
$morehtmlref = '<div class="refidno">';
// Project
if (isModEnabled('project')) {
if (isModEnabled('project') && $formproject !== null) {
$langs->load("projects");
$morehtmlref .= $langs->trans('Project').' ';
if ($user->hasRight('don', 'creer')) {
if ($action != 'classify') {
// $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
}
//if ($action != 'classify') {
// $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
//}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= $formproject->select_projects($object->socid, (string) $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
}
} else {
if (!empty($object->fk_project)) {

View File

@ -5,6 +5,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -98,6 +99,7 @@ $help_url = 'EN:Module_Donations|FR:Module_Dons|ES:M&oacute;dulo_Donaciones|DE:M
llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-donation page-card_notes');
$form = new Form($db);
$formproject = null;
if (isModEnabled('project')) {
$formproject = new FormProjets($db);
}
@ -114,23 +116,23 @@ if ($id > 0 || !empty($ref)) {
$morehtmlref = '<div class="refidno">';
// Project
if (isModEnabled('project')) {
if (isModEnabled('project') && $formproject !== null) {
$langs->load("projects");
$morehtmlref .= $langs->trans('Project').' ';
if ($user->hasRight('don', 'creer')) {
if ($action != 'classify') {
// $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
}
//if ($action != 'classify') {
// $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
//}
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= $formproject->select_projects($object->socid, (string) $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>';
} else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
}
} else {
if (!empty($object->fk_project)) {

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.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
@ -87,6 +87,9 @@ if (!$sortfield) {
$search_all = trim(GETPOST('search_all', 'alphanohtml'));
$morejs = array();
$morecss = array();
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'pd.rowid' => "RefPayment",
@ -96,17 +99,17 @@ $fieldstosearchall = array(
);
$arrayfields = array(
'pd.rowid' => array('label' => "RefPayment", 'checked' => 1, 'position' => 10),
'pd.datep' => array('label' => "Date", 'checked' => 1, 'position' => 20),
's.nom' => array('label' => "ThirdParty", 'checked' => 1, 'position' => 30),
'c.code' => array('label' => "Type", 'checked' => 1, 'position' => 40),
'pd.num_paiement' => array('label' => "Numero", 'checked' => 1, 'position' => 50, 'tooltip' => "ChequeOrTransferNumber"),
'transaction' => array('label' => "BankTransactionLine", 'checked' => 1, 'position' => 60, 'enabled' => (isModEnabled("bank"))),
'ba.label' => array('label' => "BankAccount", 'checked' => 1, 'position' => 70, 'enabled' => (isModEnabled("bank"))),
'pd.amount' => array('label' => "Amount", 'checked' => 1, 'position' => 80),
'pd.rowid' => array('label' => "RefPayment", 'checked' => '1', 'position' => 10),
'pd.datep' => array('label' => "Date", 'checked' => '1', 'position' => 20),
's.nom' => array('label' => "ThirdParty", 'checked' => '1', 'position' => 30),
'c.code' => array('label' => "Type", 'checked' => '1', 'position' => 40),
'pd.num_paiement' => array('label' => "Numero", 'checked' => '1', 'position' => 50, 'tooltip' => "ChequeOrTransferNumber"),
'transaction' => array('label' => "BankTransactionLine", 'checked' => '1', 'position' => 60, 'enabled' => (string) (isModEnabled("bank"))),
'ba.label' => array('label' => "BankAccount", 'checked' => '1', 'position' => 70, 'enabled' => (string) (isModEnabled("bank"))),
'pd.amount' => array('label' => "Amount", 'checked' => '1', 'position' => 80),
);
$arrayfields = dol_sort_array($arrayfields, 'position');
'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
'@phan-var-force array<string,array{label:string,checked:string,position?:int,help?:string,enabled?:string}> $arrayfields'; // dol_sort_array looses type for Phan
$optioncss = GETPOST('optioncss', 'alpha');
$moreforfilter = GETPOST('moreforfilter', 'alpha');

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2015 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
@ -43,6 +43,7 @@ if (isModEnabled("bank")) {
// Load translation files required by the page
$langs->loadLangs(array("bills", "banks", "companies", "donations"));
$outputlangs = $langs;
// Security check
$id = GETPOST('rowid') ? GETPOSTINT('rowid') : GETPOSTINT('id');

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* 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
@ -155,7 +155,7 @@ $form = new Form($db);
$title = $langs->trans("Payment");
llxHeader('', $title, '', '', 0, 0, '', '', '', 'mod-donation page-payment');
$sumpaid = 0;
$sql = "SELECT sum(p.amount) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."payment_donation as p";
$sql .= " WHERE p.fk_donation = ".((int) $chid);

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -168,7 +168,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);
@ -238,14 +238,17 @@ if (isModEnabled('category')) {
print '<tr><td>'.$cat_label.'</td><td>';
$cate_arbo = $form->select_all_categories($cat_type, '', 'parent', 0, 0, 1);
print img_picto('', 'category', 'class="pictofixedwidth"');
print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), 0, 0, 'widthcentpercentminusx maxwidth300');
if (is_array($cate_arbo) && is_array($cate_arbo[0])) {
print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), 0, 0, 'widthcentpercentminusx maxwidth300');
}
print '</td></tr>';
}
// User
print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>';
print img_picto('', 'user', 'class="pictofixedwidth"');
print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300');
print $form->select_dolusers($userid, 'userid', 1, null, 0, '', '', '0', 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300');
print '</td></tr>';
// Status

View File

@ -3,7 +3,7 @@
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Charlene Benke <cf.benke@patas-monkey.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
@ -32,6 +32,7 @@ $langs->load("donations");
$total = 0;
$ilink = 0;
$lastObjectLink = null;
foreach ($linkedObjectBlock as $key => $objectlink) {
$ilink++;
@ -47,9 +48,10 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
print '<td class="right">';
$total += $objectlink->total_ht;
echo price($objectlink->total_ht);
$lastObjectLink = $objectlink;
}
print '</td>';
print '<td class="right">'.$objectlink->getLibStatut(3).'</td>';
print '<td class="right">'.(is_object($lastObjectLink) ? $lastObjectLink->getLibStatut(3) : '').'</td>';
print '</tr>';
if (count($linkedObjectBlock) > 1) {