Fix: Postgresql compatibility
New: Can filter on payment type and bank account in payment lists.
This commit is contained in:
parent
00803e8ae8
commit
f24214d9ef
@ -3,6 +3,7 @@ English Dolibarr ChangeLog
|
|||||||
***** ChangeLog for 3.0 compared to 2.9 *****
|
***** ChangeLog for 3.0 compared to 2.9 *****
|
||||||
|
|
||||||
For users:
|
For users:
|
||||||
|
- New: Can filter on payment type and bank account in payment lists.
|
||||||
- New: When sending supplier orders by mail, a text is predefined.
|
- New: When sending supplier orders by mail, a text is predefined.
|
||||||
- New: Upgrade process works with Postgresql.
|
- New: Upgrade process works with Postgresql.
|
||||||
- New: Task #10538: Add filter on expiration date of subscription for
|
- New: Task #10538: Add filter on expiration date of subscription for
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -53,11 +53,13 @@ if (! $sortfield) $sortfield="p.rowid";
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader('',$langs->trans("ListPayment"));
|
llxHeader('',$langs->trans("ListPayment"));
|
||||||
|
|
||||||
|
$form=new Form($db);
|
||||||
|
|
||||||
$sql = "SELECT DISTINCT p.rowid, p.datep as dp, p.amount,";
|
$sql = "SELECT DISTINCT p.rowid, p.datep as dp, p.amount,";
|
||||||
$sql.= " p.statut, p.num_paiement,";
|
$sql.= " p.statut, p.num_paiement,";
|
||||||
//$sql.= " c.libelle as paiement_type,";
|
//$sql.= " c.libelle as paiement_type,";
|
||||||
@ -73,47 +75,55 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid";
|
|||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
|
||||||
if (!$user->rights->societe->client->voir && !$socid)
|
if (!$user->rights->societe->client->voir && !$socid)
|
||||||
{
|
{
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||||
}
|
}
|
||||||
$sql.= " WHERE p.fk_paiement = c.id";
|
$sql.= " WHERE p.fk_paiement = c.id";
|
||||||
$sql.= " AND s.entity = ".$conf->entity;
|
$sql.= " AND s.entity = ".$conf->entity;
|
||||||
if (!$user->rights->societe->client->voir && !$socid)
|
if (!$user->rights->societe->client->voir && !$socid)
|
||||||
{
|
{
|
||||||
$sql.= " AND sc.fk_user = " .$user->id;
|
$sql.= " AND sc.fk_user = " .$user->id;
|
||||||
}
|
}
|
||||||
if ($socid)
|
if ($socid)
|
||||||
{
|
{
|
||||||
$sql.= " AND f.fk_soc = ".$socid;
|
$sql.= " AND f.fk_soc = ".$socid;
|
||||||
}
|
}
|
||||||
// Search criteria
|
// Search criteria
|
||||||
if ($_REQUEST["search_ref"])
|
if ($_REQUEST["search_ref"])
|
||||||
{
|
{
|
||||||
$sql .=" AND p.rowid=".$_REQUEST["search_ref"];
|
$sql .=" AND p.rowid=".$_REQUEST["search_ref"];
|
||||||
|
}
|
||||||
|
if ($_REQUEST["search_account"])
|
||||||
|
{
|
||||||
|
$sql .=" AND b.fk_account=".$_REQUEST["search_account"];
|
||||||
|
}
|
||||||
|
if ($_REQUEST["search_paymenttype"])
|
||||||
|
{
|
||||||
|
$sql .=" AND c.code='".$_REQUEST["search_paymenttype"]."'";
|
||||||
}
|
}
|
||||||
if ($_REQUEST["search_amount"])
|
if ($_REQUEST["search_amount"])
|
||||||
{
|
{
|
||||||
$sql .=" AND p.amount=".price2num($_REQUEST["search_amount"]);
|
$sql .=" AND p.amount=".price2num($_REQUEST["search_amount"]);
|
||||||
}
|
}
|
||||||
if ($_REQUEST["search_company"])
|
if ($_REQUEST["search_company"])
|
||||||
{
|
{
|
||||||
$sql .=" AND s.nom like '%".addslashes($_REQUEST["search_company"])."%'";
|
$sql .=" AND s.nom LIKE '%".addslashes($_REQUEST["search_company"])."%'";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_GET["orphelins"]) // Option for debugging purpose only
|
if ($_GET["orphelins"]) // Option for debugging purpose only
|
||||||
{
|
{
|
||||||
// Paiements lies a aucune facture (pour aide au diagnostic)
|
// Paiements lies a aucune facture (pour aide au diagnostic)
|
||||||
$sql = "SELECT p.rowid, p.datep as dp, p.amount,";
|
$sql = "SELECT p.rowid, p.datep as dp, p.amount,";
|
||||||
$sql.= " p.statut, p.num_paiement,";
|
$sql.= " p.statut, p.num_paiement,";
|
||||||
//$sql.= " c.libelle as paiement_type";
|
//$sql.= " c.libelle as paiement_type";
|
||||||
$sql.= " c.code as paiement_code,";
|
$sql.= " c.code as paiement_code,";
|
||||||
$sql.= " s.rowid as socid, s.nom";
|
$sql.= " s.rowid as socid, s.nom";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p,";
|
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p,";
|
||||||
$sql.= " ".MAIN_DB_PREFIX."c_paiement as c";
|
$sql.= " ".MAIN_DB_PREFIX."c_paiement as c";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
|
||||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
|
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
|
||||||
$sql.= " WHERE p.fk_paiement = c.id";
|
$sql.= " WHERE p.fk_paiement = c.id";
|
||||||
$sql.= " AND s.entity = ".$conf->entity;
|
$sql.= " AND s.entity = ".$conf->entity;
|
||||||
$sql.= " AND pf.rowid IS NULL";
|
$sql.= " AND pf.rowid IS NULL";
|
||||||
}
|
}
|
||||||
$sql.= $db->order($sortfield,$sortorder);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
$sql.= $db->plimit( $limit+1 ,$offset);
|
$sql.= $db->plimit( $limit+1 ,$offset);
|
||||||
@ -123,111 +133,116 @@ $resql = $db->query($sql);
|
|||||||
|
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
$paramlist='';
|
$paramlist='';
|
||||||
$paramlist.=($_REQUEST["orphelins"]?"&orphelins=1":"");
|
$paramlist.=($_REQUEST["orphelins"]?"&orphelins=1":"");
|
||||||
$paramlist.=($_REQUEST["search_ref"]?"&search_ref=".$_REQUEST["search_ref"]:"");
|
$paramlist.=($_REQUEST["search_ref"]?"&search_ref=".$_REQUEST["search_ref"]:"");
|
||||||
$paramlist.=($_REQUEST["search_company"]?"&search_company=".$_REQUEST["search_company"]:"");
|
$paramlist.=($_REQUEST["search_company"]?"&search_company=".$_REQUEST["search_company"]:"");
|
||||||
$paramlist.=($_REQUEST["search_amount"]?"&search_amount=".$_REQUEST["search_amount"]:"");
|
$paramlist.=($_REQUEST["search_amount"]?"&search_amount=".$_REQUEST["search_amount"]:"");
|
||||||
|
|
||||||
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, "liste.php",$paramlist,$sortfield,$sortorder,'',$num);
|
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, "liste.php",$paramlist,$sortfield,$sortorder,'',$num);
|
||||||
|
|
||||||
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%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre($langs->trans("RefPayment"),"liste.php","p.rowid","",$paramlist,"",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("RefPayment"),"liste.php","p.rowid","",$paramlist,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Date"),"liste.php","dp","",$paramlist,'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Date"),"liste.php","dp","",$paramlist,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("ThirdParty"),"liste.php","s.nom","",$paramlist,"",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("ThirdParty"),"liste.php","s.nom","",$paramlist,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Type"),"liste.php","c.libelle","",$paramlist,"",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Type"),"liste.php","c.libelle","",$paramlist,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Account"),"liste.php","ba.label","",$paramlist,"",$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Account"),"liste.php","ba.label","",$paramlist,"",$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Amount"),"liste.php","p.amount","",$paramlist,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Amount"),"liste.php","p.amount","",$paramlist,'align="right"',$sortfield,$sortorder);
|
||||||
//print_liste_field_titre($langs->trans("Invoices"),"","","",$paramlist,'align="left"',$sortfield,$sortorder);
|
//print_liste_field_titre($langs->trans("Invoices"),"","","",$paramlist,'align="left"',$sortfield,$sortorder);
|
||||||
if ($conf->global->BILL_ADD_PAYMENT_VALIDATION)
|
if ($conf->global->BILL_ADD_PAYMENT_VALIDATION)
|
||||||
{
|
{
|
||||||
print_liste_field_titre($langs->trans("Status"),"liste.php","p.statut","",$paramlist,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Status"),"liste.php","p.statut","",$paramlist,'align="right"',$sortfield,$sortorder);
|
||||||
}
|
}
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
// Lines for filters fields
|
// Lines for filters fields
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td align="left">';
|
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="'.$_REQUEST["search_ref"].'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print '<td align="left">';
|
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="'.$_REQUEST["search_company"].'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td colspan="2"> </td>';
|
print '<td>';
|
||||||
print '<td align="right">';
|
$form->select_types_paiements($_REQUEST["search_paymenttype"],'search_paymenttype','',2,1,1);
|
||||||
print '<input class="fat" type="text" size="4" name="search_amount" value="'.$_REQUEST["search_amount"].'">';
|
print '</td>';
|
||||||
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 '</td>';
|
$form->select_comptes($_REQUEST["search_account"],'search_account',0,'',1);
|
||||||
if ($conf->global->BILL_ADD_PAYMENT_VALIDATION)
|
print '</td>';
|
||||||
{
|
print '<td align="right">';
|
||||||
print '<td align="right">';
|
print '<input class="fat" type="text" size="4" name="search_amount" value="'.$_REQUEST["search_amount"].'">';
|
||||||
print '</td>';
|
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";
|
if ($conf->global->BILL_ADD_PAYMENT_VALIDATION)
|
||||||
|
{
|
||||||
|
print '<td align="right">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num,$limit))
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
print '<td width="40">';
|
print '<td width="40">';
|
||||||
$paymentstatic->id=$objp->rowid;
|
$paymentstatic->id=$objp->rowid;
|
||||||
$paymentstatic->ref=$objp->rowid;
|
$paymentstatic->ref=$objp->rowid;
|
||||||
print $paymentstatic->getNomUrl(1);
|
print $paymentstatic->getNomUrl(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td align="center">'.dol_print_date($db->jdate($objp->dp),'day').'</td>';
|
print '<td align="center">'.dol_print_date($db->jdate($objp->dp),'day').'</td>';
|
||||||
|
|
||||||
// Company
|
// Company
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($objp->socid)
|
if ($objp->socid)
|
||||||
{
|
{
|
||||||
$companystatic->id=$objp->socid;
|
$companystatic->id=$objp->socid;
|
||||||
$companystatic->nom=$objp->nom;
|
$companystatic->nom=$objp->nom;
|
||||||
print $companystatic->getNomUrl(1,'',24);
|
print $companystatic->getNomUrl(1,'',24);
|
||||||
}
|
}
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
print '<td>'.$langs->trans("PaymentTypeShort".$objp->paiement_code).' '.$objp->num_paiement.'</td>';
|
print '<td>'.$langs->trans("PaymentTypeShort".$objp->paiement_code).' '.$objp->num_paiement.'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
if ($objp->bid)
|
if ($objp->bid)
|
||||||
{
|
{
|
||||||
$accountstatic->id=$objp->bid;
|
$accountstatic->id=$objp->bid;
|
||||||
$accountstatic->label=$objp->label;
|
$accountstatic->label=$objp->label;
|
||||||
print $accountstatic->getNomUrl(1);
|
print $accountstatic->getNomUrl(1);
|
||||||
}
|
}
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right">'.price($objp->amount).'</td>';
|
print '<td align="right">'.price($objp->amount).'</td>';
|
||||||
|
|
||||||
if ($conf->global->BILL_ADD_PAYMENT_VALIDATION)
|
if ($conf->global->BILL_ADD_PAYMENT_VALIDATION)
|
||||||
{
|
{
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ($objp->statut == 0) print '<a href="fiche.php?id='.$objp->rowid.'&action=valide">';
|
if ($objp->statut == 0) print '<a href="fiche.php?id='.$objp->rowid.'&action=valide">';
|
||||||
print $paymentstatic->LibStatut($objp->statut,5);
|
print $paymentstatic->LibStatut($objp->statut,5);
|
||||||
if ($objp->statut == 0) print '</a>';
|
if ($objp->statut == 0) print '</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -1551,7 +1551,7 @@ class Form
|
|||||||
* \brief Retourne la liste des modes de paiements possibles
|
* \brief Retourne la liste des modes de paiements possibles
|
||||||
* \param selected Id du mode de paiement pre-selectionne
|
* \param selected Id du mode de paiement pre-selectionne
|
||||||
* \param htmlname Nom de la zone select
|
* \param htmlname Nom de la zone select
|
||||||
* \param filtertype Pour filtre
|
* \param filtertype To filter on field type in llx_c_paiement
|
||||||
* \param format 0=id+libelle, 1=code+code, 2=code+libelle
|
* \param format 0=id+libelle, 1=code+code, 2=code+libelle
|
||||||
* \param empty 1=peut etre vide, 0 sinon
|
* \param empty 1=peut etre vide, 0 sinon
|
||||||
* \param noadmininfo 0=Add admin info, 1=Disable admin info
|
* \param noadmininfo 0=Add admin info, 1=Disable admin info
|
||||||
@ -1576,6 +1576,9 @@ class Form
|
|||||||
// On passe si on a demande de filtrer sur des modes de paiments particuliers
|
// On passe si on a demande de filtrer sur des modes de paiments particuliers
|
||||||
if (sizeof($filterarray) && ! in_array($arraytypes['type'],$filterarray)) continue;
|
if (sizeof($filterarray) && ! in_array($arraytypes['type'],$filterarray)) continue;
|
||||||
|
|
||||||
|
// We discard empty line if showempty is on because an empty line has already been output.
|
||||||
|
if ($empty && empty($arraytypes['code'])) continue;
|
||||||
|
|
||||||
if ($format == 0) print '<option value="'.$id.'"';
|
if ($format == 0) print '<option value="'.$id.'"';
|
||||||
if ($format == 1) print '<option value="'.$arraytypes['code'].'"';
|
if ($format == 1) print '<option value="'.$arraytypes['code'].'"';
|
||||||
if ($format == 2) print '<option value="'.$arraytypes['code'].'"';
|
if ($format == 2) print '<option value="'.$arraytypes['code'].'"';
|
||||||
@ -1682,12 +1685,12 @@ class Form
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return list of bank accounts
|
* Return list of bank accounts
|
||||||
* \param selected Id account pre-selected
|
* @param selected Id account pre-selected
|
||||||
* \param htmlname Name of select zone
|
* @param htmlname Name of select zone
|
||||||
* \param statut Status of searched accounts (0=open, 1=closed)
|
* @param statut Status of searched accounts (0=open, 1=closed)
|
||||||
* \param filtre To filter list
|
* @param filtre To filter list
|
||||||
* \param useempty Add an empty value in list
|
* @param useempty Add an empty value in list
|
||||||
*/
|
*/
|
||||||
function select_comptes($selected='',$htmlname='accountid',$statut=0,$filtre='',$useempty=0)
|
function select_comptes($selected='',$htmlname='accountid',$statut=0,$filtre='',$useempty=0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (c) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (c) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -137,9 +137,9 @@ class Stats
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return nb of elements, total amount and avg amount by year
|
* Return nb of elements, total amount and avg amount by year
|
||||||
* \param sql SQL request
|
* @param sql SQL request
|
||||||
* \return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function _getAllByYear($sql)
|
function _getAllByYear($sql)
|
||||||
{
|
{
|
||||||
@ -169,8 +169,9 @@ class Stats
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie le nombre de proposition par mois pour une annee donnee
|
* Renvoie le nombre de proposition par mois pour une annee donnee
|
||||||
*
|
* @param year Year
|
||||||
|
* @param sql SQL
|
||||||
*/
|
*/
|
||||||
function _getNbByMonth($year, $sql)
|
function _getNbByMonth($year, $sql)
|
||||||
{
|
{
|
||||||
@ -215,8 +216,9 @@ class Stats
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie le nombre d'element par mois pour une annee donnee
|
* Renvoie le nombre d'element par mois pour une annee donnee
|
||||||
*
|
* @param year Year
|
||||||
|
* @param sql SQL
|
||||||
*/
|
*/
|
||||||
function _getAmountByMonth($year, $sql)
|
function _getAmountByMonth($year, $sql)
|
||||||
{
|
{
|
||||||
@ -256,8 +258,9 @@ class Stats
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie le montant moyen par mois pour une annee donnee
|
* Renvoie le montant moyen par mois pour une annee donnee
|
||||||
*
|
* @param year Year
|
||||||
|
* @param sql SQL
|
||||||
*/
|
*/
|
||||||
function _getAverageByMonth($year, $sql)
|
function _getAverageByMonth($year, $sql)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -396,13 +396,21 @@ if (! $_GET['action'] && ! $_POST['action'])
|
|||||||
{
|
{
|
||||||
$sql .=" AND p.rowid=".$_REQUEST["search_ref"];
|
$sql .=" AND p.rowid=".$_REQUEST["search_ref"];
|
||||||
}
|
}
|
||||||
|
if ($_REQUEST["search_account"])
|
||||||
|
{
|
||||||
|
$sql .=" AND b.fk_account=".$_REQUEST["search_account"];
|
||||||
|
}
|
||||||
|
if ($_REQUEST["search_paymenttype"])
|
||||||
|
{
|
||||||
|
$sql .=" AND c.code='".$_REQUEST["search_paymenttype"]."'";
|
||||||
|
}
|
||||||
if ($_REQUEST["search_amount"])
|
if ($_REQUEST["search_amount"])
|
||||||
{
|
{
|
||||||
$sql .=" AND p.amount=".price2num($_REQUEST["search_amount"]);
|
$sql .=" AND p.amount=".price2num($_REQUEST["search_amount"]);
|
||||||
}
|
}
|
||||||
if ($_REQUEST["search_company"])
|
if ($_REQUEST["search_company"])
|
||||||
{
|
{
|
||||||
$sql .=" AND s.nom like '%".addslashes($_REQUEST["search_company"])."%'";
|
$sql .=" AND s.nom LIKE '%".addslashes($_REQUEST["search_company"])."%'";
|
||||||
}
|
}
|
||||||
$sql.= $db->order($sortfield,$sortorder);
|
$sql.= $db->order($sortfield,$sortorder);
|
||||||
$sql.= $db->plimit($limit + 1 ,$offset);
|
$sql.= $db->plimit($limit + 1 ,$offset);
|
||||||
@ -442,7 +450,12 @@ if (! $_GET['action'] && ! $_POST['action'])
|
|||||||
print '<td align="left">';
|
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="'.$_REQUEST["search_company"].'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td colspan="2"> </td>';
|
print '<td>';
|
||||||
|
$html->select_types_paiements($_REQUEST["search_paymenttype"],'search_paymenttype','',2,1,1);
|
||||||
|
print '</td>';
|
||||||
|
print '<td>';
|
||||||
|
$html->select_comptes($_REQUEST["search_account"],'search_account',0,'',1);
|
||||||
|
print '</td>';
|
||||||
print '<td align="right">';
|
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="'.$_REQUEST["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 '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||||
|
|||||||
@ -208,6 +208,9 @@ class DoliDb
|
|||||||
$line=preg_replace('/unique index\s*\((\w+\s*,\s*\w+)\)/i','UNIQUE\(\\1\)',$line);
|
$line=preg_replace('/unique index\s*\((\w+\s*,\s*\w+)\)/i','UNIQUE\(\\1\)',$line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// To have postgresql case sensitive
|
||||||
|
$line=str_replace(' LIKE \'',' ILIKE \'',$line);
|
||||||
|
|
||||||
# We remove end of requests "AFTER fieldxxx"
|
# We remove end of requests "AFTER fieldxxx"
|
||||||
$line=preg_replace('/AFTER [a-z0-9_]+/i','',$line);
|
$line=preg_replace('/AFTER [a-z0-9_]+/i','',$line);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user