Fix: strict mode father
This commit is contained in:
parent
d9efa95e09
commit
8e141fce14
@ -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 '<tr><td width="30%" nowrap="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
||||
print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref');
|
||||
print '</td>';
|
||||
print "</tr>\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 '</td></tr>';
|
||||
|
||||
// Label
|
||||
|
||||
@ -1657,7 +1657,7 @@ else
|
||||
print '<td>';
|
||||
if ($object->lines[$i]->fk_product)
|
||||
{
|
||||
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
||||
print '<a name="'.$object->lines[$i]->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
||||
|
||||
$product_static=new ProductFournisseur($db);
|
||||
$product_static->fetch($object->lines[$i]->fk_product);
|
||||
|
||||
@ -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 = '<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('PaymentMode')).'</div>';
|
||||
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('PaymentMode')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -96,20 +96,20 @@ if ($action == 'add_paiement')
|
||||
// d'un paiement
|
||||
if (! $_POST['accountid'])
|
||||
{
|
||||
$mesg = '<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')).'</div>';
|
||||
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentities('AccountToCredit')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($total == 0)
|
||||
{
|
||||
$mesg = '<div class="error">'.$langs->transnoentities('ErrorFieldRequired',$langs->trans('PaymentAmount')).'</div>';
|
||||
setEventMessage($langs->trans('ErrorFieldRequired',$langs->trans('PaymentAmount')), 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (empty($datepaye))
|
||||
{
|
||||
$mesg = '<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Date')).'</div>';
|
||||
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='<div class="error">'.$paiement->error.'</div>';
|
||||
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='<div class="error">'.$paiement->error.'</div>';
|
||||
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 '<form name="addpaiement" action="paiement.php" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add_paiement">';
|
||||
@ -237,7 +234,7 @@ if ($action == 'create' || $action == 'add_paiement')
|
||||
$form->select_types_paiements(empty($_POST['paiementid'])?'':$_POST['paiementid'],'paiementid');
|
||||
print '</td>';
|
||||
print '<td rowspan="3" valign="top">';
|
||||
print '<textarea name="comment" wrap="soft" cols="60" rows="'._ROWS_3.'">'.(empty($_POST['comment'])?'':$_POST['comment']).'</textarea></td></tr>';
|
||||
print '<textarea name="comment" wrap="soft" cols="60" rows="'.ROWS_3.'">'.(empty($_POST['comment'])?'':$_POST['comment']).'</textarea></td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Numero').'</td><td><input name="num_paiement" type="text" value="'.(empty($_POST['num_paiement'])?'':$_POST['num_paiement']).'"></td></tr>';
|
||||
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 '<input type="text" size="8" name="'.$namef.'" value="'.GETPOST($namef).'">';
|
||||
print "</td></tr>\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 '<tr class="liste_titre">';
|
||||
print '<td align="left">';
|
||||
print '<input class="fat" type="text" size="4" name="search_ref" value="'.$_REQUEST["search_ref"].'">';
|
||||
print '<input class="fat" type="text" size="4" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="left">';
|
||||
print '<input class="fat" type="text" size="6" name="search_company" value="'.$_REQUEST["search_company"].'">';
|
||||
print '<input class="fat" type="text" size="6" name="search_company" value="'.$search_company.'">';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$form->select_types_paiements($_REQUEST["search_paymenttype"],'search_paymenttype','',2,1,1);
|
||||
$form->select_types_paiements($search_paymenttype,'search_paymenttype','',2,1,1);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$form->select_comptes($_REQUEST["search_account"],'search_account',0,'',1);
|
||||
$form->select_comptes($search_account,'search_account',0,'',1);
|
||||
print '</td>';
|
||||
print '<td align="right">';
|
||||
print '<input class="fat" type="text" size="4" name="search_amount" value="'.$_REQUEST["search_amount"].'">';
|
||||
print '<input class="fat" type="text" size="4" name="search_amount" value="'.$search_amount.'">';
|
||||
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user