Merge pull request #2776 from aspangaro/develop-accountancy_patch1
Accountancy: add a button to purge search criteria on list
This commit is contained in:
commit
33f98a4433
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -27,19 +27,23 @@
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
||||
// langs
|
||||
$langs->load("bills");
|
||||
$langs->load("compta");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
|
||||
$account_parent = GETPOST('account_parent');
|
||||
$changeaccount = GETPOST('changeaccount');
|
||||
$search_ref = GETPOST('search_ref','alpha');
|
||||
$search_facture = GETPOST('search_facture','alpha');
|
||||
$search_label = GETPOST('search_label','alpha');
|
||||
$search_desc = GETPOST('search_desc','alpha');
|
||||
$search_amount = GETPOST('search_amount','alpha');
|
||||
$search_acount = GETPOST('search_account','alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
@ -49,13 +53,18 @@ if (! $user->rights->accounting->ventilation->dispatch)
|
||||
|
||||
$formventilation = new FormVentilation($db);
|
||||
|
||||
// change account
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref='';
|
||||
$search_facture='';
|
||||
$search_label='';
|
||||
$search_desc='';
|
||||
$search_amount='';
|
||||
$search_account='';
|
||||
}
|
||||
|
||||
$changeaccount = GETPOST('changeaccount');
|
||||
|
||||
$is_search = GETPOST('button_search_x');
|
||||
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0 && empty($is_search)) {
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
$error = 0;
|
||||
|
||||
$db->begin();
|
||||
@ -110,17 +119,20 @@ $sql .= " AND aa.rowid = l.fk_code_ventilation";
|
||||
if (strlen(trim(GETPOST("search_facture")))) {
|
||||
$sql .= " AND f.facnumber like '%" . GETPOST("search_facture") . "%'";
|
||||
}
|
||||
if (strlen(trim(GETPOST("search_ref")))) {
|
||||
$sql .= " AND p.ref like '%" . GETPOST("search_ref") . "%'";
|
||||
if (strlen(trim($search_ref))) {
|
||||
$sql .= " AND p.ref like '%" . $search_ref . "%'";
|
||||
}
|
||||
if (strlen(trim(GETPOST("search_label")))) {
|
||||
$sql .= " AND p.label like '%" . GETPOST("search_label") . "%'";
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= " AND p.label like '%" . $search_label . "%'";
|
||||
}
|
||||
if (strlen(trim(GETPOST("search_desc")))) {
|
||||
$sql .= " AND l.description like '%" . GETPOST("search_desc") . "%'";
|
||||
if (strlen(trim($search_desc))) {
|
||||
$sql .= " AND l.description like '%" . $search_desc . "%'";
|
||||
}
|
||||
if (strlen(trim(GETPOST("search_account")))) {
|
||||
$sql .= " AND aa.account_number like '%" . GETPOST("search_account") . "%'";
|
||||
if (strlen(trim($search_amount))) {
|
||||
$sql .= " AND l.total_ht like '%" . $search_amount . "%'";
|
||||
}
|
||||
if (strlen(trim($search_account))) {
|
||||
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
||||
}
|
||||
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
@ -161,18 +173,17 @@ if ($result) {
|
||||
print '<td align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre"><td><input name="search_facture" size="8" value="' . GETPOST("search_facture") . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . GETPOST("search_ref") . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . GETPOST("search_label") . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . GETPOST("search_desc") . '"></td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_account" value="' . GETPOST("search_account") . '"></td>';
|
||||
print '<tr class="liste_titre"><td><input name="search_facture" size="8" value="' . $search_facture . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount. '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="right">';
|
||||
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 align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
$facture_static = new Facture($db);
|
||||
$product_static = new Product($db);
|
||||
@ -180,7 +191,7 @@ if ($result) {
|
||||
$var = True;
|
||||
while ( $objp = $db->fetch_object($result) ) {
|
||||
$var = ! $var;
|
||||
$codeCompta = $objp->account_number . ' ' . $objp->label;
|
||||
$codecompta = $objp->account_number . ' ' . $objp->label;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
@ -202,8 +213,8 @@ if ($result) {
|
||||
|
||||
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
|
||||
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
|
||||
print '<td align="left">' . price($objp->total_ht) . '</td>';
|
||||
print '<td align="left">' . $codeCompta . '</td>';
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
print '<td align="left">' . $codecompta . '</td>';
|
||||
print '<td>' . $objp->rowid . '</td>';
|
||||
print '<td><a href="./card.php?id=' . $objp->rowid . '">';
|
||||
print img_edit();
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -26,34 +26,46 @@
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
|
||||
$account_parent = GETPOST('account_parent');
|
||||
$changeaccount = GETPOST('changeaccount');
|
||||
$search_ref = GETPOST('search_ref','alpha');
|
||||
$search_facture = GETPOST('search_facture','alpha');
|
||||
$search_label = GETPOST('search_label','alpha');
|
||||
$search_desc = GETPOST('search_desc','alpha');
|
||||
$search_amount = GETPOST('search_amount','alpha');
|
||||
$search_acount = GETPOST('search_account','alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->ventilation->dispatch)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
$formventilation = new FormVentilation($db);
|
||||
|
||||
$changeaccount = GETPOST('changeaccount');
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref='';
|
||||
$search_facture='';
|
||||
$search_label='';
|
||||
$search_desc='';
|
||||
$search_amount='';
|
||||
$search_account='';
|
||||
}
|
||||
|
||||
$is_search = GETPOST('button_search_x');
|
||||
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0 && empty($is_search)) {
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
$error = 0;
|
||||
|
||||
$db->begin();
|
||||
@ -83,7 +95,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && empty($is_search))
|
||||
|
||||
llxHeader('', $langs->trans("SuppliersVentilation") . ' - ' . $langs->trans("Dispatched"));
|
||||
|
||||
$page = $_GET["page"];
|
||||
$page = GETPOST("page");
|
||||
if ($page < 0)
|
||||
$page = 0;
|
||||
|
||||
@ -105,20 +117,23 @@ $sql .= " , " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
|
||||
$sql .= " AND aa.rowid = l.fk_code_ventilation";
|
||||
if (strlen(trim($_GET["search_facture"]))) {
|
||||
$sql .= " AND f.ref like '%" . $_GET["search_facture"] . "%'";
|
||||
if (strlen(trim($search_facture))) {
|
||||
$sql .= " AND f.ref like '%" . $search_facture . "%'";
|
||||
}
|
||||
if (strlen(trim($_GET["search_ref"]))) {
|
||||
$sql .= " AND p.ref like '%" . $_GET["search_ref"] . "%'";
|
||||
if (strlen(trim($search_ref))) {
|
||||
$sql .= " AND p.ref like '%" . $search_ref . "%'";
|
||||
}
|
||||
if (strlen(trim($_GET["search_label"]))) {
|
||||
$sql .= " AND p.label like '%" . $_GET["search_label"] . "%'";
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= " AND p.label like '%" . $search_label . "%'";
|
||||
}
|
||||
if (strlen(trim($_GET["search_desc"]))) {
|
||||
$sql .= " AND l.description like '%" . $_GET["search_desc"] . "%'";
|
||||
if (strlen(trim($search_desc))) {
|
||||
$sql .= " AND l.description like '%" . $search_desc . "%'";
|
||||
}
|
||||
if (strlen(trim($_GET["search_account"]))) {
|
||||
$sql .= " AND aa.account_number like '%" . $_GET["search_account"] . "%'";
|
||||
if (strlen(trim($search_amount))) {
|
||||
$sql .= " AND l.total_ht like '%" . $search_amount . "%'";
|
||||
}
|
||||
if (strlen(trim($search_account))) {
|
||||
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
|
||||
}
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND f.entity = '" . $conf->entity . "'";
|
||||
@ -159,18 +174,17 @@ if ($result) {
|
||||
print '<td align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre"><td><input name="search_facture" size="8" value="' . $_GET["search_facture"] . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . GETPOST("search_ref") . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . GETPOST("search_label") . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . GETPOST("search_desc") . '"></td>';
|
||||
print '<td align="right"> </td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_account" value="' . GETPOST("search_account") . '"></td>';
|
||||
print '<tr class="liste_titre"><td><input name="search_facture" size="8" value="' . $search_facture . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_amount" value="' . $search_amount . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="right">';
|
||||
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 align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
$facturefournisseur_static = new FactureFournisseur($db);
|
||||
$product_static = new Product($db);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user