Qual: Fix donation notices (#36058)

* Qual: Fix missing abstract isEnabled for ModeleDon

# Qual: Fix missing abstract isEnabled for ModeleDon

* Qual: Fix donation list fields

# Qual: Fix donation list fields

Fixes PhanTypeMismatchProperty issues in don/list.php by typecasting and
adding d.ref field to query & using it.

* Fix: Fix call to ModeleDon::write_file

- Refactored write_file method in don.class.php to extraneous parameters
- Removed PhanParamTooMany warning from baseline.txt

* Qual: Remove duplicate assignment in list.php

Removed redundant assignment of projectstatic.id.

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
MDW 2025-11-02 12:58:12 +01:00 committed by GitHub
parent 6e1f01a942
commit 2de1724786
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 12 deletions

View file

@ -152,9 +152,6 @@ return [
'htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php' => ['PhanUndeclaredProperty'],
'htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php' => ['PhanUndeclaredProperty'],
'htdocs/delivery/class/delivery.class.php' => ['PhanUndeclaredProperty'],
'htdocs/don/admin/donation.php' => ['PhanUndeclaredMethod'],
'htdocs/don/class/don.class.php' => ['PhanParamTooMany'],
'htdocs/don/list.php' => ['PhanTypeMismatchProperty'],
'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanUndeclaredProperty'],
'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/eventorganization/conferenceorbooth_list.php' => ['PhanTypeMismatchArgument'],

View file

@ -3,7 +3,7 @@
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005 Regis Houssin <regis.houssin@inodbox.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
@ -66,6 +66,13 @@ abstract class ModeleDon extends CommonDocGenerator
* @return int<-1,1> >0 if OK, <0 if KO
*/
abstract public function write_file($don, $outputlangs, $currency = '');
/**
* Return if a module can be used or not
*
* @return boolean true if module can be used
*/
abstract public function isEnabled();
}

View file

@ -1124,7 +1124,7 @@ class Don extends CommonObject
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output = $outputlangs->charset_output;
if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) {
if ($obj->write_file($object, $outputlangs /*, $currency */) > 0) {
$outputlangs->charset_output = $sav_charset_output;
// we delete preview files

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-2025 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -236,9 +236,9 @@ $morecss = array();
// Build and execute select
// --------------------------------------------------------------------
$sql = "SELECT d.rowid, d.datedon, d.fk_soc as socid, d.firstname, d.lastname, d.societe,";
$sql = "SELECT d.rowid, d.ref, d.datedon, d.fk_soc as socid, d.firstname, d.lastname, d.societe,";
$sql .= " d.amount, d.fk_statut as status,";
$sql .= " p.rowid as pid, p.ref, p.title, p.public";
$sql .= " p.rowid as pid, p.ref as pref, p.title, p.public";
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
@ -603,7 +603,7 @@ while ($i < $imaxinloop) {
$donationstatic->setVarsFromFetchObj($obj);
$donationstatic->id = $obj->rowid;
$donationstatic->ref = $obj->rowid;
$donationstatic->ref = $obj->ref;
$donationstatic->date = $db->jdate($obj->datedon);
$donationstatic->status = $obj->status;
$donationstatic->lastname = $obj->lastname;
@ -625,7 +625,7 @@ while ($i < $imaxinloop) {
if (!empty($obj->socid) && $company->id > 0) {
$donationstatic->societe = $company->getNomUrl(1);
} else {
$donationstatic->societe = $obj->societe;
$donationstatic->societe = (string) $obj->societe; // Value from sql query
}
$object = $donationstatic;
@ -687,8 +687,7 @@ while ($i < $imaxinloop) {
print "<td>";
if ($obj->pid) {
$projectstatic->id = $obj->pid;
$projectstatic->ref = $obj->ref;
$projectstatic->id = $obj->pid;
$projectstatic->ref = $obj->pref;
$projectstatic->public = $obj->public;
$projectstatic->title = $obj->title;
print $projectstatic->getNomUrl(1);