From a4d9e3b9d35492336797ec03a2236edba81f0a99 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Fri, 19 Feb 2021 09:33:28 +0100 Subject: [PATCH] WIP final --- htdocs/compta/bank/bankentries_list.php | 62 +++++++++---------------- 1 file changed, 21 insertions(+), 41 deletions(-) diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 2b531634d37..92ca025a56c 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1398,55 +1398,35 @@ if ($resql) if (!empty($arrayfields['bu.label']['checked'])) { print ''; - if ($objp->url_id) //display company - { - if($objp->type_url == 'company') { - $companystatic->id = $objp->url_id; - $companystatic->name = $objp->nom; - $companystatic->name_alias = $objp->name_alias; - $companystatic->client = $objp->client; - $companystatic->email = $objp->email; - $companystatic->fournisseur = $objp->fournisseur; - $companystatic->code_client = $objp->code_client; - $companystatic->code_fournisseur = $objp->code_fournisseur; - $companystatic->code_compta = $objp->code_compta; - $companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; - print $companystatic->getNomUrl(1); - } - } - else //display user or nothing - { + + $companylinked = 0; + $userlinked = 0; + //payment line type to define user display foreach($links as $key=>$value){ if($links[$key]['type'] == 'payment_sc') $type_link = 'payment_sc'; if($links[$key]['type'] == 'payment_salary') $type_link = 'payment_salary'; + + if($links[$key]['type'] == 'company') { + $companylinked = $links[$key]['url_id']; + } + if($links[$key]['type'] == 'user') { + $userlinked = $links[$key]['url_id']; + } } - $sqlu = "SELECT url_id FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank=".$objp->rowid." AND type='user'"; - $resqlu = $db->query($sqlu); - - if($resqlu) { - - if($db->num_rows($resqlu) > 0 && - (($type_link == 'payment_salary' && !empty($user->rights->salaries->read)) - || ($type_link == 'payment_sc' && !empty($user->rights->tax->charges->lire)))) { - - $obj = $db->fetch_object($resqlu); - $userstatic->fetch($obj->url_id); - print $userstatic->getNomUrl(1); - - } - - else { - print ' '; - } - - } else - { - dol_print_error($db); + if($companylinked) { + $companystatic->fetch($companylinked); + print $companystatic->getNomUrl(1); + } elseif($userlinked && + (($type_link == 'payment_salary' && !empty($user->rights->salaries->read)) + || ($type_link == 'payment_sc' && !empty($user->rights->tax->charges->lire)))){ + $userstatic->fetch($userlinked); + print $userstatic->getNomUrl(1); + } else { + print ' '; } - } print ''; if (!$i) $totalarray['nbfield']++; }