FIX Navigation on bank transaction list

This commit is contained in:
Laurent Destailleur 2022-01-04 09:33:52 +01:00
parent 64c7472965
commit 807f2841d4
6 changed files with 25 additions and 24 deletions

View File

@ -35,10 +35,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load translation files required by the page
$langs->load("categories");
if (!$user->rights->categorie->lire) {
accessforbidden();
}
$id = GETPOST('id', 'int');
$type = (GETPOST('type', 'aZ09') ? GETPOST('type', 'aZ09') : Categorie::TYPE_PRODUCT);
$catname = GETPOST('catname', 'alpha');
@ -52,6 +48,11 @@ if (is_numeric($type)) {
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('categoryindex'));
if (!$user->rights->categorie->lire) {
accessforbidden();
}
/*
* View
*/

View File

@ -64,6 +64,7 @@ $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$contextpage = 'banktransactionlist'.(empty($object->ref) ? '' : '-'.$object->id);
$optioncss = GETPOST('optioncss', 'aZ09');
// Security check
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
@ -264,7 +265,7 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
}
if (!$error) {
$param = 'action=reconcile&contextpage=banktransactionlist&id='.$id.'&search_account='.$id;
$param = 'action=reconcile&contextpage=banktransactionlist&id='.((int) $id).'&search_account='.((int) $id);
if ($page) {
$param .= '&page='.urlencode($page);
}
@ -448,7 +449,7 @@ if (!empty($search_debit)) {
if (!empty($search_credit)) {
$param .= '&search_credit='.urlencode($search_credit);
}
if (!empty($search_account)) {
if ($search_account > 0) {
$param .= '&search_account='.urlencode($search_account);
}
if (!empty($search_num_releve)) {
@ -758,7 +759,7 @@ if ($resql) {
}
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="'.($action ? $action : 'search').'">';
print '<input type="hidden" name="action" value="'.($action != 'delete' ? $action : 'search').'">';
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
@ -766,7 +767,7 @@ if ($resql) {
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="ref" value="'.$ref.'">';
if (GETPOST('bid')) {
print '<input type="hidden" name="bid" value="'.GETPOST("bid").'">';
print '<input type="hidden" name="bid" value="'.GETPOST("bid", 'int').'">';
}
// Form to reconcile
@ -1663,16 +1664,16 @@ if ($resql) {
print '<td class="nowraponall" align="center">';
// Transaction reconciliated or edit link
if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) { // If line not conciliated and account can be conciliated
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&amp;rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.($object->id > 0 ? '&account='.$object->id : '').'&page='.$page.'">';
print img_edit();
print '</a>';
} else {
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&amp;rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.($object->id > 0 ? '&account='.$object->id : '').'&page='.$page.'">';
print img_edit();
print '</a>';
} else {
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&amp;rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.($object->id > 0 ? '&account='.$object->id : '').'&page='.$page.'">';
print img_view();
print '</a>';
}
@ -1682,7 +1683,7 @@ if ($resql) {
}
}
if ($user->rights->banque->modifier) {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&rowid='.$objp->rowid.'&page='.$page.'">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&rowid='.$objp->rowid.'&page='.$page.$param.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">';
print img_delete('', 'class="marginleftonly"');
print '</a>';
}

View File

@ -646,10 +646,10 @@ if ($result) {
}
print '</tr>';
print "<tr><td>".$langs->trans("BankLineConciliated")."</td>";
print '<tr><td><label for="reconciled">'.$langs->trans("BankLineConciliated").'</label></td>';
if ($user->rights->banque->consolidate) {
print '<td>';
print '<input type="checkbox" name="reconciled" class="flat" '.(GETPOSTISSET("reconciled") ? (GETPOST("reconciled") ? ' checked="checked"' : '') : ($objp->rappro ? ' checked="checked"' : '')).'">';
print '<input type="checkbox" id="reconciled" name="reconciled" class="flat" '.(GETPOSTISSET("reconciled") ? (GETPOST("reconciled") ? ' checked="checked"' : '') : ($objp->rappro ? ' checked="checked"' : '')).'">';
print '</td>';
} else {
print '<td>'.yn($objp->rappro).'</td>';

View File

@ -331,8 +331,8 @@ if (empty($numref)) {
} else {
print '<input type="hidden" name="oldbankreceipt" value="'.$objp->numr.'">';
print '<input type="text" name="newbankreceipt" value="'.$objp->numr.'">';
print '<input type="submit" class="button" name="actionnewbankreceipt" value="'.$langs->trans("Rename").'">';
print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
print '<input type="submit" class="button small" name="actionnewbankreceipt" value="'.$langs->trans("Rename").'">';
print '<input type="submit" class="button button-cancel small" name="cancel" value="'.$langs->trans("Cancel").'">';
}
print '</td>';
@ -364,7 +364,7 @@ if (empty($numref)) {
print '<td class="center">';
if ($user->rights->banque->consolidate && $action != 'editbankreceipt') {
print '<a href="'.$_SERVER["PHP_SELF"].'?account='.$object->id.($page > 0 ? '&page='.$page : '').'&action=editbankreceipt&brref='.$objp->numr.'">'.img_edit().'</a>';
print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?account='.$object->id.($page > 0 ? '&page='.$page : '').'&action=editbankreceipt&brref='.$objp->numr.'">'.img_edit().'</a>';
}
print '</td>';
@ -669,6 +669,7 @@ if (empty($numref)) {
var current = $(this);
current.click(function()
{
console.log("We click on ajaxforbankoperationchange");
var url = "'.$urlajax.'&"+current.attr("href").split("?")[1];
$.get(url, function(data)
{

View File

@ -334,11 +334,7 @@ foreach ($bankcateg->fetchAll() as $bankcategory) {
$options[$bankcategory->id] = $bankcategory->label;
}
/* ************************************************************************** */
/* */
/* Create mode */
/* */
/* ************************************************************************** */
// Create mode
if ($action == 'create') {
// Update fields properties in realtime
if (!empty($conf->use_javascript_ajax)) {
@ -350,6 +346,7 @@ if ($action == 'create') {
});
function setPaymentType()
{
console.log("setPaymentType");
var code = $("#selectpaymenttype option:selected").val();
if (code == \'CHQ\' || code == \'VIR\')
{
@ -415,7 +412,8 @@ if ($action == 'create') {
if (!empty($conf->banque->enabled)) {
print '<tr><td>';
print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).'</td><td>';
$form->select_comptes($accountid, "accountid", 0, '', 2); // Affiche liste des comptes courant
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
print $form->select_comptes($accountid, "accountid", 0, '', 2, '', 0, '', 1); // Show list of main accounts (comptes courants)
print '</td></tr>';
}

View File

@ -746,7 +746,7 @@ Permission106=Export sendings
Permission109=Delete sendings
Permission111=Read financial accounts
Permission112=Create/modify/delete and compare transactions
Permission113=Setup financial accounts (create, manage categories)
Permission113=Setup financial accounts (create, manage categories of bank transactions)
Permission114=Reconcile transactions
Permission115=Export transactions and account statements
Permission116=Transfers between accounts