Merge pull request #16260 from atm-lena/develop_NEW_BankEntries_TaxSalarySocial_DisplayUser
New bank entries tax salary social display user
This commit is contained in:
commit
4e2e5db9de
@ -91,7 +91,7 @@ $search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), G
|
|||||||
$search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
|
$search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int'));
|
||||||
$search_dv_start = dol_mktime(0, 0, 0, GETPOST('search_start_dvmonth', 'int'), GETPOST('search_start_dvday', 'int'), GETPOST('search_start_dvyear', 'int'));
|
$search_dv_start = dol_mktime(0, 0, 0, GETPOST('search_start_dvmonth', 'int'), GETPOST('search_start_dvday', 'int'), GETPOST('search_start_dvyear', 'int'));
|
||||||
$search_dv_end = dol_mktime(0, 0, 0, GETPOST('search_end_dvmonth', 'int'), GETPOST('search_end_dvday', 'int'), GETPOST('search_end_dvyear', 'int'));
|
$search_dv_end = dol_mktime(0, 0, 0, GETPOST('search_end_dvmonth', 'int'), GETPOST('search_end_dvday', 'int'), GETPOST('search_end_dvyear', 'int'));
|
||||||
$search_thirdparty = GETPOST("search_thirdparty", 'alpha') ?GETPOST("search_thirdparty", 'alpha') : GETPOST("thirdparty", 'alpha');
|
$search_thirdparty_user = GETPOST("search_thirdparty", 'alpha') ?GETPOST("search_thirdparty", 'alpha') : GETPOST("thirdparty", 'alpha');
|
||||||
$search_req_nb = GETPOST("req_nb", 'alpha');
|
$search_req_nb = GETPOST("req_nb", 'alpha');
|
||||||
$search_num_releve = GETPOST("search_num_releve", 'alpha');
|
$search_num_releve = GETPOST("search_num_releve", 'alpha');
|
||||||
$search_conciliated = GETPOST("search_conciliated", 'int');
|
$search_conciliated = GETPOST("search_conciliated", 'int');
|
||||||
@ -148,7 +148,7 @@ $arrayfields = array(
|
|||||||
'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1),
|
'b.datev'=>array('label'=>$langs->trans("DateValueShort"), 'checked'=>1),
|
||||||
'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
||||||
'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1),
|
'b.num_chq'=>array('label'=>$langs->trans("Numero"), 'checked'=>1),
|
||||||
'bu.label'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>500),
|
'bu.label'=>array('label'=>$langs->trans("ThirdParty").'/'.$langs->trans("User"), 'checked'=>1, 'position'=>500),
|
||||||
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || !empty($ref)) ? 0 : 1), 'position'=>1000),
|
'ba.ref'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>(($id > 0 || !empty($ref)) ? 0 : 1), 'position'=>1000),
|
||||||
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
|
'b.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1, 'position'=>600),
|
||||||
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
|
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
|
||||||
@ -191,7 +191,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||||||
$search_ref = "";
|
$search_ref = "";
|
||||||
$search_req_nb = '';
|
$search_req_nb = '';
|
||||||
$search_description = '';
|
$search_description = '';
|
||||||
$search_thirdparty = '';
|
$search_thirdparty_user = '';
|
||||||
$search_num_releve = '';
|
$search_num_releve = '';
|
||||||
$search_conciliated = '';
|
$search_conciliated = '';
|
||||||
$thirdparty = '';
|
$thirdparty = '';
|
||||||
@ -255,7 +255,7 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
|
|||||||
$param .= '&search_conciliated='.urlencode($search_conciliated);
|
$param .= '&search_conciliated='.urlencode($search_conciliated);
|
||||||
if ($page) $param .= '&page='.urlencode($page);
|
if ($page) $param .= '&page='.urlencode($page);
|
||||||
if ($offset) $param .= '&offset='.urlencode($offset);
|
if ($offset) $param .= '&offset='.urlencode($offset);
|
||||||
if ($search_thirdparty) $param .= '&search_thirdparty='.urlencode($search_thirdparty);
|
if ($search_thirdparty_user) $param .= '&search_thirdparty='.urlencode($search_thirdparty_user);
|
||||||
if ($search_num_releve) $param .= '&search_num_releve='.urlencode($search_num_releve);
|
if ($search_num_releve) $param .= '&search_num_releve='.urlencode($search_num_releve);
|
||||||
if ($search_description) $param .= '&search_description='.urlencode($search_description);
|
if ($search_description) $param .= '&search_description='.urlencode($search_description);
|
||||||
if ($search_start_dt) $param .= '&search_start_dt='.urlencode($search_start_dt);
|
if ($search_start_dt) $param .= '&search_start_dt='.urlencode($search_start_dt);
|
||||||
@ -359,6 +359,7 @@ $formaccounting = new FormAccounting($db);
|
|||||||
|
|
||||||
$companystatic = new Societe($db);
|
$companystatic = new Societe($db);
|
||||||
$bankaccountstatic = new Account($db);
|
$bankaccountstatic = new Account($db);
|
||||||
|
$userstatic= new User($db);
|
||||||
|
|
||||||
$banktransferstatic = new BonPrelevement($db);
|
$banktransferstatic = new BonPrelevement($db);
|
||||||
$societestatic = new Societe($db);
|
$societestatic = new Societe($db);
|
||||||
@ -390,7 +391,7 @@ if (!empty($ref)) $param .= '&ref='.urlencode($ref);
|
|||||||
if (!empty($search_ref)) $param .= '&search_ref='.urlencode($search_ref);
|
if (!empty($search_ref)) $param .= '&search_ref='.urlencode($search_ref);
|
||||||
if (!empty($search_description)) $param .= '&search_description='.urlencode($search_description);
|
if (!empty($search_description)) $param .= '&search_description='.urlencode($search_description);
|
||||||
if (!empty($search_type)) $param .= '&type='.urlencode($search_type);
|
if (!empty($search_type)) $param .= '&type='.urlencode($search_type);
|
||||||
if (!empty($search_thirdparty)) $param .= '&search_thirdparty='.urlencode($search_thirdparty);
|
if (!empty($search_thirdparty_user)) $param .= '&search_thirdparty='.urlencode($search_thirdparty_user);
|
||||||
if (!empty($search_debit)) $param .= '&search_debit='.urlencode($search_debit);
|
if (!empty($search_debit)) $param .= '&search_debit='.urlencode($search_debit);
|
||||||
if (!empty($search_credit)) $param .= '&search_credit='.urlencode($search_credit);
|
if (!empty($search_credit)) $param .= '&search_credit='.urlencode($search_credit);
|
||||||
if (!empty($search_account)) $param .= '&search_account='.urlencode($search_account);
|
if (!empty($search_account)) $param .= '&search_account='.urlencode($search_account);
|
||||||
@ -482,7 +483,7 @@ if ($id > 0 || !empty($ref))
|
|||||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,";
|
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,";
|
||||||
$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,";
|
$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";
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
@ -512,7 +513,7 @@ if ($search_ref) $sql .= natural_search("b.rowid", $search_ref, 1);
|
|||||||
if ($search_req_nb) $sql .= natural_search("b.num_chq", $search_req_nb);
|
if ($search_req_nb) $sql .= natural_search("b.num_chq", $search_req_nb);
|
||||||
if ($search_num_releve) $sql .= natural_search("b.num_releve", $search_num_releve);
|
if ($search_num_releve) $sql .= natural_search("b.num_releve", $search_num_releve);
|
||||||
if ($search_conciliated != '' && $search_conciliated != '-1') $sql .= " AND b.rappro = ".urlencode($search_conciliated);
|
if ($search_conciliated != '' && $search_conciliated != '-1') $sql .= " AND b.rappro = ".urlencode($search_conciliated);
|
||||||
if ($search_thirdparty) $sql .= natural_search("s.nom", $search_thirdparty);
|
if ($search_thirdparty_user) $sql .= natural_search(array("s.nom", "u.firstname", "u.lastname"), $search_thirdparty_user);
|
||||||
if ($search_description)
|
if ($search_description)
|
||||||
{
|
{
|
||||||
$search_description_to_use = $search_description;
|
$search_description_to_use = $search_description;
|
||||||
@ -587,7 +588,7 @@ if (!empty($search_description)) $mode_balance_ok = false;
|
|||||||
if (!empty($search_type)) $mode_balance_ok = false;
|
if (!empty($search_type)) $mode_balance_ok = false;
|
||||||
if (!empty($search_debit)) $mode_balance_ok = false;
|
if (!empty($search_debit)) $mode_balance_ok = false;
|
||||||
if (!empty($search_credit)) $mode_balance_ok = false;
|
if (!empty($search_credit)) $mode_balance_ok = false;
|
||||||
if (!empty($search_thirdparty)) $mode_balance_ok = false;
|
if (!empty($search_thirdparty_user)) $mode_balance_ok = false;
|
||||||
if ($search_conciliated != '' && $search_conciliated != '-1') $mode_balance_ok = false;
|
if ($search_conciliated != '' && $search_conciliated != '-1') $mode_balance_ok = false;
|
||||||
if (!empty($search_num_releve)) $mode_balance_ok = false;
|
if (!empty($search_num_releve)) $mode_balance_ok = false;
|
||||||
|
|
||||||
@ -1012,6 +1013,8 @@ if ($resql)
|
|||||||
while ($i < min($num, $limit))
|
while ($i < min($num, $limit))
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
|
$links = $bankaccountstatic->get_url($objp->rowid);
|
||||||
|
|
||||||
// If we are in a situation where we need/can show balance, we calculate the start of balance
|
// If we are in a situation where we need/can show balance, we calculate the start of balance
|
||||||
if (!$balancecalculated && (!empty($arrayfields['balancebefore']['checked']) || !empty($arrayfields['balance']['checked'])) && ($mode_balance_ok || $search_conciliated === '0'))
|
if (!$balancecalculated && (!empty($arrayfields['balancebefore']['checked']) || !empty($arrayfields['balance']['checked'])) && ($mode_balance_ok || $search_conciliated === '0'))
|
||||||
{
|
{
|
||||||
@ -1202,7 +1205,6 @@ if ($resql)
|
|||||||
//print "</a> ";
|
//print "</a> ";
|
||||||
|
|
||||||
// Add links after description
|
// Add links after description
|
||||||
$links = $bankaccountstatic->get_url($objp->rowid);
|
|
||||||
$cachebankaccount = array();
|
$cachebankaccount = array();
|
||||||
foreach ($links as $key=>$val)
|
foreach ($links as $key=>$val)
|
||||||
{
|
{
|
||||||
@ -1374,6 +1376,7 @@ if ($resql)
|
|||||||
print '<td class="tdoverflowmax150">';
|
print '<td class="tdoverflowmax150">';
|
||||||
if ($objp->url_id)
|
if ($objp->url_id)
|
||||||
{
|
{
|
||||||
|
if ($objp->type_url == 'company') {
|
||||||
$companystatic->id = $objp->url_id;
|
$companystatic->id = $objp->url_id;
|
||||||
$companystatic->name = $objp->nom;
|
$companystatic->name = $objp->nom;
|
||||||
$companystatic->name_alias = $objp->name_alias;
|
$companystatic->name_alias = $objp->name_alias;
|
||||||
@ -1385,9 +1388,35 @@ 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);
|
||||||
} else {
|
}
|
||||||
|
}
|
||||||
|
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_sc' && !empty($user->rights->tax->charges->lire)))) {
|
||||||
|
$obj = $db->fetch_object($resqlu);
|
||||||
|
$userstatic->fetch($obj->url_id);
|
||||||
|
print $userstatic->getNomUrl(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
print ' ';
|
print ' ';
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -567,6 +567,25 @@ class PaymentSocialContribution extends CommonObject
|
|||||||
$socialcontrib->fetch($key);
|
$socialcontrib->fetch($key);
|
||||||
$result = $acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_label.(($socialcontrib->lib && $socialcontrib->lib != $socialcontrib->type_label) ? ' ('.$socialcontrib->lib.')' : ''), 'sc');
|
$result = $acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_label.(($socialcontrib->lib && $socialcontrib->lib != $socialcontrib->type_label) ? ' ('.$socialcontrib->lib.')' : ''), 'sc');
|
||||||
if ($result <= 0) dol_print_error($this->db);
|
if ($result <= 0) dol_print_error($this->db);
|
||||||
|
|
||||||
|
if ($socialcontrib->fk_user) {
|
||||||
|
$fuser = new User($this->db);
|
||||||
|
$fuser->fetch($socialcontrib->fk_user);
|
||||||
|
|
||||||
|
// Add link 'user' in bank_url between operation and bank transaction
|
||||||
|
$result = $acc->add_url_line(
|
||||||
|
$bank_line_id,
|
||||||
|
$socialcontrib->fk_user,
|
||||||
|
DOL_URL_ROOT . '/user/card.php?id=',
|
||||||
|
$fuser->getFullName($langs),
|
||||||
|
'user'
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($result <= 0) {
|
||||||
|
$this->error = $acc->error;
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user