diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index a238b4f6a2b..5fc3880c600 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -422,7 +422,7 @@ if (isModEnabled('don') && $user->hasRight('don', 'lire')) { $langs->load("boxes"); $donationstatic = new Don($db); - $sql = "SELECT d.rowid, d.lastname, d.firstname, d.societe, d.datedon as date, d.tms as dm, d.amount, d.fk_statut as status"; + $sql = "SELECT d.rowid, d.lastname, d.firstname, d.societe, d.datedon as date, d.tms as dm, d.amount, d.fk_statut as status, d.fk_soc as socid"; $sql .= " FROM ".MAIN_DB_PREFIX."don as d"; $sql .= " WHERE d.entity IN (".getEntity('donation').")"; // Add where from hooks @@ -473,9 +473,17 @@ if (isModEnabled('don') && $user->hasRight('don', 'lire')) { $donationstatic->statut = $obj->status; $donationstatic->status = $obj->status; - $label = $donationstatic->getFullName($langs); - if ($obj->societe) { - $label .= ($label ? ' - ' : '').$obj->societe; + if (!empty($obj->socid)) { + $companystatic = new Societe($db); + $ret = $companystatic->fetch($obj->socid); + if ($ret > 0) { + $label = $companystatic->getNomUrl(1); + } + } else { + $label = $donationstatic->getFullName($langs); + if ($obj->societe) { + $label .= ($label ? ' - ' : '').$obj->societe; + } } print ''; diff --git a/htdocs/don/card.php b/htdocs/don/card.php index abb8560727f..675a8655c30 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -398,7 +398,7 @@ if ($action == 'create') { // Company if (isModEnabled("societe") && getDolGlobalString('DONATION_USE_THIRDPARTIES')) { // Thirdparty - if ($soc->id > 0) { + if (!empty($soc) && $soc->id > 0) { print ''.$langs->trans('ThirdParty').''; print ''; print $soc->getNomUrl(1); @@ -420,7 +420,7 @@ if ($action == 'create') { print ''.$langs->trans('ThirdParty').''; print ''; $filter = '((s.client:IN:1,2,3) AND (status:=:1))'; - print $form->select_company($soc->id, 'socid', $filter, 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); + print $form->select_company($socid, 'socid', $filter, 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // Option to reload page to retrieve customer information. Note, this clear other input if (getDolGlobalString('RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED')) { print '