Merge branch 'NEW_BankEntries_TaxSalarySocial_DisplayUser' of github.com:atm-lena/dolibarr into develop_NEW_BankEntries_TaxSalarySocial_DisplayUser
This commit is contained in:
commit
b3c1bb9706
@ -484,8 +484,7 @@ $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappr
|
|||||||
$sql .= " b.fk_account, b.fk_type,";
|
$sql .= " b.fk_account, b.fk_type,";
|
||||||
$sql .= " ba.rowid as bankid, ba.ref as bankref,";
|
$sql .= " ba.rowid as bankid, ba.ref as bankref,";
|
||||||
$sql .= " bu.url_id, bu.type as type_url,";
|
$sql .= " bu.url_id, bu.type as type_url,";
|
||||||
$sql .= " s.nom, s.name_alias, s.client, s.fournisseur, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
$sql .= " s.nom, s.name_alias, s.client, s.fournisseur, s.email, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur";
|
||||||
$sql .= " u.lastname as user_lastname, u.firstname as user_firstname, u.email as user_email, u.statut as user_statut";
|
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||||
@ -499,9 +498,8 @@ if ($search_bid > 0) $sql .= MAIN_DB_PREFIX."bank_class as l,";
|
|||||||
$sql .= " ".MAIN_DB_PREFIX."bank_account as ba,";
|
$sql .= " ".MAIN_DB_PREFIX."bank_account as ba,";
|
||||||
$sql .= " ".MAIN_DB_PREFIX."bank as b";
|
$sql .= " ".MAIN_DB_PREFIX."bank as b";
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)";
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND (type = 'company' OR type = 'user')";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND type = 'company'";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid AND bu.type = 'company'";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON bu.url_id = u.rowid AND bu.type = 'user'";
|
|
||||||
$sql .= " WHERE b.fk_account = ba.rowid";
|
$sql .= " WHERE b.fk_account = ba.rowid";
|
||||||
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
$sql .= " AND ba.entity IN (".getEntity('bank_account').")";
|
||||||
if ($search_account > 0) $sql .= " AND b.fk_account = ".$search_account;
|
if ($search_account > 0) $sql .= " AND b.fk_account = ".$search_account;
|
||||||
@ -1375,12 +1373,6 @@ if ($resql)
|
|||||||
// Third party
|
// Third party
|
||||||
if (!empty($arrayfields['bu.label']['checked']))
|
if (!empty($arrayfields['bu.label']['checked']))
|
||||||
{
|
{
|
||||||
//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';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<td class="tdoverflowmax150">';
|
print '<td class="tdoverflowmax150">';
|
||||||
if ($objp->url_id)
|
if ($objp->url_id)
|
||||||
{
|
{
|
||||||
@ -1396,21 +1388,41 @@ if ($resql)
|
|||||||
$companystatic->code_compta = $objp->code_compta;
|
$companystatic->code_compta = $objp->code_compta;
|
||||||
$companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
|
$companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
|
||||||
print $companystatic->getNomUrl(1);
|
print $companystatic->getNomUrl(1);
|
||||||
} elseif ($objp->type_url == 'user' &&
|
}
|
||||||
|
}
|
||||||
|
else //display user or nothing
|
||||||
|
{
|
||||||
|
//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';
|
||||||
|
}
|
||||||
|
|
||||||
|
$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_salary' && !empty($user->rights->salaries->read))
|
||||||
|| ($type_link == 'payment_sc' && !empty($user->rights->tax->charges->lire)))
|
|| ($type_link == 'payment_sc' && !empty($user->rights->tax->charges->lire)))) {
|
||||||
) {
|
|
||||||
$userstatic->id = $objp->url_id;
|
$obj = $db->fetch_object($resqlu);
|
||||||
$userstatic->firstname = $objp->user_firstname;
|
$userstatic->fetch($obj->url_id);
|
||||||
$userstatic->name = $objp->user_lastname;
|
|
||||||
$userstatic->email = $objp->user_email;
|
|
||||||
$userstatic->statut = $objp->user_statut;
|
|
||||||
print $userstatic->getNomUrl(1);
|
print $userstatic->getNomUrl(1);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
print ' ';
|
print ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user