From d032280a961e61ec2d1b90ea7e095a11729a3af1 Mon Sep 17 00:00:00 2001 From: Inovea Conseil Date: Tue, 17 Apr 2018 16:03:12 +0200 Subject: [PATCH 01/11] NEW add any predefined mail content --- htdocs/core/class/html.formmail.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index a370684b191..555ad503693 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2015-2017 Marcos García + * Copyright (C) 2015-2017 Nicolas ZABOURI * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1110,7 +1111,8 @@ class FormMail extends Form elseif ($type_template=='fichinter_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendFichInter"); } elseif ($type_template=='thirdparty') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentThirdparty"); } elseif ($type_template=='user') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentUser"); } - + elseif (!empty($type_template)) { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContent".ucfirst($type_template)); } + $ret->label = 'default'; $ret->lang = $outputlangs->defaultlang; $ret->topic = ''; From fd7bc2e6076ff5ffdb5fa62b8a17abb72adf4b57 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 18 Apr 2018 06:20:34 +0200 Subject: [PATCH 02/11] Accountancy - move to loadLangs --- htdocs/accountancy/admin/account.php | 7 +------ htdocs/accountancy/admin/accountmodel.php | 20 +++++++++---------- htdocs/accountancy/admin/card.php | 4 +--- htdocs/accountancy/admin/categories.php | 3 +-- htdocs/accountancy/admin/categories_list.php | 4 ++-- htdocs/accountancy/admin/defaultaccounts.php | 7 +------ htdocs/accountancy/admin/export.php | 6 +----- htdocs/accountancy/admin/fiscalyear.php | 3 +-- htdocs/accountancy/admin/fiscalyear_card.php | 3 +-- htdocs/accountancy/admin/fiscalyear_info.php | 3 +-- htdocs/accountancy/admin/importaccounts.php | 7 +------ htdocs/accountancy/admin/index.php | 5 +---- htdocs/accountancy/admin/journals_list.php | 6 ++---- htdocs/accountancy/admin/productaccount.php | 8 +------- htdocs/accountancy/bookkeeping/balance.php | 2 +- .../bookkeeping/balancebymonth.php | 8 +------- htdocs/accountancy/bookkeeping/list.php | 3 +-- .../accountancy/bookkeeping/listbyaccount.php | 3 +-- .../bookkeeping/thirdparty_lettrage.php | 3 ++- .../thirdparty_lettrage_supplier.php | 3 ++- .../class/accountingaccount.class.php | 2 +- .../class/accountingjournal.class.php | 2 +- .../accountancy/class/bookkeeping.class.php | 2 +- htdocs/accountancy/customer/card.php | 5 +---- htdocs/accountancy/customer/lines.php | 8 +------- htdocs/accountancy/customer/list.php | 9 +-------- htdocs/accountancy/expensereport/card.php | 6 +----- htdocs/accountancy/expensereport/lines.php | 10 +--------- htdocs/accountancy/expensereport/list.php | 10 +--------- htdocs/accountancy/index.php | 16 +-------------- htdocs/accountancy/supplier/card.php | 5 +---- htdocs/accountancy/supplier/lines.php | 9 +-------- htdocs/accountancy/supplier/list.php | 9 +-------- 33 files changed, 46 insertions(+), 155 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 58bbd09fdf2..ac45b3993a4 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -28,12 +28,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; -// Langs -$langs->load("compta"); -$langs->load("bills"); -$langs->load("admin"); -$langs->load("accountancy"); -$langs->load("salaries"); +$langs->loadLangs(array("compta","bills","admin","accountancy","salaries")); $mesg = ''; $action = GETPOST('action','aZ09'); diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 9728a9524ea..a06d8a3f8d1 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -880,7 +880,7 @@ if ($id) $valuetoshow=price($valuetoshow); } else if ($fieldlist[$field]=='libelle_facture') { - $langs->load("bills"); + $langs->loadLangs(array("bills")); $key=$langs->trans("PaymentCondition".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); $valuetoshow=nl2br($valuetoshow); @@ -890,7 +890,7 @@ if ($id) $valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_availability') { - $langs->load("propal"); + $langs->loadLangs(array("propal")); $key=$langs->trans("AvailabilityType".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } @@ -915,17 +915,17 @@ if ($id) $valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') { - $langs->load('agenda'); + $langs->loadLangs(array("agenda")); $key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_payment_term') { - $langs->load("bills"); + $langs->loadLangs(array("bills")); $key=$langs->trans("PaymentConditionShort".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') { - $langs->load("bills"); + $langs->loadLangs(array("bills")); $key=$langs->trans("PaymentType".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } @@ -934,12 +934,12 @@ if ($id) $valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_method') { - $langs->load("orders"); + $langs->loadLangs(array("orders")); $key=$langs->trans($obj->code); $valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->{$fieldlist[$field]}; } else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_shipment_mode') { - $langs->load("sendings"); + $langs->loadLangs(array("sendings")); $key=$langs->trans("SendingMethod".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } @@ -950,7 +950,7 @@ if ($id) } else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees') { - $langs->load('trips'); + $langs->loadLangs(array("trips")); $key = $langs->trans(strtoupper($obj->code)); $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); } @@ -961,11 +961,11 @@ if ($id) $valuetoshow = $langs->getCurrencySymbol($obj->code,1); } else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') { - $langs->load("products"); + $langs->loadLangs(array("products")); $valuetoshow=$langs->trans($obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='short_label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') { - $langs->load("products"); + $langs->loadLangs(array("products")); $valuetoshow = $langs->trans($obj->{$fieldlist[$field]}); } else if (($fieldlist[$field] == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX.'c_paper_format')) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 61166f88d07..669283077d9 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -31,9 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $error = 0; -// Langs -$langs->load("bills"); -$langs->load("accountancy"); +$langs->loadLangs(array("bills","accountancy")); $mesg = ''; $action = GETPOST('action','aZ09'); diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index 69d09ae301b..1a287b3d039 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -29,8 +29,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $error = 0; -$langs->load("bills"); -$langs->load("accountancy"); +$langs->loadLangs(array("bills","accountancy")); $mesg = ''; $id = GETPOST('id', 'int'); diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index fb7561dda94..dedc55b3fd5 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -178,7 +178,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) } if (! is_numeric(GETPOST('position','alpha'))) { - $langs->load("errors"); + $langs->loadLangs(array("errors")); $ok=0; setEventMessages($langs->transnoentities('ErrorFieldMustBeANumeric', $langs->transnoentities("Position")), null, 'errors'); } @@ -735,7 +735,7 @@ if ($id) $valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_availability') { - $langs->load("propal"); + $langs->loadLangs(array("propal")); $key=$langs->trans("AvailabilityType".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index c4b31c0f169..9d254338526 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -34,12 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; -$langs->load("compta"); -$langs->load("bills"); -$langs->load("admin"); -$langs->load("accountancy"); -$langs->load("salaries"); -$langs->load("loan"); +$langs->loadLangs(array("compta","bills","admin","accountancy","salaries","loan")); // Security check if (empty($user->rights->accounting->chartofaccount)) diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index dbe2a3b0c1c..6845491d003 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -28,15 +28,11 @@ */ require '../../main.inc.php'; -// Class require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancyexport.class.php'; -$langs->load("compta"); -$langs->load("bills"); -$langs->load("admin"); -$langs->load("accountancy"); +$langs->loadLangs(array("compta","bills","admin","accountancy")); // Security access if (empty($user->rights->accounting->chartofaccount)) diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 147c140bdd1..f3a6c9feb75 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -39,8 +39,7 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield="f.rowid"; // Set here default search field if (! $sortorder) $sortorder="ASC"; -$langs->load("admin"); -$langs->load("compta"); +$langs->loadLangs(array("admin","compta")); // Security check if ($user->societe_id > 0) diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 78c6510469b..db323881bdc 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -26,8 +26,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/fiscalyear.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php'; -$langs->load("admin"); -$langs->load("compta"); +$langs->loadLangs(array("admin","compta")); // Security check if ($user->societe_id > 0) diff --git a/htdocs/accountancy/admin/fiscalyear_info.php b/htdocs/accountancy/admin/fiscalyear_info.php index baadbdc0828..f8f0bd5668e 100644 --- a/htdocs/accountancy/admin/fiscalyear_info.php +++ b/htdocs/accountancy/admin/fiscalyear_info.php @@ -26,8 +26,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/fiscalyear.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php'; -$langs->load("admin"); -$langs->load("compta"); +$langs->loadLangs(array("admin","compta")); // Security check if ($user->societe_id > 0) diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index 93d41b3cbc6..acc679cffd8 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -24,16 +24,11 @@ */ require '../../main.inc.php'; -// Class require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; -// langs -$langs->load("compta"); -$langs->load("bills"); -$langs->load("main"); -$langs->load("accountancy"); +$langs->loadLangs(array("compta","bills","accountancy")); // Security check if (! $user->admin) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 44c816530dd..64857fbfbb4 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -32,10 +32,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; -$langs->load("compta"); -$langs->load("bills"); -$langs->load("admin"); -$langs->load("accountancy"); +$langs->loadLangs(array("compta","bills","admin","accountancy")); // Security access if (empty($user->rights->accounting->chartofaccount)) diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index a7811a2d606..8aea0463fc3 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -30,9 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; -$langs->load("admin"); -$langs->load("compta"); -$langs->load("accountancy"); +$langs->loadLangs(array("admin","compta","accountancy")); $action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view'; $confirm=GETPOST('confirm','alpha'); @@ -629,7 +627,7 @@ if ($id) $valuetoshow=$langs->trans('All'); } else if ($fieldlist[$field]=='nature' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') { - $langs->load("accountancy"); + $langs->loadLangs(array("accountancy")); $key=$langs->trans("AccountingJournalType".strtoupper($obj->nature)); $valuetoshow=($obj->nature && $key != "AccountingJournalType".strtoupper($obj->nature)?$key:$obj->{$fieldlist[$field]}); } diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index f6552d3d1e1..44b9f078914 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -26,7 +26,6 @@ */ require '../../main.inc.php'; -// Class require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; @@ -35,12 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; -// Langs -$langs->load("companies"); -$langs->load("compta"); -$langs->load("main"); -$langs->load("accountancy"); -$langs->load("products"); +$langs->loadLangs(array("companies","compta","accountancy","products")); // Security check if (empty($conf->accounting->enabled)) { diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index d27da1afbe9..d8a59a5ba43 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; // Langs -$langs->load("accountancy"); +$langs->loadLangs(array("accountancy")); $page = GETPOST("page"); $sortorder = GETPOST("sortorder"); diff --git a/htdocs/accountancy/bookkeeping/balancebymonth.php b/htdocs/accountancy/bookkeeping/balancebymonth.php index 1d746b4d4df..decf962c8d5 100644 --- a/htdocs/accountancy/bookkeeping/balancebymonth.php +++ b/htdocs/accountancy/bookkeeping/balancebymonth.php @@ -26,16 +26,10 @@ */ require '../../main.inc.php'; -// Class require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; -// Langs -$langs->load("main"); -$langs->load("compta"); -$langs->load("bills"); -$langs->load("other"); -$langs->load("accountancy"); +$langs->loadLangs(array("compta","bills","other","accountancy")); // Filter $year = GETPOST("year",'int'); diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index d3bf948aaf7..368cf406185 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -32,8 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; -// Langs -$langs->load("accountancy"); +$langs->loadLangs(array("accountancy")); $action = GETPOST('action', 'alpha'); $search_mvt_num = GETPOST('search_mvt_num', 'int'); diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 15be2255830..499865233db 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -33,8 +33,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; -// Langs -$langs->load("accountancy"); +$langs->loadLangs(array("accountancy")); $page = GETPOST("page"); $sortorder = GETPOST("sortorder"); diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php b/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php index 550ea1d933a..67d89bcda90 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php @@ -33,6 +33,8 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; +$langs->loadLangs(array("compta")); + $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); @@ -141,7 +143,6 @@ if ($object->check_codeclient() != 0) print ''; print ''; -$langs->load('compta'); print ''; print ''; print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer); diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php index 35bdcfa23fe..96317a3a740 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php @@ -35,6 +35,8 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; +$langs->loadLangs(array("compta")); + $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); @@ -157,7 +159,6 @@ if ($object->check_codefournisseur() != 0) print ''; print ''; -$langs->load('compta'); print ''; print ''; print $form->editfieldkey("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer); diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 0b0d42b0075..d1870fabc38 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -566,7 +566,7 @@ class AccountingAccount extends CommonObject function LibStatut($statut,$mode=0) { global $langs; - $langs->load('users'); + $langs->loadLangs(array("users")); if ($mode == 0) { diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 2e48fc8a54a..454de6d7b84 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -256,7 +256,7 @@ class AccountingJournal extends CommonObject { global $langs; - $langs->load("accountancy"); + $langs->loadLangs(array("accountancy")); if ($mode == 0) { diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 6c82672f311..f7fed2e2b5b 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -170,7 +170,7 @@ class BookKeeping extends CommonObject // Check parameters if (empty($this->numero_compte) || $this->numero_compte == '-1' || $this->numero_compte == 'NotDefined') { - $langs->load("errors"); + $langs->loadLangs(array("errors")); if (in_array($this->doc_type, array('bank', 'expense_report'))) { $this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForBankLine', $this->fk_docdet, $this->doc_type); diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index 92d8f7b1c37..d0e5adc97fd 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -24,13 +24,10 @@ */ require '../../main.inc.php'; -// Class require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; -// Langs -$langs->load("bills"); -$langs->load("accountancy"); +$langs->loadLangs(array("bills","accountancy")); $action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index e696b4774d1..c2a0f553f00 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -27,7 +27,6 @@ */ require '../../main.inc.php'; -// Class require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; @@ -35,12 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; -// Langs -$langs->load("bills"); -$langs->load("compta"); -$langs->load("main"); -$langs->load("accountancy"); -$langs->load("productbatch"); +$langs->loadLangs(array("bills","compta","accountancy","productbatch")); $account_parent = GETPOST('account_parent'); $changeaccount = GETPOST('changeaccount'); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 4d9d7532d7e..f277dfff268 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -27,7 +27,6 @@ */ require '../../main.inc.php'; -// Class require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; @@ -36,13 +35,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; -// Langs -$langs->load("compta"); -$langs->load("bills"); -$langs->load("other"); -$langs->load("main"); -$langs->load("accountancy"); -$langs->load("productbatch"); +$langs->loadLangs(array("compta","bills","other","accountancy","productbatch")); $action=GETPOST('action','alpha'); $massaction=GETPOST('massaction','alpha'); diff --git a/htdocs/accountancy/expensereport/card.php b/htdocs/accountancy/expensereport/card.php index 3b59847d84d..59237fd13b2 100644 --- a/htdocs/accountancy/expensereport/card.php +++ b/htdocs/accountancy/expensereport/card.php @@ -28,14 +28,10 @@ */ require '../../main.inc.php'; -// Class require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; -// Langs -$langs->load("bills"); -$langs->load("accountancy"); -$langs->load("trips"); +$langs->loadLangs(array("bills","accountancy","trips")); $action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 28a44d23a5e..7ab29657172 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -26,7 +26,6 @@ */ require '../../main.inc.php'; -// Class require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; @@ -34,14 +33,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; -// Langs -$langs->load("compta"); -$langs->load("bills"); -$langs->load("other"); -$langs->load("main"); -$langs->load("accountancy"); -$langs->load("trips"); -$langs->load("productbatch"); +$langs->loadLangs(array("compta","bills","other","accountancy","trips","productbatch")); $account_parent = GETPOST('account_parent','int'); $changeaccount = GETPOST('changeaccount'); diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 2a24aa2f656..6f8be4c2715 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -27,7 +27,6 @@ */ require '../../main.inc.php'; -// Class require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; @@ -35,14 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; -// Langs -$langs->load("compta"); -$langs->load("bills"); -$langs->load("other"); -$langs->load("trips"); -$langs->load("main"); -$langs->load("accountancy"); -$langs->load("productbatch"); +$langs->loadLangs(array("compta","bills","other","trips","accountancy","productbatch")); $action=GETPOST('action','alpha'); $massaction=GETPOST('massaction','alpha'); diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index cad9547ec4c..8de7209ef93 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -26,26 +26,12 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; -// Langs -$langs->load("compta"); -$langs->load("bills"); -$langs->load("other"); -$langs->load("main"); -$langs->load("accountancy"); +$langs->loadLangs(array("compta","bills","other","accountancy","loans","banks","admin","dict")); // Security check if ($user->societe_id > 0) accessforbidden(); -$langs->load("admin"); -$langs->load("dict"); -$langs->load("bills"); -$langs->load("accountancy"); -$langs->load("compta"); -$langs->load("banks"); -$langs->load("loans"); - - /* * Actions */ diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index f74165251f3..847181b79cb 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -28,13 +28,10 @@ */ require '../../main.inc.php'; -// Class require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; -// Langs -$langs->load("bills"); -$langs->load("accountancy"); +$langs->loadLangs(array("bills","accountancy")); $action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 6ad8731a415..3f4ecffe588 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -26,7 +26,6 @@ */ require '../../main.inc.php'; -// Class require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; @@ -35,13 +34,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; -// Langs -$langs->load("compta"); -$langs->load("bills"); -$langs->load("other"); -$langs->load("main"); -$langs->load("accountancy"); -$langs->load("productbatch"); +$langs->loadLangs(array("compta","bills","other","accountancy","productbatch")); $account_parent = GETPOST('account_parent'); $changeaccount = GETPOST('changeaccount'); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index c19e1d2716c..51db676f552 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -27,7 +27,6 @@ */ require '../../main.inc.php'; -// Class require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; @@ -36,13 +35,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; -// Langs -$langs->load("compta"); -$langs->load("bills"); -$langs->load("other"); -$langs->load("main"); -$langs->load("accountancy"); -$langs->load("productbatch"); +$langs->loadLangs(array("compta","bills","other","accountancy","productbatch")); $action=GETPOST('action','alpha'); $massaction=GETPOST('massaction','alpha'); From eaecf7190a2d8a57c6d74f6f872f6fdc2459a8ba Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 18 Apr 2018 08:34:48 +0200 Subject: [PATCH 03/11] Fix: avoid Warning: A non-numeric value encountered + wrong var name --- htdocs/admin/defaultvalues.php | 10 +++++----- htdocs/admin/tools/dolibarr_export.php | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 790445f7032..5c17fd32eb0 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -1,6 +1,6 @@ - * Copyright (C) 2017 Regis Houssin +/* Copyright (C) 2017 Laurent Destailleur + * Copyright (C) 2017-2018 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -212,9 +212,9 @@ print "
\n"; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($optioncss != '') $param.='&optioncss='.$optioncss; -if (defaulturl) $param.='&defaulturl='.urlencode(defaulturl); -if (defaultkey) $param.='&defaultkey='.urlencode(defaultkey); -if (defaultvalue) $param.='&defaultvalue='.urlencode(defaultvalue); +if ($defaulturl) $param.='&defaulturl='.urlencode($defaulturl); +if ($defaultkey) $param.='&defaultkey='.urlencode($defaultkey); +if ($defaultvalue) $param.='&defaultvalue='.urlencode($defaultvalue); print '
entity) && $debug)?'?debug=1':'').'" method="POST">'; diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 7b2c8805f55..c876d7cfd9a 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2012 Regis Houssin +/* Copyright (C) 2006-2018 Laurent Destailleur + * Copyright (C) 2006-2018 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,7 +36,7 @@ $sortorder = GETPOST('sortorder','alpha'); $page = GETPOST('page','int'); if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="date"; -if ($page < 0) { $page = 0; } +if (empty($page) || $page == -1) { $page = 0; } $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page; From 85c93c26a90eda3cd091c7043e6c5ff53a34ee26 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 18 Apr 2018 09:27:54 +0200 Subject: [PATCH 04/11] Fix: dolibarrize --- htdocs/core/class/html.formticketsup.class.php | 13 +++++++------ htdocs/ticketsup/list.php | 14 ++++++++------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/html.formticketsup.class.php b/htdocs/core/class/html.formticketsup.class.php index 7248e2b9a8e..120d4c218be 100644 --- a/htdocs/core/class/html.formticketsup.class.php +++ b/htdocs/core/class/html.formticketsup.class.php @@ -148,7 +148,8 @@ class FormTicketsup } print ''; - print '
'; + dol_fiche_head(''); + print ''; @@ -181,7 +182,7 @@ class FormTicketsup print ''; if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) { $htmlname = 'socid'; @@ -436,7 +437,7 @@ class FormTicketsup $ticketstat->loadCacheTypesTickets(); - print ''; if ($empty) { print ''; } @@ -536,7 +537,7 @@ class FormTicketsup $ticketstat->loadCacheCategoriesTickets(); - print ''; if ($empty) { print ''; } @@ -605,7 +606,7 @@ class FormTicketsup print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } - print ajax_combobox('select'.$htmlname); + print ajax_combobox('select'.$htmlname,'',0,0,'off'); } /** @@ -637,7 +638,7 @@ class FormTicketsup $ticketstat->loadCacheSeveritiesTickets(); - print ''; if ($empty) { print ''; } diff --git a/htdocs/ticketsup/list.php b/htdocs/ticketsup/list.php index a5552d854b1..61dcf45ba83 100644 --- a/htdocs/ticketsup/list.php +++ b/htdocs/ticketsup/list.php @@ -1,6 +1,7 @@ - * Copyright (C) 2016 Christophe Battarel +/* Copyright (C) 2013-2018 Jean-François FERRY + * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2018 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -580,12 +581,13 @@ print ''."\n"; // Detect if we need a fetch on each output line $needToFetchEachLine=0; -foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) -{ - if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object +if (! empty($extrafields->attributes[$object->table_element]['computed'])) { + foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) + { + if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object + } } - // Loop on record // -------------------------------------------------------------------- $i=0; From d841abd55ade6792f00448abed6e2401dfdfa5e8 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 18 Apr 2018 09:37:29 +0200 Subject: [PATCH 05/11] Fix: missing value when reload --- htdocs/core/class/html.formticketsup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formticketsup.class.php b/htdocs/core/class/html.formticketsup.class.php index 120d4c218be..9cc9a09dbc6 100644 --- a/htdocs/core/class/html.formticketsup.class.php +++ b/htdocs/core/class/html.formticketsup.class.php @@ -299,7 +299,7 @@ class FormTicketsup // Notify thirdparty at creation print ''; // TITLE From d6680b982a8ca775b295fa4fd70aeb5e415a8c1e Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 18 Apr 2018 09:42:29 +0200 Subject: [PATCH 06/11] Fix: file not physically removed --- htdocs/public/ticketsup/create_ticket.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/public/ticketsup/create_ticket.php b/htdocs/public/ticketsup/create_ticket.php index 8c8a0dd2f60..56c81a8a530 100644 --- a/htdocs/public/ticketsup/create_ticket.php +++ b/htdocs/public/ticketsup/create_ticket.php @@ -93,9 +93,7 @@ if (GETPOST('addfile') && !GETPOST('add_ticket')) { // Remove file if (GETPOST('removedfile') && !GETPOST('add_ticket')) { - ////$res = $object->fetch('',GETPOST('track_id')); - ////if($res > 0) - ////{ + include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; // Set tmp directory @@ -103,9 +101,8 @@ if (GETPOST('removedfile') && !GETPOST('add_ticket')) { $upload_dir_tmp = $vardir . '/temp'; // TODO Delete only files that was uploaded from email form - dol_remove_file_process($_POST['removedfile'], 0); + dol_remove_file_process($_POST['removedfile'], 0, 0); $action = 'create_ticket'; - ////} } if ($action == 'create_ticket' && GETPOST('add_ticket')) { $error = 0; From ff76e60c49685c71d034f2739609bdb8d08e615c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 18 Apr 2018 10:13:20 +0200 Subject: [PATCH 07/11] Fix: some bugs and warnings --- htdocs/core/class/commonobject.class.php | 27 ++++++++++--------- .../core/class/html.formticketsup.class.php | 4 +-- htdocs/ticketsup/card.php | 11 +++++--- htdocs/ticketsup/class/ticketsup.class.php | 4 +-- 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 70342919792..1b750e59503 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3923,23 +3923,26 @@ abstract class CommonObject $var = true; $i = 0; - foreach ($this->lines as $line) + if (! empty($this->lines)) { - if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line))) + foreach ($this->lines as $line) { - if (empty($line->fk_parent_line)) + if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line))) { - $parameters=array('line'=>$line,'var'=>$var,'i'=>$i); - $action=''; - $hookmanager->executeHooks('printOriginObjectLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if (empty($line->fk_parent_line)) + { + $parameters=array('line'=>$line,'var'=>$var,'i'=>$i); + $action=''; + $hookmanager->executeHooks('printOriginObjectLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + } + } + else + { + $this->printOriginLine($line, $var, $restrictlist); } - } - else - { - $this->printOriginLine($line, $var, $restrictlist); - } - $i++; + $i++; + } } } diff --git a/htdocs/core/class/html.formticketsup.class.php b/htdocs/core/class/html.formticketsup.class.php index 9cc9a09dbc6..a7f1b7a8d34 100644 --- a/htdocs/core/class/html.formticketsup.class.php +++ b/htdocs/core/class/html.formticketsup.class.php @@ -858,7 +858,7 @@ class FormTicketsup // Destinataires print ''; + print ''; // Label if ($objp->fk_product > 0) { @@ -1684,7 +1684,7 @@ else $colspan = 7; } - print ''; + print ''; print '"; + print ''; print '"; + print ''; print ''; + print ''; print ''; print "\n"; } @@ -1886,7 +1886,7 @@ else { print '
' . $langs->trans("ThirdParty") . ''; $events = array(); $events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); - print $form->select_company($this->withfromsocid, 'socid', '', 1, 1, '', $events); + print $form->select_company($this->withfromsocid, 'socid', '', 1, 1, '', $events, 0, 'minwidth200'); print '
'; - print 'withnotifytiersatcreate?' checked="checked"':'').'>'; + print 'withnotifytiersatcreate?' checked="checked"':'')).'>'; print '
'; // Date planned @@ -1721,14 +1721,14 @@ else if (is_array($extralabelslines) && count($extralabelslines)>0) { $line = new ContratLigne($db); $line->fetch_optionals($objp->rowid); - print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bcnd[$var], 'colspan'=>$colspan), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); + print $line->showOptionals($extrafieldsline, 'view', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); } } // Ligne en mode update else { // Ligne carac - print "
'; if ($objp->fk_product) { @@ -1783,7 +1783,7 @@ else if($conf->global->PRODUCT_USE_UNITS) $colspan++; // Ligne dates prevues - print "
'; print $langs->trans("DateStartPlanned").' '; $form->select_date($db->jdate($objp->date_debut),"date_start_update",$usehm,$usehm,($db->jdate($objp->date_debut)>0?0:1),"update"); @@ -1795,7 +1795,7 @@ else if (is_array($extralabelslines) && count($extralabelslines)>0) { $line = new ContratLigne($db); $line->fetch_optionals($objp->rowid); - print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$colspan), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); + print $line->showOptionals($extrafieldsline, 'edit', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); } } @@ -1808,7 +1808,7 @@ else if ($object->statut > 0) { - print '

'; - print ''; + print ''; print ''; print ''; print "\n"; - print ''; + print ''; print ''; + print ''; print ''; @@ -1981,7 +1981,7 @@ else print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index f6552d3d1e1..0c95831ad52 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -35,12 +35,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; -// Langs -$langs->load("companies"); -$langs->load("compta"); -$langs->load("main"); -$langs->load("accountancy"); -$langs->load("products"); +// Load traductions files requiredby by page +$langs->loadLangs(array("companies","compta","main","accountancy","products")); // Security check if (empty($conf->accounting->enabled)) { @@ -360,7 +356,6 @@ if ($result) $product_static = new Product($db); - $var = true; $i=0; while ($i < min($num,$limit)) { diff --git a/htdocs/accountancy/bookkeeping/balancebymonth.php b/htdocs/accountancy/bookkeeping/balancebymonth.php index 1d746b4d4df..2e16054000d 100644 --- a/htdocs/accountancy/bookkeeping/balancebymonth.php +++ b/htdocs/accountancy/bookkeeping/balancebymonth.php @@ -30,12 +30,8 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; -// Langs -$langs->load("main"); -$langs->load("compta"); -$langs->load("bills"); -$langs->load("other"); -$langs->load("accountancy"); +// Load traductions files requiredby by page +$langs->loadLangs(array("bills","compta","main","accountancy","other")); // Filter $year = GETPOST("year",'int'); @@ -75,8 +71,6 @@ if ($result) { $y = $year_current; -$var = true; - print '
'.$langs->trans("ServiceStatus").': '.$object->lines[$cursorline-1]->getLibStatut(4).''; if ($user->societe_id == 0) @@ -1913,7 +1913,7 @@ else print '
'; // Si pas encore active @@ -1969,7 +1969,7 @@ else } } - print '
'.$langs->trans("DateServiceActivate").''; print $form->select_date($dateactstart,'',$usehm,$usehm,'',"active",1,0,1); print '
'.$langs->trans("Comment").''; print '   '; @@ -2026,7 +2026,7 @@ else $now=dol_now(); if ($dateactend > $now) $dateactend=$now; - print '
'; + print '
'; if ($objp->statut >= 4) { if ($objp->statut == 4) @@ -2039,7 +2039,7 @@ else print ''; print '
'.$langs->trans("Comment").''; print '   '; @@ -2079,8 +2079,6 @@ else // Form to add new line if ($action != 'editline') { - $var = true; - $forcetoshowtitlelines=1; // Add free products/services @@ -2201,8 +2199,7 @@ else $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; $genallowed = $user->rights->contrat->lire; $delallowed = $user->rights->contrat->creer; - - $var = true; + print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); From ecda8bf55d7a432f4361e451d5e426b9e32b941d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 19 Apr 2018 17:07:36 +0200 Subject: [PATCH 11/11] clean and update code --- htdocs/accountancy/admin/importaccounts.php | 8 ++------ htdocs/accountancy/admin/productaccount.php | 9 ++------- htdocs/accountancy/bookkeeping/balancebymonth.php | 12 +++--------- htdocs/accountancy/customer/list.php | 10 ++-------- htdocs/accountancy/expensereport/list.php | 11 ++--------- htdocs/accountancy/supplier/list.php | 10 ++-------- 6 files changed, 13 insertions(+), 47 deletions(-) diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index 93d41b3cbc6..0399adf2e6c 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -29,11 +29,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; -// langs -$langs->load("compta"); -$langs->load("bills"); -$langs->load("main"); -$langs->load("accountancy"); +// Load traductions files requiredby by page +$langs->loadLangs(array("compta","bills","main","accountancy")); // Security check if (! $user->admin) @@ -141,7 +138,6 @@ if ($result) { $form = new Form($db); $formaccounting = new FormAccounting($db); - $var = true; while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); print '
'; print ''; @@ -108,7 +102,7 @@ if ($resql) { $row = $db->fetch_row($resql); - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 4d9d7532d7e..63c46a8410c 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -36,13 +36,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; -// Langs -$langs->load("compta"); -$langs->load("bills"); -$langs->load("other"); -$langs->load("main"); -$langs->load("accountancy"); -$langs->load("productbatch"); +// Load traductions files requiredby by page +$langs->loadLangs(array("bills","compta","main","accountancy","other","productbatch")); $action=GETPOST('action','alpha'); $massaction=GETPOST('massaction','alpha'); @@ -384,7 +379,6 @@ if ($result) { $product_static = new Product($db); $form = new Form($db); - $var = true; while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 2a24aa2f656..79468add3de 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -35,14 +35,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; -// Langs -$langs->load("compta"); -$langs->load("bills"); -$langs->load("other"); -$langs->load("trips"); -$langs->load("main"); -$langs->load("accountancy"); -$langs->load("productbatch"); +// Load traductions files requiredby by page +$langs->loadLangs(array("bills","compta","main","accountancy","other","trips","productbatch")); $action=GETPOST('action','alpha'); $massaction=GETPOST('massaction','alpha'); @@ -345,7 +339,6 @@ if ($result) { $expensereport_static = new ExpenseReport($db); $form = new Form($db); - $var = true; while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index c19e1d2716c..961c68167c6 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -36,13 +36,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; -// Langs -$langs->load("compta"); -$langs->load("bills"); -$langs->load("other"); -$langs->load("main"); -$langs->load("accountancy"); -$langs->load("productbatch"); +// Load traductions files requiredby by page +$langs->loadLangs(array("bills","compta","main","accountancy","other","productbatch")); $action=GETPOST('action','alpha'); $massaction=GETPOST('massaction','alpha'); @@ -385,7 +380,6 @@ if ($result) { $productfourn_static = new ProductFournisseur($db); $form = new Form($db); - $var = true; while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result);
' . $langs->trans("Label") . '' . $langs->trans("JanuaryMin") . '' . $langs->trans("FebruaryMin") . '' . $langs->trans("MarchMin") . '' . $langs->trans("AprilMin") . '' . $langs->trans("MayMin") . '' . $langs->trans("JuneMin") . '' . $langs->trans("JulyMin") . '' . $langs->trans("AugustMin") . '' . $langs->trans("SeptemberMin") . '' . $langs->trans("OctoberMin") . '' . $langs->trans("NovemberMin") . '' . $langs->trans("DecemberMin") . 'Total
' . length_accountg($row[0]) . '
' . length_accountg($row[0]) . '' . price($row[1]) . '' . price($row[2]) . '' . price($row[3]) . '