Uniformize code
This commit is contained in:
parent
e6dd0003e0
commit
8c6db8669b
@ -39,39 +39,47 @@ $langs->load("bills");
|
|||||||
$langs->load("withdrawals");
|
$langs->load("withdrawals");
|
||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
|
|
||||||
|
// Get supervariables
|
||||||
|
$action = GETPOST("action");
|
||||||
|
$id = GETPOST("id");
|
||||||
|
$socid = GETPOST("socid");
|
||||||
|
|
||||||
if ($_POST["action"] == 'confirm_rejet')
|
$page = GETPOST("page");
|
||||||
|
$sortorder = GETPOST("sortorder");
|
||||||
|
$sortfield = GETPOST("sortfield");
|
||||||
|
|
||||||
|
if ($action == 'confirm_rejet')
|
||||||
{
|
{
|
||||||
if ( $_POST["confirm"] == 'yes')
|
if ( GETPOST("confirm") == 'yes')
|
||||||
{
|
{
|
||||||
$daterej = mktime(2, 0 , 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
$daterej = mktime(2, 0 , 0, GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear"));
|
||||||
|
|
||||||
$lipre = new LignePrelevement($db, $user);
|
$lipre = new LignePrelevement($db, $user);
|
||||||
|
|
||||||
if ($lipre->fetch($_GET["id"]) == 0)
|
if ($lipre->fetch($id) == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($_POST["motif"] > 0 && $daterej < time())
|
if (GETPOST("motif") > 0 && $daterej < time())
|
||||||
{
|
{
|
||||||
$rej = new RejetPrelevement($db, $user);
|
$rej = new RejetPrelevement($db, $user);
|
||||||
|
|
||||||
$rej->create($user, $_GET["id"], $_POST["motif"], $daterej, $lipre->bon_rowid, $_POST["facturer"]);
|
$rej->create($user, $id, GETPOST("motif"), $daterej, $lipre->bon_rowid, GETPOST("facturer"));
|
||||||
|
|
||||||
Header("Location: ligne.php?id=".$_GET["id"]);
|
Header("Location: ligne.php?id=".$id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("Motif : ".$_POST["motif"]);
|
dol_syslog("Motif : ".GETPOST("motif"));
|
||||||
dol_syslog("$daterej $time ");
|
dol_syslog("$daterej $time ");
|
||||||
Header("Location: ligne.php?id=".$_GET["id"]."&action=rejet");
|
Header("Location: ligne.php?id=".$id."&action=rejet");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Header("Location: ligne.php?id=".$_GET["id"]);
|
Header("Location: ligne.php?id=".$id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,16 +91,16 @@ if ($_POST["action"] == 'confirm_rejet')
|
|||||||
llxHeader('',$langs->trans("StandingOrder"));
|
llxHeader('',$langs->trans("StandingOrder"));
|
||||||
|
|
||||||
$h = 0;
|
$h = 0;
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$_GET["id"];
|
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$id;
|
||||||
$head[$h][1] = $langs->trans("Card");
|
$head[$h][1] = $langs->trans("Card");
|
||||||
$hselected = $h;
|
$hselected = $h;
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if ($_GET["id"])
|
if ($id)
|
||||||
{
|
{
|
||||||
$lipre = new LignePrelevement($db, $user);
|
$lipre = new LignePrelevement($db, $user);
|
||||||
|
|
||||||
if ($lipre->fetch($_GET["id"]) == 0)
|
if ($lipre->fetch($id) == 0)
|
||||||
{
|
{
|
||||||
$bon = new BonPrelevement($db);
|
$bon = new BonPrelevement($db);
|
||||||
$bon->fetch($lipre->bon_rowid);
|
$bon->fetch($lipre->bon_rowid);
|
||||||
@ -143,7 +151,7 @@ if ($_GET["id"])
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["action"] == 'rejet' && $user->rights->prelevement->bons->credit)
|
if ($action == 'rejet' && $user->rights->prelevement->bons->credit)
|
||||||
{
|
{
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
@ -152,7 +160,7 @@ if ($_GET["id"])
|
|||||||
|
|
||||||
$rej = new RejetPrelevement($db, $user);
|
$rej = new RejetPrelevement($db, $user);
|
||||||
|
|
||||||
print '<form name="confirm_rejet" method="post" action="ligne.php?id='.$_GET["id"].'">';
|
print '<form name="confirm_rejet" method="post" action="ligne.php?id='.$id.'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="confirm_rejet">';
|
print '<input type="hidden" name="action" value="confirm_rejet">';
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
@ -198,7 +206,7 @@ if ($_GET["id"])
|
|||||||
|
|
||||||
print "<div class=\"tabsAction\">";
|
print "<div class=\"tabsAction\">";
|
||||||
|
|
||||||
if ($_GET["action"] == '')
|
if ($action == '')
|
||||||
{
|
{
|
||||||
if ($bon->statut == 2 && $lipre->statut == 2 && $user->rights->prelevement->bons->credit)
|
if ($bon->statut == 2 && $lipre->statut == 2 && $user->rights->prelevement->bons->credit)
|
||||||
{
|
{
|
||||||
@ -212,9 +220,7 @@ if ($_GET["id"])
|
|||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
|
||||||
$page = $_GET["page"];
|
|
||||||
$sortorder = $_GET["sortorder"];
|
|
||||||
$sortfield = $_GET["sortfield"];
|
|
||||||
|
|
||||||
if ($page == -1) { $page = 0 ; }
|
if ($page == -1) { $page = 0 ; }
|
||||||
|
|
||||||
@ -241,8 +247,8 @@ if ($_GET["id"])
|
|||||||
$sql.= " AND f.fk_soc = s.rowid";
|
$sql.= " AND f.fk_soc = s.rowid";
|
||||||
$sql.= " AND pf.fk_facture = f.rowid";
|
$sql.= " AND pf.fk_facture = f.rowid";
|
||||||
$sql.= " AND f.entity = ".$conf->entity;
|
$sql.= " AND f.entity = ".$conf->entity;
|
||||||
$sql.= " AND pl.rowid=".$_GET["id"];
|
$sql.= " AND pl.rowid=".$id;
|
||||||
if ($_GET["socid"]) $sql.= " AND s.rowid = ".$_GET["socid"];
|
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||||
$sql.= " ORDER BY $sortfield $sortorder ";
|
$sql.= " ORDER BY $sortfield $sortorder ";
|
||||||
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
$sql.= $db->plimit($conf->liste_limit+1, $offset);
|
||||||
|
|
||||||
@ -253,7 +259,7 @@ if ($_GET["id"])
|
|||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$urladd = "&id=".$_GET["id"];
|
$urladd = "&id=".$id;
|
||||||
|
|
||||||
print_barre_liste($langs->trans("Bills"), $page, "factures.php", $urladd, $sortfield, $sortorder, '', $num, 0, '');
|
print_barre_liste($langs->trans("Bills"), $page, "factures.php", $urladd, $sortfield, $sortorder, '', $num, 0, '');
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?PHP
|
<?PHP
|
||||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -31,10 +31,14 @@ $langs->load("companies");
|
|||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
$socid = GETPOST("socid");
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'prelevement','','','bons');
|
$result = restrictedArea($user, 'prelevement','','','bons');
|
||||||
|
|
||||||
|
// Get supervariables
|
||||||
|
$page = GETPOST("page");
|
||||||
|
$sortorder = GETPOST("sortorder");
|
||||||
|
$sortfield = GETPOST("sortfield");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
@ -42,10 +46,6 @@ $result = restrictedArea($user, 'prelevement','','','bons');
|
|||||||
|
|
||||||
llxHeader('',$langs->trans("WithdrawsRefused"));
|
llxHeader('',$langs->trans("WithdrawsRefused"));
|
||||||
|
|
||||||
$page = $_GET["page"];
|
|
||||||
$sortorder = $_GET["sortorder"];
|
|
||||||
$sortfield = $_GET["sortfield"];
|
|
||||||
|
|
||||||
$offset = $conf->liste_limit * $page ;
|
$offset = $conf->liste_limit * $page ;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
|
|||||||
@ -33,7 +33,7 @@ $langs->load("companies");
|
|||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
$socid = GETPOST("socid");
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'prelevement','','','bons');
|
$result = restrictedArea($user, 'prelevement','','','bons');
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user