Fix: Avoid duplicate lines
This commit is contained in:
parent
14c61e5cb4
commit
37f44dbd75
@ -34,8 +34,9 @@ $langs->load('companies');
|
|||||||
$langs->load('bills');
|
$langs->load('bills');
|
||||||
$langs->load('banks');
|
$langs->load('banks');
|
||||||
|
|
||||||
$facid=isset($_GET['facid'])?$_GET['facid']:$_POST['facid'];
|
$facid=GETPOST('facid');
|
||||||
$action=isset($_GET['action'])?$_GET['action']:$_POST['action'];
|
$action=GETPOST('action');
|
||||||
|
$socid=GETPOST('socid','int');
|
||||||
|
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'alpha');
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
@ -51,7 +52,6 @@ if (! $sortfield) $sortfield="p.rowid";
|
|||||||
$amounts = array();
|
$amounts = array();
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid=0;
|
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
$socid = $user->societe_id;
|
$socid = $user->societe_id;
|
||||||
@ -159,7 +159,7 @@ if ($action == 'add_paiement')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($invoiceid > 0) $loc = DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$invoiceid;
|
if ($invoiceid > 0) $loc = DOL_URL_ROOT.'/fourn/facture/fiche.php?facid='.$invoiceid;
|
||||||
else $loc = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$paiement_id;
|
else $loc = DOL_URL_ROOT.'/fourn/paiement/fiche.php?id='.$paiement_id;
|
||||||
Header('Location: '.$loc);
|
Header('Location: '.$loc);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -170,6 +170,7 @@ if ($action == 'add_paiement')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -344,7 +345,7 @@ if ($action == 'create' || $action == 'add_paiement')
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage liste
|
* Show list
|
||||||
*/
|
*/
|
||||||
if (! $_GET['action'] && ! $_POST['action'])
|
if (! $_GET['action'] && ! $_POST['action'])
|
||||||
{
|
{
|
||||||
@ -355,12 +356,12 @@ if (! $_GET['action'] && ! $_POST['action'])
|
|||||||
if (! $sortorder) $sortorder='DESC';
|
if (! $sortorder) $sortorder='DESC';
|
||||||
if (! $sortfield) $sortfield='p.datep';
|
if (! $sortfield) $sortfield='p.datep';
|
||||||
|
|
||||||
$sql = 'SELECT p.rowid, p.rowid as pid, p.datep as dp, p.amount as pamount,';
|
$sql = 'SELECT p.rowid as pid, p.datep as dp, p.amount as pamount, p.num_paiement,';
|
||||||
$sql.= ' f.rowid as facid, f.rowid as ref, f.facnumber, f.amount,';
|
|
||||||
$sql.= ' s.rowid as socid, s.nom,';
|
$sql.= ' s.rowid as socid, s.nom,';
|
||||||
$sql.= ' c.libelle as paiement_type, p.num_paiement,';
|
$sql.= ' c.libelle as paiement_type,';
|
||||||
$sql.= ' ba.rowid as bid, ba.label';
|
$sql.= ' ba.rowid as bid, ba.label,';
|
||||||
if (!$user->rights->societe->client->voir) $sql .= ", sc.fk_soc, sc.fk_user ";
|
if (!$user->rights->societe->client->voir) $sql .= ' sc.fk_soc, sc.fk_user,';
|
||||||
|
$sql.= ' SUM(f.amount)';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p';
|
||||||
if (!$user->rights->societe->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn';
|
||||||
@ -378,15 +379,15 @@ if (! $_GET['action'] && ! $_POST['action'])
|
|||||||
// Search criteria
|
// Search criteria
|
||||||
if ($_REQUEST["search_ref"])
|
if ($_REQUEST["search_ref"])
|
||||||
{
|
{
|
||||||
$sql .=" AND p.rowid=".$_REQUEST["search_ref"];
|
$sql .= ' AND p.rowid='.$db->escape($_REQUEST["search_ref"]);
|
||||||
}
|
}
|
||||||
if ($_REQUEST["search_account"])
|
if ($_REQUEST["search_account"])
|
||||||
{
|
{
|
||||||
$sql .=" AND b.fk_account=".$_REQUEST["search_account"];
|
$sql .= ' AND b.fk_account='.$db->escape($_REQUEST["search_account"]);
|
||||||
}
|
}
|
||||||
if ($_REQUEST["search_paymenttype"])
|
if ($_REQUEST["search_paymenttype"])
|
||||||
{
|
{
|
||||||
$sql .=" AND c.code='".$_REQUEST["search_paymenttype"]."'";
|
$sql .= " AND c.code='".$db->escape($_REQUEST["search_paymenttype"])."'";
|
||||||
}
|
}
|
||||||
if ($_REQUEST["search_amount"])
|
if ($_REQUEST["search_amount"])
|
||||||
{
|
{
|
||||||
@ -396,6 +397,8 @@ if (! $_GET['action'] && ! $_POST['action'])
|
|||||||
{
|
{
|
||||||
$sql .= " AND s.nom LIKE '%".$db->escape($_REQUEST["search_company"])."%'";
|
$sql .= " AND s.nom LIKE '%".$db->escape($_REQUEST["search_company"])."%'";
|
||||||
}
|
}
|
||||||
|
$sql.= " GROUP BY p.rowid, p.datep, p.amount, p.num_paiement, s.rowid, s.nom, c.libelle, ba.rowid, ba.label";
|
||||||
|
if (!$user->rights->societe->client->voir) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||||
$sql.= $db->order($sortfield,$sortorder);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
$sql.= $db->plimit($limit+1, $offset);
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
@ -413,8 +416,8 @@ if (! $_GET['action'] && ! $_POST['action'])
|
|||||||
|
|
||||||
print_barre_liste($langs->trans('SupplierPayments'), $page, 'paiement.php',$paramlist,$sortfield,$sortorder,'',$num);
|
print_barre_liste($langs->trans('SupplierPayments'), $page, 'paiement.php',$paramlist,$sortfield,$sortorder,'',$num);
|
||||||
|
|
||||||
if ($mesg) print $mesg;
|
if ($mesg) dol_htmloutput_mesg($mesg);
|
||||||
if ($errmsg) print $errmsg;
|
if ($errmsg) dol_htmloutput_errors($errmsg);
|
||||||
|
|
||||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user