From b47252fcb6a206d3c73eec4127f05007dac71b76 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 11 Feb 2016 06:39:02 +0100 Subject: [PATCH 01/25] Modifiy menu for accountancy module - New balance feature --- htdocs/core/menus/init_menu_auguria.sql | 6 +++--- htdocs/core/menus/standard/eldy.lib.php | 7 ++++--- htdocs/langs/en_US/accountancy.lang | 20 +++++--------------- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 1e5062f7e1d..0d95d94c721 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -217,9 +217,9 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left -- Journals -- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2420__+MAX_llx_menu__, 'accountancy', 'journal', 2400__+MAX_llx_menu__, '/accountancy/journal/index.php?leftmenu=journal', 'Journaux', 1, 'accountancy', '$user->rights->accounting->comptarapport->lire', '', 0, 7, __ENTITY__); -- General Ledger - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2430__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php?leftmenu=bookkeeping', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__); - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2431__+MAX_llx_menu__, 'accountancy', '', 2430__+MAX_llx_menu__, '/accountancy/bookkeeping/listbyyear.php', 'ByYear', 2, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__); - insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2432__+MAX_llx_menu__, 'accountancy', '', 2430__+MAX_llx_menu__, '/accountancy/bookkeeping/balancebymonth.php', 'AccountBalanceByMonth', 2, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__); + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2430__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__); + -- Balance + insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2435__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__); -- Reports insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'report', 2400__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 0497b50308f..7ae6ea1a1a1 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -968,9 +968,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } // General Ledger - $newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=bookkeeping",$langs->trans("Bookkeeping"),1,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookkeeping'); - if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/listbyyear.php",$langs->trans("ByYear"),2,$user->rights->accounting->mouvements->lire); - if (empty($leftmenu) || preg_match('/bookkeeping/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balancebymonth.php",$langs->trans("AccountBalanceByMonth"),2,$user->rights->accounting->mouvements->lire); + $newmenu->add("/accountancy/bookkeeping/list.php",$langs->trans("Bookkeeping"),1,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookkeeping'); + + // Balance + $newmenu->add("/accountancy/bookkeeping/balance",$langs->trans("AccountBalance"),1,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'balance'); // Reports $langs->load("compta"); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 9f3941a42ec..9948afa4800 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -48,7 +48,7 @@ UpdateAccount=Modification of an accounting account UpdateMvts=Modification of a movement WriteBookKeeping=Record accounts in general ledger Bookkeeping=General ledger -AccountBalanceByMonth=Account balance by month +AccountBalance=Account balance AccountingVentilation=Breakdown accounting AccountingVentilationSupplier=Breakdown accounting supplier @@ -105,7 +105,6 @@ Code_tiers=Thirdparty Labelcompte=Label account Sens=Sens Codejournal=Journal -NumPiece=Piece number DelBookKeeping=Delete the records of the general ledger @@ -154,8 +153,6 @@ ErrorAccountancyCodeIsAlreadyUse=Error, you cannot delete this accounting accoun FicheVentilation=Breakdown card GeneralLedgerIsWritten=Operations are written in the general ledger -MvtNotCorrectlyBalanced=Mouvement not correctly balanced. Credit = %s. Debit = %s - ##Export Journal Feature ExportFormat=Format of Export Prefixname=Prefix of export File @@ -166,15 +163,8 @@ Fieldname=Name of Field Headername=Name in header Type=Type of fields Param=Additionnal parameters -EnabledProduct=In product -EnabledTiers=In third party -EnabledVat=In VAT +EnabledProduct=In Product +EnabledTiers=In Tiers +EnabledVat=In Vat -## Tools - Init accounting account on product / service -InitAccountancy=Init accountancy -InitAccountancyDesc=This page can be used to initialize an accounting account on products and services that does not have accountancy account defined for sales and purchases. Check before that setup of module accountancy is complete. -Options=Options -OptionModeProductSell=Mode sales -OptionModeProductBuy=Mode purchases -OptionModeProductSellDesc=Show all products with no accounting account defined for sales. -OptionModeProductBuyDesc=Show all products with no accounting account defined for purchases. \ No newline at end of file +MvtNotCorrectlyBalanced=Mouvement not correctly balanced. Credit = %s. Debit = %s \ No newline at end of file From 87fee74fb12a8f6db1ab3759b76a100ddc9558d4 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 11 Feb 2016 06:44:35 +0100 Subject: [PATCH 02/25] Modify menu for accountancy module - New balance feature --- htdocs/langs/en_US/accountancy.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 9948afa4800..9149c5d35ba 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -167,4 +167,4 @@ EnabledProduct=In Product EnabledTiers=In Tiers EnabledVat=In Vat -MvtNotCorrectlyBalanced=Mouvement not correctly balanced. Credit = %s. Debit = %s \ No newline at end of file +MvtNotCorrectlyBalanced=Mouvement not correctly balanced. Credit = %s. Debit = %s From f1a26cf54b3c88bde2738edc0d22ed649af5c101 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 11 Feb 2016 06:49:49 +0100 Subject: [PATCH 03/25] Correct problem of merging for language file --- htdocs/langs/en_US/accountancy.lang | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 9149c5d35ba..6039ec88013 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -105,6 +105,7 @@ Code_tiers=Thirdparty Labelcompte=Label account Sens=Sens Codejournal=Journal +NumPiece=Piece number DelBookKeeping=Delete the records of the general ledger @@ -153,6 +154,8 @@ ErrorAccountancyCodeIsAlreadyUse=Error, you cannot delete this accounting accoun FicheVentilation=Breakdown card GeneralLedgerIsWritten=Operations are written in the general ledger +MvtNotCorrectlyBalanced=Mouvement not correctly balanced. Credit = %s. Debit = %s + ##Export Journal Feature ExportFormat=Format of Export Prefixname=Prefix of export File @@ -163,8 +166,15 @@ Fieldname=Name of Field Headername=Name in header Type=Type of fields Param=Additionnal parameters -EnabledProduct=In Product -EnabledTiers=In Tiers -EnabledVat=In Vat +EnabledProduct=In product +EnabledTiers=In third party +EnabledVat=In VAT -MvtNotCorrectlyBalanced=Mouvement not correctly balanced. Credit = %s. Debit = %s +## Tools - Init accounting account on product / service +InitAccountancy=Init accountancy +InitAccountancyDesc=This page can be used to initialize an accounting account on products and services that does not have accountancy account defined for sales and purchases. Check before that setup of module accountancy is complete. +Options=Options +OptionModeProductSell=Mode sales +OptionModeProductBuy=Mode purchases +OptionModeProductSellDesc=Show all products with no accounting account defined for sales. +OptionModeProductBuyDesc=Show all products with no accounting account defined for purchases. \ No newline at end of file From d4057c3febe9e1254adfa65263585bd39cd86bea Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 15 Feb 2016 06:56:51 +0100 Subject: [PATCH 04/25] Fixed: Correct problem of rights beetween tax and salaries module --- htdocs/compta/charges/index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 45b10f2363c..6e136be1b25 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2003 Rodolphe Quiedeville * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2011-2014 Alexandre Spangaro + * Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2011-2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * @@ -86,7 +86,7 @@ if (GETPOST("mode") != 'sconly') } // Payment Salary -if ($conf->salaries->enabled) +if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) { if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly') { @@ -167,7 +167,7 @@ if ($conf->salaries->enabled) } -if ($conf->tax->enabled) +if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) { // Social contributions only if (GETPOST("mode") != 'sconly') @@ -278,7 +278,7 @@ if ($conf->tax->enabled) } // VAT -if ($conf->tax->enabled) +if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) { if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly') { From 353fa7c2fc445234c906cf4ae43074f612b3291f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Feb 2016 07:04:07 +0100 Subject: [PATCH 05/25] Little cleaning on how options ar shown --- htdocs/admin/workflow.php | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index bdd84a50a7f..28feb8ab23e 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -69,21 +69,16 @@ print "
"; // List of workflow we can enable print ''."\n"; -print ''."\n"; -print ' '; -print ' '; -print "\n"; clearstatcache(); $workflowcodes=array( - 'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'), - 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'), - 'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'), + 'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('family'=>'create', 'position'=>10, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'), + 'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('family'=>'create', 'position'=>20, 'enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'), + 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>'WarningCloseAlways'), // For the following 2 options, if module invoice is disabled, they does not exists, so "Classify billed" for order must be done manually from order card. - 'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'), - 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'), - + 'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>40, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'), + 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify', 'position'=>50, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'bill','warning'=>'WarningCloseAlways'), ); if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) @@ -94,16 +89,30 @@ if (! empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts[' } } +// TODO We must sort on position here + $nbqualified=0; +$oldfamily=''; foreach($workflowcodes as $key => $params) { $picto=$params['picto']; $enabled=$params['enabled']; + $family=$params['family']; if (! verifCond($enabled)) continue; $nbqualified++; - $var = !$var; + + if ($oldfamily != $family) + { + print ''."\n"; + print ' '; + print ' '; + print "\n"; + $oldfamily = $family; + } + + $var = !$var; print "\n"; print "'; print ''; print ''; - print ''; + print ''; print ''; print ''; // Propals if (! empty($conf->propal->enabled) && $user->rights->propale->lire) { + $nblines++; $ret=$product->load_stats_propale($socid); if ($ret < 0) dol_print_error($db); $langs->load("propal"); @@ -234,6 +237,7 @@ function show_stats_for_company($product,$socid) // Commandes clients if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { + $nblines++; $ret=$product->load_stats_commande($socid); if ($ret < 0) dol_print_error($db); $langs->load("orders"); @@ -251,6 +255,7 @@ function show_stats_for_company($product,$socid) // Commandes fournisseurs if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire) { + $nblines++; $ret=$product->load_stats_commande_fournisseur($socid); if ($ret < 0) dol_print_error($db); $langs->load("orders"); @@ -268,6 +273,7 @@ function show_stats_for_company($product,$socid) // Contrats if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) { + $nblines++; $ret=$product->load_stats_contrat($socid); if ($ret < 0) dol_print_error($db); $langs->load("contracts"); @@ -285,6 +291,7 @@ function show_stats_for_company($product,$socid) // Factures clients if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { + $nblines++; $ret=$product->load_stats_facture($socid); if ($ret < 0) dol_print_error($db); $langs->load("bills"); @@ -302,6 +309,7 @@ function show_stats_for_company($product,$socid) // Factures fournisseurs if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) { + $nblines++; $ret=$product->load_stats_facture_fournisseur($socid); if ($ret < 0) dol_print_error($db); $langs->load("bills"); @@ -317,7 +325,7 @@ function show_stats_for_company($product,$socid) print ''; } - return 0; + return $nblines++; } diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index eebec1e7f88..834611558a2 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -537,6 +537,7 @@ NbOfCustomers=Number of customers NbOfLines=Number of lines NbOfObjects=Number of objects NbOfReferers=Number of referrers +NbOfObjectReferers=Number of refering objects Referers=Refering objects TotalQuantity=Total quantity DateFromTo=From %s to %s diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index b8a7d377904..ea480222aa7 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -313,3 +313,4 @@ DefaultPriceRealPriceMayDependOnCustomer=Default price, real price may depend on WarningSelectOneDocument=Please select at least one document DefaultUnitToShow=Unit NbOfQtyInProposals=Qty in proposals +ClinkOnALinkOfColumn=Click on a link of column %s to get a detailed view... diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 590830702bb..57c426dc3a1 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2014 Florian Henry @@ -48,7 +48,7 @@ $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','', // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('productstatsinvoice')); -$mesg = ''; +$showmessage=GETPOST('showmessage'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -67,6 +67,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { $search_year=''; } + + /* * View */ @@ -107,7 +109,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'.$langs->trans("Description").''.$langs->trans("Status").'
'.$langs->trans("Description").''.$langs->trans("Status").'
".img_object('', $picto).$langs->trans('desc'.$key); if (! empty($params['warning'])) From d55ac472c3d2ca1cfc85c43f9dafcf2c081d0cad Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 16 Feb 2016 11:27:58 +0100 Subject: [PATCH 06/25] Fix: issue when bank module is disabled Fix: missing entity filter for lines of payment --- .../core/modules/rapport/pdf_paiement.class.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 83bbb0a59b4..cc47c9570a6 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -146,10 +146,11 @@ class pdf_paiement $num=0; $lines=array(); - // count number of ligne of payement + // count number of lines of payment $sql = "SELECT p.rowid as prowid"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p"; $sql.= " WHERE p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'"; + $sql.= " AND p.entity = " . $conf->entity; $result = $this->db->query($sql); if ($result) { @@ -160,19 +161,23 @@ class pdf_paiement $sql = "SELECT p.datep as dp, f.facnumber"; //$sql .= ", c.libelle as paiement_type, p.num_paiement"; $sql.= ", c.code as paiement_code, p.num_paiement"; - $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount "; - $sql.= ", pf.amount as pf_amount , ba.ref as bankaccount "; + $sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount"; + $sql.= ", pf.amount as pf_amount"; + if (! empty($conf->banque->enabled)) + $sql.= ", ba.ref as bankaccount"; $sql.= ", p.rowid as prowid"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."facture as f,"; $sql.= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf,"; - $sql.= " ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba,"; + if (! empty($conf->banque->enabled)) + $sql.= " ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba,"; $sql.= " ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql.= " WHERE f.fk_soc = s.rowid AND pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid"; - $sql.= " AND p.fk_bank = b.rowid AND b.fk_account = ba.rowid "; + if (! empty($conf->banque->enabled)) + $sql.= " AND p.fk_bank = b.rowid AND b.fk_account = ba.rowid "; $sql.= " AND f.entity = ".$conf->entity; $sql.= " AND p.fk_paiement = c.id "; $sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'"; From 134c9d13bc521bd62a29c651fbce927097168c24 Mon Sep 17 00:00:00 2001 From: jfefe Date: Tue, 16 Feb 2016 12:45:18 +0100 Subject: [PATCH 07/25] FIX : check contrast of link when using background color for category --- htdocs/categories/class/categorie.class.php | 13 ++++++----- htdocs/categories/index.php | 8 ++++++- htdocs/theme/eldy/style.css.php | 26 ++++++++++----------- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index a35fc566ea1..50a1a8d0e06 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -229,7 +229,7 @@ class Categorie extends CommonObject $error=0; dol_syslog(get_class($this).'::create', LOG_DEBUG); - + // Clean parameters $this->label = trim($this->label); $this->description = trim($this->description); @@ -405,7 +405,7 @@ class Categorie extends CommonObject // End call triggers $this->db->commit(); - + return 1; } else @@ -571,12 +571,12 @@ class Categorie extends CommonObject if ($this->id == -1) return -2; // For backward compatibility - if ($type == 'societe') + if ($type == 'societe') { $type = 'customer'; dol_syslog(get_class($this) . "::add_type(): type 'societe' is deprecated, please use 'customer' instead", LOG_WARNING); } - elseif ($type == 'fournisseur') + elseif ($type == 'fournisseur') { $type = 'supplier'; dol_syslog(get_class($this) . "::add_type(): type 'fournisseur' is deprecated, please use 'supplier' instead", LOG_WARNING); @@ -1353,16 +1353,17 @@ class Categorie extends CommonObject * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param string $option Sur quoi pointe le lien ('', 'xyz') * @param int $maxlength Max length of text + * @param string $forced_color Hexadecimal code to force link color * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$option='',$maxlength=0) + function getNomUrl($withpicto=0,$option='',$maxlength=0, $forced_color='') { global $langs; $result=''; $label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label); - $link = ''; + $link = ''; $linkend=''; $picto='category'; diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index e57cd22d5fd..a01ea17e969 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -148,7 +148,13 @@ foreach($fulltree as $key => $val) $categstatic->ref=$val['label']; $categstatic->color=$val['color']; $categstatic->type=$type; - $li=$categstatic->getNomUrl(1,'',60); + // Check contrast with background and correct text color + $color = colorArrayToHex(colorStringToArray($categstatic->color,array()),''); + $textcolor='000'; + $tmpcolorweight=0; + foreach(colorStringToArray($color,array()) as $x) $tmpcolorweight+=$x; + if ($tmpcolorweight < 400) $textcolor='FFF'; + $li=$categstatic->getNomUrl(1,'',60, $textcolor); $desc=dol_htmlcleanlastbr($val['description']); $data[] = array( diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 14154d01f51..a756e1f941c 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -653,7 +653,7 @@ div.arearef { margin-bottom: 10px; } div.heightref { - min-height: 80px; + min-height: 80px; } div.divphotoref { padding-right: 20px; @@ -1177,8 +1177,8 @@ div.vmenu, td.vmenu { width: 188px; } -.menu_contenu { - padding-top: 5px; +.menu_contenu { + padding-top: 5px; padding-bottom: 2px; } #menu_contenu_logo { padding-right: 4px; } @@ -1247,7 +1247,7 @@ div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks, div.blockvmen -moz-box-shadow: 3px 3px 4px #DDD; -webkit-box-shadow: 3px 3px 4px #DDD; box-shadow: 3px 3px 4px #DDD; - */ + */ } div.blockvmenusearch @@ -2078,7 +2078,7 @@ table.liste, table.noborder, table.formdoc, div.noborder { border-bottom-width: 1px; border-bottom-color: #BBB; border-bottom-style: solid; - + margin: 0px 0px 5px 0px; -moz-box-shadow: 2px 2px 4px #CCC; @@ -3661,10 +3661,10 @@ a span.select2-chosen box-shadow: none; -webkit-box-shadow: none !important; box-shadow: none !important; - color: #fff !important; + color: #fff; } span.noborderoncategories a, li.noborderoncategories a { - color: #fff !important; + color: #fff; line-height: normal; vertical-align: top; } @@ -3772,10 +3772,10 @@ a.ui-link, a.ui-link:hover, .ui-btn:hover, span.ui-btn-text:hover, span.ui-btn-i } select { /* display: inline-block; */ /* We can't set this. This disable ability to make */ - /* TODO added by jmobile, replace jmobile with pure css*/ + /* TODO added by jmobile, replace jmobile with pure css*/ overflow:hidden; white-space: nowrap; - text-overflow: ellipsis; + text-overflow: ellipsis; } .fiche .ui-controlgroup { margin: 0px; @@ -3953,11 +3953,11 @@ border-top-right-radius: 6px; @media only screen and (max-width: 767px) { .imgopensurveywizard { width:95%; height: auto; } - + #tooltip { position: absolute; width: px; - } + } } @@ -3997,14 +3997,14 @@ border-top-right-radius: 6px; top: 4px; max-width: 82px; } - + div.mainmenu { min-width: 20px; } .topmenuimage { background-size: 20px auto; } - + #tooltip { position: absolute; width: px; From 841145678d13a24ac0f3e01aa4375109948f5b0c Mon Sep 17 00:00:00 2001 From: jfefe Date: Tue, 16 Feb 2016 12:56:57 +0100 Subject: [PATCH 08/25] Always check links color when background color is set onto category --- htdocs/categories/class/categorie.class.php | 10 ++++++++-- htdocs/categories/index.php | 8 +------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 50a1a8d0e06..fb74a29a9f5 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1353,16 +1353,22 @@ class Categorie extends CommonObject * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param string $option Sur quoi pointe le lien ('', 'xyz') * @param int $maxlength Max length of text - * @param string $forced_color Hexadecimal code to force link color * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$option='',$maxlength=0, $forced_color='') + function getNomUrl($withpicto=0,$option='',$maxlength=0) { global $langs; $result=''; $label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label); + // Check contrast with background and correct text color + $color = colorArrayToHex(colorStringToArray($this->color,array()),''); + $forced_color='000'; + $tmpcolorweight=0; + foreach(colorStringToArray($color,array()) as $x) $tmpcolorweight+=$x; + if ($tmpcolorweight < 400) $forced_color='FFF'; + $link = ''; $linkend=''; diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index a01ea17e969..e57cd22d5fd 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -148,13 +148,7 @@ foreach($fulltree as $key => $val) $categstatic->ref=$val['label']; $categstatic->color=$val['color']; $categstatic->type=$type; - // Check contrast with background and correct text color - $color = colorArrayToHex(colorStringToArray($categstatic->color,array()),''); - $textcolor='000'; - $tmpcolorweight=0; - foreach(colorStringToArray($color,array()) as $x) $tmpcolorweight+=$x; - if ($tmpcolorweight < 400) $textcolor='FFF'; - $li=$categstatic->getNomUrl(1,'',60, $textcolor); + $li=$categstatic->getNomUrl(1,'',60); $desc=dol_htmlcleanlastbr($val['description']); $data[] = array( From d8e173af032827ae070f00dc5452ca78032dfe64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Feb 2016 15:01:28 +0100 Subject: [PATCH 09/25] Fix regression (class not found, css on hover broken) with try to manage contrast on categories. --- htdocs/categories/class/categorie.class.php | 18 +++++++++++------ htdocs/core/class/html.formother.class.php | 17 +++++++++++----- htdocs/theme/eldy/style.css.php | 13 ++++++++++-- htdocs/theme/md/style.css.php | 22 ++++++++++++++++++--- 4 files changed, 54 insertions(+), 16 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index fb74a29a9f5..03a66adab74 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1349,6 +1349,7 @@ class Categorie extends CommonObject /** * Return name and link of category (with picto) + * Use ->id, ->ref, ->label, ->color * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param string $option Sur quoi pointe le lien ('', 'xyz') @@ -1363,13 +1364,18 @@ class Categorie extends CommonObject $label=$langs->trans("ShowCategory").': '. ($this->ref?$this->ref:$this->label); // Check contrast with background and correct text color - $color = colorArrayToHex(colorStringToArray($this->color,array()),''); - $forced_color='000'; - $tmpcolorweight=0; - foreach(colorStringToArray($color,array()) as $x) $tmpcolorweight+=$x; - if ($tmpcolorweight < 400) $forced_color='FFF'; + $forced_color='categtextwhite'; + if ($this->color) + { + $hex=$this->color; + $r = hexdec($hex[0].$hex[1]); + $g = hexdec($hex[2].$hex[3]); + $b = hexdec($hex[4].$hex[5]); + $bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm + if ($bright > 0.6) $forced_color='categtextblack'; // Higher than 60% + } - $link = ''; + $link = ''; $linkend=''; $picto='category'; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 1727db5f227..078dc01d96f 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -595,13 +595,20 @@ class FormOther */ static function showColor($color, $textifnotdefined='') { + $textcolor='FFF'; + if ($color) + { + $hex=$color; + $r = hexdec($hex[0].$hex[1]); + $g = hexdec($hex[2].$hex[3]); + $b = hexdec($hex[4].$hex[5]); + $bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm + if ($bright > 0.6) $textcolor='000'; + } + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $color = colorArrayToHex(colorStringToArray($color,array()),''); - $textcolor='000'; - $tmpcolorweight=0; - foreach(colorStringToArray($color,array()) as $x) $tmpcolorweight+=$x; - if ($tmpcolorweight < 400) $textcolor='FFF'; + if ($color) print ''; else print $textifnotdefined; } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index a756e1f941c..1aa5b41ac3f 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3655,22 +3655,31 @@ a span.select2-chosen overflow: hidden; } + +/* ============================================================================== */ +/* For categories */ +/* ============================================================================== */ + .noborderoncategories { border: none !important; border-radius: 5px !important; box-shadow: none; -webkit-box-shadow: none !important; box-shadow: none !important; - color: #fff; } span.noborderoncategories a, li.noborderoncategories a { - color: #fff; line-height: normal; vertical-align: top; } span.noborderoncategories { padding: 3px 5px 0px 5px; } +.categtextwhite, .treeview .categtextwhite.hover { + color: #fff !important; +} +.categtextblack { + color: #000 !important; +} /* ============================================================================== */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index fe1e161dfc8..e08512b9ca4 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2789,6 +2789,14 @@ table.dp { color: rgb(); } +.categtextwhite, .treeview .categtextwhite.hover { + color: #fff !important; +} +.categtextblack { + color: #000 !important; +} + + /* ============================================================================== */ /* Afficher/cacher */ /* ============================================================================== */ @@ -3498,22 +3506,30 @@ a span.select2-chosen overflow: hidden; } + +/* ============================================================================== */ +/* For categories */ +/* ============================================================================== */ + .noborderoncategories { border: none !important; border-radius: 5px !important; box-shadow: none; -webkit-box-shadow: none !important; box-shadow: none !important; - color: #fff !important; } span.noborderoncategories a, li.noborderoncategories a { - color: #fff !important; line-height: normal; } span.noborderoncategories { padding: 5px 5px 0px 5px; } - +.categtextwhite, .treeview .categtextwhite.hover { + color: #fff !important; +} +.categtextblack { + color: #000 !important; +} /* ============================================================================== */ From 14fb2c914aa93123f95a624571b6c4de2dc5d266 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Feb 2016 15:38:24 +0100 Subject: [PATCH 10/25] Fix option MAIN_USE_HOURMIN_IN_DATE_RANGE was not supported in output --- htdocs/core/tpl/objectline_view.tpl.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index f71b2b484d1..7162ac66cb9 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -90,12 +90,14 @@ if (empty($usemargins)) $usemargins=0; } else { - if ($line->fk_product > 0) + $format = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE?'dayhour':'day'; + + if ($line->fk_product > 0) { echo $form->textwithtooltip($text,$description,3,'','',$i,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):'')); // Show range - echo get_date_range($line->date_start, $line->date_end); + echo get_date_range($line->date_start, $line->date_end, $format); // Add description in form if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) @@ -119,7 +121,7 @@ if (empty($usemargins)) $usemargins=0; } // Show range - echo get_date_range($line->date_start,$line->date_end); + echo get_date_range($line->date_start,$line->date_end, $format); } } ?> From 03b9b65d933b02ea796c609b8538e04abf5320da Mon Sep 17 00:00:00 2001 From: philippe grand Date: Tue, 16 Feb 2016 16:45:19 +0100 Subject: [PATCH 11/25] [quality] : better help --- .../fourn/class/fournisseur.commande.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index a0184662065..2edbcb0f249 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2010-2014 Philippe Grand + * Copyright (C) 2010-2016 Philippe Grand * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador @@ -53,7 +53,7 @@ class CommandeFournisseur extends CommonOrder var $id; /** - * Supplier invoice reference + * Supplier order reference * @var string */ var $ref; @@ -103,7 +103,7 @@ class CommandeFournisseur extends CommonOrder var $user_approve_id; var $user_approve_id2; // Used when SUPPLIER_ORDER_DOUBLE_APPROVAL is set - //Incorterms + //Incoterms var $fk_incoterms; var $location_incoterms; var $libelle_incoterms; //Used into tooltip @@ -114,7 +114,7 @@ class CommandeFournisseur extends CommonOrder * @var CommandeFournisseurLigne[] */ public $lines = array(); - //Ajout pour supplier_proposal + //Add for supplier_proposal var $origin; var $origin_id; var $linked_objects=array(); @@ -243,7 +243,7 @@ class CommandeFournisseur extends CommonOrder $this->db->free($resql); - // Retreive all extrafield + // Retrieve all extrafields // fetch optionals attributes and labels require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'); $extrafields=new ExtraFields($this->db); @@ -390,7 +390,7 @@ class CommandeFournisseur extends CommonOrder { $this->db->begin(); - // Definition du nom de modele de numerotation de commande + // Definition of supplier order numbering model name $soc = new Societe($this->db); $soc->fetch($this->fourn_id); @@ -435,7 +435,7 @@ class CommandeFournisseur extends CommonOrder // Rename directory if dir was a temporary ref if (preg_match('/^[\(]?PROV/i', $this->ref)) { - // On renomme repertoire ($this->ref = ancienne ref, $num = nouvelle ref) + // We rename directory ($this->ref = ancienne ref, $num = nouvelle ref) // in order not to lose the attached files $oldref = dol_sanitizeFileName($this->ref); $newref = dol_sanitizeFileName($num); @@ -618,8 +618,8 @@ class CommandeFournisseur extends CommonOrder /** - * Renvoie la reference de commande suivante non utilisee en fonction du modele - * de numerotation actif defini dans COMMANDE_SUPPLIER_ADDON_NUMBER + * Returns the following order reference not used depending on the numbering model activated + * defined within COMMANDE_SUPPLIER_ADDON_NUMBER * * @param Societe $soc objet societe * @return string reference libre pour la facture From 633de3bcb454908cdbe9ee2bdd62d16cbf2dffb2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Feb 2016 22:33:02 +0100 Subject: [PATCH 12/25] Fix list of object referers should not be set to invoice by default (may be module is disabed). I replace with a message to choose list. --- htdocs/core/lib/product.lib.php | 16 ++++++++++++---- htdocs/langs/en_US/main.lang | 1 + htdocs/langs/en_US/products.lang | 1 + htdocs/product/stats/facture.php | 15 ++++++++++----- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 6deaf7eae08..7bdb6cd5756 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -101,7 +101,7 @@ function product_prepare_head($object) $head[$h][2] = 'stats'; $h++; - $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$object->id; + $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?showmessage=1&id=".$object->id; $head[$h][1] = $langs->trans('Referers'); $head[$h][2] = 'referers'; $h++; @@ -201,22 +201,25 @@ function product_admin_prepare_head() * * @param Product $product Product object * @param int $socid Thirdparty id - * @return integer + * @return integer NB of lines shown into array */ function show_stats_for_company($product,$socid) { global $conf,$langs,$user,$db; + $nblines = 0; + print '
'.$langs->trans("Referers").''.$langs->trans("NbOfThirdParties").''.$langs->trans("NbOfReferers").''.$langs->trans("NbOfObjectReferers").''.$langs->trans("TotalQuantity").'
'; - show_stats_for_company($product,$socid); + $nboflines = show_stats_for_company($product,$socid); print "
"; @@ -116,8 +118,11 @@ if ($id > 0 || ! empty($ref)) dol_fiche_end(); - - if ($user->rights->facture->lire) + if ($showmessage && $nboflines > 1) + { + print $langs->trans("ClinkOnALinkOfColumn", $langs->transnoentitiesnoconv("Referers")); + } + elseif ($user->rights->facture->lire) { $sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,"; $sql.= " f.facnumber, f.datef, f.paye, f.fk_statut as statut, f.rowid as facid,"; From 5d2c189e0e9b41ad4757d8dfbf047de5626c2b61 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Feb 2016 23:45:25 +0100 Subject: [PATCH 13/25] Fix bad place of table --- htdocs/core/class/html.form.class.php | 5 +++-- htdocs/expedition/tpl/linkedobjectblock.tpl.php | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5078b5932c9..73b401025e9 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5084,17 +5084,18 @@ class Form print ''; print ''; print ''; + print ''; print '' . $objp->ref . ''; print '' . $objp->ref_client . ''; print '' . price($objp->total_ht) . ''; print '' . $objp->name . ''; - print ''; print ''; $i ++; } print ''; print '
     
'; + print ''; $this->db->free($resqlorderlist); } else { @@ -5150,11 +5151,11 @@ class Form print ''; print ''; print ''; + print ''; print '' . $objp->ref . ''; print '' . $objp->ref_supplier . ''; print '' . price($objp->total_ht) . ''; print '' . $objp->name . ''; - print ''; print ''; $i ++; diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index f18ed1ea80f..aea4127b50a 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -74,7 +74,7 @@ foreach($linkedObjectBlock as $key => $objectlink) +--> - --> - + From dfe7c6f06f1ef5d399c776297b3df939b666e0eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Thu, 18 Feb 2016 12:21:11 +0100 Subject: [PATCH 14/25] Fix #4649 Wrong parameters order --- htdocs/product/price.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 73064859297..c06158ae2ff 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1256,7 +1256,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) // Count total nb of records $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $nbtotalofrecords = $prodcustprice->fetch_all($sortfield, $sortorder, 0, 0, $filter); + $nbtotalofrecords = $prodcustprice->fetch_all($sortorder, $sortfield, 0, 0, $filter); } $result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter); From 9fd22722ffccd8678ea09042f003e1d9d887f358 Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Thu, 18 Feb 2016 15:18:47 +0100 Subject: [PATCH 15/25] left a space between clone and $object --- htdocs/contact/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index bd9a4b781f5..813eb826f72 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -343,7 +343,7 @@ if (empty($reshook)) } } - $object->oldcopy = clone$object; + $object->oldcopy = clone $object; $object->old_lastname = GETPOST("old_lastname"); $object->old_firstname = GETPOST("old_firstname"); From bc4c964b891af67f41492a9e0c0f0a37362716eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Feb 2016 23:21:02 +0100 Subject: [PATCH 16/25] Several fixes in stock management (label, and bad action when lot module is on) --- htdocs/core/menus/init_menu_auguria.sql | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/langs/en_US/stocks.lang | 3 +- htdocs/product/stock/massstockmove.php | 2 +- htdocs/product/stock/mouvement.php | 216 ++++++++++++++++-- htdocs/product/stock/product.php | 4 +- .../product/stock/tpl/stockcorrection.tpl.php | 13 +- .../product/stock/tpl/stocktransfer.tpl.php | 38 +-- 8 files changed, 235 insertions(+), 45 deletions(-) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 0d95d94c721..86b8a58e68f 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -110,7 +110,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3102__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/list.php', 'List', 1, 'stocks', '$user->rights->stock->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3104__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/mouvement.php', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 3105__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/replenish.php', 'Replenishments', 1, 'stocks', '$user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'StockTransfer', 1, 'stocks', '$user->rights->stock->mouvement->creer', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->stock->enabled', __HANDLER__, 'left', 3106__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/massstockmove.php', 'MassStockTransferShort', 1, 'stocks', '$user->rights->stock->mouvement->creer', '', 2, 5, __ENTITY__); -- Product - Categories insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3200__+MAX_llx_menu__, 'products', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=0', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 816d6d9cd8b..eff98bba3a6 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1133,7 +1133,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->rights->stock->lire); $newmenu->add("/product/stock/mouvement.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); if ($conf->fournisseur->enabled) $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire); - $newmenu->add("/product/stock/massstockmove.php", $langs->trans("StockTransfer"), 1, $user->rights->stock->mouvement->creer); + $newmenu->add("/product/stock/massstockmove.php", $langs->trans("MassStockTransferShort"), 1, $user->rights->stock->mouvement->creer); } // Expeditions diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 943e988b2f7..e6b9f82730c 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -34,7 +34,8 @@ LastMovements=Last movements Units=Units Unit=Unit StockCorrection=Correct stock -StockTransfer=Stock movement +StockTransfer=Transfer stock +MassStockTransferShort=Mass stock transfer StockMovement=Stock movement StockMovements=Stock movements LabelMovement=Movement label diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 652ec947a37..7d62699b425 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -325,7 +325,7 @@ $title = $langs->trans('MassMovement'); llxHeader('', $title); -print load_fiche_titre($langs->trans("MassStockMovement")); +print load_fiche_titre($langs->trans("MassStockTransferShort")); $titletoadd=$langs->trans("Select"); $titletoaddnoent=$langs->transnoentitiesnoconv("Select"); diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 32edd0b4e9d..190bf676c8a 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -54,16 +54,18 @@ $search_warehouse = trim(GETPOST("search_warehouse")); $search_inventorycode = trim(GETPOST("search_inventorycode")); $search_user = trim(GETPOST("search_user")); $search_batch = trim(GETPOST("search_batch")); + $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $page = GETPOST("page",'int'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); if ($page < 0) $page = 0; $offset = $limit * $page; - if (! $sortfield) $sortfield="m.datem"; if (! $sortorder) $sortorder="DESC"; +$pdluoid=GETPOST('pdluoid','int'); + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $year=''; @@ -152,6 +154,171 @@ if ($action == "correct_stock") if (! $error) $action=''; } +// Transfer stock from a warehouse to another warehouse +if ($action == "transfert_stock" && ! $cancel) +{ + $product = new Product($db); + if (! empty($product_id)) $result=$product->fetch($product_id); + + if (! (GETPOST("id_entrepot_destination",'int') > 0)) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); + $error++; + $action='transfert'; + } + if (empty($product_id)) + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors'); + $action='transfert'; + } + if (! GETPOST("nbpiece",'int')) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors'); + $error++; + $action='transfert'; + } + if ($id == GETPOST("id_entrepot_destination",'int')) + { + setEventMessages($langs->trans("ErrorSrcAndTargetWarehouseMustDiffers"), null, 'errors'); + $error++; + $action='transfert'; + } + + if (! empty($conf->productbatch->enabled)) + { + $product = new Product($db); + $result=$product->fetch($product_id); + + if ($product->hasbatch() && ! GETPOST("batch_number")) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("batch_number")), null, 'errors'); + $error++; + $action='transfert'; + } + } + + if (! $error) + { + if ($id) + { + $object = new Entrepot($db); + $result=$object->fetch($id); + + $db->begin(); + + $product->load_stock(); // Load array product->stock_warehouse + + // Define value of products moved + $pricesrc=0; + //if (isset($product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp)) $pricesrc=$product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp; + if (isset($product->pmp)) $pricesrc=$product->pmp; + $pricedest=$pricesrc; + + if ($product->hasbatch()) + { + $pdluo = new Productbatch($db); + + if ($pdluoid > 0) + { + $result=$pdluo->fetch($pdluoid); + if ($result) + { + $srcwarehouseid=$pdluo->warehouseid; + $batch=$pdluo->batch; + $eatby=$pdluo->eatby; + $sellby=$pdluo->sellby; + } + else + { + setEventMessages($pdluo->error, $pdluo->errors, 'errors'); + $error++; + } + } + else + { + $srcwarehouseid=$id; + $batch=GETPOST('batch_number'); + $eatby=$d_eatby; + $sellby=$d_sellby; + } + + if (! $error) + { + // Remove stock + $result1=$product->correct_stock_batch( + $user, + $srcwarehouseid, + GETPOST("nbpiece",'int'), + 1, + GETPOST("label",'san_alpha'), + $pricesrc, + $eatby,$sellby,$batch, + GETPOST('inventorycode') + ); + // Add stock + $result2=$product->correct_stock_batch( + $user, + GETPOST("id_entrepot_destination",'int'), + GETPOST("nbpiece",'int'), + 0, + GETPOST("label",'san_alpha'), + $pricedest, + $eatby,$sellby,$batch, + GETPOST('inventorycode') + ); + } + } + else + { + // Remove stock + $result1=$product->correct_stock( + $user, + $id, + GETPOST("nbpiece"), + 1, + GETPOST("label"), + $pricesrc, + GETPOST('inventorycode') + ); + + // Add stock + $result2=$product->correct_stock( + $user, + GETPOST("id_entrepot_destination"), + GETPOST("nbpiece"), + 0, + GETPOST("label"), + $pricedest, + GETPOST('inventorycode') + ); + } + if (! $error && $result1 >= 0 && $result2 >= 0) + { + $db->commit(); + + if ($backtopage) + { + header("Location: ".$backtopage); + exit; + } + else + { + header("Location: mouvement.php?id=".$object->id); + exit; + } + } + else + { + setEventMessages($product->error, $product->errors, 'errors'); + $db->rollback(); + $action='transfert'; + } + } + } +} + + /* * View @@ -451,7 +618,7 @@ if ($resql) /* */ /* ************************************************************************** */ - if (empty($action) && $id) + if (empty($action) && $id > 0) { print "
\n"; @@ -460,16 +627,17 @@ if ($resql) print ''.$langs->trans("StockCorrection").''; } - /*if ($user->rights->stock->mouvement->creer) + if ($user->rights->stock->mouvement->creer) { - print ''.$langs->trans("StockMovement").''; - }*/ + print ''.$langs->trans("StockTransfer").''; + } + print '

'; } $param=''; - if ($id) $param.='&id='.$id; + if ($id > 0) $param.='&id='.$id; if ($search_movement) $param.='&search_movement='.urlencode($search_movement); if ($search_inventorycode) $param.='&search_inventorycode='.urlencode($search_inventorycode); if ($search_product_ref) $param.='&search_product_ref='.urlencode($search_product_ref); @@ -479,11 +647,11 @@ if ($resql) if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined if ($search_user) $param.='&search_user='.urlencode($search_user); if ($idproduct > 0) $param.='&idproduct='.$idproduct; - if ($id) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords,''); + if ($id > 0) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords,''); else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords); print '
'; - if ($id) print ''; + if ($id > 0) print ''; print ''; print ""; @@ -498,7 +666,7 @@ if ($resql) print_liste_field_titre($langs->trans("l_eatby"),$_SERVER["PHP_SELF"],'m.eatby','',$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("l_sellby"),$_SERVER["PHP_SELF"],'m.sellby','',$param,'align="center"',$sortfield,$sortorder); } - print_liste_field_titre($langs->trans("Warehouse"),$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible + if (! $id > 0) print_liste_field_titre($langs->trans("Warehouse"),$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("InventoryCodeShort"),$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("LabelMovement"),$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); @@ -532,9 +700,12 @@ if ($resql) print ''; } // Warehouse - print ''; + if (! $id > 0) + { + print ''; + } // Author print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } // Warehouse - print '\n"; + if (! $id > 0) + { + print '\n"; + } // Author print ''; // Serial / Eat-by date - if ((! empty($conf->productbatch->enabled)) && is_object($product) && $product->hasbatch()) + if (! empty($conf->productbatch->enabled) && + (($object->element == 'product' && $object->hasbatch()) + || ($object->element == 'stock')) + ) { print ''; - print ''; print ''; @@ -101,7 +104,7 @@ } // Label of mouvement of id of inventory - $valformovementlabel=((GETPOST("label") && (GETPOST('label') != $langs->trans("MovementCorrectStock",''))) ? GETPOST("label") : $langs->trans("MovementCorrectStock", $product->ref)); + $valformovementlabel=((GETPOST("label") && (GETPOST('label') != $langs->trans("MovementCorrectStock",''))) ? GETPOST("label") : $langs->trans("MovementCorrectStock", $productref)); print ''; print ''; print ''; // Price base @@ -981,11 +1124,16 @@ if ($action == 'edit_price' && $object->getRights()->creer) // VAT if (empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; } else { // This option is kept for backward compatibility but has no sense print ''; } @@ -1205,7 +1353,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) // VAT print ''; // Price base @@ -1289,7 +1437,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) // VAT print ''; // Price base From 16c44af690211fffb04a4205784a51d9cbb90689 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Feb 2016 02:44:56 +0100 Subject: [PATCH 20/25] Fix bad example of setup to use --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index cc5a97a1ca7..e873655bcdc 100755 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1662,7 +1662,7 @@ BackupDumpWizard=Wizard to build database backup dump file SomethingMakeInstallFromWebNotPossible=Installation of external module is not possible from the web interface for the following reason: SomethingMakeInstallFromWebNotPossible2=For this reason, process to upgrade described here is only manual steps a privileged user can do. InstallModuleFromWebHasBeenDisabledByFile=Install of external module from application has been disabled by your administrator. You must ask him to remove the file %s to allow this feature. -ConfFileMuseContainCustom=Installing an external module from application save the module files into directory %s. To have this directory processed by Dolibarr, you must setup your conf/conf.php to have option
- $dolibarr_main_url_root_alt enabled to value $dolibarr_main_url_root_alt="/custom"
- $dolibarr_main_document_root_alt enabled to value "%s/custom" +ConfFileMuseContainCustom=Installing an external module from application save the module files into directory %s. To have this directory processed by Dolibarr, you must setup your conf/conf.php to have option
$dolibarr_main_url_root_alt='/custom';
$dolibarr_main_document_root_alt='%s/custom'; HighlightLinesOnMouseHover=Highlight table lines when mouse move passes over HighlightLinesColor=Highlight color of the line when the mouse passes over (keep empty for no highlight) TextTitleColor=Color of page title From 9e11fd988dd720906c3c6b5b2effe2b8a447e3cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Feb 2016 03:32:02 +0100 Subject: [PATCH 21/25] Fix: color of category when showing full path must use color of last element of path --- htdocs/categories/class/categorie.class.php | 42 +++++++++++++++++---- htdocs/categories/viewcat.php | 2 +- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 03a66adab74..befbaf34c25 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -1131,29 +1131,57 @@ class Categorie extends CommonObject * Retourne les chemin de la categorie, avec les noms des categories * separes par $sep (" >> " par defaut) * - * @param string $sep Separator - * @param string $url Url + * @param string $sep Separator + * @param string $url Url + * @param int $nocolor 0 * @return array */ - function print_all_ways($sep = " >> ", $url='') + function print_all_ways($sep = " >> ", $url='', $nocolor=0) { $ways = array(); - foreach ($this->get_all_ways() as $way) + $allways = $this->get_all_ways(); // Load array of categories + foreach ($allways as $way) { $w = array(); + $i = 0; foreach ($way as $cat) { + $i++; + + if (empty($nocolor)) + { + $forced_color='toreplace'; + if ($i == count($way)) + { + // Check contrast with background and correct text color + $forced_color='categtextwhite'; + if ($cat->color) + { + $hex=$cat->color; + $r = hexdec($hex[0].$hex[1]); + $g = hexdec($hex[2].$hex[3]); + $b = hexdec($hex[4].$hex[5]); + $bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm + if ($bright >= 0.5) $forced_color='categtextblack'; // Higher than 60% + } + } + } + if ($url == '') { - $w[] = "".$cat->label.""; + $link = ''; + $linkend=''; + $w[] = $link.$cat->label.$linkend; } else { $w[] = "".$cat->label.""; } } - $ways[] = implode($sep, $w); + $newcategwithpath = preg_replace('/toreplace/', $forced_color, implode($sep, $w)); + + $ways[] = $newcategwithpath; } return $ways; @@ -1372,7 +1400,7 @@ class Categorie extends CommonObject $g = hexdec($hex[2].$hex[3]); $b = hexdec($hex[4].$hex[5]); $bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm - if ($bright > 0.6) $forced_color='categtextblack'; // Higher than 60% + if ($bright >= 0.5) $forced_color='categtextblack'; // Higher than 60% } $link = ''; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 3b5d0b64a86..a1486ff344f 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -189,7 +189,7 @@ print '
'; - print ''; - print ''; + print ''; + print ''; print ''; @@ -598,17 +769,20 @@ if ($resql) // Batch if (! empty($conf->productbatch->enabled)) { - print ''.$objp->batch.''. dol_print_date($objp->eatby,'day') .''. dol_print_date($objp->sellby,'day') .''.$objp->batch.''. dol_print_date($objp->eatby,'day') .''. dol_print_date($objp->sellby,'day') .''; - $warehousestatic->id=$objp->entrepot_id; - $warehousestatic->libelle=$objp->stock; - $warehousestatic->lieu=$objp->lieu; - print $warehousestatic->getNomUrl(1); - print "'; + $warehousestatic->id=$objp->entrepot_id; + $warehousestatic->libelle=$objp->stock; + $warehousestatic->lieu=$objp->lieu; + print $warehousestatic->getNomUrl(1); + print "'; $userstatic->id=$objp->fk_user_author; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index ba083cc1527..5b26f215adb 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -648,7 +648,7 @@ if (empty($action) && $object->id) //if (($user->rights->stock->mouvement->creer) && ! $object->hasbatch()) if ($user->rights->stock->mouvement->creer) { - print ''.$langs->trans("StockMovement").''; + print ''.$langs->trans("StockTransfer").''; } print ''; @@ -753,7 +753,7 @@ if ($resql) { print "\n".'
'; print img_picto($langs->trans("Tranfer"),'uparrow','class="hideonsmartphone"').' '; - print 'id.'">'.$langs->trans("StockMovement").''; + print 'id.'">'.$langs->trans("StockTransfer").''; // Disabled, because edition of stock content must use the "Correct stock menu". // Do not use this, or data will be wrong (bad tracking of movement label, inventory code, ... //print 'id.'#'.$pdluo->id.'">'; diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 90a7468a351..d9f02781fd5 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -15,13 +15,13 @@ * along with this program. If not, see . * * $object must be defined - * $product can be defined */ ?> element == 'product') $productref = $object->ref; $langs->load("productbatch"); @@ -81,10 +81,13 @@ print '
'.$langs->trans("batch_number").''; + print 'element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; print ''; print '
'.$langs->trans("MovementLabel").''; diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index 0f13a5452da..1c0448192f1 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -14,17 +14,20 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . * - * $product must be defined + * $object must be defined * $backtopage */ ?> element == 'product') $productref = $object->ref; $langs->load("productbatch"); + if (empty($id)) $id = $object->id; + $pdluoid=GETPOST('pdluoid','int'); $pdluo = new Productbatch($db); @@ -44,7 +47,7 @@ print load_fiche_titre($langs->trans("StockTransfer"),'','title_generic.png'); - print ''."\n"; + print ''."\n"; print ''; print ''; print ''; @@ -54,28 +57,37 @@ } print ''; + // Source warehouse or product print ''; - print ''; + print ''; } - else + if ($object->element == 'stock') { - print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot_source')?GETPOST('id_entrepot_source','int'):'ifone')),'id_entrepot_source','',1); + print ''; + print ''; } - print ''; + print ''; print ''; print ''; - // Eat-by date - if ((! empty($conf->productbatch->enabled)) && $product->hasbatch()) + // Serial / Eat-by date + if (! empty($conf->productbatch->enabled) && + (($object->element == 'product' && $object->hasbatch()) + || ($object->element == 'stock')) + ) { print ''; - print ''; print ''; @@ -90,7 +102,7 @@ } // Label - $valformovementlabel=(GETPOST("label")?GETPOST("label"):$langs->trans("MovementTransferStock", $product->ref)); + $valformovementlabel=(GETPOST("label")?GETPOST("label"):$langs->trans("MovementTransferStock", $productref)); print ''; print ''; print ''; print '
'.$langs->trans("WarehouseSource").''; - if ($pdluoid > 0) + if ($object->element == 'product') { - print $formproduct->selectWarehouses($pdluo->warehouseid,'id_entrepot_source','',1,1); + print ''.$langs->trans("WarehouseSource").''; + print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')),'id_entrepot','',1); + print ''.$langs->trans("Product").''; + print $form->select_produits(GETPOST('product_id'),'product_id',(empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':'')); + print ''.$langs->trans("WarehouseTarget").''; print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'),'id_entrepot_destination','',1); print ''.$langs->trans("NumberOfUnit").'
'.$langs->trans("batch_number").''; + print 'element == 'stock'?'': ' class="fieldrequired"').'>'.$langs->trans("batch_number").''; print ' 0 ? ' disabled':'').' value="'.(GETPOST('batch_number')?GETPOST('batch_number'):$pdluo->batch).'">'; // If form was opened for a specific pdluoid, field is disabled print '
'.$langs->trans("MovementLabel").''; From bd80249580e2dbdd85e43c087cd83edaca915241 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Feb 2016 01:45:52 +0100 Subject: [PATCH 17/25] Fix code comment --- htdocs/core/lib/price.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index 03eb651e4db..dd33ab0c5c2 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -47,7 +47,7 @@ * @param int $info_bits Miscellaneous informations on line * @param int $type 0/1=Product/service * @param Societe $seller Thirdparty seller (we need $seller->country_id property). Provided only if seller is the supplier, otherwise $seller will be $mysoc. - * @param array $localtaxes_array Array with localtaxes info (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function). + * @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function). * @param integer $progress Situation invoices progress (value from 0 to 100, 100 by default) * @return result[ 0=total_ht, * 1=total_vat, (main vat only) @@ -113,7 +113,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $localtax2_type = $localtaxes_array[2]; $localtax2_rate = $localtaxes_array[3]; } - else // deprecated method. values and type for localtaxes must be provided by caller and loade with getLocalTaxesFromRate + else // deprecated method. values and type for localtaxes must be provided by caller and loaded with getLocalTaxesFromRate { $sql = "SELECT taux, localtax1, localtax2, localtax1_type, localtax2_type"; $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as cv"; From 3b5ce32cb058f22a5ee099e633aba0b90b74f17e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Feb 2016 01:47:00 +0100 Subject: [PATCH 18/25] Code comment --- htdocs/core/lib/functions.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9f5742af1bc..138a3054333 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3318,7 +3318,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0) * Return localtax rate for a particular vat, when selling a product with vat $vatrate, from a $thirdparty_buyer to a $thirdparty_seller * Note: This function applies same rules than get_default_tva * - * @param float $vatrate Vat rate + * @param float $vatrate Vat rate. Can be '8.5' or '8.5 (8.5NPR)' for example * @param int $local Local tax to search and return (1 or 2 return only tax rate 1 or tax rate 2) * @param Societe $thirdparty_buyer Object of buying third party * @param Societe $thirdparty_seller Object of selling third party @@ -3509,7 +3509,7 @@ function get_localtax_by_third($local) * Instead this function must be called when adding a line to get the array of localtax and type, and then * provide it to the function calcul_price_total. * - * @param float $vatrate VAT Rate + * @param float $vatrate VAT Rate. Value can be '8.5' or '8.5 (8.5NPR)'. * @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2) * @param Societe $buyer Company object * @param Societe $seller Company object @@ -3660,7 +3660,7 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr } else dol_print_error($db); } - else $ret=$conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS; + else $ret=$conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS; // Forced value if autodetect fails } dol_syslog("get_product_vat_for_country: ret=".$ret); From 4d0b9946f5941e81fa99a99346bfb25988ecfe3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Feb 2016 02:41:00 +0100 Subject: [PATCH 19/25] FIX Maxi serious problem when updating prices and vat of a product. All mode (one price, price per level, ...) were impacted. Localtax setup were lost. --- .../install/mysql/migration/3.8.0-3.9.0.sql | 10 + htdocs/install/mysql/tables/llx_product.sql | 6 +- .../tables/llx_product_customer_price.sql | 2 + .../tables/llx_product_customer_price_log.sql | 4 +- .../mysql/tables/llx_product_price.sql | 2 + htdocs/product/class/product.class.php | 67 ++++-- .../class/productcustomerprice.class.php | 12 + htdocs/product/price.php | 206 +++++++++++++++--- 8 files changed, 256 insertions(+), 53 deletions(-) diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 41166b0de06..46bd098e888 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -26,6 +26,16 @@ ALTER TABLE llx_don ADD COLUMN fk_country integer NOT NULL DEFAULT 0 after country; +ALTER TABLE llx_product ADD COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0' after localtax1_tx; +ALTER TABLE llx_product ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx; +ALTER TABLE llx_product_price ADD COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0' after localtax1_tx; +ALTER TABLE llx_product_price ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx; +ALTER TABLE llx_product_customer_price ADD COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0' after localtax1_tx; +ALTER TABLE llx_product_customer_price ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx; +ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax1_type varchar(10) NOT NULL DEFAULT '0' after localtax1_tx; +ALTER TABLE llx_product_customer_price_log ADD COLUMN localtax2_type varchar(10) NOT NULL DEFAULT '0' after localtax2_tx; + + UPDATE llx_user set api_key = null where api_key = ''; diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index f42f18b8e46..1f7b7da3c0d 100755 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -46,8 +46,10 @@ create table llx_product cost_price double(24,8) DEFAULT NULL, -- Cost price without tax. Can be used for margin calculation. tva_tx double(6,3), -- Default VAT rate of product recuperableonly integer NOT NULL DEFAULT '0', -- French NPR VAT - localtax1_tx double(6,3) DEFAULT 0, -- Spanish local VAT 1 - localtax2_tx double(6,3) DEFAULT 0, -- Spanish local VAT 2 + localtax1_tx double(6,3) DEFAULT 0, -- + localtax1_type varchar(10) NOT NULL DEFAULT '0', -- + localtax2_tx double(6,3) DEFAULT 0, -- + localtax2_type varchar(10) NOT NULL DEFAULT '0', -- fk_user_author integer DEFAULT NULL, -- user making creation fk_user_modif integer, -- user making last change tosell tinyint DEFAULT 1, -- Product you sell diff --git a/htdocs/install/mysql/tables/llx_product_customer_price.sql b/htdocs/install/mysql/tables/llx_product_customer_price.sql index 0dd37358682..8098ae5f028 100644 --- a/htdocs/install/mysql/tables/llx_product_customer_price.sql +++ b/htdocs/install/mysql/tables/llx_product_customer_price.sql @@ -36,7 +36,9 @@ create table llx_product_customer_price tva_tx double(6,3), recuperableonly integer NOT NULL DEFAULT '0', -- Other NPR VAT localtax1_tx double(6,3) DEFAULT 0, -- Other local VAT 1 + localtax1_type varchar(10) NOT NULL DEFAULT '0', localtax2_tx double(6,3) DEFAULT 0, -- Other local VAT 2 + localtax2_type varchar(10) NOT NULL DEFAULT '0', fk_user integer, import_key varchar(14) -- Import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_product_customer_price_log.sql b/htdocs/install/mysql/tables/llx_product_customer_price_log.sql index b25bd982aab..699060cdc98 100644 --- a/htdocs/install/mysql/tables/llx_product_customer_price_log.sql +++ b/htdocs/install/mysql/tables/llx_product_customer_price_log.sql @@ -21,7 +21,7 @@ create table llx_product_customer_price_log ( rowid integer AUTO_INCREMENT PRIMARY KEY, - entity integer DEFAULT 1 NOT NULL, -- multi company id + entity integer DEFAULT 1 NOT NULL, -- multi company id datec datetime, fk_product integer NOT NULL, fk_soc integer NOT NULL, @@ -33,7 +33,9 @@ create table llx_product_customer_price_log tva_tx double(6,3), recuperableonly integer NOT NULL DEFAULT '0', -- Other NPR VAT localtax1_tx double(6,3) DEFAULT 0, -- Other local VAT 1 + localtax1_type varchar(10) NOT NULL DEFAULT '0', localtax2_tx double(6,3) DEFAULT 0, -- Other local VAT 2 + localtax2_type varchar(10) NOT NULL DEFAULT '0', fk_user integer, import_key varchar(14) -- Import key )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_product_price.sql b/htdocs/install/mysql/tables/llx_product_price.sql index 1341c49dcaa..a0797b8bd33 100755 --- a/htdocs/install/mysql/tables/llx_product_price.sql +++ b/htdocs/install/mysql/tables/llx_product_price.sql @@ -34,7 +34,9 @@ create table llx_product_price tva_tx double(6,3) NOT NULL, recuperableonly integer NOT NULL DEFAULT '0', localtax1_tx double(6,3) DEFAULT 0, + localtax1_type varchar(10) NOT NULL DEFAULT '0', localtax2_tx double(6,3) DEFAULT 0, + localtax2_type varchar(10) NOT NULL DEFAULT '0', fk_user_author integer, tosell tinyint DEFAULT 1, price_by_qty integer NOT NULL DEFAULT 0, diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8278f244941..90b7f3cd994 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -101,10 +101,12 @@ class Product extends CommonObject var $tva_tx; //! French VAT NPR (0 or 1) var $tva_npr=0; - //! Spanish local taxes + //! Other local taxes var $localtax1_tx; var $localtax2_tx; - + var $localtax1_type; + var $localtax2_type; + //! Stock var $stock_reel; //! Average price value for product entry into stock (PMP) @@ -294,7 +296,9 @@ class Product extends CommonObject //Local taxes if (empty($this->localtax1_tx)) $this->localtax1_tx = 0; if (empty($this->localtax2_tx)) $this->localtax2_tx = 0; - + if (empty($this->localtax1_type)) $this->localtax1_type = '0'; + if (empty($this->localtax2_type)) $this->localtax2_type = '0'; + if (empty($this->price)) $this->price = 0; if (empty($this->price_min)) $this->price_min = 0; @@ -631,6 +635,8 @@ class Product extends CommonObject if (empty($this->tva_npr)) $this->tva_npr = 0; if (empty($this->localtax1_tx)) $this->localtax1_tx = 0; if (empty($this->localtax2_tx)) $this->localtax2_tx = 0; + if (empty($this->localtax1_type)) $this->localtax1_type = '0'; + if (empty($this->localtax2_type)) $this->localtax2_type = '0'; if (empty($this->status)) $this->status = 0; if (empty($this->status_buy)) $this->status_buy = 0; @@ -698,7 +704,9 @@ class Product extends CommonObject $sql.= ", recuperableonly = " . $this->tva_npr; $sql.= ", localtax1_tx = " . $this->localtax1_tx; $sql.= ", localtax2_tx = " . $this->localtax2_tx; - + $sql.= ", localtax1_type = " . ($this->localtax1_type!=''?"'".$this->localtax1_type."'":"'0'"); + $sql.= ", localtax2_type = " . ($this->localtax2_type!=''?"'".$this->localtax2_type."'":"'0'"); + $sql.= ", barcode = ". (empty($this->barcode)?"null":"'".$this->db->escape($this->barcode)."'"); $sql.= ", fk_barcode_type = ". (empty($this->barcode_type)?"null":$this->db->escape($this->barcode_type)); @@ -1216,10 +1224,10 @@ class Product extends CommonObject if (empty($this->price_by_qty)) $this->price_by_qty=0; // Add new price - $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(price_level,date_price,fk_product,fk_user_author,price,price_ttc,price_base_type,tosell,tva_tx,recuperableonly,"; - $sql.= " localtax1_tx, localtax2_tx, price_min,price_min_ttc,price_by_qty,entity,fk_price_expression) "; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(price_level,date_price,fk_product,fk_user_author,price,price_ttc,price_base_type,tosell, tva_tx, recuperableonly,"; + $sql.= " localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, price_min,price_min_ttc,price_by_qty,entity,fk_price_expression) "; $sql.= " VALUES(".($level?$level:1).", '".$this->db->idate($now)."',".$this->id.",".$user->id.",".$this->price.",".$this->price_ttc.",'".$this->price_base_type."',".$this->status.",".$this->tva_tx.",".$this->tva_npr.","; - $sql.= " ".$this->localtax1_tx.",".$this->localtax2_tx.",".$this->price_min.",".$this->price_min_ttc.",".$this->price_by_qty.",".$conf->entity.",".($this->fk_price_expression > 0?$this->fk_price_expression:'null'); + $sql.= " ".$this->localtax1_tx.", ".$this->localtax2_tx.", '".$this->localtax1_type."', '".$this->localtax2_type."', ".$this->price_min.",".$this->price_min_ttc.",".$this->price_by_qty.",".$conf->entity.",".($this->fk_price_expression > 0?$this->fk_price_expression:'null'); $sql.= ")"; dol_syslog(get_class($this)."::_log_price", LOG_DEBUG); @@ -1371,15 +1379,16 @@ class Product extends CommonObject * @param double $newprice New price * @param string $newpricebase HT or TTC * @param User $user Object user that make change - * @param double $newvat New VAT Rate + * @param double $newvat New VAT Rate (For example 8.5. Should not be a string) * @param double $newminprice New price min * @param int $level 0=standard, >0 = level if multilevel prices * @param int $newnpr 0=Standard vat rate, 1=Special vat rate for French NPR VAT * @param int $newpsq 1 if it has price by quantity * @param int $ignore_autogen Used to avoid infinite loops - * @return int <0 if KO, >0 if OK + * @param array $localtaxes_array Array with localtaxes info array('0'=>type1,'1'=>rate1,'2'=>type2,'3'=>rate2) (loaded by getLocalTaxesFromRate(vatrate, 0, ...) function). + * @return int <0 if KO, >0 if OK */ - function updatePrice($newprice, $newpricebase, $user, $newvat='',$newminprice='', $level=0, $newnpr=0, $newpsq=0, $ignore_autogen=0) + function updatePrice($newprice, $newpricebase, $user, $newvat='',$newminprice='', $level=0, $newnpr=0, $newpsq=0, $ignore_autogen=0, $localtaxes_array=array()) { global $conf,$langs; @@ -1448,13 +1457,23 @@ class Product extends CommonObject } //print 'x'.$id.'-'.$newprice.'-'.$newpricebase.'-'.$price.'-'.$price_ttc.'-'.$price_min.'-'.$price_min_ttc; - - //Local taxes - $localtax1=get_localtax($newvat,1); - $localtax2=get_localtax($newvat,2); + if (count($localtaxes_array) > 0) + { + $localtaxtype1=$localtaxes_array['0']; + $localtax1=$localtaxes_array['1']; + $localtaxtype2=$localtaxes_array['2']; + $localtax2=$localtaxes_array['3']; + } + else // old method. deprecated because ot can't retreive type + { + $localtaxtype1='0'; + $localtax1=get_localtax($newvat,1); + $localtaxtype2='0'; + $localtax2=get_localtax($newvat,2); + } if (empty($localtax1)) $localtax1=0; // If = '' then = 0 if (empty($localtax2)) $localtax2=0; // If = '' then = 0 - + $this->db->begin(); // Ne pas mettre de quote sur les numeriques decimaux. @@ -1467,6 +1486,8 @@ class Product extends CommonObject $sql.= " price_min_ttc=".$price_min_ttc.","; $sql.= " localtax1_tx=".($localtax1>=0?$localtax1:'NULL').","; $sql.= " localtax2_tx=".($localtax2>=0?$localtax2:'NULL').","; + $sql.= " localtax1_type=".($localtaxtype1!=''?"'".$localtaxtype1."'":"'0'").","; + $sql.= " localtax2_type=".($localtaxtype2!=''?"'".$localtaxtype2."'":"'0'").","; $sql.= " tva_tx='".price2num($newvat)."',"; $sql.= " recuperableonly='".$newnpr."'"; $sql.= " WHERE rowid = ".$id; @@ -1493,7 +1514,9 @@ class Product extends CommonObject //Local taxes $this->localtax1_tx = $localtax1; $this->localtax2_tx = $localtax2; - + $this->localtax1_type = $localtaxtype1; + $this->localtax2_type = $localtaxtype2; + // Price by quantity $this->price_by_qty = $newpsq; @@ -1564,12 +1587,12 @@ class Product extends CommonObject } $sql = "SELECT rowid, ref, ref_ext, label, description, url, note, customcode, fk_country, price, price_ttc,"; - $sql.= " price_min, price_min_ttc, price_base_type, cost_price, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, tosell,"; + $sql.= " price_min, price_min_ttc, price_base_type, cost_price, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell,"; $sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas,"; $sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; $sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,"; - $sql.= " datec, tms, import_key, entity, desiredstock, tobatch, fk_unit"; - $sql.= " , fk_price_expression, price_autogen"; + $sql.= " datec, tms, import_key, entity, desiredstock, tobatch, fk_unit,"; + $sql.= " fk_price_expression, price_autogen"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; if ($id) $sql.= " WHERE rowid = ".$this->db->escape($id); else @@ -1611,10 +1634,12 @@ class Product extends CommonObject $this->tva_tx = $obj->tva_tx; //! French VAT NPR $this->tva_npr = $obj->tva_npr; - //! Spanish local taxes + //! Local taxes $this->localtax1_tx = $obj->localtax1_tx; $this->localtax2_tx = $obj->localtax2_tx; - + $this->localtax1_type = $obj->localtax1_type; + $this->localtax2_type = $obj->localtax2_type; + $this->finished = $obj->finished; $this->duration = $obj->duration; $this->duration_value = substr($obj->duration,0,dol_strlen($obj->duration)-1); diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index c92f09ffbaf..08727d44161 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -42,7 +42,9 @@ class Productcustomerprice extends CommonObject var $price_base_type; var $tva_tx; var $recuperableonly; + var $localtax1_type; var $localtax1_tx; + var $localtax2_type; var $localtax2_tx; var $fk_user; var $lines = array (); @@ -150,7 +152,9 @@ class Productcustomerprice extends CommonObject $sql .= "price_base_type,"; $sql .= "tva_tx,"; $sql .= "recuperableonly,"; + $sql .= "localtax1_type,"; $sql .= "localtax1_tx,"; + $sql .= "localtax2_type,"; $sql .= "localtax2_tx,"; $sql .= "fk_user,"; $sql .= "import_key"; @@ -168,7 +172,9 @@ class Productcustomerprice extends CommonObject $sql .= " " . (! isset($this->price_base_type) ? 'NULL' : "'" . $this->db->escape($this->price_base_type) . "'") . ","; $sql .= " " . (! isset($this->tva_tx) ? 'NULL' : "'" . $this->tva_tx . "'") . ","; $sql .= " " . (! isset($this->recuperableonly) ? 'NULL' : "'" . $this->recuperableonly . "'") . ","; + $sql .= " " . (empty($this->localtax1_type) ? "'0'" : "'" . $this->localtax1_type . "'") . ","; $sql .= " " . (! isset($this->localtax1_tx) ? 'NULL' : "'" . $this->localtax1_tx . "'") . ","; + $sql .= " " . (empty($this->localtax2_type) ? "'0'" : "'" . $this->localtax2_type . "'") . ","; $sql .= " " . (! isset($this->localtax2_tx) ? 'NULL' : "'" . $this->localtax2_tx . "'") . ","; $sql .= " " . $user->id . ","; $sql .= " " . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ""; @@ -595,6 +601,8 @@ class Productcustomerprice extends CommonObject $sql .= "recuperableonly,"; $sql .= "localtax1_tx,"; $sql .= "localtax2_tx,"; + $sql .= "localtax1_type,"; + $sql .= "localtax2_type,"; $sql .= "fk_user,"; $sql .= "import_key"; @@ -614,6 +622,8 @@ class Productcustomerprice extends CommonObject $sql .= " t.recuperableonly,"; $sql .= " t.localtax1_tx,"; $sql .= " t.localtax2_tx,"; + $sql .= " t.localtax1_type,"; + $sql .= " t.localtax2_type,"; $sql .= " t.fk_user,"; $sql .= " t.import_key"; @@ -645,6 +655,8 @@ class Productcustomerprice extends CommonObject $sql .= " recuperableonly=" . (isset($this->recuperableonly) ? $this->recuperableonly : "null") . ","; $sql .= " localtax1_tx=" . (isset($this->localtax1_tx) ? $this->localtax1_tx : "null") . ","; $sql .= " localtax2_tx=" . (isset($this->localtax2_tx) ? $this->localtax2_tx : "null") . ","; + $sql .= " localtax1_type=" . (! empty($this->localtax1_type) ? "'".$this->localtax1_type."'": "'0'") . ","; + $sql .= " localtax2_type=" . (! empty($this->localtax2_type) ? "'".$this->localtax2_type."'": "'0'") . ","; $sql .= " fk_user=" . $user->id . ","; $sql .= " import_key=" . (isset($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null") . ""; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index bd72c916103..7c8e18b213b 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -94,7 +94,43 @@ if (empty($reshook)) if (($action == 'update_vat') && !$cancel && ($user->rights->produit->creer || $user->rights->service->creer)) { - $object->tva_tx = GETPOST('tva_tx'); + $tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 + + $tva_tx_txt; + + // We must define tva_tx, npr and local taxes + $tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot + $npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0; + $localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0'; + // If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes + if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) + { + // We look into database using code + $vatratecode=$reg[1]; + // Get record from code + $sql = "SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; + $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$mysoc->country_code."'"; + $sql.= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1"; + $sql.= " AND t.code ='".$vatratecode."'"; + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + $npr = $obj->recuperableonly; + $localtax1 = $obj->localtax1; + $localtax2 = $obj->localtax2; + $localtax1_type = $obj->localtax1_type; + $localtax2_type = $obj->localtax2_type; + } + } + + $object->tva_tx = $tva_tx; + $object->tva_npr = $npr; + $object->localtax1_tx = $localtax1; + $object->localtax2_tx = $localtax2; + $object->localtax1_type = $localtax1_type; + $object->localtax2_type = $localtax2_type; $db->begin(); @@ -106,7 +142,7 @@ if (empty($reshook)) if ($error) { - $object->updatePrice($newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq); + $object->updatePrice($newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq); // FIXME Bug $newvat and $newnpr not defined } if (! $error) @@ -145,31 +181,41 @@ if (empty($reshook)) } // Multiprices - if (!$error && !empty($conf->global->PRODUIT_MULTIPRICES)) { + if (! $error && ! empty($conf->global->PRODUIT_MULTIPRICES)) { $newprice = GETPOST('price', 'array'); $newprice_min = GETPOST('price_min', 'array'); $newpricebase = GETPOST('multiprices_base_type', 'array'); $newvattx = GETPOST('tva_tx', 'array'); + $newvatnpr = GETPOST('tva_npr', 'array'); + $newlocaltax1_tx = GETPOST('localtax1_tx', 'array'); + $newlocaltax1_type = GETPOST('localtax1_type', 'array'); + $newlocaltax2_tx = GETPOST('localtax2_tx', 'array'); + $newlocaltax2_type = GETPOST('localtax2_type', 'array'); //Shall we generate prices using price rules? $object->price_autogen = GETPOST('usePriceRules') == 'on' ? true : false; - for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) { - + for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) + { if (!isset($newprice[$i])) { continue; } - $newnpr = (preg_match('/\*/', $newvattx[$i] ? 1 : 0)); - $newvat = str_replace('*', '', $newvattx[$i]); - + $tva_tx_txt = $newvattx[$i]; + $npr = $newvatnpr[$i]; + $localtax1 = $newlocaltax1_tx[$i]; + $localtax1_type = $newlocaltax1_type[$i]; + $localtax2 = $newlocaltax2_tx[$i]; + $localtax2_type = $newlocaltax2_type[$i]; + $pricestoupdate[$i] = array( 'price' => $newprice[$i], 'price_min' => $newprice_min[$i], 'price_base_type' => $newpricebase[$i], - 'vat_tx' => $newvat, - 'npr' => $newnpr + 'vat_tx' => $tva_tx, + 'npr' => $npr, + 'localtaxes_array' => array('0'=>$localtax1_type, '1'=>$localtax1, '2'=>$localtax2_type, '3'=>$localtax2) ); //If autogeneration is enabled, then we only set the first level @@ -178,12 +224,41 @@ if (empty($reshook)) } } } else { + $tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' , '8.5*', '8.5 (8.5NPR) *' for example. + + // We must define tva_tx, npr and local taxes + $tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot + $npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0; + $localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0'; + // If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes + if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) + { + // We look into database using code + $vatratecode=$reg[1]; + // Get record from code + $sql = "SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; + $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$mysoc->country_code."'"; + $sql.= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1"; + $sql.= " AND t.code ='".$vatratecode."'"; + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + $npr = $obj->recuperableonly; + $localtax1 = $obj->localtax1; + $localtax2 = $obj->localtax2; + $localtax1_type = $obj->localtax1_type; + $localtax2_type = $obj->localtax2_type; + } + } $pricestoupdate[0] = array( - 'price' => $_POST ["price"], - 'price_min' => $_POST ["price_min"], - 'price_base_type' => $_POST ["price_base_type"], - 'vat_tx' => str_replace('*', '', $_POST ["tva_tx"]), - 'npr' => preg_match('/\*/', $_POST ["tva_tx"]) ? 1 : 0 + 'price' => $_POST["price"], + 'price_min' => $_POST["price_min"], + 'price_base_type' => $_POST["price_base_type"], + 'vat_tx' => $tva_tx, + 'npr' => $npr, + 'localtaxes_array' => array('0'=>$localtax1_type, '1'=>$localtax1, '2'=>$localtax2_type, '3'=>$localtax2) ); } @@ -207,7 +282,7 @@ if (empty($reshook)) break; } - $res = $object->updatePrice($newprice, $val['price_base_type'], $user, $val['vat_tx'], $newprice_min, $key, $val['npr'], $psq); + $res = $object->updatePrice($newprice, $val['price_base_type'], $user, $val['vat_tx'], $newprice_min, $key, $val['npr'], $psq, 0, $val['localtaxes_array']); if ($res < 0) { $error ++; @@ -344,9 +419,43 @@ if (empty($reshook)) $prodcustprice->price = price2num(GETPOST("price"), 'MU'); $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU'); $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); - $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); - $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); + $tva_tx_txt = GETPOST("tva_tx"); + + // We must define tva_tx, npr and local taxes + $tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot + $npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0; + $localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0'; + // If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes + if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) + { + // We look into database using code + $vatratecode=$reg[1]; + // Get record from code + $sql = "SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; + $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$mysoc->country_code."'"; + $sql.= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1"; + $sql.= " AND t.code ='".$vatratecode."'"; + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + $npr = $obj->recuperableonly; + $localtax1 = $obj->localtax1; + $localtax2 = $obj->localtax2; + $localtax1_type = $obj->localtax1_type; + $localtax2_type = $obj->localtax2_type; + } + } + + $prodcustprice->tva_tx = $tva_tx; + $prodcustprice->recuperableonly = $npr; + $prodcustprice->localtax1_tx = $localtax1; + $prodcustprice->localtax2_tx = $localtax2; + $prodcustprice->localtax1_type = $localtax1_type; + $prodcustprice->localtax2_type = $localtax2_type; + if (! ($prodcustprice->fk_soc > 0)) { $langs->load("errors"); @@ -383,9 +492,9 @@ if (empty($reshook)) $result = $prodcustprice->delete($user); if ($result < 0) { - setEventMessages($prodcustprice->error, $prodcustprice->errors, 'mesgs'); + setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); } else { - setEventMessages($langs->trans('RecordDeleted'), null, 'errors'); + setEventMessages($langs->trans('RecordDeleted'), null, 'mesgs'); } $action = ''; } @@ -402,9 +511,43 @@ if (empty($reshook)) $prodcustprice->price = price2num(GETPOST("price"), 'MU'); $prodcustprice->price_min = price2num(GETPOST("price_min"), 'MU'); $prodcustprice->price_base_type = GETPOST("price_base_type", 'alpha'); - $prodcustprice->tva_tx = str_replace('*', '', GETPOST("tva_tx")); - $prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0); - + + $tva_tx_txt = GETPOST("tva_tx"); + + // We must define tva_tx, npr and local taxes + $tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot + $npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0; + $localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0'; + // If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes + if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) + { + // We look into database using code + $vatratecode=$reg[1]; + // Get record from code + $sql = "SELECT t.rowid, t.code, t.recuperableonly, t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; + $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$mysoc->country_code."'"; + $sql.= " AND t.taux = ".((float) $tva_tx)." AND t.active = 1"; + $sql.= " AND t.code ='".$vatratecode."'"; + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + $npr = $obj->recuperableonly; + $localtax1 = $obj->localtax1; + $localtax2 = $obj->localtax2; + $localtax1_type = $obj->localtax1_type; + $localtax2_type = $obj->localtax2_type; + } + } + + $prodcustprice->tva_tx = $tva_tx; + $prodcustprice->recuperableonly = $npr; + $prodcustprice->localtax1_tx = $localtax1; + $prodcustprice->localtax2_tx = $localtax2; + $prodcustprice->localtax1_type = $localtax1_type; + $prodcustprice->localtax2_type = $localtax2_type; + if ($prodcustprice->price_min<$maxpricesupplier && !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) { setEventMessages($langs->trans("MinimumPriceLimit",price($maxpricesupplier,0,'',1,-1,-1,'auto')), null, 'errors'); @@ -792,7 +935,7 @@ if ($action == 'edit_vat' && ($user->rights->produit->creer || $user->rights->se // VAT print '
' . $langs->trans("VATRate") . ''; - print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr); + print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1); print '
'; @@ -825,7 +968,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) // VAT print '
' . $langs->trans("VATRate") . ''; - print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr); + print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1); print '
'; - print $form->load_tva("tva_tx[" . $i.']', $object->multiprices_tva_tx[$i], $mysoc, '', $object->id); + print $form->load_tva("tva_tx[" . $i.']', $object->multiprices_tva_tx[$i], $mysoc, '', $object->id, false, $object->type, false, 1); print '
' . $langs->trans("VATRate") . ''; - print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr); + print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, $object->type, false, 1); print '
' . $langs->trans("VATRate") . ''; - print $form->load_tva("tva_tx", $prodcustprice->tva_tx, $mysoc, '', $object->id, $prodcustprice->recuperableonly); + print $form->load_tva("tva_tx", $prodcustprice->tva_tx, $mysoc, '', $object->id, $prodcustprice->recuperableonly, $object->type, false, 1); print '
'; // Path of category print '
'; -$ways = $object->print_all_ways(); +$ways = $object->print_all_ways(" >> ", '', 1); print $langs->trans("Ref").''; print ''.$langs->trans("Root").' >> '; foreach ($ways as $way) From b70f2f329c65e92e5b0e6fa2421d5f6aa138f54e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Feb 2016 03:59:22 +0100 Subject: [PATCH 22/25] Fix bad position of form --- htdocs/comm/multiprix.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index fbaf00e53db..7510c0a5b96 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -84,12 +84,12 @@ if ($_socid > 0) if ($objsoc->client == 1) $tabchoice='customer'; if ($objsoc->client == 2) $tabchoice='prospect'; - dol_fiche_head($head, $tabchoice, $langs->trans("ThirdParty"), 0, 'company'); - - print ''; print ''; print ''; + + dol_fiche_head($head, $tabchoice, $langs->trans("ThirdParty"), 0, 'company'); + print ''; print ''; From cc524c818095d3e78fe85868f8bb6134c7a75cd6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Feb 2016 04:41:29 +0100 Subject: [PATCH 25/25] Fix bad picto --- htdocs/fourn/facture/paiement.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 253b55b4659..c107639e786 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -534,7 +534,7 @@ if (empty($action)) $paramlist.=(! empty($search_amount)?"&search_amount='".$search_amount:""); if ($optioncss != '') $paramlist.='&optioncss='.$optioncss; - print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num, 0, 'title_accountancy.png'); print ''; if ($optioncss != '') print '';
'; print ''; @@ -121,12 +121,14 @@ if ($_socid > 0) print ""; print "
"; - print '

'; + dol_fiche_end(); + + print '
'; print ""; - print "\n"; - print '
'; + + print '

'; /* From 3864bd35c9258cec647873d536db7c8788a7a77d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Feb 2016 03:59:43 +0100 Subject: [PATCH 23/25] Fix NPR Vat is working correctly with multiprice too --- htdocs/product/price.php | 2 +- htdocs/product/stock/replenish.php | 4 +++- htdocs/product/stock/replenishorders.php | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 7c8e18b213b..b6cf03fc837 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1129,7 +1129,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) print ''; print ''; print ''; - print ''; + print ''; } else { // This option is kept for backward compatibility but has no sense print '
'; diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 94629a3e821..8773d10ad4d 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -372,6 +372,8 @@ $head[1][1] = $langs->trans("ReplenishmentOrders"); $head[1][2] = 'replenishorders'; +print load_fiche_titre($langs->trans('Replenishment'), '', 'title_generic.png'); + print '
'. ''. @@ -382,7 +384,7 @@ print '' ''. ''; -dol_fiche_head($head, 'replenish', $langs->trans('Replenishment'), 0, 'stock'); +dol_fiche_head($head, 'replenish', '', 0, ''); print $langs->trans("ReplenishmentStatusDesc").'
'."\n"; if ($usevirtualstock == 1) diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index 303180c2cb7..785760ef511 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -52,6 +52,8 @@ $texte = $langs->trans('ReplenishmentOrders'); llxHeader('', $texte, $helpurl, ''); +print load_fiche_titre($langs->trans('Replenishment'), '', 'title_generic.png'); + $head = array(); $head[0][0] = DOL_URL_ROOT.'/product/stock/replenish.php'; $head[0][1] = $langs->trans('Status'); @@ -60,7 +62,7 @@ $head[1][0] = DOL_URL_ROOT.'/product/stock/replenishorders.php'; $head[1][1] = $texte; $head[1][2] = 'replenishorders'; -dol_fiche_head($head, 'replenishorders', $langs->trans('Replenishment'), 0, 'stock'); +dol_fiche_head($head, 'replenishorders', '', 0, ''); $commandestatic = new CommandeFournisseur($db); $sref = GETPOST('search_ref', 'alpha'); From 79bc7cf08531b7a572dcc9ea7231184c2aa4b248 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 19 Feb 2016 04:05:08 +0100 Subject: [PATCH 24/25] Fix showing description --- htdocs/admin/company.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index be7756e5900..849916222dd 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -1013,14 +1013,14 @@ else print '
'.$langs->trans("CalcLocaltax").': '; if($conf->global->MAIN_INFO_LOCALTAX_CALC1==0) { - print $langs->transcountry("CalcLocaltax1",$mysoc->country_code); + print $langs->trans("CalcLocaltax1").' - '.$langs->trans("CalcLocaltax1Desc"); } else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==1) { - print $langs->transcountry("CalcLocaltax2",$mysoc->country_code); + print $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"); } else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){ - print $langs->transcountry("CalcLocaltax3",$mysoc->country_code); + print $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"); } print '