From 10a895f1bddba186933398d587333e5a95593552 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 5 May 2015 22:36:48 +0200 Subject: [PATCH 1/4] Accountancy: add a button to purge search criteria on list --- htdocs/accountancy/customer/lines.php | 73 +++++++++++++++----------- htdocs/accountancy/supplier/lines.php | 74 ++++++++++++++++----------- 2 files changed, 86 insertions(+), 61 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 01806db8332..bc50d33695c 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2014 Ari Elbaz (elarifr) * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -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 ' '; print "\n"; - print ''; - print ''; - print ''; - print ''; - print ' '; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ' '; - print ''; - print ''; - print ''; print ' '; - print "\n"; + print ''; + print ''; + print "\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 ""; @@ -202,8 +213,8 @@ if ($result) { print '' . dol_trunc($objp->product_label, 24) . ''; print '' . nl2br(dol_trunc($objp->description, 32)) . ''; - print '' . price($objp->total_ht) . ''; - print '' . $codeCompta . ''; + print '' . price($objp->total_ht) . ''; + print '' . $codecompta . ''; print '' . $objp->rowid . ''; print ''; print img_edit(); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 5df5ee0c06f..dd6319e7c43 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2014 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -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 ' '; print "\n"; - print ''; - print ''; - print ''; - print ''; - print ' '; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ' '; - print ''; - print ''; - print ''; print ' '; - print "\n"; + print ''; + print ''; + print "\n"; $facturefournisseur_static = new FactureFournisseur($db); $product_static = new Product($db); From 1cb7d284a547e3a1de94b1206f213a6b73a9c05e Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 6 May 2015 12:16:36 +0200 Subject: [PATCH 2/4] Fix : shipment PDF was not using generation params Conflicts: htdocs/core/modules/expedition/modules_expedition.php htdocs/expedition/fiche.php --- htdocs/core/modules/expedition/modules_expedition.php | 4 ++-- htdocs/expedition/card.php | 2 +- htdocs/expedition/class/expedition.class.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/expedition/modules_expedition.php b/htdocs/core/modules/expedition/modules_expedition.php index d9205503e11..a2437d5001f 100644 --- a/htdocs/core/modules/expedition/modules_expedition.php +++ b/htdocs/core/modules/expedition/modules_expedition.php @@ -152,7 +152,7 @@ abstract class ModelNumRefExpedition * @return int <=0 if KO, >0 if OK * @deprecated Use the new function generateDocument of Expedition class */ -function expedition_pdf_create(DoliDB $db, Expedition $object, $modele, $outputlangs) +function expedition_pdf_create(DoliDB $db, Expedition $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - return $object->generateDocument($modele, $outputlangs); + return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 8826c453b6f..db8b236feaa 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -406,7 +406,7 @@ if (empty($reshook)) $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($newlang); } - $result = $object->generateDocument($object->modelpdf, $outputlangs); + $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db,$result); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 8a9377b1507..e93dfb2d768 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1645,7 +1645,7 @@ class Expedition extends CommonObject * @param Translate $outputlangs Objet lang a utiliser pour traduction * @return int <=0 if KO, >0 if OK */ - public function generateDocument($modele, $outputlangs) + public function generateDocument($modele, $outputlangs,$hidedetails=0, $hidedesc=0, $hideref=0) { global $conf,$user,$langs; @@ -1668,7 +1668,7 @@ class Expedition extends CommonObject $this->fetch_origin(); - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, 0, 0, 0); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } /** From e191fc41a3c3e2510429b7846b2ff7514cd9ae8b Mon Sep 17 00:00:00 2001 From: fmarcet Date: Mon, 4 May 2015 09:22:55 +0200 Subject: [PATCH 3/4] FIX: Bug on order and supplier invoice numeration mask when use supplier code --- htdocs/core/lib/functions2.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index f2b105242de..5fbf3fb9c5e 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2008-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2014 Marcos García + * Copyright (C) 2015 Ferran Marcet * * 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 @@ -604,6 +605,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m global $conf; if (! is_object($objsoc)) $valueforccc=$objsoc; + else if($table == "commande_fournisseur" || $table == "facture_fourn" ) $valueforccc=$objsoc->code_fournisseur; else $valueforccc=$objsoc->code_client; // Clean parameters From 652ff9e67cd68a33ca0fd9803164c322bb50919b Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Wed, 6 May 2015 23:13:33 +0200 Subject: [PATCH 4/4] Commenting function --- htdocs/expedition/class/expedition.class.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index e93dfb2d768..c40a2689d27 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2006-2012 Laurent Destailleur - * Copyright (C) 2011-2013 Juanjo Menent + * Copyright (C) 2011-2015 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Cedric GROSS * Copyright (C) 2014-2015 Marcos García @@ -1639,11 +1639,14 @@ class Expedition extends CommonObject } /** - * Cree un bon d'expedition sur disque + * Create a document onto disk accordign to template module. * - * @param string $modele Force le modele a utiliser ('' to not force) - * @param Translate $outputlangs Objet lang a utiliser pour traduction - * @return int <=0 if KO, >0 if OK + * @param string $modele Force the model to using ('' to not force) + * @param Translate $outputlangs object lang to use for translations + * @param int $hidedetails Hide details of lines + * @param int $hidedesc Hide description + * @param int $hideref Hide ref + * @return int 0 if KO, 1 if OK */ public function generateDocument($modele, $outputlangs,$hidedetails=0, $hidedesc=0, $hideref=0) {