Fix navigation in bank direct debit orders
This commit is contained in:
parent
5af153550d
commit
5ae13ea9d6
@ -63,6 +63,9 @@ if (! $sortorder) $sortorder='DESC';
|
|||||||
|
|
||||||
$object = new BonPrelevement($db,"");
|
$object = new BonPrelevement($db,"");
|
||||||
|
|
||||||
|
// Load object
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -70,9 +73,7 @@ $object = new BonPrelevement($db,"");
|
|||||||
|
|
||||||
if ( $action == 'confirm_delete' )
|
if ( $action == 'confirm_delete' )
|
||||||
{
|
{
|
||||||
$object->fetch($id, $ref);
|
$res=$object->delete($user);
|
||||||
|
|
||||||
$res=$object->delete();
|
|
||||||
if ($res > 0)
|
if ($res > 0)
|
||||||
{
|
{
|
||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
@ -83,8 +84,6 @@ if ( $action == 'confirm_delete' )
|
|||||||
// Seems to no be used and replaced with $action == 'infocredit
|
// Seems to no be used and replaced with $action == 'infocredit
|
||||||
if ( $action == 'confirm_credite' && GETPOST('confirm','alpha') == 'yes')
|
if ( $action == 'confirm_credite' && GETPOST('confirm','alpha') == 'yes')
|
||||||
{
|
{
|
||||||
$object->fetch($id, $ref);
|
|
||||||
|
|
||||||
$res=$object->set_credite();
|
$res=$object->set_credite();
|
||||||
if ($res >= 0)
|
if ($res >= 0)
|
||||||
{
|
{
|
||||||
@ -97,8 +96,6 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
|
|||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$object->fetch($id, $ref);
|
|
||||||
|
|
||||||
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
|
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -132,7 +129,6 @@ if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
|
|||||||
// Set direct debit order to credited, create payment and close invoices
|
// Set direct debit order to credited, create payment and close invoices
|
||||||
if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
|
if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
|
||||||
{
|
{
|
||||||
$object->fetch($id, $ref);
|
|
||||||
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
|
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
|
||||||
|
|
||||||
$error = $object->set_infocredit($user, $dt);
|
$error = $object->set_infocredit($user, $dt);
|
||||||
@ -156,8 +152,6 @@ llxHeader('',$langs->trans("WithdrawalsReceipts"));
|
|||||||
|
|
||||||
if ($id > 0 || $ref)
|
if ($id > 0 || $ref)
|
||||||
{
|
{
|
||||||
$object->fetch($id, $ref);
|
|
||||||
|
|
||||||
$head = prelevement_prepare_head($object);
|
$head = prelevement_prepare_head($object);
|
||||||
dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
dol_fiche_head($head, 'prelevement', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||||
|
|
||||||
@ -414,13 +408,8 @@ if ($id > 0 || $ref)
|
|||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -313,7 +313,7 @@ class BonPrelevement extends CommonObject
|
|||||||
|
|
||||||
$this->_fetched = 1;
|
$this->_fetched = 1;
|
||||||
|
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1110,9 +1110,10 @@ class BonPrelevement extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Get object and lines from database
|
* Get object and lines from database
|
||||||
*
|
*
|
||||||
|
* @param User $user Object user that delete
|
||||||
* @return int >0 if OK, <0 if KO
|
* @return int >0 if OK, <0 if KO
|
||||||
*/
|
*/
|
||||||
function delete()
|
function delete($user=null)
|
||||||
{
|
{
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
|||||||
@ -71,7 +71,7 @@ llxHeader('',$langs->trans("WithdrawalsReceipts"));
|
|||||||
|
|
||||||
if ($prev_id > 0 || $ref)
|
if ($prev_id > 0 || $ref)
|
||||||
{
|
{
|
||||||
if ($object->fetch($prev_id, $ref) == 0)
|
if ($object->fetch($prev_id, $ref) >= 0)
|
||||||
{
|
{
|
||||||
$head = prelevement_prepare_head($object);
|
$head = prelevement_prepare_head($object);
|
||||||
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
dol_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||||
|
|||||||
@ -63,7 +63,7 @@ llxHeader('',$langs->trans("WithdrawalsReceipts"));
|
|||||||
|
|
||||||
if ($prev_id > 0 || $ref)
|
if ($prev_id > 0 || $ref)
|
||||||
{
|
{
|
||||||
if ($object->fetch($prev_id, $ref) == 0)
|
if ($object->fetch($prev_id, $ref) >= 0)
|
||||||
{
|
{
|
||||||
$head = prelevement_prepare_head($object);
|
$head = prelevement_prepare_head($object);
|
||||||
dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
dol_fiche_head($head, 'rejects', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||||
@ -152,7 +152,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
|
|||||||
$sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
$sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||||
$sql.= " , ".MAIN_DB_PREFIX."societe as s";
|
$sql.= " , ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql.= " , ".MAIN_DB_PREFIX."prelevement_rejet as pr";
|
$sql.= " , ".MAIN_DB_PREFIX."prelevement_rejet as pr";
|
||||||
$sql.= " WHERE p.rowid=".$prev_id;
|
$sql.= " WHERE p.rowid=".$object->id;
|
||||||
$sql.= " AND pl.fk_prelevement_bons = p.rowid";
|
$sql.= " AND pl.fk_prelevement_bons = p.rowid";
|
||||||
$sql.= " AND p.entity = ".$conf->entity;
|
$sql.= " AND p.entity = ".$conf->entity;
|
||||||
$sql.= " AND pl.fk_soc = s.rowid";
|
$sql.= " AND pl.fk_soc = s.rowid";
|
||||||
|
|||||||
@ -58,9 +58,9 @@ $object = new BonPrelevement($db,"");
|
|||||||
|
|
||||||
llxHeader('',$langs->trans("WithdrawalsReceipts"));
|
llxHeader('',$langs->trans("WithdrawalsReceipts"));
|
||||||
|
|
||||||
if ($prev_id)
|
if ($prev_id > 0 || $ref)
|
||||||
{
|
{
|
||||||
if ($object->fetch($prev_id) == 0)
|
if ($object->fetch($prev_id, $ref) >= 0)
|
||||||
{
|
{
|
||||||
$head = prelevement_prepare_head($object);
|
$head = prelevement_prepare_head($object);
|
||||||
dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
dol_fiche_head($head, 'statistics', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
|
||||||
@ -144,7 +144,7 @@ if ($prev_id)
|
|||||||
|
|
||||||
$sql = "SELECT sum(pl.amount), pl.statut";
|
$sql = "SELECT sum(pl.amount), pl.statut";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
|
||||||
$sql.= " WHERE pl.fk_prelevement_bons = ".$prev_id;
|
$sql.= " WHERE pl.fk_prelevement_bons = ".$object->id;
|
||||||
$sql.= " GROUP BY pl.statut";
|
$sql.= " GROUP BY pl.statut";
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user