FIX Navigation from bank receipts
This commit is contained in:
parent
db6ed7a646
commit
f92f279527
@ -40,8 +40,7 @@ $id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('account', 'int'));
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$num = (GETPOST('num', 'alpha') ? GETPOST('num', 'alpha') : GETPOST('sectionid', 'alpha'));
|
||||
$numref = $num;
|
||||
$numref = (GETPOST('num', 'alpha') ? GETPOST('num', 'alpha') : GETPOST('sectionid', 'alpha'));
|
||||
|
||||
// Security check
|
||||
if ($user->socid) {
|
||||
@ -66,7 +65,11 @@ if (!$sortfield)
|
||||
$sortfield = "name";
|
||||
|
||||
$object = new Account($db);
|
||||
if ($id > 0 || !empty($ref)) $object->fetch($id, $ref);
|
||||
if ($id > 0 || !empty($ref))
|
||||
{
|
||||
$result = $object->fetch($id, $ref);
|
||||
$account = $object->id; // Force the search field on id of account
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, 'banque', $object->id, 'bank_account', '', '');
|
||||
|
||||
@ -78,7 +81,7 @@ if ($_GET["rel"] == 'prev')
|
||||
$sql = "SELECT DISTINCT(b.num_releve) as num";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql .= " WHERE b.num_releve < '".$db->escape($numref)."'";
|
||||
$sql .= " AND b.fk_account = ".$object->id;
|
||||
$sql .= " AND b.fk_account = ".$id;
|
||||
$sql .= " ORDER BY b.num_releve DESC";
|
||||
|
||||
dol_syslog("htdocs/compta/bank/releve.php", LOG_DEBUG);
|
||||
@ -99,7 +102,7 @@ if ($_GET["rel"] == 'prev')
|
||||
$sql = "SELECT DISTINCT(b.num_releve) as num";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql .= " WHERE b.num_releve > '".$db->escape($numref)."'";
|
||||
$sql .= " AND b.fk_account = ".$object->id;
|
||||
$sql .= " AND b.fk_account = ".$id;
|
||||
$sql .= " ORDER BY b.num_releve ASC";
|
||||
|
||||
dol_syslog("htdocs/compta/bank/releve.php", LOG_DEBUG);
|
||||
@ -124,12 +127,12 @@ if ($_GET["rel"] == 'prev')
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (!empty($num))
|
||||
if (!empty($numref))
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$upload_dir = $conf->bank->dir_output."/".$id."/statement/".dol_sanitizeFileName($num);
|
||||
$upload_dir = $conf->bank->dir_output."/".$id."/statement/".dol_sanitizeFileName($numref);
|
||||
}
|
||||
$backtopage = $_SERVER['PHP_SELF']."?account=".$id."&num=".$num;
|
||||
$backtopage = $_SERVER['PHP_SELF']."?account=".$id."&num=".$numref;
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
||||
|
||||
|
||||
@ -145,10 +148,10 @@ llxHeader('', $title, $helpurl);
|
||||
|
||||
if ($id > 0 || !empty($ref)) {
|
||||
if ($object->fetch($id, $ref)) {
|
||||
$upload_dir = $conf->bank->dir_output."/".$id."/statement/".dol_sanitizeFileName($num);
|
||||
$upload_dir = $conf->bank->dir_output."/".$id."/statement/".dol_sanitizeFileName($numref);
|
||||
|
||||
// Onglets
|
||||
$head = account_statement_prepare_head($object, $num);
|
||||
$head = account_statement_prepare_head($object, $numref);
|
||||
dol_fiche_head($head, 'document', $langs->trans("AccountStatement"), -1, 'account');
|
||||
|
||||
|
||||
@ -166,7 +169,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
$morehtmlright .= '<li class="pagination"><a class="paginationnext" href="'.$_SERVER["PHP_SELF"].'?rel=next&num='.$numref.'&ve='.$ve.'&account='.$object->id.'"><i class="fa fa-chevron-right" title="'.dol_escape_htmltag($langs->trans("Next")).'"></i></a></li>';
|
||||
$morehtmlright .= '</ul></div>';
|
||||
|
||||
$title = $langs->trans("AccountStatement").' '.$num.' - '.$langs->trans("BankAccount").' '.$object->getNomUrl(1, 'receipts');
|
||||
$title = $langs->trans("AccountStatement").' '.$numref.' - '.$langs->trans("BankAccount").' '.$object->getNomUrl(1, 'receipts');
|
||||
print load_fiche_titre($title,$morehtmlright, '');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
@ -185,9 +188,9 @@ if ($id > 0 || !empty($ref)) {
|
||||
$modulepart = 'bank';
|
||||
$permission = $user->rights->banque->modifier;
|
||||
$permtoedit = $user->rights->banque->modifier;
|
||||
$param = '&id='.$object->id.'&num='.urlencode($num);
|
||||
$moreparam = '&num='.urlencode($num); ;
|
||||
$relativepathwithnofile = $id."/statement/".dol_sanitizeFileName($num)."/";
|
||||
$param = '&id='.$object->id.'&num='.urlencode($numref);
|
||||
$moreparam = '&num='.urlencode($numref); ;
|
||||
$relativepathwithnofile = $id."/statement/".dol_sanitizeFileName($numref)."/";
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user