New: Add search box for donation and trips/expenses

This commit is contained in:
Laurent Destailleur 2011-06-30 21:53:02 +00:00
parent c16d6251b5
commit c321b972de
8 changed files with 143 additions and 27 deletions

View File

@ -22,7 +22,7 @@
/**
* \file htdocs/compta/deplacement/list.php
* \brief Page list of expenses
* \version $Id: list.php,v 1.1 2011/06/29 17:55:33 eldy Exp $
* \version $Id: list.php,v 1.2 2011/06/30 21:53:02 eldy Exp $
*/
require("../../main.inc.php");
@ -49,6 +49,8 @@ if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="d.dated";
$limit = $conf->liste_limit;
$search_ref=GETPOST('search_ref');
/*
* View
@ -59,7 +61,7 @@ $tripandexpense_static=new Deplacement($db);
llxHeader();
$sql = "SELECT s.nom, s.rowid as socid,"; // Ou
$sql.= " d.rowid, d.type, d.dated as dd, d.km, "; // Comment
$sql.= " d.rowid, d.type, d.dated as dd, d.km,"; // Comment
$sql.= " u.name, u.firstname"; // Qui
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= ", ".MAIN_DB_PREFIX."deplacement as d";
@ -69,6 +71,10 @@ $sql.= " WHERE d.fk_user = u.rowid";
$sql.= " AND d.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid;
if (trim($search_ref) != '')
{
$sql.= ' AND d.rowid LIKE \'%'.$db->escape(trim($search_ref)) . '%\'';
}
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1 ,$offset);
@ -81,6 +87,7 @@ if ($resql)
print_barre_liste($langs->trans("ListOfFees"), $page, $_SERVER["PHP_SELF"],"&socid=$socid",$sortfield,$sortorder,'',$num);
$i = 0;
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","","&socid=$socid",'',$sortfield,$sortorder);
@ -92,6 +99,29 @@ if ($resql)
print_liste_field_titre('',$_SERVER["PHP_SELF"], '');
print "</tr>\n";
// Filters lines
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>';
print '<td class="liste_titre">';
//print '<input class="flat" size="10" type="text" name="search_company" value="'.$search_company.'">';
print '</td>';
print '<td class="liste_titre">';
//print '<input class="flat" size="10" type="text" name="search_name" value="'.$search_name.'">';
print '</td>';
print '<td class="liste_titre" align="left">';
print '&nbsp;';
print '</td>';
print '<td class="liste_titre" align="right">';
print '&nbsp;';
print '</td>';
print '<td class="liste_titre" align="right">';
print '&nbsp;';
print '</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print "</td></tr>\n";
$var=true;
while ($i < min($num,$limit))
{
@ -117,6 +147,7 @@ if ($resql)
}
print "</table>";
print "</form>\n";
$db->free($resql);
}
else
@ -125,5 +156,5 @@ else
}
$db->close();
llxFooter('$Date: 2011/06/29 17:55:33 $ - $Revision: 1.1 $');
llxFooter('$Date: 2011/06/30 21:53:02 $ - $Revision: 1.2 $');
?>

View File

@ -21,7 +21,7 @@
* \file htdocs/compta/dons/liste.php
* \ingroup don
* \brief Page de liste des dons
* \version $Id$
* \version $Id: liste.php,v 1.34 2011/06/30 21:53:02 eldy Exp $
*/
require("../../main.inc.php");
@ -43,6 +43,9 @@ if (! $sortfield) $sortfield="d.datedon";
$limit = $conf->liste_limit;
$statut=isset($_GET["statut"])?$_GET["statut"]:"-1";
$search_ref=GETPOST('search_ref');
$search_company=GETPOST('search_company');
$search_name=GETPOST('search_name');
@ -66,6 +69,18 @@ if ($statut >= 0)
{
$sql .= " AND d.fk_statut = ".$statut;
}
if (trim($search_ref) != '')
{
$sql.= ' AND d.rowid LIKE \'%'.$db->escape(trim($search_ref)) . '%\'';
}
if (trim($search_company) != '')
{
$sql.= ' AND d.societe LIKE \'%'.$db->escape(trim($search_company)) . '%\'';
}
if (trim($search_name) != '')
{
$sql.= ' AND d.nom LIKE \'%'.$db->escape(trim($search_name)) . '%\' OR d.prenom LIKE \'%'.$db->escape(trim($search_name)) . '%\'';
}
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1, $offset);
@ -89,6 +104,7 @@ if ($result)
}
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";
print "<table class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","&page=$page&statut=$statut","","",$sortfield,$sortorder);
@ -104,12 +120,38 @@ if ($result)
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.fk_statut","&page=$page&statut=$statut","",'align="right"',$sortfield,$sortorder);
print "</tr>\n";
// Filters lines
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>';
print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_company" value="'.$search_company.'">';
print '</td>';
print '<td class="liste_titre">';
print '<input class="flat" size="10" type="text" name="search_name" value="'.$search_name.'">';
print '</td>';
print '<td class="liste_titre" align="left">';
print '&nbsp;';
print '</td>';
if ($conf->projet->enabled)
{
print '<td class="liste_titre" align="right">';
print '&nbsp;';
print '</td>';
}
print '<td class="liste_titre" align="right">';
print '&nbsp;';
print '</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print "</td></tr>\n";
$var=True;
while ($i < min($num,$limit))
{
$objp = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
print "<tr ".$bc[$var].">";
$donationstatic->id=$objp->rowid;
$donationstatic->ref=$objp->rowid;
$donationstatic->nom=$objp->nom;
@ -140,6 +182,8 @@ if ($result)
$i++;
}
print "</table>";
print "</form>\n";
$db->free($resql);
}
else
{
@ -149,5 +193,5 @@ else
$db->close();
llxFooter('$Date$ - $Revision$');
llxFooter('$Date: 2011/06/30 21:53:02 $ - $Revision: 1.34 $');
?>

View File

@ -26,7 +26,7 @@
* \file htdocs/compta/facture.php
* \ingroup facture
* \brief Page to create/see an invoice
* \version $Id: facture.php,v 1.841 2011/06/30 13:27:21 hregis Exp $
* \version $Id: facture.php,v 1.842 2011/06/30 21:53:02 eldy Exp $
*/
require('../main.inc.php');
@ -61,6 +61,7 @@ $action=GETPOST('action');
$confirm=GETPOST('confirm');
$lineid=GETPOST('lineid');
$userid=GETPOST('userid');
$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref'):GETPOST('search_ref');
// Security check
$fieldid = isset($_GET["ref"])?'facnumber':'rowid';
@ -248,8 +249,8 @@ if ($action == 'valid')
if ($action == 'set_thirdparty')
{
$object->updateObjectField('facture',$id,'fk_soc',$socid);
$object->updateObjectField('facture',$id,'fk_soc',$socid);
Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id);
exit;
}
@ -3052,9 +3053,9 @@ else
{
$sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
}
if ($_POST['sf_ref'])
if (trim($search_ref) != '')
{
$sql.= ' AND f.facnumber LIKE \'%'.$db->escape(trim($_POST['sf_ref'])) . '%\'';
$sql.= ' AND f.facnumber LIKE \'%'.$db->escape(trim($search_ref)) . '%\'';
}
if ($sall)
{
@ -3106,17 +3107,17 @@ else
//print '<td class="liste_titre">&nbsp;</td>';
print '</tr>';
// Lignes des champs de filtre
// Filters lines
print '<tr class="liste_titre">';
print '<td class="liste_titre" align="left">';
print '<input class="flat" size="10" type="text" name="search_ref" value="'.$_GET['search_ref'].'">';
print '<td class="liste_titre" colspan="1" align="center">';
print '<input class="flat" size="10" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>';
print '<td class="liste_titre" align="center">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
//print '&nbsp;'.$langs->trans('Year').': ';
$syear = $year;
//print '&nbsp;'.$langs->trans('Year').': '.$syear;
//print 'xx'.$syear.'zz';
//if ($syear == '') $syear = date("Y");
$htmlother->select_year($syear,'year',1, 20, 5);
$htmlother->select_year($syear?$syear:-1,'year',1, 20, 5);
print '</td>';
print '<td class="liste_titre" align="left">&nbsp;</td>';
print '<td class="liste_titre" align="left">';
@ -3234,5 +3235,5 @@ else
$db->close();
llxFooter('$Date: 2011/06/30 13:27:21 $ - $Revision: 1.841 $');
llxFooter('$Date: 2011/06/30 21:53:02 $ - $Revision: 1.842 $');
?>

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2011 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
@ -22,7 +22,7 @@
* \file htdocs/compta/index.php
* \ingroup compta
* \brief Main page of accountancy area
* \version $Id: index.php,v 1.181 2011/06/29 17:55:34 eldy Exp $
* \version $Id: index.php,v 1.182 2011/06/30 21:53:02 eldy Exp $
*/
require('../main.inc.php');
@ -111,7 +111,7 @@ $max=3;
/*
* Find invoices
* Search invoices
*/
if ($conf->facture->enabled && $user->rights->facture->lire)
{
@ -127,6 +127,9 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
print "</table></form><br>";
}
/*
* Search supplier invoices
*/
if ($conf->fournisseur->enabled && $user->rights->fournisseur->lire)
{
print '<form method="post" action="'.DOL_URL_ROOT.'/fourn/facture/index.php">';
@ -141,6 +144,39 @@ if ($conf->fournisseur->enabled && $user->rights->fournisseur->lire)
print "</table></form><br>";
}
/*
* Search donations
*/
if ($conf->don->enabled && $user->rights->don->lire)
{
print '<form method="post" action="'.DOL_URL_ROOT.'/compta/dons/liste.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchADonation").'</td></tr>';
print "<tr ".$bc[0].">";
print "<td>".$langs->trans("Ref").':</td><td><input type="text" name="search_ref" class="flat" size="18"></td>';
print '<td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
//print "<tr ".$bc[0]."><td>".$langs->trans("Other").':</td><td><input type="text" name="sall" class="flat" size="18"></td>';
print '</tr>';
print "</table></form><br>";
}
/*
* Search expenses
*/
if ($conf->deplacement->enabled && $user->rights->deplacement->lire)
{
print '<form method="post" action="'.DOL_URL_ROOT.'/compta/deplacement/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchATripAndExpense").'</td></tr>';
print "<tr ".$bc[0].">";
print "<td>".$langs->trans("Ref").':</td><td><input type="text" name="search_ref" class="flat" size="18"></td>';
print '<td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
//print "<tr ".$bc[0]."><td>".$langs->trans("Other").':</td><td><input type="text" name="sall" class="flat" size="18"></td>';
print '</tr>';
print "</table></form><br>";
}
/**
* Draft customers invoices
@ -1009,5 +1045,5 @@ print '</table>';
$db->close();
llxFooter('$Date: 2011/06/29 17:55:34 $ - $Revision: 1.181 $');
llxFooter('$Date: 2011/06/30 21:53:02 $ - $Revision: 1.182 $');
?>

View File

@ -23,4 +23,5 @@ DonationStatusPaidShort=Received
ValidPromess=Validate promise
BuildDonationReceipt=Build receipt
DonationsModels=Documents models for donation receipts
LastModifiedDonations=Last %s modified donations
LastModifiedDonations=Last %s modified donations
SearchADonation=Search a donation

View File

@ -18,4 +18,5 @@ TF_OTHER=Other
TF_LUNCH=Lunch
TF_TRIP=Trip
ListTripsAndExpenses=List of trips and expenses
ExpensesArea=Trips and exepenses area
ExpensesArea=Trips and exepenses area
SearchATripAndExpense=Search a trip and expense

View File

@ -23,4 +23,5 @@ DonationStatusPaidShort=Payé
ValidPromess=Valider promesse
BuildDonationReceipt=Créer reçu
DonationsModels=Modèle de document de bon de réception de dons
LastModifiedDonations=Les %s derniers dons modifiés
LastModifiedDonations=Les %s derniers dons modifiés
SearchADonation=Rechercher un don

View File

@ -19,4 +19,5 @@ TF_OTHER=Autre
TF_LUNCH=Repas
TF_TRIP=Déplacement
ListTripsAndExpenses=Liste des notes de frais
ExpensesArea=Espace Notes de frais
ExpensesArea=Espace Notes de frais
SearchATripAndExpense=Rechercher une note de frais