forked from Wavyzz/dolibarr
Fix: Postgresql compatibility
New: Can filter on payment type and bank account in payment lists.
This commit is contained in:
@@ -3,6 +3,7 @@ English Dolibarr ChangeLog
|
||||
***** ChangeLog for 3.0 compared to 2.9 *****
|
||||
|
||||
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: Upgrade process works with Postgresql.
|
||||
- New: Task #10538: Add filter on expiration date of subscription for
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* 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>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -58,6 +58,8 @@ if (! $sortfield) $sortfield="p.rowid";
|
||||
|
||||
llxHeader('',$langs->trans("ListPayment"));
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$sql = "SELECT DISTINCT p.rowid, p.datep as dp, p.amount,";
|
||||
$sql.= " p.statut, p.num_paiement,";
|
||||
//$sql.= " c.libelle as paiement_type,";
|
||||
@@ -90,13 +92,21 @@ if ($_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"])
|
||||
{
|
||||
$sql .=" AND p.amount=".price2num($_REQUEST["search_amount"]);
|
||||
}
|
||||
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
|
||||
@@ -159,7 +169,12 @@ if ($resql)
|
||||
print '<td align="left">';
|
||||
print '<input class="fat" type="text" size="6" name="search_company" value="'.$_REQUEST["search_company"].'">';
|
||||
print '</td>';
|
||||
print '<td colspan="2"> </td>';
|
||||
print '<td>';
|
||||
$form->select_types_paiements($_REQUEST["search_paymenttype"],'search_paymenttype','',2,1,1);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$form->select_comptes($_REQUEST["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 type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
|
||||
|
||||
@@ -1551,7 +1551,7 @@ class Form
|
||||
* \brief Retourne la liste des modes de paiements possibles
|
||||
* \param selected Id du mode de paiement pre-selectionne
|
||||
* \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 empty 1=peut etre vide, 0 sinon
|
||||
* \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
|
||||
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 == 1) 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
|
||||
* \param selected Id account pre-selected
|
||||
* \param htmlname Name of select zone
|
||||
* \param statut Status of searched accounts (0=open, 1=closed)
|
||||
* \param filtre To filter list
|
||||
* \param useempty Add an empty value in list
|
||||
* Return list of bank accounts
|
||||
* @param selected Id account pre-selected
|
||||
* @param htmlname Name of select zone
|
||||
* @param statut Status of searched accounts (0=open, 1=closed)
|
||||
* @param filtre To filter list
|
||||
* @param useempty Add an empty value in list
|
||||
*/
|
||||
function select_comptes($selected='',$htmlname='accountid',$statut=0,$filtre='',$useempty=0)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* 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
|
||||
* 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
|
||||
* \param sql SQL request
|
||||
* \return array
|
||||
* Return nb of elements, total amount and avg amount by year
|
||||
* @param sql SQL request
|
||||
* @return array
|
||||
*/
|
||||
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)
|
||||
{
|
||||
@@ -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)
|
||||
{
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -396,13 +396,21 @@ if (! $_GET['action'] && ! $_POST['action'])
|
||||
{
|
||||
$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"])
|
||||
{
|
||||
$sql .=" AND p.amount=".price2num($_REQUEST["search_amount"]);
|
||||
}
|
||||
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->plimit($limit + 1 ,$offset);
|
||||
@@ -442,7 +450,12 @@ if (! $_GET['action'] && ! $_POST['action'])
|
||||
print '<td align="left">';
|
||||
print '<input class="fat" type="text" size="6" name="search_company" value="'.$_REQUEST["search_company"].'">';
|
||||
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 '<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").'">';
|
||||
|
||||
@@ -208,6 +208,9 @@ class DoliDb
|
||||
$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"
|
||||
$line=preg_replace('/AFTER [a-z0-9_]+/i','',$line);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user