FIX Donation - List - Sort order don't work if company is linked to third party

This commit is contained in:
Alexandre SPANGARO 2026-05-27 14:15:09 +02:00
parent aa4d9cc8a6
commit 8a96ea337f

View file

@ -6,6 +6,7 @@
* Copyright (C) 2019 Thibault FOUCART <support@ptibogxiv.net>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2026 Alexandre Spangaro <alexandre@inovea-conseil.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
@ -237,7 +238,7 @@ $morecss = array();
// Build and execute select
// --------------------------------------------------------------------
$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 .= " d.amount, d.fk_statut as status, s.nom,";
$sql .= " p.rowid as pid, p.ref as pref, p.title, p.public";
// Add fields from hooks
$parameters = array();
@ -563,7 +564,7 @@ if ($conf->main_checkbox_left_column) {
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.rowid", "", $param, "", $sortfield, $sortorder);
$totalarray['nbfield']++;
if (getDolGlobalString('DONATION_USE_THIRDPARTIES')) {
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "d.fk_soc", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
$totalarray['nbfield']++;
} else {
print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "d.societe", "", $param, "", $sortfield, $sortorder);