diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 01806db83320e..bc50d33695ca1 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 @@ $formventilation = new FormVentilation($db); -// change account - -$changeaccount = GETPOST('changeaccount'); - -$is_search = GETPOST('button_search_x'); +// 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=''; +} -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 @@ 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($search_label))) { + $sql .= " AND p.label like '%" . $search_label . "%'"; } -if (strlen(trim(GETPOST("search_label")))) { - $sql .= " AND p.label like '%" . GETPOST("search_label") . "%'"; +if (strlen(trim($search_desc))) { + $sql .= " AND l.description like '%" . $search_desc . "%'"; } -if (strlen(trim(GETPOST("search_desc")))) { - $sql .= " AND l.description like '%" . GETPOST("search_desc") . "%'"; +if (strlen(trim($search_amount))) { + $sql .= " AND l.total_ht like '%" . $search_amount . "%'"; } -if (strlen(trim(GETPOST("search_account")))) { - $sql .= " AND aa.account_number like '%" . GETPOST("search_account") . "%'"; +if (strlen(trim($search_account))) { + $sql .= " AND aa.account_number like '%" . $search_account . "%'"; } if (! empty($conf->multicompany->enabled)) { @@ -161,18 +173,17 @@ 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 @@ $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 @@ 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 5df5ee0c06f52..dd6319e7c4354 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'); - -$is_search = GETPOST('button_search_x'); +// 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=''; +} -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 @@ llxHeader('', $langs->trans("SuppliersVentilation") . ' - ' . $langs->trans("Dispatched")); -$page = $_GET["page"]; +$page = GETPOST("page"); if ($page < 0) $page = 0; @@ -105,20 +117,23 @@ $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($search_ref))) { + $sql .= " AND p.ref like '%" . $search_ref . "%'"; } -if (strlen(trim($_GET["search_ref"]))) { - $sql .= " AND p.ref like '%" . $_GET["search_ref"] . "%'"; +if (strlen(trim($search_label))) { + $sql .= " AND p.label like '%" . $search_label . "%'"; } -if (strlen(trim($_GET["search_label"]))) { - $sql .= " AND p.label like '%" . $_GET["search_label"] . "%'"; +if (strlen(trim($search_desc))) { + $sql .= " AND l.description like '%" . $search_desc . "%'"; } -if (strlen(trim($_GET["search_desc"]))) { - $sql .= " AND l.description like '%" . $_GET["search_desc"] . "%'"; +if (strlen(trim($search_amount))) { + $sql .= " AND l.total_ht like '%" . $search_amount . "%'"; } -if (strlen(trim($_GET["search_account"]))) { - $sql .= " AND aa.account_number like '%" . $_GET["search_account"] . "%'"; +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 @@ 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); diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index f2b105242de2d..5fbf3fb9c5ec9 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 diff --git a/htdocs/core/modules/expedition/modules_expedition.php b/htdocs/core/modules/expedition/modules_expedition.php index d9205503e1185..a2437d5001f47 100644 --- a/htdocs/core/modules/expedition/modules_expedition.php +++ b/htdocs/core/modules/expedition/modules_expedition.php @@ -152,7 +152,7 @@ function getVersion() * @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 8826c453b6f2e..db8b236feaab9 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -406,7 +406,7 @@ $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 8a9377b1507a9..c40a2689d27d3 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,13 +1639,16 @@ function set_billed() } /** - * 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) + public function generateDocument($modele, $outputlangs,$hidedetails=0, $hidedesc=0, $hideref=0) { global $conf,$user,$langs; @@ -1668,7 +1671,7 @@ public function generateDocument($modele, $outputlangs) $this->fetch_origin(); - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, 0, 0, 0); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } /**