From 977b12fac0423d821afdf8102dd616d0ea57cf65 Mon Sep 17 00:00:00 2001 From: Darkjeff Date: Tue, 28 Jul 2015 19:26:46 +0200 Subject: [PATCH 1/5] clean code customer and supplier accountancy celan code add VAT research --- htdocs/accountancy/customer/lines.php | 29 +++++---- htdocs/accountancy/supplier/lines.php | 49 ++++++++++++--- htdocs/accountancy/supplier/list.php | 89 +++++++++++++++++---------- 3 files changed, 112 insertions(+), 55 deletions(-) diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index d00296ed2b9..d49b5b3dcf7 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2015 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -27,10 +27,13 @@ */ 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"); @@ -38,23 +41,23 @@ $langs->load("accountancy"); $account_parent = GETPOST('account_parent'); $changeaccount = GETPOST('changeaccount'); +//Search Getpost $search_ref = GETPOST('search_ref','alpha'); $search_invoice = GETPOST('search_invoice','alpha'); $search_label = GETPOST('search_label','alpha'); $search_desc = GETPOST('search_desc','alpha'); $search_amount = GETPOST('search_amount','alpha'); $search_account = GETPOST('search_account','alpha'); +$search_vat = GETPOST('search_vat','alpha'); +//Getpost Order and column and limit page $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); $page = GETPOST('page','int'); - -//if ($page == -1) { $page = 0; } if ($page < 0) $page = 0; $pageprev = $page - 1; $pagenext = $page + 1; -//$limit = $conf->liste_limit; if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; } else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) { @@ -62,19 +65,11 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { } else { $limit = $conf->liste_limit; } -//$offset = $conf->liste_limit * $page; $offset = $limit * $page; -// TODO : remove comment -//elarifr we can not use only -//$sql .= " ORDER BY l.rowid"; -// f.datef will order like FA08 FA09 FA10 FA05 FA06 FA07 FA04... -// f.facnumber will not order properly invoice / avoir / accompte you can have All AC then All AV and all FA -// l.rowid when an invoice is edited rowid are added at end of table & facturedet.rowid are not ordered -//if (! $sortfield) $sortfield="f.facnumber"; + if (! $sortfield) $sortfield="f.datef, f.facnumber, l.rowid"; -//if (! $sortorder) $sortorder="DESC"; if (! $sortorder) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { $sortorder = " DESC "; @@ -98,6 +93,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_desc=''; $search_amount=''; $search_account=''; + $search_vat=''; } if (is_array($changeaccount) && count($changeaccount) > 0) { @@ -181,6 +177,10 @@ if (strlen(trim($search_amount))) { if (strlen(trim($search_account))) { $sql .= " AND aa.account_number like '%" . $search_account . "%'"; } +if (strlen(trim($search_vat))) +{ + $sql .= " AND (l.tva_tx like '" . $search_vat . "%')"; +} if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")"; } @@ -210,6 +210,7 @@ if ($result) { print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"],"l.tva_tx","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"],"aa.account_number","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre(''); print_liste_field_titre(''); @@ -222,6 +223,7 @@ if ($result) { print ''; print ''; print ''; + print '%'; print ''; print ' '; print ''; @@ -257,6 +259,7 @@ if ($result) { print '' . dol_trunc($objp->product_label, 24) . ''; print '' . nl2br(dol_trunc($objp->description, 32)) . ''; print '' . price($objp->total_ht) . ''; + print '' . price($objp->tva_tx) . ''; print '' . $codecompta . ''; print '' . $objp->rowid . ''; print ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 80f7bc5e6ee..4dd7cb6c15e 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2015 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -26,11 +26,14 @@ */ 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"); @@ -39,24 +42,45 @@ $langs->load("accountancy"); $account_parent = GETPOST('account_parent'); $changeaccount = GETPOST('changeaccount'); +//Search Getpost $search_ref = GETPOST('search_ref','alpha'); $search_invoice = GETPOST('search_invoice','alpha'); $search_label = GETPOST('search_label','alpha'); $search_desc = GETPOST('search_desc','alpha'); $search_amount = GETPOST('search_amount','alpha'); $search_account = GETPOST('search_account','alpha'); +$search_vat = GETPOST('search_vat','alpha'); +//Getpost Order and column and limit page $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); $page = GETPOST('page','int'); -if ($page == -1) { $page = 0; } +if ($page < 0) $page = 0; $offset = $conf->liste_limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$limit = $conf->liste_limit; -if (! $sortfield) $sortfield="f.ref"; -if (! $sortorder) $sortorder="DESC"; +if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) +{ + $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; +} +else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) +{ + $limit = $conf->liste_limit; +} +else +{ + $limit = $conf->liste_limit; +} +if (! $sortfield) $sortfield="f.datef, f.ref, l.rowid"; + +if (! $sortorder) +{ + if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) + { + $sortorder = " DESC "; + } +} // Security check if ($user->societe_id > 0) @@ -75,6 +99,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_desc=''; $search_amount=''; $search_account=''; + $search_vat=''; } if (is_array($changeaccount) && count($changeaccount) > 0) { @@ -124,9 +149,6 @@ print ''; -/* - * Action - */ /* * Supplier Invoice lines @@ -157,6 +179,10 @@ if (strlen(trim($search_amount))) { if (strlen(trim($search_account))) { $sql .= " AND aa.account_number like '%" . $search_account . "%'"; } +if (strlen(trim($search_vat))) +{ + $sql .= " AND (l.tva_tx like '" . $search_vat . "%')"; +} if (! empty($conf->multicompany->enabled)) { $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")"; } @@ -187,6 +213,7 @@ if ($result) { print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"],"l.total_ht","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"],"l.tva_tx","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"],"aa.account_number","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre(''); print_liste_field_titre(''); @@ -198,11 +225,12 @@ if ($result) { print ''; print ''; print ''; + print '%'; print ''; print ' '; - print ''; + print ''; print ''; - print "\n"; + print "\n"; $facturefournisseur_static = new FactureFournisseur($db); $product_static = new Product($db); @@ -234,6 +262,7 @@ if ($result) { print '' . dol_trunc($objp->product_label, 24) . ''; print '' . nl2br(dol_trunc($objp->description, 32)) . ''; print '' . price($objp->total_ht) . ''; + print '' . price($objp->tva_tx) . ''; print '' . $codeCompta . ''; print '' . $objp->rowid . ''; print ''; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 02057b31255..3e1622558cb 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2015 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent s @@ -41,15 +41,24 @@ $langs->load("main"); $langs->load("accountancy"); $action = GETPOST('action'); + +//Select Box $codeventil = GETPOST('codeventil', 'array'); $mesCasesCochees = GETPOST('mesCasesCochees', 'array'); + +//Search Getpost +$search_invoice = GETPOST('search_invoice','alpha'); $search_ref = GETPOST('search_ref','alpha'); $search_label = GETPOST('search_label','alpha'); $search_desc = GETPOST('search_desc','alpha'); +$search_amount = GETPOST('search_amount','alpha'); +$search_account = GETPOST('search_account','alpha'); +$search_vat = GETPOST('search_vat','alpha'); +//Getpost Order and column and limit page $sortfield = GETPOST('sortfield','alpha'); $sortorder = GETPOST('sortorder','alpha'); -//Should move to top with all GETPOST + $page = GETPOST('page'); if ($page < 0) $page = 0; @@ -62,18 +71,8 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { $limit = $conf->liste_limit; } $offset = $limit * $page; -//End Should move to top with all GETPOST - -// TODO : remove comment -//elarifr we can not use only -//$sql .= " ORDER BY l.rowid"; -// f.datef will order like FA08 FA09 FA10 FA05 FA06 FA07 FA04... -// f.ref will not order properly invoice / avoir / accompte you can have All AC then All AV and all FA -// l.rowid when an invoice is edited rowid are added at end of table & facturedet.rowid are not ordered -//if (! $sortfield) $sortfield="l.rowid"; if (! $sortfield) $sortfield="f.datef, f.ref, l.rowid"; -//if (! $sortorder) $sortorder="DESC"; if (! $sortorder) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) { $sortorder = " DESC "; @@ -103,6 +102,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_ref=''; $search_label=''; $search_desc=''; + $search_amount=''; + $search_account=''; + $search_vat=''; } /* @@ -110,9 +112,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both */ llxHeader('', $langs->trans("Ventilation")); -//debug -//print_r($aarowid_s); -//print_r($aarowid_p); print ''; -//TODO For select box print ''; + $(function () { + $(\'#select-all\').click(function(event) { + // Iterate each checkbox + $(\':checkbox\').each(function() { + this.checked = true; + }); + }); + $(\'#unselect-all\').click(function(event) { + // Iterate each checkbox + $(\':checkbox\').each(function() { + this.checked = false; + }); + }); + }); + '; -/* - * Action - */ -//TODO -/* -if ($action == 'ventil') { - print '
' . $langs->trans("Processing") . '...
'; - if (! empty($codeventil_buy) && ! empty($mesCasesCochees)) { - if (! empty($codeventil_sell) && ! empty($mesCasesCochees)) { - } else { - print '
' . $langs->trans("AnyLineVentilate") . '
'; - } - print '
' . $langs->trans("EndProcessing") . '
'; -} -*/ -//do we really need to exclude old product not tosell / tobuy ? -//$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type , p.tosell , p.tobuy "; -//$sql .= " WHERE p.accountancy_code_sell IS NULL AND p.tosell = 1 OR p.accountancy_code_buy IS NULL AND p.tobuy = 1"; -//$sql .= " WHERE p.accountancy_code_sell ='' AND p.tosell = 1 OR p.accountancy_code_buy ='' AND p.tobuy = 1"; $sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type"; $sql .= " FROM " . MAIN_DB_PREFIX . "product as p"; -//$sql .= " , " . MAIN_DB_PREFIX . "accountingaccount as aa"; $sql .= " WHERE ("; $sql .= " p.accountancy_code_sell ='' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL"; -//Search on correct pcg version + $pcgver = $conf->global->CHARTOFACCOUNTS; $sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell != '' AND p.accountancy_code_sell NOT IN - (SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))"; - //(SELECT account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa WHERE fk_pcg_version='PCG99-BASE'))"; + (SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))"; $sql .= " OR (p.accountancy_code_buy IS NOT NULL AND p.accountancy_code_buy != '' AND p.accountancy_code_buy NOT IN - (SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))"; - //(SELECT account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa WHERE fk_pcg_version='PCG99-BASE'))"; + (SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))"; $sql .= ")"; //Add search filter like if (strlen(trim($search_ref))) { - $sql .= " AND (p.ref like '" . $search_ref . "%')"; + $sql .= " AND (p.ref like '" . $search_ref . "%')"; } if (strlen(trim($search_label))) { - $sql .= " AND (p.label like '" . $search_label . "%')"; + $sql .= " AND (p.label like '" . $search_label . "%')"; } if (strlen(trim($search_desc))) { - $sql .= " AND (p.description like '%" . $search_desc . "%')"; + $sql .= " AND (p.description like '%" . $search_desc . "%')"; } $sql.= $db->order($sortfield,$sortorder); @@ -249,176 +238,170 @@ $sql .= $db->plimit($limit + 1, $offset); dol_syslog("/accountancy/admin/productaccount.php:: sql=" . $sql, LOG_DEBUG); $result = $db->query($sql); if ($result) { - $num_lines = $db->num_rows($result); - $i = 0; + $num_lines = $db->num_rows($result); + $i = 0; /* - - * View */ - print_barre_liste($langs->trans("ProductAccountingAccountSelect"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); + print_barre_liste($langs->trans("ProductAccountingAccountSelect"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); - print '' . $langs->trans("DescProductAccountingAccount") . ' '; - print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"],"p.rowid","",$param,'',$sortfield,$sortorder); - print '  '; +print '
'; +print ''; +print ''; + +print ''; +print ''; +print ''; +print "\n"; +print ''; +print '\n"; +print ''; +print '\n"; + +print "
'.$langs->trans('OptionMode').''.$langs->trans('Description').'
'.$langs->trans('Accountancy_code_sell').''.nl2br($langs->trans('OptionModeProductSell')); +print "
'.$langs->trans('Accountancy_code_buy').''.nl2br($langs->trans('OptionModeProductBuy'))."
\n"; + +print '

'; + +print "
\n"; -//DEBUG -//print $sql; - print '
'; -// print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print '
' . $langs->trans("ChangeAccount") . '
'; - print $langs->trans("Accountancy_code_buy") . ': ' . $form->select_account($account_number_buy, 'account_number_buy', 1,'', 0, 1); - print '
'; - print '
'; - print '
' . $langs->trans("ChangeAccount") . '
'; - print $langs->trans("Accountancy_code_sell") . ': ' . $form->select_account($account_number_sell, 'account_number_sell', 1, '', 0, 1); - print '
'; - print '
'; - //TODO change button - print ''; - print '
'; - print ''; - print ''; -// print ''; -// print ''; -// print ''; - print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder); - print ''; - print ''; - print ''; - print ''; - print_liste_field_titre(''); -// print_liste_field_titre(''); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ' '; + print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"],"p.rowid","",$param,'',$sortfield,$sortorder); + print '  '; - print ''; - print ''; -// print ''; - print ''; - - $var = true; - - while ( $i < min($num_lines, 250) ) { - $obj = $db->fetch_object($result); - $var = ! $var; - - $compta_prodsell = $obj->accountancy_code_sell; - if (empty($compta_prodsell)) { - if ($obj->product_type == 0) { - $compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); - $compta_prodsell_id = $aarowid_prodsell; - } else { - $compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); - $compta_prodsell_id = $aarowid_servsell; - } - } - - $compta_prodbuy = $obj->accountancy_code_buy; - if (empty($compta_prodbuy)) { - if ($obj->product_type == 0) { - $compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef")); - $compta_prodbuy_id = $aarowid_prodbuy; - } else { - $compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef")); - $compta_prodbuy_id = $aarowid_servbuy; - } - } - - $product_static = new Product($db); - - print ""; -//debug -print ''; + print '
' . $langs->trans("Ref") . '' . $langs->trans("Label") . '' . $langs->trans("Description") . '' . $langs->trans("Accountancy_code_buy") . '' . $langs->trans("Accountancy_code_buy_suggest") . '' . $langs->trans("Accountancy_code_sell") . '' . $langs->trans("Accountancy_code_sell_suggest") . '' . $langs->trans("Ventilate") . '
/'.'
%%' . $langs->trans("DescProductAccountingAccount") . ' '; - print ''; -// print ''; - print ' '; - print ''; -// print ''; - print ' 
Compte Suggeres compta_prodbuy=' . $compta_prodbuy . ' -- compta_prodbuy_id' . $compta_prodbuy_id . '-- compta_prodsell:' . $compta_prodsell . '-- compta_prodsell_id' . $compta_prodsell_id . '
'; + print ''; + print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder); + IF ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') { + print ''; + print ''; + } + else { + print ''; + print ''; + } + print_liste_field_titre(''); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - print ""; - print ""; - // Ref produit as link - $product_static->ref = $obj->ref; - $product_static->id = $obj->rowid; - $product_static->type = $obj->type; - print ''; + print ''; + print ''; + print ''; + + $var = true; + + while ( $i < min($num_lines, 250) ) { + $obj = $db->fetch_object($result); + $var = ! $var; + + $compta_prodsell = $obj->accountancy_code_sell; + + if ($obj->product_type == 0) { + $compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); + $compta_prodsell_id = $aarowid_prodsell; + } else { + $compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); + $compta_prodsell_id = $aarowid_servsell; + } + + + $compta_prodbuy = $obj->accountancy_code_buy; + + if ($obj->product_type == 0) { + $compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef")); + $compta_prodbuy_id = $aarowid_prodbuy; + } else { + $compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef")); + $compta_prodbuy_id = $aarowid_servbuy; + } + + + $product_static = new Product($db); + + print ""; - print ''; + print ""; + print ""; + // Ref produit as link + $product_static->ref = $obj->ref; + $product_static->id = $obj->rowid; + $product_static->type = $obj->type; + print ''; + print ''; //TODO ADJUST DESCRIPTION SIZE -// print ''; - //TODO: we shoul set a user defined value to adjust user square / wide screen size - $trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; - print ''; +// print ''; + //TODO: we shoul set a user defined value to adjust user square / wide screen size + $trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; + print ''; - //acountingaccount buy - print ''; + //acountingaccount buy + + IF ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') { + print ''; //TODO: replace by select -// print ''; - //TODO: we shoul set a user defined value to adjust user square / wide screen size - //$trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; - print ''; - - //acountingaccount sel - print ''; +// print ''; + //TODO: we shoul set a user defined value to adjust user square / wide screen size + //$trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; + print ''; + } + Else { + //acountingaccount sel + print ''; //TODO: replace by select - //TODO: we shoul set a user defined value to adjust user square / wide screen size - //$trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; - print ''; - //action edit & select box - print ''; - print ''; - //Checkbox select - print ''; + //TODO: we shoul set a user defined value to adjust user square / wide screen size + //$trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; + print ''; + } + + //Checkbox select + print ''; - print ""; - $i ++; - } + print ""; + $i ++; + } + print '
' . $langs->trans("Accountancy_code_buy") . '' . $langs->trans("Accountancy_code_buy_suggest") . '' . $langs->trans("Accountancy_code_sell") . '' . $langs->trans("Accountancy_code_sell_suggest") . '' . $langs->trans("Ventilate") . '
/'.'
%%
'; - if ($product_static->id) - print $product_static->getNomUrl(1); - else - print '- '; - print ' '; + print ''; + print ' '; + print ''; + print '
' . $obj->label . '
'; + if ($product_static->id) + print $product_static->getNomUrl(1); + else + print '- '; + print '' . $obj->label . '' . $obj->description . '' . nl2br(dol_trunc($obj->description, $trunclengh)) . '' . $obj->description . '' . nl2br(dol_trunc($obj->description, $trunclengh)) . '' . $obj->accountancy_code_buy . '' . $obj->accountancy_code_buy . '' . $compta_prodbuy . ''; - print $form->select_account($compta_prodbuy_id, 'codeventil[]', 1); - print '' . $obj->accountancy_code_sell . '' . $compta_prodbuy . ''; + print $form->select_account($compta_prodbuy_id, 'codeventil[]', 1); + print '' . $obj->accountancy_code_sell . ''; - print $form->select_account($compta_prodsell_id, 'codeventil[]', 1); - print '' . $obj->rowid . ''; - print img_edit(); - print ''; - print ''; + print $form->select_account($compta_prodsell_id, 'codeventil[]', 1); + print ''; + print '
'; + print '
'; + print '
'; - $db->free($result); + + + $db->free($result); } else { -// print $db->error(); - dol_print_error($db); + dol_print_error($db); } -print ""; + llxFooter(); $db->close(); \ No newline at end of file From 2500e26072d2409344858cedf1452373e5b13619 Mon Sep 17 00:00:00 2001 From: Darkjeff Date: Mon, 10 Aug 2015 10:29:05 +0200 Subject: [PATCH 3/5] update product account clean sql if buy or sell --- htdocs/accountancy/admin/productaccount.php | 25 +++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 8d79a81e8e3..7a33a698cd1 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -1,7 +1,7 @@ - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ari Elbaz (elarifr) @@ -102,6 +102,7 @@ if ($action == 'update') { } if ($action == $langs->trans("Change_Account")) +//todo check sql { print '
' . $langs->trans("Processing") . '...
'; if (! empty($codeventil) && ! empty($mesCasesCochees)) @@ -120,7 +121,7 @@ if ($action == $langs->trans("Change_Account")) { $maLigneCourante = explode("_", $maLigneCochee); $monId = $maLigneCourante[0]; - $monNumLigne = $maLigneCourante[2]; + $monNumLigne = $maLigneCourante[1]; $monCompte = $mesCodesVentilChoisis[$monNumLigne]; $sql = " UPDATE " . MAIN_DB_PREFIX . "product"; @@ -212,15 +213,25 @@ print ''; - -$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type"; +$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type"; $sql .= " FROM " . MAIN_DB_PREFIX . "product as p"; $sql .= " WHERE ("; $pcgver = $conf->global->CHARTOFACCOUNTS; IF ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') { -$sql .= " p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL"; -$sql .= " OR (p.accountancy_code_buy IS NOT NULL AND p.accountancy_code_buy != '' AND p.accountancy_code_buy NOT IN + $sql .= " p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL"; + $sql .= " OR (p.accountancy_code_buy IS NOT NULL AND p.accountancy_code_buy != '' AND p.accountancy_code_buy NOT IN (SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))"; - } - ELSE { -$sql .= " p.accountancy_code_sell ='' OR p.accountancy_code_sell IS NULL "; -$sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell != '' AND p.accountancy_code_sell NOT IN +} else { + $sql .= " p.accountancy_code_sell ='' OR p.accountancy_code_sell IS NULL "; + $sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell != '' AND p.accountancy_code_sell NOT IN (SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))"; - } +} $sql .= ")"; - - - -//Add search filter like +// Add search filter like if (strlen(trim($search_ref))) { $sql .= " AND (p.ref like '" . $search_ref . "%')"; } @@ -242,7 +231,7 @@ if (strlen(trim($search_label))) { if (strlen(trim($search_desc))) { $sql .= " AND (p.description like '%" . $search_desc . "%')"; } -$sql.= $db->order($sortfield,$sortorder); +$sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($limit + 1, $offset); @@ -251,71 +240,65 @@ $result = $db->query($sql); if ($result) { $num_lines = $db->num_rows($result); $i = 0; - -/* + + /* * View */ print_barre_liste($langs->trans("ProductAccountingAccountSelect"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); - -print '
'; -print ''; -print ''; - -print ''; -print ''; -print ''; -print "\n"; -print ''; -print '\n"; -print ''; -print '\n"; - -print "
'.$langs->trans('OptionMode').''.$langs->trans('Description').'
'.$langs->trans('Accountancy_code_sell').''.nl2br($langs->trans('OptionModeProductSell')); -print "
'.$langs->trans('Accountancy_code_buy').''.nl2br($langs->trans('OptionModeProductBuy'))."
\n"; - -print '

'; - -print "
\n"; - - - - - - - print '' . $langs->trans("DescProductAccountingAccount") . ' '; - print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"],"p.rowid","",$param,'',$sortfield,$sortorder); - print '  '; - - - - - + + print ''; + print ''; + print ''; + print ''; print ''; - print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"],"p.ref","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"],"p.label","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder); - IF ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') { - print ''; - print ''; + print ''; + print "\n"; + print ''; + print '\n"; + print ''; + print '\n"; + + print "
' . $langs->trans("Accountancy_code_buy") . '' . $langs->trans("Accountancy_code_buy_suggest") . '' . $langs->trans('OptionMode') . '' . $langs->trans('Description') . '
' . $langs->trans('Accountancy_code_sell') . '' . nl2br($langs->trans('OptionModeProductSell')); + print "
' . $langs->trans('Accountancy_code_buy') . '' . nl2br($langs->trans('OptionModeProductBuy')) . "
\n"; + + print '
'; + + print "
\n"; + + if (! empty($msg)) { + print $msg; } - else { - print '' . $langs->trans("Accountancy_code_sell") . ''; - print '' . $langs->trans("Accountancy_code_sell_suggest") . ''; + + // print '' . $langs->trans("DescProductAccountingAccount") . ' '; + // print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"], "p.rowid", "", $param, '', $sortfield, $sortorder); + print '  '; + + print ''; + print ''; + print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); + if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { + print ''; + // print_liste_field_titre(''); + print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; - - print ''; - print ''; + print ''; print ''; @@ -327,30 +310,28 @@ print "
\n"; $compta_prodsell = $obj->accountancy_code_sell; - if ($obj->product_type == 0) { - $compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); - $compta_prodsell_id = $aarowid_prodsell; - } else { - $compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); - $compta_prodsell_id = $aarowid_servsell; - } - + if ($obj->product_type == 0) { + $compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); + $compta_prodsell_id = $aarowid_prodsell; + } else { + $compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef")); + $compta_prodsell_id = $aarowid_servsell; + } $compta_prodbuy = $obj->accountancy_code_buy; - if ($obj->product_type == 0) { - $compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef")); - $compta_prodbuy_id = $aarowid_prodbuy; - } else { - $compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef")); - $compta_prodbuy_id = $aarowid_servbuy; - } - + if ($obj->product_type == 0) { + $compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef")); + $compta_prodbuy_id = $aarowid_prodbuy; + } else { + $compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef")); + $compta_prodbuy_id = $aarowid_servbuy; + } $product_static = new Product($db); print ""; - + print ""; print ""; // Ref produit as link @@ -363,56 +344,51 @@ print "
\n"; else print '- '; print ''; - print ''; -//TODO ADJUST DESCRIPTION SIZE -// print ''; - //TODO: we shoul set a user defined value to adjust user square / wide screen size + print ''; + // TODO ADJUST DESCRIPTION SIZE + // print ''; + // TODO: we shoul set a user defined value to adjust user square / wide screen size $trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; print ''; - - //acountingaccount buy - IF ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') { - print ''; -//TODO: replace by select -// print ''; - //TODO: we shoul set a user defined value to adjust user square / wide screen size - //$trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; - print ''; - } - Else { - - //acountingaccount sel - print ''; -//TODO: replace by select - //TODO: we shoul set a user defined value to adjust user square / wide screen size - //$trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; - print ''; + // acountingaccount buy + + if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { + print ''; + // TODO: replace by select + // print ''; + // TODO: we shoul set a user defined value to adjust user square / wide screen size + // $trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; + print ''; + } else { + + // acountingaccount sel + print ''; + // TODO: replace by select + // TODO: we shoul set a user defined value to adjust user square / wide screen size + // $trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; + print ''; } - //Checkbox select + // Checkbox select print ''; - + print ''; + print ""; $i ++; } - print '
' . $langs->trans("Accountancy_code_buy") . ''; + print '' . $langs->trans("Accountancy_code_buy_suggest") . ''; + } else { + print '' . $langs->trans("Accountancy_code_sell") . ''; + print '' . $langs->trans("Accountancy_code_sell_suggest") . ''; } - print_liste_field_titre(''); - print '' . $langs->trans("Ventilate") . '
/'.'
' . $langs->trans("Ventilate") . '
/' . '
%% '; - print ''; + + print ' '; + print ''; print ' '; - print ''; + print ''; print '
'. dol_trunc($obj->label, 24) . '' . $obj->description . '' . dol_trunc($obj->label, 24) . '' . $obj->description . '' . nl2br(dol_trunc($obj->description, $trunclengh)) . '' . $obj->accountancy_code_buy . '' . $compta_prodbuy . ''; - print $form->select_account($compta_prodbuy_id, 'codeventil[]', 1); - print '' . $obj->accountancy_code_sell . ''; - print $form->select_account($compta_prodsell_id, 'codeventil[]', 1); - print '' . $obj->accountancy_code_buy . '' . $compta_prodbuy . ''; + print $form->select_account($compta_prodbuy_id, 'codeventil_'.$product_static->id, 1); + print '' . $obj->accountancy_code_sell . ''; + print $form->select_account($compta_prodsell_id, 'codeventil_'.$product_static->id, 1); + print ''; - print '
'; - print '
'; - print '
'; - - + print ''; + print '
'; + print ''; $db->free($result); } else { dol_print_error($db); } - - llxFooter(); $db->close(); \ No newline at end of file diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 0c79820ea44..988eecfab84 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -65,8 +65,10 @@ class AccountingAccount extends CommonObject * @param string $account_number Account number * @return int <0 if KO, >0 if OK */ - function fetch($rowid = null, $account_number = null) + function fetch($rowid = null, $account_number = null, $limittocurentchart=0) { + global $conf; + if ($rowid || $account_number) { $sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, fk_user_author, fk_user_modif, active"; $sql.= " FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE"; @@ -75,7 +77,9 @@ class AccountingAccount extends CommonObject } elseif ($account_number) { $sql .= " account_number = '" . $account_number . "'"; } - + if (!empty($limittocurentchart)) { + $sql .=' AND fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$conf->global->CHARTOFACCOUNTS.')'; + } dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { @@ -101,7 +105,8 @@ class AccountingAccount extends CommonObject return 0; } } else { - dol_print_error($this->db); + $this->error="Error " . $this->db->lasterror(); + $this->errors[] = "Error " . $this->db->lasterror(); } } return -1; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index d3a4547c38b..6d82c324fd6 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -24,14 +24,13 @@ * \ingroup Accounting Expert * \brief Ventilation page from customers invoices */ - require '../../main.inc.php'; // Class -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; -require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; +require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; // Langs $langs->load("compta"); @@ -42,24 +41,25 @@ $langs->load("accountancy"); $action = GETPOST('action'); -//Select Box +// Select Box $codeventil = GETPOST('codeventil', 'array'); $mesCasesCochees = GETPOST('mesCasesCochees', 'array'); -//Search Getpost -$search_invoice = GETPOST('search_invoice','alpha'); -$search_ref = GETPOST('search_ref','alpha'); -$search_label = GETPOST('search_label','alpha'); -$search_desc = GETPOST('search_desc','alpha'); -$search_amount = GETPOST('search_amount','alpha'); -$search_account = GETPOST('search_account','alpha'); -$search_vat = GETPOST('search_vat','alpha'); +// Search Getpost +$search_invoice = GETPOST('search_invoice', 'alpha'); +$search_ref = GETPOST('search_ref', 'alpha'); +$search_label = GETPOST('search_label', 'alpha'); +$search_desc = GETPOST('search_desc', 'alpha'); +$search_amount = GETPOST('search_amount', 'alpha'); +$search_account = GETPOST('search_account', 'alpha'); +$search_vat = GETPOST('search_vat', 'alpha'); -//Getpost Order and column and limit page -$sortfield = GETPOST('sortfield','alpha'); -$sortorder = GETPOST('sortorder','alpha'); -$page = GETPOST('page'); -if ($page < 0) $page = 0; +// Getpost Order and column and limit page +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); +$page = GETPOST('page','int'); +if ($page < 0) + $page = 0; if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { $limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION; @@ -70,7 +70,8 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) { } $offset = $limit * $page; -if (! $sortfield) $sortfield="f.datef, f.facnumber, l.rowid"; +if (! $sortfield) + $sortfield = "f.datef, f.facnumber, l.rowid"; if (! $sortorder) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) { @@ -91,23 +92,23 @@ $aarowid_s = $accounting->fetch('', ACCOUNTING_SERVICE_SOLD_ACCOUNT); $aarowid_p = $accounting->fetch('', ACCOUNTING_PRODUCT_SOLD_ACCOUNT); // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) -{ - $search_ref=''; - $search_invoice=''; - $search_label=''; - $search_desc=''; - $search_amount=''; - $search_account=''; - $search_vat=''; +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { + $search_ref = ''; + $search_invoice = ''; + $search_label = ''; + $search_desc = ''; + $search_amount = ''; + $search_account = ''; + $search_vat = ''; } + /* * View */ llxHeader('', $langs->trans("Ventilation")); -print '