mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
FIX missing company name if dontaion is linked to third party
This commit is contained in:
parent
f885d1e05b
commit
3e45bf00eb
|
|
@ -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 '<tr class="oddeven tdoverflowmax100">';
|
||||
|
|
|
|||
|
|
@ -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 '<td class="fieldrequired">'.$langs->trans('ThirdParty').'</td>';
|
||||
print '<td>';
|
||||
print $soc->getNomUrl(1);
|
||||
|
|
@ -420,7 +420,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($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 '<script type="text/javascript">
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ $max = 10;
|
|||
* Last modified donations
|
||||
*/
|
||||
|
||||
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.societe, c.lastname, c.firstname, c.tms as datem, c.amount";
|
||||
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.societe, c.lastname, c.firstname, c.tms as datem, c.amount, c.fk_soc as socid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."don as c";
|
||||
$sql .= " WHERE c.entity = ".$conf->entity;
|
||||
//$sql.= " AND c.fk_statut > 2";
|
||||
|
|
@ -234,9 +234,17 @@ if ($resql) {
|
|||
print '</td>';
|
||||
|
||||
print '<td class="nobordernopadding">';
|
||||
print $obj->societe;
|
||||
print($obj->societe && ($obj->lastname || $obj->firstname) ? ' / ' : '');
|
||||
print dolGetFirstLastname($obj->firstname, $obj->lastname);
|
||||
if (!empty($obj->socid)) {
|
||||
$companystatic = new Societe($db);
|
||||
$ret = $companystatic->fetch($obj->socid);
|
||||
if ($ret > 0) {
|
||||
print $companystatic->getNomUrl(1);
|
||||
}
|
||||
} else {
|
||||
print $obj->societe;
|
||||
print($obj->societe && ($obj->lastname || $obj->firstname) ? ' / ' : '');
|
||||
print dolGetFirstLastname($obj->firstname, $obj->lastname);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right nobordernopadding nowraponall amount">';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user