From a057cb93c9d50bf985e694c2a90ff5f8af4b3401 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 22 Oct 2016 14:05:04 +0200 Subject: [PATCH] Debug accounting module --- htdocs/accountancy/admin/productaccount.php | 32 ++++++++++++++------- htdocs/accountancy/customer/list.php | 7 +++-- htdocs/accountancy/supplier/list.php | 16 ++++++----- 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 598320bfd63..495fb2a1304 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -259,10 +259,10 @@ if ($result) print ''; print '' . $langs->trans('Options') . '' . $langs->trans('Description') . ''; print "\n"; - print ' ' . $langs->trans('OptionModeProductSell') . ''; + print ' ' . $langs->trans('OptionModeProductSell') . ''; print '' . nl2br($langs->trans('OptionModeProductSellDesc')); print "\n"; - print ' ' . $langs->trans('OptionModeProductBuy') . ''; + print ' ' . $langs->trans('OptionModeProductBuy') . ''; print '' . nl2br($langs->trans('OptionModeProductBuyDesc')) . "\n"; print "\n"; @@ -284,7 +284,7 @@ if ($result) 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"], "p.description", "", $param, '', $sortfield, $sortorder); + if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder); /* if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { print_liste_field_titre($langs->trans("Accountancy_code_buy")); @@ -301,7 +301,7 @@ if ($result) print ''; print ''; print ''; - print ' '; + if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print ' '; print ''; $searchpitco=$form->showFilterAndCheckAddButtons(1, 'checkforselect', 1); print $searchpitco; @@ -340,23 +340,33 @@ if ($result) print ''; print ""; - print ''; + + print ''; + // Ref produit as link $product_static->ref = $obj->ref; $product_static->id = $obj->rowid; $product_static->type = $obj->type; + $product_static->label = $obj->label; + $product_static->description = $obj->description; + print ''; if ($product_static->id) print $product_static->getNomUrl(1); else print '- '; print ''; - print '' . dol_trunc($obj->label, 24) . ''; - // TODO ADJUST DESCRIPTION SIZE - // print '' . $obj->description . ''; - // TODO: we shoul set a user defined value to adjust user square / wide screen size - $trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 64; - print '' . nl2br(dol_trunc($obj->description, $trunclengh)) . ''; + + print ''.$obj->label.''; + + if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) + { + // TODO ADJUST DESCRIPTION SIZE + // print '' . $obj->description . ''; + // TODO: we shoul set a user defined value to adjust user square / wide screen size + $trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 64; + print '' . nl2br(dol_trunc($obj->description, $trunclengh)) . ''; + } // Accounting account buy if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 080f79d1fce..7c718c54bfb 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -342,12 +342,15 @@ if ($result) { print price($objp->tva_tx_line); print ''; + // Accounting account suggested print ''; - if ($objp->code_sell_l == $objp->code_sell_p) { + if ($objp->code_sell_l == $objp->code_sell_p) { // Test if there is a difference between code by default and code on product if ($objp->code_sell_l > 0) print $objp->code_sell_l; else print $langs->trans("Unknown"); } else { - print $langs->trans("Buy") . ' = ' . $objp->code_sell_l . '
' . $langs->trans("Sell") . ' = ' . $objp->code_sell_p; + print $langs->trans("Default") . ' = ' . ($objp->code_sell_l > 0 ? $objp->code_sell_l : $langs->trans("Unknown")); + print '
'; + print $langs->trans("Product") . ' = ' . ($objp->code_sell_p > 0 ? $objp->code_sell_p : $langs->trans("Unknown")); } print ''; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 2f00bd67bd6..bd0dac49096 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -174,7 +174,7 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accounta $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version"; $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " AND product_type <= 2"; -$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='')"; +$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_buy IS NULL OR p.accountancy_code_buy ='')"; // Add search filter like if (strlen(trim($search_invoice))) { $sql .= " AND (f.ref like '%" . $search_invoice . "%')"; @@ -352,13 +352,15 @@ if ($result) { print price($objp->tva_tx_line); print ''; + // Accounting account suggested print ''; - // if not same kind of product_type stored in product & facturedet we display both account and let user choose - if ($objp->code_buy_l == $objp->code_buy_p) { - if ($objp->code_buy_l > 0) print $objp->code_buy_l; - else print $langs->trans("Unknown"); - } else { // This can happen if user has change type of product after creation of invoice - print 'lines=' . $objp->code_buy_l . '
product=' . $objp->code_buy_p; + if ($objp->code_buy_l == $objp->code_buy_p) { // Test if there is a difference between code by default and code on product + if ($objp->code_buy_l > 0) print $objp->code_buy_l; + else print $langs->trans("Unknown"); + } else { + print $langs->trans("Default") . ' = ' . ($objp->code_buy_l > 0 ? $objp->code_buy_l : $langs->trans("Unknown")); + print '
'; + print $langs->trans("Product") . ' = ' . ($objp->code_buy_p > 0 ? $objp->code_buy_p : $langs->trans("Unknown")); } print '';