diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php
index d62ed9d2696..0ff2ef644a6 100644
--- a/htdocs/fourn/facture/document.php
+++ b/htdocs/fourn/facture/document.php
@@ -42,7 +42,7 @@ $confirm=GETPOST('confirm','alpha');
// Security check
if ($user->societe_id) $socid=$user->societe_id;
-$result = restrictedArea($user, 'fournisseur', $facid, 'facture_fourn', 'facture');
+$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
// Get parameters
$sortfield = GETPOST("sortfield",'alpha');
@@ -130,7 +130,7 @@ if ($object->id > 0)
// Ref
print '
| '.$langs->trans("Ref").' | ';
- print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
+ print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref');
print ' | ';
print "
\n";
@@ -172,12 +172,15 @@ if ($object->id > 0)
}
print ')';
}
+ // FIXME $facidnext is not defined
+ /*
if ($facidnext > 0)
{
$facthatreplace=new FactureFournisseur($db);
$facthatreplace->fetch($facidnext);
print ' ('.$langs->transnoentities("ReplacedByInvoice",$facthatreplace->getNomUrl(1)).')';
}
+ */
print '';
// Label
diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php
index 35e03a80b49..4e3d60848f6 100644
--- a/htdocs/fourn/facture/fiche.php
+++ b/htdocs/fourn/facture/fiche.php
@@ -1657,7 +1657,7 @@ else
print '';
if ($object->lines[$i]->fk_product)
{
- print ''; // ancre pour retourner sur la ligne
+ print ''; // ancre pour retourner sur la ligne
$product_static=new ProductFournisseur($db);
$product_static->fetch($object->lines[$i]->fk_product);
diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php
index 8e45d645873..999068cfb05 100644
--- a/htdocs/fourn/facture/paiement.php
+++ b/htdocs/fourn/facture/paiement.php
@@ -36,7 +36,7 @@ $langs->load('bills');
$langs->load('banks');
$facid=GETPOST('facid','int');
-$action=GETPOST('action');
+$action=GETPOST('action','alpha');
$socid=GETPOST('socid','int');
$sortfield = GETPOST("sortfield",'alpha');
@@ -86,7 +86,7 @@ if ($action == 'add_paiement')
// Effectue les verifications des parametres
if ($_POST['paiementid'] <= 0)
{
- $mesg = ' '.$langs->trans('ErrorFieldRequired',$langs->transnoentities('PaymentMode')).' ';
+ setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('PaymentMode')), 'errors');
$error++;
}
@@ -96,20 +96,20 @@ if ($action == 'add_paiement')
// d'un paiement
if (! $_POST['accountid'])
{
- $mesg = ''.$langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')).' ';
+ setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors');
$error++;
}
}
if ($total == 0)
{
- $mesg = ''.$langs->transnoentities('ErrorFieldRequired',$langs->trans('PaymentAmount')).' ';
+ setEventMessage($langs->trans('ErrorFieldRequired',$langs->trans('PaymentAmount')), 'errors');
$error++;
}
if (empty($datepaye))
{
- $mesg = ''.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Date')).' ';
+ setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('Date')), 'errors');
$error++;
}
@@ -129,7 +129,7 @@ if ($action == 'add_paiement')
$paiement_id = $paiement->create($user,(GETPOST('closepaidinvoices')=='on'?1:0));
if ($paiement_id < 0)
{
- $errmsg=''.$paiement->error.' ';
+ setEventMessage($paiement->error, 'errors');
$error++;
}
}
@@ -139,7 +139,7 @@ if ($action == 'add_paiement')
$result=$paiement->addPaymentToBank($user,'payment_supplier','(SupplierInvoicePayment)',$_POST['accountid'],'','');
if ($result < 0)
{
- $errmsg=''.$paiement->error.' ';
+ setEventMessage($paiement->error, 'errors');
$error++;
}
}
@@ -188,7 +188,7 @@ if ($action == 'create' || $action == 'add_paiement')
$facture = new FactureFournisseur($db);
$facture->fetch($facid);
- $datefacture=dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
+ $datefacture=dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$dateinvoice=($datefacture==''?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0):$datefacture);
$sql = 'SELECT s.nom, s.rowid as socid,';
@@ -210,9 +210,6 @@ if ($action == 'create' || $action == 'add_paiement')
print_fiche_titre($langs->trans('DoPayment'));
- if ($mesg) dol_htmloutput_mesg($mesg);
- if ($errmsg) dol_htmloutput_errors($errmsg);
-
print ' | ';
print '';
- print ' | ';
+ print '';
print '| '.$langs->trans('Numero').' | |
';
if (! empty($conf->banque->enabled))
{
@@ -254,15 +251,15 @@ if ($action == 'create' || $action == 'add_paiement')
/*
* Autres factures impayees
*/
- $sql = 'SELECT f.rowid as facid,f.rowid as ref,f.facnumber,f.total_ttc, f.datef as df';
- $sql.= ', sum(pf.amount) as am';
+ $sql = 'SELECT f.rowid as facid, f.rowid as ref, f.facnumber, f.total_ht, f.total_ttc, f.datef as df';
+ $sql.= ', SUM(pf.amount) as am';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
$sql.= " WHERE f.entity = ".$conf->entity;
$sql.= ' AND f.fk_soc = '.$facture->socid;
$sql.= ' AND f.paye = 0';
$sql.= ' AND f.fk_statut = 1'; // Statut=0 => non validee, Statut=2 => annulee
- $sql.= ' GROUP BY f.rowid,f.facnumber,f.total_ttc,f.datef';
+ $sql.= ' GROUP BY f.rowid, f.facnumber, f.total_ht, f.total_ttc, f.datef';
$resql = $db->query($sql);
if ($resql)
{
@@ -286,6 +283,7 @@ if ($action == 'create' || $action == 'add_paiement')
$var=True;
$total=0;
+ $total_ttc=0;
$totalrecu=0;
while ($i < $num)
{
@@ -311,7 +309,7 @@ if ($action == 'create' || $action == 'add_paiement')
$namef = 'amount_'.$objp->facid;
print '';
print "\n";
- $total+=$objp->total;
+ $total+=$objp->total_ht;
$total_ttc+=$objp->total_ttc;
$totalrecu+=$objp->am;
$i++;
@@ -349,7 +347,7 @@ if ($action == 'create' || $action == 'add_paiement')
/*
* Show list
*/
-if (! $_GET['action'] && ! $_POST['action'])
+if (empty($action))
{
if ($page == -1) $page = 0 ;
$limit = $conf->liste_limit;
@@ -358,6 +356,12 @@ if (! $_GET['action'] && ! $_POST['action'])
if (! $sortorder) $sortorder='DESC';
if (! $sortfield) $sortfield='p.datep';
+ $search_ref=GETPOST('search_ref');
+ $search_account=GETPOST('search_account');
+ $search_paymenttype=GETPOST('search_paymenttype');
+ $search_amount=GETPOST('search_amount');
+ $search_company=GETPOST('search_company');
+
$sql = 'SELECT p.rowid as pid, p.datep as dp, p.amount as pamount, p.num_paiement,';
$sql.= ' s.rowid as socid, s.nom,';
$sql.= ' c.libelle as paiement_type,';
@@ -379,25 +383,25 @@ if (! $_GET['action'] && ! $_POST['action'])
$sql .= ' AND f.fk_soc = '.$socid;
}
// Search criteria
- if ($_REQUEST["search_ref"])
+ if (! empty($search_ref))
{
- $sql .= ' AND p.rowid='.$db->escape($_REQUEST["search_ref"]);
+ $sql .= ' AND p.rowid='.$db->escape($search_ref);
}
- if ($_REQUEST["search_account"])
+ if (! empty($search_account))
{
- $sql .= ' AND b.fk_account='.$db->escape($_REQUEST["search_account"]);
+ $sql .= ' AND b.fk_account='.$db->escape($search_account);
}
- if ($_REQUEST["search_paymenttype"])
+ if (! empty($search_paymenttype))
{
- $sql .= " AND c.code='".$db->escape($_REQUEST["search_paymenttype"])."'";
+ $sql .= " AND c.code='".$db->escape($search_paymenttype)."'";
}
- if ($_REQUEST["search_amount"])
+ if (! empty($search_amount))
{
- $sql .= " AND p.amount=".price2num($_REQUEST["search_amount"]);
+ $sql .= " AND p.amount=".price2num($search_amount);
}
- if ($_REQUEST["search_company"])
+ if (! empty($search_company))
{
- $sql .= " AND s.nom LIKE '%".$db->escape($_REQUEST["search_company"])."%'";
+ $sql .= " AND s.nom LIKE '%".$db->escape($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";
@@ -412,9 +416,9 @@ if (! $_GET['action'] && ! $_POST['action'])
$var=True;
$paramlist='';
- $paramlist.=($_REQUEST["search_ref"]?"&search_ref=".$_REQUEST["search_ref"]:"");
- $paramlist.=($_REQUEST["search_company"]?"&search_company=".$_REQUEST["search_company"]:"");
- $paramlist.=($_REQUEST["search_amount"]?"&search_amount=".$_REQUEST["search_amount"]:"");
+ $paramlist.=(! empty($search_ref)?"&search_ref=".$search_ref:"");
+ $paramlist.=(! empty($search_company)?"&search_company=".$search_company:"");
+ $paramlist.=(! empty($search_amount)?"&search_amount=".$search_amount:"");
print_barre_liste($langs->trans('SupplierPayments'), $page, 'paiement.php',$paramlist,$sortfield,$sortorder,'',$num);
@@ -436,20 +440,20 @@ if (! $_GET['action'] && ! $_POST['action'])
// Lines for filters fields
print '';
print '| ';
- print '';
+ print '';
print ' | ';
print ' | ';
print '';
- print '';
+ print '';
print ' | ';
print '';
- $form->select_types_paiements($_REQUEST["search_paymenttype"],'search_paymenttype','',2,1,1);
+ $form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1);
print ' | ';
print '';
- $form->select_comptes($_REQUEST["search_account"],'search_account',0,'',1);
+ $form->select_comptes($search_account,'search_account',0,'',1);
print ' | ';
print '';
- print '';
+ print '';
print '';
print ' | ';
print "
\n";