diff --git a/ChangeLog b/ChangeLog index e99731fe548..caec167d380 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,7 @@ WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: * The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product +* Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead. ***** ChangeLog for 16.0.0 compared to 15.0.0 ***** @@ -27,7 +28,7 @@ Following changes may create regressions for some external modules, but were nec For users: --------------- -NEW: PHP 8.1 compatibility. +NEW: PHP 8.1 compatibility: Warning: Application works correctly with PHP8 and 8.1 but you may experience a lot of PHP warning into the PHP server log files (depending on the PHP setup). Removal of all PHP warnings on server side is planned for v17. NEW: Support for recurring purchase invoices. @@ -138,6 +139,7 @@ NEW: Ticket triggers: allow to automatically send messages on new tickets NEW: Accountancy - Add hidden feature for accounting reconciliation NEW: Can store the session into database (instead of beeing managed by PHP) NEW: Added MMK currency (Myanmar Kyat) +NEW: On a form to send an email, we show all emails of contacts of object Modules NEW: Module Partnership Management diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 3024d3b1e61..abf16cee764 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -632,7 +632,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/webmozart`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/autoload.php`; diff --git a/dev/tools/fixperms.sh b/dev/tools/fixperms.sh index 5b027ad1580..6b11f25112b 100755 --- a/dev/tools/fixperms.sh +++ b/dev/tools/fixperms.sh @@ -24,6 +24,7 @@ fi if [ "x$1" = "xfix" ] then find ./htdocs -type f -iname "*.php" -exec chmod a-x {} \; + find ./htdocs/install/ -type d -exec chmod ug+rw {} \; chmod a+x ./scripts/*/*.php chmod a+x ./scripts/*/*.sh chmod g-w ./scripts/*/*.php diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index 39aa21f2d63..e65572eafd3 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -1,6 +1,6 @@ - * Copyright (C) 2017 Alexandre Spangaro +/* Copyright (C) 2016 Jamal Elbaz + * Copyright (C) 2017-2022 Alexandre Spangaro * * 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 @@ -124,7 +124,8 @@ if (!empty($cat_id)) { $arraykeyvalue = array(); foreach ($accountingcategory->lines_cptbk as $key => $val) { - $arraykeyvalue[length_accountg($val->numero_compte)] = length_accountg($val->numero_compte).' ('.$val->label_compte.($val->doc_ref ? ' '.$val->doc_ref : '').')'; + $doc_ref = !empty($val->doc_ref) ? $val->doc_ref : ''; + $arraykeyvalue[length_accountg($val->numero_compte)] = length_accountg($val->numero_compte) . ' - ' . $val->label_compte . ($doc_ref ? ' '.$doc_ref : ''); } if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) { diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index c2071e76cea..15dba808e00 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2017 Florian Henry - * Copyright (C) 2013-2021 Alexandre Spangaro + * Copyright (C) 2013-2022 Alexandre Spangaro * Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2018-2020 Frédéric France * @@ -332,7 +332,9 @@ if ($action == 'valid') { $html = new Form($db); $formaccounting = new FormAccounting($db); -llxHeader('', $langs->trans("CreateMvts")); +$title = $langs->trans("CreateMvts"); + +llxHeader('', $title); // Confirmation to delete the command if ($action == 'delete') { @@ -341,7 +343,7 @@ if ($action == 'delete') { } if ($action == 'create') { - print load_fiche_titre($langs->trans("CreateMvts")); + print load_fiche_titre($title); $object = new BookKeeping($db); $next_num_mvt = $object->getNextNumMvt('_tmp'); @@ -540,21 +542,24 @@ if ($action == 'create') { print ''; print ''; - // Date document export - print ''; - print ''.$langs->trans("DateExport").''; - print ''; - print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; - print ''; - print ''; + // Don't show in tmp mode, inevitably empty + if ($mode != "_tmp") { + // Date document export + print ''; + print '' . $langs->trans("DateExport") . ''; + print ''; + print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; + print ''; + print ''; - // Date document validation - print ''; - print ''.$langs->trans("DateValidation").''; - print ''; - print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; - print ''; - print ''; + // Date document validation + print ''; + print '' . $langs->trans("DateValidation") . ''; + print ''; + print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; + print ''; + print ''; + } // Validate /* diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index aa5e8dfc257..4ba5f0aa9be 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2021 Alexandre Spangaro + * Copyright (C) 2013-2022 Alexandre Spangaro * Copyright (C) 2016-2017 Laurent Destailleur * Copyright (C) 2018-2021 Frédéric France * @@ -1136,6 +1136,9 @@ $totalarray = array(); $totalarray['nbfield'] = 0; $total_debit = 0; $total_credit = 0; +$totalarray['val'] = array (); +$totalarray['val']['totaldebit'] = 0; +$totalarray['val']['totalcredit'] = 0; while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 0bd1c06aab8..4b5f0d9bad6 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -824,17 +824,22 @@ print $hookmanager->resPrint; print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; - -$total_debit = 0; -$total_credit = 0; -$sous_total_debit = 0; -$sous_total_credit = 0; $displayed_account_number = null; // Start with undefined to be able to distinguish with empty // Loop on record // -------------------------------------------------------------------- $i = 0; + $totalarray = array(); +$totalarray['val'] = array (); +$totalarray['nbfield'] = 0; +$total_debit = 0; +$total_credit = 0; +$sous_total_debit = 0; +$sous_total_credit = 0; +$totalarray['val']['totaldebit'] = 0; +$totalarray['val']['totalcredit'] = 0; + while ($i < min($num, $limit)) { $line = $object->lines[$i]; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 992b885f272..0cc8ab4e8d9 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015-2017 Alexandre Spangaro + * Copyright (C) 2015-2022 Alexandre Spangaro * Copyright (C) 2015-2020 Florian Henry * Copyright (C) 2018-2020 Frédéric France * @@ -1667,7 +1667,9 @@ class BookKeeping extends CommonObject $this->doc_type = $obj->doc_type; $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); - $this->date_export = $this->db->jdate($obj->date_export); + if ($mode != "_tmp") { + $this->date_export = $this->db->jdate($obj->date_export); + } $this->date_validation = $this->db->jdate($obj->date_validation); } else { $this->error = "Error ".$this->db->lasterror(); @@ -1764,7 +1766,9 @@ class BookKeeping extends CommonObject $line->piece_num = $obj->piece_num; $line->date_creation = $obj->date_creation; $line->date_modification = $obj->date_modification; - $line->date_export = $obj->date_export; + if ($mode != "_tmp") { + $line->date_export = $obj->date_export; + } $line->date_validation = $obj->date_validation; $this->linesmvt[] = $line; diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 911197994c1..2745ab4784a 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -23,6 +23,8 @@ * \brief Home accounting module */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index b595402228e..22537a60a39 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2015-2022 Alexandre Spangaro * Copyright (C) 2016 Charlie Benke * * This program is free software; you can redistribute it and/or modify @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -// $formatexportset ùust be defined +// $formatexportset must be defined // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { @@ -24,11 +24,11 @@ if (empty($conf) || !is_object($conf)) { exit; } -$code = $conf->global->MAIN_INFO_ACCOUNTANT_CODE; -$prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC; -$format = $conf->global->ACCOUNTING_EXPORT_FORMAT; -$nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME; -$siren = $conf->global->MAIN_INFO_SIREN; +$code = getDolGlobalString('MAIN_INFO_ACCOUNTANT_CODE'); +$prefix = getDolGlobalString('ACCOUNTING_EXPORT_PREFIX_SPEC'); +$format = getDolGlobalString('ACCOUNTING_EXPORT_FORMAT'); +$nodateexport = getDolGlobalInt('ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME'); +$siren = getDolGlobalString('MAIN_INFO_SIREN'); $date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S'); $endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d'); diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index 3c7775dc6b8..41ea43c4cec 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -167,10 +167,30 @@ if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) { print $enabledisablehtml; print ''; +print '

'; -print '
'; if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) { + print '
'; + //print $langs->trans('FollowingLinksArePublic').'
'; + print img_picto('', 'globe').' '.$langs->trans('BlankSubscriptionForm').'
'; + if (isModEnabled('multicompany')) { + $entity_qr = '?entity='.$conf->entity; + } else { + $entity_qr = ''; + } + + // Define $urlwithroot + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + + print ''; + print ajax_autoselect('publicurlmember'); + print '
'; print '
'; @@ -248,29 +268,6 @@ print dol_get_fiche_end(); print ''; - -if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) { - print '
'; - //print $langs->trans('FollowingLinksArePublic').'
'; - print img_picto('', 'globe').' '.$langs->trans('BlankSubscriptionForm').'
'; - if (isModEnabled('multicompany')) { - $entity_qr = '?entity='.$conf->entity; - } else { - $entity_qr = ''; - } - - // Define $urlwithroot - $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); - $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file - //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - - print ''; - print ajax_autoselect('publicurlmember'); -} - // End of page llxFooter(); $db->close(); diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 63527452fe1..6816023f8de 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -29,6 +29,8 @@ * \brief Page of a member */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -44,9 +46,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + // Load translation files required by the page $langs->loadLangs(array("companies", "bills", "members", "users", "other", "paypal")); + +// Get parameters $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 5ecf5069915..1d2df6c04ab 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -663,6 +663,10 @@ class Adherent extends CommonObject { global $conf, $langs, $hookmanager; + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + + require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $nbrowsaffected = 0; $error = 0; diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 1ef98dddb6d..388d51be376 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -27,19 +27,24 @@ * \brief Home page of membership module */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array("companies", "members")); + + $hookmanager = new HookManager($db); // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('membersindex')); -// Load translation files required by the page -$langs->loadLangs(array("companies", "members")); // Security check $result = restrictedArea($user, 'adherent'); diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index f9208daf70d..2c2efdd00a6 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -27,14 +27,20 @@ * \brief Page to list all members of foundation */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + +// Load translation files required by the page $langs->loadLangs(array("members", "companies")); + +// Get parameters $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); @@ -42,6 +48,8 @@ $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search + +// Search fields $search = GETPOST("search", 'alpha'); $search_ref = GETPOST("search_ref", 'alpha'); $search_lastname = GETPOST("search_lastname", 'alpha'); diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 2d98dfe5fbc..0d05bb85523 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -23,25 +23,34 @@ * \brief Tab for note of a member */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; + // Load translation files required by the page $langs->loadLangs(array("companies", "members", "bills")); + +// Get parameters $action = GETPOST('action', 'aZ09'); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alphanohtml'); + +// Initialize objects $object = new Adherent($db); + $result = $object->fetch($id); if ($result > 0) { $adht = new AdherentType($db); $result = $adht->fetch($object->typeid); } + $permissionnote = $user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php // Fetch object diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 05f692be526..e2b8ace4783 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -526,7 +526,7 @@ $tabcond[40] = (isModEnabled("societe") && !empty($conf->global->THIRDPARTY_ENAB $tabcond[41] = !empty($conf->intracommreport->enabled); $tabcond[42] = isModEnabled("product"); $tabcond[43] = isModEnabled("product") && !empty($conf->productbatch->enabled) && $conf->global->MAIN_FEATURES_LEVEL >= 2; -$tabcond[44] = !empty($conf->asset->enabled); +$tabcond[44] = isModEnabled('asset'); // List of help for fields (no more used, help is defined into tabcomplete) $tabhelp = array(); diff --git a/htdocs/admin/ecm.php b/htdocs/admin/ecm.php index 44df7f74189..3e0c2378742 100644 --- a/htdocs/admin/ecm.php +++ b/htdocs/admin/ecm.php @@ -22,6 +22,8 @@ * \brief Page to setup ECM (GED) module */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; @@ -37,6 +39,8 @@ if (!$user->admin) { /* * Action */ + +// set if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { $code = $reg[1]; if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) { @@ -47,6 +51,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { } } +// delete if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) { $code = $reg[1]; if (dolibarr_del_const($db, $code, $conf->entity) > 0) { diff --git a/htdocs/admin/facture_situation.php b/htdocs/admin/facture_situation.php index 609a6605d1a..350055348f8 100644 --- a/htdocs/admin/facture_situation.php +++ b/htdocs/admin/facture_situation.php @@ -130,12 +130,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); -llxHeader( - "", - $langs->trans("BillsSetup"), - 'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura' -); +$help_yrl = 'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'; +llxHeader("", $langs->trans("BillsSetup"), $help_url); $linkback = ''.$langs->trans("BackToModuleList").''; diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index baf35de9a35..0695408c16d 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -385,6 +385,20 @@ if ($mode == 'other') { print ''; print ''; + // Show Quick Add link + print '' . $langs->trans("ShowQuickAddLink") . ''; + print ajax_constantonoff("MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); + print ''; + print ''; + + // Hide wiki link on login page + $pictohelp = ''; + print '' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . ''; + print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); + //print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1); + print ''; + print ''; + // Max size of lists print '' . $langs->trans("DefaultMaxSizeList") . ''; print ''; @@ -449,12 +463,6 @@ if ($mode == 'other') { print ''; */ - // Show Quick Add link - print '' . $langs->trans("ShowQuickAddLink") . ''; - print ajax_constantonoff("MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); - print ''; - print ''; - // Show bugtrack link print ''; print $form->textwithpicto($langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")), $langs->trans("ShowBugTrackLinkDesc")); @@ -463,14 +471,6 @@ if ($mode == 'other') { print ''; print ''; - // Hide wiki link on login page - $pictohelp = ''; - print '' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . ''; - print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); - //print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1); - print ''; - print ''; - // Disable javascript and ajax print '' . $form->textwithpicto($langs->trans("DisableJavascript"), $langs->trans("DisableJavascriptNote")) . ''; print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 9378fc28bbe..471b34866a7 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -219,29 +219,6 @@ if ($action == 'add') { } } -// delete -if ($action == 'confirm_delete' && $confirm == 'yes') { - $db->begin(); - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu WHERE rowid = ".GETPOST('menuId', 'int'); - $result = $db->query($sql); - - if ($result == 0) { - $db->commit(); - - llxHeader(); - setEventMessages($langs->trans("MenuDeleted"), null, 'mesgs'); - llxFooter(); - exit; - } else { - $db->rollback(); - - $reload = 0; - $_GET["action"] = ''; - $action = ''; - } -} - /* diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index fdb3117423b..3e4c088620d 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -101,7 +101,7 @@ if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') { } $text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'restricthtml'); - if (!empty($text_home)) { + if (GETPOSTISSET('TICKET_PUBLIC_TEXT_HOME')) { $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity); } else { $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity); @@ -235,12 +235,10 @@ $head = ticketAdminPrepareHead(); print dol_get_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket"); -print ''.$langs->trans("TicketPublicAccess").' : '.dol_buildpath('/public/ticket/index.php?entity='.$conf->entity, 2).''; - -print dol_get_fiche_end(); - $param = ''; +print '
'; + $enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' '; if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { // Button off, click to enable @@ -256,9 +254,30 @@ if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print $enabledisablehtml; print ''; -print '

'; +print dol_get_fiche_end(); + + if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { + print '
'; + + + // Define $urlwithroot + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + + print ''.$langs->trans("TicketPublicAccess").' :
'; + print ''; + print ajax_autoselect('publicurlmember'); + + + print '

'; + + print '
'; print ''; print ''; @@ -371,8 +390,8 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help'); print ''; - // Texte d'accueil homepage - $public_text_home = $conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans('TicketPublicInterfaceTextHome'); + // Text on home page + $public_text_home = getDolGlobalString('TICKET_PUBLIC_TEXT_HOME', ''.$langs->trans("TicketPublicDesc").''); print ''.$langs->trans("TicketPublicInterfaceTextHomeLabelAdmin").''; print ''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -383,7 +402,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help'); print ''; - // Texte d'aide à la saisie du message + // Text to help to enter a ticket $public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'); print ''.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").''; print ''; diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index d21622d1f68..8b1e8ebf8c0 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -56,21 +56,23 @@ if (!$user->admin) { accessforbidden(); } -if ($file && !$what) { - //print DOL_URL_ROOT.'/dolibarr_export.php'; - header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportMethod"))).(GETPOST('page_y', 'int') ? '&page_y='.GETPOST('page_y', 'int') : '')); - exit; -} - $errormsg = ''; +$utils = new Utils($db); + /* * Actions */ +if ($file && !$what) { + //print DOL_URL_ROOT.'/dolibarr_export.php'; + header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportMethod"))).(GETPOST('page_y', 'int') ? '&page_y='.GETPOST('page_y', 'int') : '')); + exit; +} + if ($action == 'delete') { - $file = $conf->admin->dir_output.'/'.GETPOST('urlfile'); + $file = $conf->admin->dir_output.'/'.dol_sanitizeFileName(GETPOST('urlfile')); $ret = dol_delete_file($file, 1); if ($ret) { setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); @@ -80,11 +82,6 @@ if ($action == 'delete') { $action = ''; } - -/* - * View - */ - $_SESSION["commandbackuplastdone"] = ''; $_SESSION["commandbackuptorun"] = ''; $_SESSION["commandbackupresult"] = ''; @@ -103,13 +100,6 @@ if (!empty($MemoryLimit)) { @ini_set('memory_limit', $MemoryLimit); } - -//$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad'; -//llxHeader('','',$help_url); - -//print load_fiche_titre($langs->trans("Backup"),'','title_setup'); - - // Start with empty buffer $dump_buffer = ''; $dump_buffer_len = 0; @@ -122,9 +112,6 @@ $outputdir = $conf->admin->dir_output.'/backup'; $result = dol_mkdir($outputdir); -$utils = new Utils($db); - - // MYSQL if ($what == 'mysql') { $cmddump = GETPOST("mysqldump", 'none'); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg @@ -216,7 +203,16 @@ if ($errormsg) { }*/ } + + +/* + * View + */ + +top_httphead(); + $db->close(); // Redirect to backup page header("Location: dolibarr_export.php".(GETPOST('page_y', 'int') ? '?page_y='.GETPOST('page_y', 'int') : '')); +exit(); diff --git a/htdocs/admin/tools/export_files.php b/htdocs/admin/tools/export_files.php index bc627cc14f0..68cb81ccc24 100644 --- a/htdocs/admin/tools/export_files.php +++ b/htdocs/admin/tools/export_files.php @@ -205,7 +205,12 @@ if ($compression == 'zip') { print $errormsg; } + +// Output export + if ($export_type != 'externalmodule' || empty($what)) { + top_httphead(); + if ($errormsg) { setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors'); } else { @@ -218,12 +223,15 @@ if ($export_type != 'externalmodule' || empty($what)) { $returnto = 'dolibarr_export.php'; header("Location: ".$returnto); + exit(); } else { + top_httphead('application/zip'); + $zipname = $outputdir."/".$file; // Then download the zipped file. - header('Content-Type: application/zip'); + header('Content-disposition: attachment; filename='.basename($zipname)); header('Content-Length: '.filesize($zipname)); readfile($zipname); diff --git a/htdocs/asset/accountancy_codes.php b/htdocs/asset/accountancy_codes.php index 431b4ba7c68..824f1a75bbb 100644 --- a/htdocs/asset/accountancy_codes.php +++ b/htdocs/asset/accountancy_codes.php @@ -58,7 +58,7 @@ $permissiontoadd = $user->rights->asset->write; // Used by the include of action if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); $result = $assetaccountancycodes->fetchAccountancyCodes($object->id); if ($result < 0) { diff --git a/htdocs/asset/agenda.php b/htdocs/asset/agenda.php index 3d40cf62328..437e51cf0b1 100644 --- a/htdocs/asset/agenda.php +++ b/htdocs/asset/agenda.php @@ -86,7 +86,7 @@ $permissiontoadd = $user->rights->asset->write; // Used by the include of action if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); /* diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index d94ba613d91..c2d768b5405 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -80,7 +80,7 @@ if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!$permissiontoread) accessforbidden(); diff --git a/htdocs/asset/depreciation.php b/htdocs/asset/depreciation.php index 8f3547d81fb..679d750c668 100644 --- a/htdocs/asset/depreciation.php +++ b/htdocs/asset/depreciation.php @@ -56,7 +56,7 @@ if ($id > 0 || !empty($ref)) { if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!empty($object->not_depreciated)) accessforbidden(); $object->asset_depreciation_options = &$assetdepreciationoptions; diff --git a/htdocs/asset/depreciation_options.php b/htdocs/asset/depreciation_options.php index ba5719705dc..23c66d8961b 100644 --- a/htdocs/asset/depreciation_options.php +++ b/htdocs/asset/depreciation_options.php @@ -58,7 +58,7 @@ $permissiontoadd = $user->rights->asset->write; // Used by the include of action if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!empty($object->not_depreciated)) accessforbidden(); $object->asset_depreciation_options = &$assetdepreciationoptions; diff --git a/htdocs/asset/disposal.php b/htdocs/asset/disposal.php index 7fddb92b05f..e06e86c78ac 100644 --- a/htdocs/asset/disposal.php +++ b/htdocs/asset/disposal.php @@ -57,7 +57,7 @@ $permissiontoadd = $user->rights->asset->write; // Used by the include of action if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!isset($object->disposal_date) || $object->disposal_date === "") accessforbidden(); diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php index 96b222b26c1..9f4439f94d6 100644 --- a/htdocs/asset/document.php +++ b/htdocs/asset/document.php @@ -78,7 +78,7 @@ $permissiontoadd = $user->rights->asset->asset->write; // Used by the include of if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); /* diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index c475e22fc83..45f90101adc 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -125,7 +125,7 @@ $permissiontoadd = $user->rights->asset->write; $permissiontodelete = $user->rights->asset->delete; // Security check -if (empty($conf->asset->enabled)) { +if (!isModEnabled('asset')) { accessforbidden('Module not enabled'); } @@ -134,7 +134,7 @@ if ($user->socid > 0) accessforbidden(); $socid = 0; if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!$permissiontoread) accessforbidden(); diff --git a/htdocs/asset/model/accountancy_codes.php b/htdocs/asset/model/accountancy_codes.php index 7582b61177e..6eb6d70abaf 100644 --- a/htdocs/asset/model/accountancy_codes.php +++ b/htdocs/asset/model/accountancy_codes.php @@ -59,7 +59,7 @@ $permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rig if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!$permissiontoread) accessforbidden(); $result = $assetaccountancycodes->fetchAccountancyCodes(0, $object->id); diff --git a/htdocs/asset/model/agenda.php b/htdocs/asset/model/agenda.php index f1db3030dc2..51a7fb515bf 100644 --- a/htdocs/asset/model/agenda.php +++ b/htdocs/asset/model/agenda.php @@ -88,7 +88,7 @@ if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!$permissiontoread) accessforbidden(); diff --git a/htdocs/asset/model/card.php b/htdocs/asset/model/card.php index 3d3ec2f67d2..756ac32e31f 100644 --- a/htdocs/asset/model/card.php +++ b/htdocs/asset/model/card.php @@ -80,7 +80,7 @@ if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) $socid = $user->socid; $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!$permissiontoread) accessforbidden(); diff --git a/htdocs/asset/model/depreciation_options.php b/htdocs/asset/model/depreciation_options.php index c34bd38dc46..f3f585f5397 100644 --- a/htdocs/asset/model/depreciation_options.php +++ b/htdocs/asset/model/depreciation_options.php @@ -59,7 +59,7 @@ $permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rig if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!$permissiontoread) accessforbidden(); $object->asset_depreciation_options = &$assetdepreciationoptions; diff --git a/htdocs/asset/model/list.php b/htdocs/asset/model/list.php index a55d5f49f9a..1d85a982e5d 100644 --- a/htdocs/asset/model/list.php +++ b/htdocs/asset/model/list.php @@ -126,7 +126,7 @@ $permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rig $permissiontodelete = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->delete) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->delete))); // Security check -if (empty($conf->asset->enabled)) { +if (!isModEnabled('asset')) { accessforbidden('Module not enabled'); } @@ -140,7 +140,7 @@ if ($user->socid > 0) { } $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); if (!$permissiontoread) accessforbidden(); /* diff --git a/htdocs/asset/note.php b/htdocs/asset/note.php index 8de86d49bb7..810ab7f4462 100644 --- a/htdocs/asset/note.php +++ b/htdocs/asset/note.php @@ -57,7 +57,7 @@ $permissiontoadd = $user->rights->asset->write; // Used by the include of action if ($user->socid > 0) accessforbidden(); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->asset->enabled)) accessforbidden(); +if (!isModEnabled('asset')) accessforbidden(); /* diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 5405b33d994..0e5da0735ce 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -487,753 +487,800 @@ $typeid = $type; // List of products or services (type is type of category) if ($type == Categorie::TYPE_PRODUCT) { - $permission = ($user->rights->produit->creer || $user->rights->service->creer); + if ($user->hasRight("product", "read")) { + $permission = ($user->rights->produit->creer || $user->rights->service->creer); + + $prods = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($prods < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddProductServiceIntoCategory").'  '; + $form->select_produits('', 'elemid', '', 0, 0, -1, 2, '', 1); + print '
'; + print '
'; + } - $prods = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($prods < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AddProductServiceIntoCategory").'  '; - $form->select_produits('', 'elemid', '', 0, 0, -1, 2, '', 1); - print '
'; - print '
'; - } + print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = ''; - $newcardbutton = dolGetButtonTitle($langs->trans("AddProduct"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&categories[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer); - print_barre_liste($langs->trans("ProductsAndServices"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, $newcardbutton, '', $limit); + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = ''; + $newcardbutton = dolGetButtonTitle($langs->trans("AddProduct"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&categories[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer); + print_barre_liste($langs->trans("ProductsAndServices"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'products', 0, $newcardbutton, '', $limit); - print ''."\n"; - print ''."\n"; + print '
'.$langs->trans("Ref").'
'."\n"; + print ''."\n"; - if (count($prods) > 0) { - $i = 0; - foreach ($prods as $prod) { - $i++; - if ($i > $limit) { - break; + if (count($prods) > 0) { + $i = 0; + foreach ($prods as $prod) { + $i++; + if ($i > $limit) { + break; + } + + print "\t".''."\n"; + print '\n"; + print '\n"; + // Link to delete from category + print ''; + print "\n"; } - - print "\t".''."\n"; - print '\n"; - print '\n"; - // Link to delete from category - print ''; - print "\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Ref").'
'; + print $prod->getNomUrl(1); + print "'.$prod->label."'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print '
'; - print $prod->getNomUrl(1); - print "'.$prod->label."'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; - } - print '
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("ProductsAndServices"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'products'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } } // List of customers if ($type == Categorie::TYPE_CUSTOMER) { - $permission = $user->rights->societe->creer; + if ($user->hasRight("societe", "read")) { + $permission = $user->rights->societe->creer; + + $socs = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($socs < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddCustomerIntoCategory").'  '; + print $form->select_company('', 'elemid', 's.client IN (1,3)'); + print '
'; + print '
'; + } - $socs = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($socs < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AddCustomerIntoCategory").'  '; - print $form->select_company('', 'elemid', 's.client IN (1,3)'); - print '
'; - print '
'; - } + print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = ''; + $newcardbutton = dolGetButtonTitle($langs->trans("AddThirdParty"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&client=3&custcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer); + print_barre_liste($langs->trans("Customers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit); - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = ''; - $newcardbutton = dolGetButtonTitle($langs->trans("AddThirdParty"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&client=3&custcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer); - print_barre_liste($langs->trans("Customers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit); + print ''."\n"; + print ''."\n"; - print '
'.$langs->trans("Name").'
'."\n"; - print ''."\n"; + if (count($socs) > 0) { + $i = 0; + foreach ($socs as $key => $soc) { + $i++; + if ($i > $limit) { + break; + } - if (count($socs) > 0) { - $i = 0; - foreach ($socs as $key => $soc) { - $i++; - if ($i > $limit) { - break; + print "\t".''."\n"; + print '\n"; + // Link to delete from category + print ''; + print "\n"; } - - print "\t".''."\n"; - print '\n"; - // Link to delete from category - print ''; - print "\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Name").'
'; + print $soc->getNomUrl(1); + print "'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print '
'; - print $soc->getNomUrl(1); - print "'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; - } - print '
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("Customers"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'companies'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } } // List of suppliers if ($type == Categorie::TYPE_SUPPLIER) { - $permission = $user->rights->societe->creer; + if ($user->hasRight("fournisseur", "read")) { + $permission = $user->rights->societe->creer; + + $socs = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($socs < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddSupplierIntoCategory").'  '; + print $form->select_company('', 'elemid', 's.fournisseur = 1'); + print '
'; + print '
'; + } - $socs = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($socs < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AddSupplierIntoCategory").'  '; - print $form->select_company('', 'elemid', 's.fournisseur = 1'); - print '
'; - print '
'; - } + print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = ''; + $newcardbutton = dolGetButtonTitle($langs->trans("AddSupplier"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&fournisseur=1&suppcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer); + print_barre_liste($langs->trans("Suppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit); - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($socs); $nbtotalofrecords = ''; - $newcardbutton = dolGetButtonTitle($langs->trans("AddSupplier"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&fournisseur=1&suppcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer); - print_barre_liste($langs->trans("Suppliers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit); + print ''."\n"; + print '\n"; - print '
'.$langs->trans("Name")."
'."\n"; - print '\n"; + if (count($socs) > 0) { + $i = 0; + foreach ($socs as $soc) { + $i++; + if ($i > $limit) { + break; + } - if (count($socs) > 0) { - $i = 0; - foreach ($socs as $soc) { - $i++; - if ($i > $limit) { - break; + print "\t".''."\n"; + print '\n"; + // Link to delete from category + print ''; + + print "\n"; } - - print "\t".''."\n"; - print '\n"; - // Link to delete from category - print ''; - - print "\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Name")."
'; + print $soc->getNomUrl(1); + print "'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print '
'; - print $soc->getNomUrl(1); - print "'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; - } - print '
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("Suppliers"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'companies'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } } // List of members if ($type == Categorie::TYPE_MEMBER) { - require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; + if ($user->hasRight("adherent", "read")) { + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - $permission = $user->rights->adherent->creer; + $permission = $user->rights->adherent->creer; + + $prods = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($prods < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AssignCategoryTo").'  '; + print $form->selectMembers('', 'elemid'); + print '
'; + print '
'; + } - $prods = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($prods < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AssignCategoryTo").'  '; - print $form->selectMembers('', 'elemid'); - print '
'; - print '
'; - } + print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = ''; + $newcardbutton = dolGetButtonTitle($langs->trans("AddMember"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create&memcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->adherent->creer); + print_barre_liste($langs->trans("Member"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit); - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = ''; - $newcardbutton = dolGetButtonTitle($langs->trans("AddMember"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create&memcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->adherent->creer); - print_barre_liste($langs->trans("Member"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit); + print "\n"; + print ''."\n"; - print "
'.$langs->trans("Name").'
\n"; - print ''."\n"; + if (count($prods) > 0) { + $i = 0; + foreach ($prods as $key => $member) { + $i++; + if ($i > $limit) { + break; + } - if (count($prods) > 0) { - $i = 0; - foreach ($prods as $key => $member) { - $i++; - if ($i > $limit) { - break; + print "\t".''."\n"; + print '\n"; + print '\n"; + print '\n"; + // Link to delete from category + print '\n"; } - - print "\t".''."\n"; - print '\n"; - print '\n"; - print '\n"; - // Link to delete from category - print '\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Name").'
'; + $member->ref = $member->login; + print $member->getNomUrl(1, 0); + print "'.$member->lastname."'.$member->firstname."'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print "
'; - $member->ref = $member->login; - print $member->getNomUrl(1, 0); - print "'.$member->lastname."'.$member->firstname."'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; - } - print "
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("Member"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'members'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } } // List of contacts if ($type == Categorie::TYPE_CONTACT) { - $permission = $user->rights->societe->creer; + if ($user->hasRight("societe", "read")) { + $permission = $user->rights->societe->creer; - $contacts = $object->getObjectsInCateg($type, 0, $limit, $offset); - if (is_numeric($contacts) && $contacts < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; + $contacts = $object->getObjectsInCateg($type, 0, $limit, $offset); + if (is_numeric($contacts) && $contacts < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AssignCategoryTo").'  '; + print $form->selectContacts('', '', 'elemid'); + print '
'; + print '
'; + } print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AssignCategoryTo").'  '; - print $form->selectContacts('', '', 'elemid'); - print '
'; - print '
'; - } - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; - $num = count($contacts); - $nbtotalofrecords = ''; - $newcardbutton = dolGetButtonTitle($langs->trans("AddContact"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?action=create&contcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer); - $objsoc = new Societe($db); - print_barre_liste($langs->trans("Contact"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contact', 0, $newcardbutton, '', $limit); + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; + $num = count($contacts); + $nbtotalofrecords = ''; + $newcardbutton = dolGetButtonTitle($langs->trans("AddContact"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?action=create&contcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->societe->creer); + $objsoc = new Societe($db); + print_barre_liste($langs->trans("Contact"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'contact', 0, $newcardbutton, '', $limit); - print ''."\n"; - print ''."\n"; + print '
'.$langs->trans("Ref").'
'."\n"; + print ''."\n"; - if (is_array($contacts) && count($contacts) > 0) { - $i = 0; - foreach ($contacts as $key => $contact) { - $i++; - if ($i > $limit) { - break; + if (is_array($contacts) && count($contacts) > 0) { + $i = 0; + foreach ($contacts as $key => $contact) { + $i++; + if ($i > $limit) { + break; + } + + print "\t".''."\n"; + print '\n"; + // Link to delete from category + print ''; + print "\n"; } - - print "\t".''."\n"; - print '\n"; - // Link to delete from category - print ''; - print "\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Ref").'
'; + print $contact->getNomUrl(1, 'category'); + if ($contact->socid > 0) { + $objsoc->fetch($contact->socid); + print ' - '; + print $objsoc->getNomUrl(1, 'contact'); + } + print "'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print '
'; - print $contact->getNomUrl(1, 'category'); - if ($contact->socid > 0) { - $objsoc->fetch($contact->socid); - print ' - '; - print $objsoc->getNomUrl(1, 'contact'); - } - print "'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; - } - print '
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("Contact"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'contact'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } } // List of bank accounts if ($type == Categorie::TYPE_ACCOUNT) { - require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + if ($user->hasRight("banque", "read")) { + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - $permission = $user->rights->banque->creer; + $permission = $user->rights->banque->creer; + + $accounts = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($accounts < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddAccountIntoCategory").'  '; + $form->select_comptes('', 'elemid'); + print '
'; + print '
'; + } - $accounts = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($accounts < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AddAccountIntoCategory").'  '; - $form->select_comptes('', 'elemid'); - print '
'; - print '
'; - } + print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($accounts); $nbtotalofrecords = ''; $newcardbutton = ''; + print_barre_liste($langs->trans("Account"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit); - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($accounts); $nbtotalofrecords = ''; $newcardbutton = ''; - print_barre_liste($langs->trans("Account"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit); + print "\n"; + print ''."\n"; - print "
'.$langs->trans("Ref").'
\n"; - print ''."\n"; + if (count($accounts) > 0) { + $i = 0; + foreach ($accounts as $key => $account) { + $i++; + if ($i > $limit) { + break; + } - if (count($accounts) > 0) { - $i = 0; - foreach ($accounts as $key => $account) { - $i++; - if ($i > $limit) { - break; + print "\t".''."\n"; + print '\n"; + print '\n"; + print '\n"; + // Link to delete from category + print '\n"; } - - print "\t".''."\n"; - print '\n"; - print '\n"; - print '\n"; - // Link to delete from category - print '\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Ref").'
'; + print $account->getNomUrl(1, 0); + print "'.$account->bank."'.$account->number."'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print "
'; - print $account->getNomUrl(1, 0); - print "'.$account->bank."'.$account->number."'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; - } - print "
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("Banque"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'bank'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } } // List of Project if ($type == Categorie::TYPE_PROJECT) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + if ($user->hasRight("project", "read")) { + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - $permission = $user->rights->projet->creer; + $permission = $user->rights->projet->creer; + + $objects = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($objects < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddProjectIntoCategory").'  '; + $form->selectProjects('', 'elemid'); + print '
'; + print '
'; + } - $objects = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($objects < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AddProjectIntoCategory").'  '; - $form->selectProjects('', 'elemid'); - print '
'; - print '
'; - } + print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = ''; - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = ''; + print_barre_liste($langs->trans("Project"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'project', 0, $newcardbutton, '', $limit); - print_barre_liste($langs->trans("Project"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'project', 0, $newcardbutton, '', $limit); + print "\n"; + print ''."\n"; - print "
'.$langs->trans("Ref").'
\n"; - print ''."\n"; + if (count($objects) > 0) { + $i = 0; + foreach ($objects as $key => $project) { + $i++; + if ($i > $limit) { + break; + } - if (count($objects) > 0) { - $i = 0; - foreach ($objects as $key => $project) { - $i++; - if ($i > $limit) { - break; + print "\t".''."\n"; + print '\n"; + print '\n"; + print '\n"; + // Link to delete from category + print '\n"; } - - print "\t".''."\n"; - print '\n"; - print '\n"; - print '\n"; - // Link to delete from category - print '\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Ref").'
'; + print $project->getNomUrl(1); + print "'.$project->ref."'.$project->title."'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print "
'; - print $project->getNomUrl(1); - print "'.$project->ref."'.$project->title."'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; - } - print "
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("Project"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'project'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } } // List of users -if ($type == Categorie::TYPE_USER && $user->hasRight("user", "user", "read")) { - require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +if ($type == Categorie::TYPE_USER) { + if ($user->hasRight("user", "user", "read")) { + require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; - $users = $object->getObjectsInCateg($type); - if ($users < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; + $users = $object->getObjectsInCateg($type); + if ($users < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddObjectIntoCategory").'  '; + print $form->select_dolusers('', 'elemid'); + print '
'; + print '
'; + } print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AddObjectIntoCategory").'  '; - print $form->select_dolusers('', 'elemid'); - print '
'; - print '
'; - } - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; - print '
'; + print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; - $num = count($users); + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; + $num = count($users); - print_barre_liste($langs->trans("Users"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, '', 'user', 0, '', '', $limit); + print_barre_liste($langs->trans("Users"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, '', 'user', 0, '', '', $limit); - print "\n"; - print ''."\n"; + print "
'.$langs->trans("Users").' '.$num.'
\n"; + print ''."\n"; - if (count($users) > 0) { - // Use "$userentry" here, because "$user" is the current user - foreach ($users as $key => $userentry) { - print "\t".''."\n"; - print '\n"; - print '\n"; + if (count($users) > 0) { + // Use "$userentry" here, because "$user" is the current user + foreach ($users as $key => $userentry) { + print "\t".''."\n"; + print '\n"; + print '\n"; - // Link to delete from category - print '\n"; } - print "\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Users").' '.$num.'
'; - print $userentry->getNomUrl(1); - print "'.$userentry->job."
'; + print $userentry->getNomUrl(1); + print "'.$userentry->job."'; - if ($user->rights->user->user->creer) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; + // Link to delete from category + print ''; + if ($user->rights->user->user->creer) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print "
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("Users"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'user'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } -} else { - print_barre_liste($langs->trans("Users"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'user'); - accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } // List of warehouses if ($type == Categorie::TYPE_WAREHOUSE) { - $permission = $user->rights->stock->creer; + if ($user->hasRight("warehouse", "read")) { + $permission = $user->rights->stock->creer; - require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; - $objects = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($objects < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = ''; - - print_barre_liste($langs->trans("Warehouses"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'stock', 0, $newcardbutton, '', $limit); - - print "\n"; - print ''."\n"; - - if (count($objects) > 0) { - $i = 0; - foreach ($objects as $key => $project) { - $i++; - if ($i > $limit) { - break; - } - - print "\t".''."\n"; - print '\n"; - print '\n"; - print '\n"; - // Link to delete from category - print '\n"; - } + $objects = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($objects < 0) { + dol_print_error($db, $object->error, $object->errors); } else { - print ''; - } - print "
'.$langs->trans("Ref").'
'; - print $project->getNomUrl(1); - print "'.$project->ref."'.$project->title."'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; - } - print "
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; - - print '
'."\n"; - } -} - -// List of tickets -if ($type == Categorie::TYPE_TICKET) { - $permission = ($user->rights->categorie->creer || $user->rights->categorie->creer); - - $tickets = $object->getObjectsInCateg($type, 0, $limit, $offset); - if ($tickets < 0) { - dol_print_error($db, $object->error, $object->errors); - } else { - // Form to add record into a category - $showclassifyform = 1; - if ($showclassifyform) { - print '
'; print '
'; print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $langs->trans("AddTicketIntoCategory").'  '; - $form->selectTickets('', 'elemid'); - print '
'; - print '
'; - } + print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($objects); $nbtotalofrecords = ''; $newcardbutton = ''; - print '
'; - $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($tickets); $nbtotalofrecords = ''; $newcardbutton = ''; - print_barre_liste($langs->trans("Ticket"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'ticket', 0, $newcardbutton, '', $limit); + print_barre_liste($langs->trans("Warehouses"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'stock', 0, $newcardbutton, '', $limit); + print "\n"; + print ''."\n"; - print '
'.$langs->trans("Ref").'
'."\n"; - print ''."\n"; + if (count($objects) > 0) { + $i = 0; + foreach ($objects as $key => $project) { + $i++; + if ($i > $limit) { + break; + } - if (count($tickets) > 0) { - $i = 0; - foreach ($tickets as $ticket) { - $i++; - if ($i > $limit) break; - - print "\t".''."\n"; - print '\n"; - print '\n"; - // Link to delete from category - print ''."\n"; + print '\n"; + print '\n"; + print '\n"; + // Link to delete from category + print '\n"; } - print ''; - print "\n"; + } else { + print ''; } - } else { - print ''; - } - print "
'.$langs->trans("Ref").'
'; - print $ticket->getNomUrl(1); - print "'.$ticket->label."'; - if ($permission) { - print "id."'>"; - print $langs->trans("DeleteFromCat"); - print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); - print ""; + print "\t".'
'; + print $project->getNomUrl(1); + print "'.$project->ref."'.$project->title."'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print "
'.$langs->trans("ThisCategoryHasNoItems").'
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + print "\n"; - print '
'."\n"; + print ''."\n"; + } + } else { + print_barre_liste($langs->trans("Warehouse"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'stock'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); + } +} + +// List of tickets +if ($type == Categorie::TYPE_TICKET) { + if ($user->hasRight("ticket", "read")) { + $permission = ($user->rights->categorie->creer || $user->rights->categorie->creer); + + $tickets = $object->getObjectsInCateg($type, 0, $limit, $offset); + if ($tickets < 0) { + dol_print_error($db, $object->error, $object->errors); + } else { + // Form to add record into a category + $showclassifyform = 1; + if ($showclassifyform) { + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddTicketIntoCategory").'  '; + $form->selectTickets('', 'elemid'); + print '
'; + print '
'; + } + + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
'; + $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($tickets); $nbtotalofrecords = ''; $newcardbutton = ''; + print_barre_liste($langs->trans("Ticket"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'ticket', 0, $newcardbutton, '', $limit); + + + print ''."\n"; + print ''."\n"; + + if (count($tickets) > 0) { + $i = 0; + foreach ($tickets as $ticket) { + $i++; + if ($i > $limit) break; + + print "\t".''."\n"; + print '\n"; + print '\n"; + // Link to delete from category + print ''; + print "\n"; + } + } else { + print ''; + } + print "
'.$langs->trans("Ref").'
'; + print $ticket->getNomUrl(1); + print "'.$ticket->label."'; + if ($permission) { + print "id."'>"; + print $langs->trans("DeleteFromCat"); + print img_picto($langs->trans("DeleteFromCat"), 'unlink', '', false, 0, 0, '', 'paddingleft'); + print ""; + } + print '
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; + + print '
'."\n"; + } + } else { + print_barre_liste($langs->trans("Ticket"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'ticket'); + accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); } } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index ed963ddd7f2..6f6ddc5383e 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1496,7 +1496,7 @@ if ($action == 'create') { // Description print ''.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('note', (GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : $object->note_private), '', 120, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%'); + $doleditor = new DolEditor('note', (GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : $object->note_private), '', 120, 'dolibarr_notes', 'In', true, true, isModEnabled('fckeditor'), ROWS_4, '90%'); $doleditor->Create(); print ''; diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index e7745f1d5fd..8c13709b250 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -124,7 +124,7 @@ class AgendaEvents extends DolibarrApi if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) { $search_sale = DolibarrApiAccess::$user->id; } - if (empty($conf->societe->enabled)) { + if (!isModEnabled('societe')) { $search_sale = 0; // If module thirdparty not enabled, sale representative is something that does not exists } diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 6f9cfac40a5..9eb37d80799 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -194,7 +194,7 @@ if (isModEnabled("propal") && $user->rights->propal->lire) { $companystatic->canvas = $obj->canvas; print ''; - print ''.$propalstatic->getNomUrl(1).''; + print ''.$propalstatic->getNomUrl(1).''; print ''.$companystatic->getNomUrl(1, 'customer').''; print ''.price((!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc)).''; print ''; @@ -291,7 +291,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa $companystatic->canvas = $obj->canvas; print ''; - print ''.$supplierproposalstatic->getNomUrl(1).''; + print ''.$supplierproposalstatic->getNomUrl(1).''; print ''.$companystatic->getNomUrl(1, 'supplier').''; print ''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).''; print ''; @@ -389,7 +389,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { $companystatic->canvas = $obj->canvas; print ''; - print ''.$orderstatic->getNomUrl(1).''; + print ''.$orderstatic->getNomUrl(1).''; print ''.$companystatic->getNomUrl(1, 'customer').''; print ''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).''; print ''; @@ -487,7 +487,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO $companystatic->canvas = $obj->canvas; print ''; - print ''.$supplierorderstatic->getNomUrl(1).''; + print ''.$supplierorderstatic->getNomUrl(1).''; print ''.$companystatic->getNomUrl(1, 'supplier').''; print ''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).''; print ''; @@ -573,8 +573,9 @@ if (!empty($conf->ficheinter->enabled)) { $companystatic->email = $obj->email; $companystatic->entity = $obj->entity; $companystatic->canvas = $obj->canvas; + print ''; - print ''; + print ''; print $fichinterstatic->getNomUrl(1); print ""; print ''; @@ -654,7 +655,7 @@ if (isModEnabled("societe") && $user->rights->societe->lire) { $companystatic->canvas = $objp->canvas; print ''; - print ''.$companystatic->getNomUrl(1, 'customer').''; + print ''.$companystatic->getNomUrl(1, 'customer').''; print ''; //print $companystatic->getLibCustProspStatut(); @@ -751,7 +752,7 @@ if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERM $companystatic->canvas = $objp->canvas; print ''; - print ''.$companystatic->getNomUrl(1, 'supplier').''; + print ''.$companystatic->getNomUrl(1, 'supplier').''; print ''; $obj = $companystatic; @@ -865,8 +866,8 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) { // T $staticcontrat->ref = $obj->ref; print ''; - print ''.$staticcontrat->getNomUrl(1).''; - print ''.$companystatic->getNomUrl(1, 'customer', 44).''; + print ''.$staticcontrat->getNomUrl(1).''; + print ''.$companystatic->getNomUrl(1, 'customer', 44).''; print ''.$staticcontrat->LibStatut($obj->statut, 3).''; print ''; @@ -962,7 +963,7 @@ if (isModEnabled("propal") && $user->rights->propal->lire) { print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; @@ -1082,7 +1083,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { print '
'.$propalstatic->getNomUrl(1).''.$propalstatic->getNomUrl(1).''.$warning.''.$formfile->getDocumentsLink($propalstatic->element, $filename, $filedir).'
'; print ''; - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 03644fe5690..57f61f3d9f7 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -25,6 +25,8 @@ * \brief Home page of customer order module */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; @@ -32,6 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array('orders', 'bills')); + + if (!$user->rights->commande->lire) { accessforbidden(); } @@ -41,8 +48,6 @@ $hookmanager = new HookManager($db); // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('ordersindex')); -// Load translation files required by the page -$langs->loadLangs(array('orders', 'bills')); // Security check $socid = GETPOST('socid', 'int'); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index b92140efa03..4ba2f410cc9 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -779,7 +779,6 @@ $projectstatic = new Project($db); $title = $langs->trans("Orders"); $help_url = "EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; -// llxHeader('',$title,$help_url); $sql = 'SELECT'; if ($sall || $search_product_category > 0 || $search_user > 0) { diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 30d2bedcf14..688b0fd544b 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -108,7 +108,7 @@ $arrayfields = array( ); // Security check -if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled)) { +if (!isModEnabled('comptabilite') && !isModEnabled('accounting')) { accessforbidden(); } if ($user->socid > 0) { @@ -135,13 +135,13 @@ $error = 0; $listofchoices = array( 'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills', 'enabled' => isModEnabled('facture'), 'perms' => !empty($user->rights->facture->lire)), - 'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills', 'enabled' => isModEnabled("supplier_invoice"), 'perms' => !empty($user->rights->fournisseur->facture->lire)), - 'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips', 'enabled' => !empty($conf->expensereport->enabled), 'perms' => !empty($user->rights->expensereport->lire)), - 'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation', 'enabled' => !empty($conf->don->enabled), 'perms' => !empty($user->rights->don->lire)), - 'selectsocialcontributions'=>array('label'=>'SocialContributions', 'enabled' => !empty($conf->tax->enabled), 'perms' => !empty($user->rights->tax->charges->lire)), - 'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries', 'enabled' => !empty($conf->salaries->enabled), 'perms' => !empty($user->rights->salaries->read)), - 'selectvariouspayment'=>array('label'=>'VariousPayment', 'enabled' => isModEnabled("banque"), 'perms' => !empty($user->rights->banque->lire)), - 'selectloanspayment'=>array('label'=>'PaymentLoan', 'enabled' => !empty($conf->loan->enabled), 'perms' => !empty($user->rights->loan->read)), + 'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills', 'enabled' => isModEnabled('supplier_invoice'), 'perms' => !empty($user->rights->fournisseur->facture->lire)), + 'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips', 'enabled' => isModEnabled('expensereport'), 'perms' => !empty($user->rights->expensereport->lire)), + 'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation', 'enabled' => isModEnabled('don'), 'perms' => !empty($user->rights->don->lire)), + 'selectsocialcontributions'=>array('label'=>'SocialContributions', 'enabled' => isModEnabled('tax'), 'perms' => !empty($user->rights->tax->charges->lire)), + 'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries', 'enabled' => isModEnabled('salaries'), 'perms' => !empty($user->rights->salaries->read)), + 'selectvariouspayment'=>array('label'=>'VariousPayment', 'enabled' => isModEnabled('banque'), 'perms' => !empty($user->rights->banque->lire)), + 'selectloanspayment'=>array('label'=>'PaymentLoan', 'enabled' => isModEnabled('don'), 'perms' => !empty($user->rights->loan->read)), ); @@ -569,7 +569,7 @@ print ''."\n print ''; print ''.$langs->trans("ExportAccountingSourceDocHelp"); -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { print ' '.$langs->trans("ExportAccountingSourceDocHelp2", $langs->transnoentitiesnoconv("Accounting"), $langs->transnoentitiesnoconv("Journals")); } print '
'; @@ -689,21 +689,21 @@ if (!empty($date_start) && !empty($date_stop)) { print_liste_field_titre($arrayfields['ref']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'nowraponall '); print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print ''; print ''; print ''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''; } print ''; if (empty($TData)) { print ''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''; } print ''; @@ -833,7 +833,7 @@ if (!empty($date_start) && !empty($date_stop)) { $totalVAT_debit -= $data['amount_vat']; } - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print '\n"; } @@ -847,7 +847,7 @@ if (!empty($date_start) && !empty($date_stop)) { print ''; print ''; print ''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''; } print "\n"; @@ -858,7 +858,7 @@ if (!empty($date_start) && !empty($date_stop)) { print ''; print ''; print ''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''; } print "\n"; @@ -869,7 +869,7 @@ if (!empty($date_start) && !empty($date_stop)) { print ''; print ''; print ''; - if (isModEnabled('multicompany')) { + if (isModEnabled('multicurrency')) { print ''; } print "\n"; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index af833e7e257..d9689202297 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -365,7 +365,7 @@ if (GETPOST('save') && !$cancel && !empty($user->rights->banque->modifier)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors'); } - /*if (! empty($conf->accounting->enabled) && (empty($search_accountancy_code) || $search_accountancy_code == '-1')) + /*if (isModEnabled('accounting') && (empty($search_accountancy_code) || $search_accountancy_code == '-1')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors'); $error++; @@ -517,9 +517,15 @@ $morehtmlref = ''; if ($id > 0 || !empty($ref)) { $title = $object->ref.' - '.$langs->trans("Transactions"); - $helpurl = ""; - llxHeader('', $title, $helpurl); +} else { + $title = $langs->trans("BankTransactions"); +} +$help_url = ''; +llxHeader('', $title, $help_url, '', 0, 0, array(), array(), $param); + + +if ($id > 0 || !empty($ref)) { // Load bank groups require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php'; $bankcateg = new BankCateg($db); @@ -574,11 +580,8 @@ if ($id > 0 || !empty($ref)) { } } } -} else { - llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param); } - $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,"; $sql .= " b.fk_account, b.fk_type, b.fk_bordereau,"; $sql .= " ba.rowid as bankid, ba.ref as bankref"; @@ -879,7 +882,7 @@ if ($resql) { print ''; print ''; print ''; - /*if (! empty($conf->accounting->enabled)) + /*if (isModEnabled('accounting')) { print ''; print ''; - /*if (! empty($conf->accounting->enabled)) + /*if (isModEnabled('accounting')) { print ''; // Tags-Categories - if (!empty($conf->categorie->enabled)) { + if (isModEnabled('categorie')) { print ''; print ''; print ''; print ''; // Accountancy journal - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { print ''; print '
'.$orderstatic->getNomUrl(1).''.$orderstatic->getNomUrl(1).''.$formfile->getDocumentsLink($orderstatic->element, $filename, $filedir).'
'.$langs->trans("Document").''.$langs->trans("Paid").''.$langs->trans("TotalHT").($conf->multicurrency->enabled ? ' ('.$conf->currency.')' : '').''.$langs->trans("TotalTTC").($conf->multicurrency->enabled ? ' ('.$conf->currency.')' : '').''.$langs->trans("TotalVAT").($conf->multicurrency->enabled ? ' ('.$conf->currency.')' : '').''.$langs->trans("TotalHT").(isModEnabled('multicurrency') ? ' ('.$conf->currency.')' : '').''.$langs->trans("TotalTTC").(isModEnabled('multicurrency') ? ' ('.$conf->currency.')' : '').''.$langs->trans("TotalVAT").(isModEnabled('multicurrency') ? ' ('.$conf->currency.')' : '').''.$langs->trans("ThirdParty").''.$langs->trans("Code").''.$langs->trans("Country").''.$langs->trans("VATIntra").''.$langs->trans("Currency").'
'.$langs->trans("NoRecordFound").'
'.$data['currency']."'.price(price2num($totalIT_credit, 'MT')).''.price(price2num($totalVAT_credit, 'MT')).'
'.price(price2num($totalIT_debit, 'MT')).''.price(price2num($totalVAT_debit, 'MT')).'
'.price(price2num($totalIT_credit + $totalIT_debit, 'MT')).''.price(price2num($totalVAT_credit + $totalVAT_debit, 'MT')).'
'.$langs->trans("BankAccount").''.$langs->trans("Debit").''.$langs->trans("Credit").''; print $langs->trans("AccountAccounting"); @@ -914,7 +917,7 @@ if ($resql) { //} print ''; print $formaccounting->select_account($search_accountancy_code, 'search_accountancy_code', 1, null, 1, 1, ''); @@ -1023,9 +1026,9 @@ if ($resql) { $moreforfilter .= ''; $moreforfilter .= ''; - if (!empty($conf->categorie->enabled)) { + if (isModEnabled('categorie')) { // Categories - if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { $langs->load('categories'); // Bank line diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 420ff97ff0d..62c4dfa53ec 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -36,16 +36,16 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -if (!empty($conf->categorie->enabled)) { +if (isModEnabled('categorie')) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; } @@ -336,7 +336,7 @@ if (empty($reshook)) { $form = new Form($db); $formbank = new FormBank($db); $formcompany = new FormCompany($db); -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $formaccounting = new FormAccounting($db); } @@ -445,7 +445,7 @@ if ($action == 'create') { print '
'.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1); @@ -581,7 +581,7 @@ if ($action == 'create') { $fieldrequired = 'fieldrequired '; } - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { print '
'.$langs->trans("AccountancyCode").''; print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1); @@ -592,7 +592,7 @@ if ($action == 'create') { } // Accountancy journal - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { print '
'.$langs->trans("AccountancyJournal").''; print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0); @@ -671,7 +671,7 @@ if ($action == 'create') { // Accountancy code print '
'.$langs->trans("AccountancyCode").''; - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch('', $object->account_number, 1); @@ -682,7 +682,7 @@ if ($action == 'create') { print '
'.$langs->trans("AccountancyJournal").''; @@ -708,7 +708,7 @@ if ($action == 'create') { print ''; // Categories - if (!empty($conf->categorie->enabled)) { + if (isModEnabled('categorie')) { print '"; @@ -958,7 +958,7 @@ if ($action == 'create') { print ''; // Tags-Categories - if (!empty($conf->categorie->enabled)) { + if (isModEnabled('categorie')) { print ''.$langs->trans("AccountancyCode").''; print ''; // Accountancy journal - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { print ''; print '"; // Categories - if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { $langs->load('categories'); // Bank line diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 238b9919ef1..362ca3d488f 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -32,13 +32,13 @@ require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php'; -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; } -if (!empty($conf->categorie->enabled)) { +if (isModEnabled('categorie')) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; } @@ -58,7 +58,7 @@ $search_number = GETPOST('search_number', 'alpha'); $search_status = GETPOST('search_status') ?GETPOST('search_status', 'alpha') : 'opened'; // 'all' or ''='opened' $optioncss = GETPOST('optioncss', 'alpha'); -if (!empty($conf->categorie->enabled)) { +if (isModEnabled('categorie')) { $search_category_list = GETPOST("search_category_".Categorie::TYPE_ACCOUNT."_list", "array"); } @@ -116,8 +116,8 @@ $arrayfields = array( 'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1, 'position'=>12), 'accountype'=>array('label'=>$langs->trans("Type"), 'checked'=>1, 'position'=>14), 'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1, 'position'=>16), - 'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>(!empty($conf->accounting->enabled) || !empty($conf->accounting->enabled)), 'position'=>18), - 'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>(!empty($conf->accounting->enabled) || !empty($conf->accounting->enabled)), 'position'=>20), + 'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>(isModEnabled('accounting')), 'position'=>18), + 'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>(isModEnabled('accounting')), 'position'=>20), 'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1, 'position'=>50), 'b.currency_code'=>array('label'=>$langs->trans("Currency"), 'checked'=>0, 'position'=>22), 'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), @@ -197,7 +197,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label']) && is_arra $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)"; } -if (!empty($conf->categorie->enabled)) { +if (isModEnabled('categorie')) { $sql .= Categorie::getFilterJoinQuery(Categorie::TYPE_ACCOUNT, "b.rowid"); } @@ -209,7 +209,7 @@ if ($search_status == 'closed') { $sql .= " AND clos = 1"; } -if (!empty($conf->categorie->enabled)) { +if (isModEnabled('categorie')) { $sql .= Categorie::getFilterSelectQuery(Categorie::TYPE_ACCOUNT, "b.rowid", $search_category_list); } @@ -344,7 +344,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; $moreforfilter = ''; -if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { +if (isModEnabled('categorie') && $user->rights->categorie->lire) { $moreforfilter .= $form->getFilterBox(Categorie::TYPE_ACCOUNT, $search_category_list); } @@ -569,7 +569,7 @@ foreach ($accounts as $key => $type) { // Account number if (!empty($arrayfields['b.account_number']['checked'])) { print ''; print '"; print "\n"; print "'; print ''; print ''; // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $formproject = new FormProjets($db); // Associated project @@ -557,7 +557,7 @@ if ($id) { $morehtmlref = '
'; // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= $langs->trans('Project').' '; if ($user->rights->banque->modifier) { @@ -625,7 +625,7 @@ if ($id) { print '
'; // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load('projects'); print ''; print ''; // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled('multicurrency')) { // Multicurrency code print ''; print ''; print ''; print '"; // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled('multicurrency')) { print ''; print ''; print '"; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled('multicurrency')) { print ''; print '"; print '"; @@ -3992,7 +3990,7 @@ if ($action == 'create') { $resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT'); // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled('multicurrency')) { $multicurrency_totalpaid = $object->getSommePaiement(1); $multicurrency_totalcreditnotes = $object->getSumCreditNotesUsed(1); $multicurrency_totaldeposits = $object->getSumDepositsUsed(1); @@ -4364,7 +4362,7 @@ if ($action == 'create') { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($usercancreate) { @@ -4584,7 +4582,7 @@ if ($action == 'create') { print ''; // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled('multicurrency')) { // Multicurrency code print ''; print ''; - if ($conf->global->TAKEPOS_SUPPLEMENTS) { + if (getDolGlobalInt('TAKEPOS_SUPPLEMENTS')) { print ''; print '\n"; } @@ -203,8 +205,8 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) { print $form->buttonsSaveCancel("Save", ''); } -if (!empty($conf->global->TAKEPOS_BAR_RESTAURANT)) { - if ($conf->global->TAKEPOS_QR_MENU) { +if (getDolGlobalInt('TAKEPOS_BAR_RESTAURANT')) { + if (getDolGlobalInt('TAKEPOS_QR_MENU')) { $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file print '
'; @@ -221,7 +223,7 @@ if (!empty($conf->global->TAKEPOS_BAR_RESTAURANT)) { print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1); print "
'.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1); $c = new Categorie($db); @@ -1006,7 +1006,7 @@ if ($action == 'create') { print '
'; - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1); } else { print 'account_number).'">'; @@ -1014,7 +1014,7 @@ if ($action == 'create') { print '
'.$langs->trans("AccountancyJournal").''; print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0); diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index b42ef184c8f..222f2604af0 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1398,7 +1398,7 @@ class Account extends CommonObject $option = 'nolink'; } - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; $langs->load("accountancy"); $label .= '
'.$langs->trans('AccountAccounting').': '.length_accountg($this->account_number); diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 3cde5212e2d..a22e32b2595 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -37,16 +37,16 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'categories', 'compta', 'bills', 'other')); -if (!empty($conf->adherent->enabled)) { +if (isModEnabled('adherent')) { $langs->load("members"); } -if (!empty($conf->don->enabled)) { +if (isModEnabled('don')) { $langs->load("donations"); } -if (!empty($conf->loan->enabled)) { +if (isModEnabled('loan')) { $langs->load("loan"); } -if (!empty($conf->salaries->enabled)) { +if (isModEnabled('salaries')) { $langs->load("salaries"); } @@ -580,7 +580,7 @@ if ($result) { print "
'; - if (!empty($conf->accounting->enabled) && !empty($objecttmp->account_number)) { + if (isModEnabled('accounting') && !empty($objecttmp->account_number)) { $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch('', $objecttmp->account_number, 1); print ''; @@ -587,7 +587,7 @@ foreach ($accounts as $key => $type) { // Accountancy journal if (!empty($arrayfields['b.fk_accountancy_journal']['checked'])) { print ''; - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { if (empty($objecttmp->fk_accountancy_journal)) { print img_warning($langs->trans("Mandatory")); } else { diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index c08336841e2..ea80f1caab3 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -223,6 +223,17 @@ if ($id > 0) { $param .= '&id='.urlencode($id); } +if (empty($numref)) { + $title = $object->ref.' - '.$langs->trans("AccountStatements"); + $helpurl = ""; +} else { + $title = $langs->trans("FinancialAccount").' - '.$langs->trans("AccountStatements"); + $helpurl = ""; +} + + +llxHeader('', $title, $helpurl); + if (empty($numref)) { $sortfield = 'numr'; @@ -248,10 +259,6 @@ if (empty($numref)) { $numrows = $db->num_rows($result); $i = 0; - $title = $object->ref.' - '.$langs->trans("AccountStatements"); - $helpurl = ""; - llxHeader('', $title, $helpurl); - // Onglets $head = bank_prepare_head($object); print dol_get_fiche_head($head, 'statement', $langs->trans("FinancialAccount"), 0, 'account'); @@ -387,10 +394,6 @@ if (empty($numref)) { * Show list of record into a bank statement */ - $title = $langs->trans("FinancialAccount").' - '.$langs->trans("AccountStatements"); - $helpurl = ""; - llxHeader('', $title, $helpurl); - // Onglets $head = account_statement_prepare_head($object, $numref); print dol_get_fiche_head($head, 'statement', $langs->trans("AccountStatement"), -1, 'account'); diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index f728dc74f4e..ff38abb32d4 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -270,12 +270,12 @@ print '
'; print img_picto('', 'bank_account', 'class="paddingright"'); -$form->select_comptes($account_from, 'account_from', 0, '', 1, '', empty($conf->multicurrency->enabled) ? 0 : 1); +$form->select_comptes($account_from, 'account_from', 0, '', 1, '', !isModEnabled('multicurrency') ? 0 : 1); print "\n"; print img_picto('', 'bank_account', 'class="paddingright"'); -$form->select_comptes($account_to, 'account_to', 0, '', 1, '', empty($conf->multicurrency->enabled) ? 0 : 1); +$form->select_comptes($account_to, 'account_to', 0, '', 1, '', !isModEnabled('multicurrency') ? 0 : 1); print ""; diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 23621157e5a..804efd010e3 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; 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.'/accountancy/class/accountingjournal.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -52,7 +52,7 @@ $amount = price2num(GETPOST("amount", "alpha")); $paymenttype = GETPOST("paymenttype", "aZ09"); $accountancy_code = GETPOST("accountancy_code", "alpha"); $projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); -if (!empty($conf->accounting->enabled) && !empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { +if (isModEnabled('accounting') && !empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { $subledger_account = GETPOST("subledger_account", "alpha") > 0 ? GETPOST("subledger_account", "alpha") : ''; } else { $subledger_account = GETPOST("subledger_account", "alpha"); @@ -149,7 +149,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors'); $error++; } - if (!empty($conf->accounting->enabled) && !$object->accountancy_code) { + if (isModEnabled('accounting') && !$object->accountancy_code) { $langs->load('errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors'); $error++; @@ -305,10 +305,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->banque->m * View */ $form = new Form($db); -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $formaccounting = new FormAccounting($db); } -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -448,7 +448,7 @@ if ($action == 'create') { } // Accountancy account - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { // TODO Remove the fieldrequired and allow instead to edit a various payment to enter accounting code print '
'.$langs->trans("AccountAccounting").''; @@ -461,7 +461,7 @@ if ($action == 'create') { } // Subledger account - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { print '
'.$langs->trans("SubledgerAccount").''; if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { @@ -485,7 +485,7 @@ if ($action == 'create') { print '
'; print $langs->trans("AccountAccounting"); print ''; - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch('', $object->accountancy_code, 1); diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index b7cb8ee6bbf..6cbfd596c44 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -97,7 +97,7 @@ if ($object->id) { $morehtmlref = '
'; // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= $langs->trans('Project').' : '; if ($user->rights->banque->modifier && 0) { diff --git a/htdocs/compta/bank/various_payment/info.php b/htdocs/compta/bank/various_payment/info.php index b46ab36ddf6..51442fd20a1 100644 --- a/htdocs/compta/bank/various_payment/info.php +++ b/htdocs/compta/bank/various_payment/info.php @@ -57,7 +57,7 @@ print dol_get_fiche_head($head, 'info', $langs->trans("VariousPayment"), -1, $ob $morehtmlref = '
'; // Project -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= $langs->trans('Project').' : '; if ($user->rights->banque->modifier && 0) { diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index aa65ac8d2a3..6644a81f62a 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -154,8 +154,8 @@ $arrayfields = array( 'project' =>array('label'=>"Project", 'checked'=>1, 'position'=>200, "enabled"=>!empty($conf->project->enabled)), 'bank' =>array('label'=>"BankAccount", 'checked'=>1, 'position'=>300, "enabled"=>isModEnabled("banque")), 'entry' =>array('label'=>"BankTransactionLine", 'checked'=>1, 'position'=>310, "enabled"=>isModEnabled("banque")), - 'account' =>array('label'=>"AccountAccountingShort", 'checked'=>1, 'position'=>400, "enabled"=>!empty($conf->accounting->enabled)), - 'subledger' =>array('label'=>"SubledgerAccount", 'checked'=>1, 'position'=>410, "enabled"=>!empty($conf->accounting->enabled)), + 'account' =>array('label'=>"AccountAccountingShort", 'checked'=>1, 'position'=>400, "enabled"=>isModEnabled('accounting')), + 'subledger' =>array('label'=>"SubledgerAccount", 'checked'=>1, 'position'=>410, "enabled"=>isModEnabled('accounting')), 'debit' =>array('label'=>"Debit", 'checked'=>1, 'position'=>500), 'credit' =>array('label'=>"Credit", 'checked'=>1, 'position'=>510), ); @@ -190,7 +190,7 @@ $form = new Form($db); if ($arrayfields['account']['checked'] || $arrayfields['subledger']['checked']) { $formaccounting = new FormAccounting($db); } -if ($arrayfields['bank']['checked'] && !empty($conf->accounting->enabled)) { +if ($arrayfields['bank']['checked'] && isModEnabled('accounting')) { $accountingjournal = new AccountingJournal($db); } if ($arrayfields['ref']['checked']) { @@ -621,7 +621,7 @@ if ($resql) { $accountstatic->ref = $obj->bref; $accountstatic->number = $obj->bnumber; - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $accountstatic->account_number = $obj->bank_account_number; $accountingjournal->fetch($obj->accountancy_journal); $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index 0130cfe10f0..97bca312645 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -70,10 +70,10 @@ if ($contextpage == 'takepos') { $arrayofpaymentmode = array('cash'=>'Cash', 'cheque'=>'Cheque', 'card'=>'CreditCard'); $arrayofposavailable = array(); -if (!empty($conf->cashdesk->enabled)) { +if (isModEnabled('cashdesk')) { $arrayofposavailable['cashdesk'] = $langs->trans('CashDesk').' (cashdesk)'; } -if (!empty($conf->takepos->enabled)) { +if (isModEnabled('takepos')) { $arrayofposavailable['takepos'] = $langs->trans('TakePOS').' (takepos)'; } // TODO Add hook here to allow other POS to add themself @@ -265,6 +265,10 @@ $initialbalanceforterminal = array(); $theoricalamountforterminal = array(); $theoricalnbofinvoiceforterminal = array(); + +llxHeader('', $langs->trans("CashControl")); + + if ($action == "create" || $action == "start" || $action == 'close') { if ($action == 'close') { $posmodule = $object->posmodule; @@ -376,8 +380,6 @@ if ($action == "create" || $action == "start" || $action == 'close') { //var_dump($theoricalamountforterminal); var_dump($theoricalnbofinvoiceforterminal); if ($action != 'close') { - llxHeader('', $langs->trans("NewCashFence")); - print load_fiche_titre($langs->trans("CashControl")." - ".$langs->trans("New"), '', 'cash-register'); print ''; @@ -597,8 +599,6 @@ if ($action == "create" || $action == "start" || $action == 'close') { if (empty($action) || $action == "view" || $action == "close") { $result = $object->fetch($id); - llxHeader('', $langs->trans("CashControl")); - if ($result <= 0) { print $langs->trans("ErrorRecordNotFound"); } else { diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index a80916cdc0d..71ab6dd4961 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -133,7 +133,7 @@ if ($year) { print ''.$langs->trans("DescTaxAndDividendsArea").'
'; print "
"; -if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) { +if (isModEnabled('tax') && $user->rights->tax->charges->lire) { // Social contributions only print load_fiche_titre($langs->trans("SocialContributions").($year ? ' ('.$langs->trans("Year").' '.$year.')' : ''), '', ''); @@ -266,7 +266,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) { } // VAT -if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) { +if (isModEnabled('tax') && $user->rights->tax->charges->lire) { print "
"; $tva = new Tva($db); diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 029c5b5f223..8259d40f694 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -29,7 +29,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/trip.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -422,7 +422,7 @@ if ($action == 'create') { print '
'; diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 630cafcd3bf..bdb375c6b6b 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -34,7 +34,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; //include_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; } @@ -924,7 +924,7 @@ llxHeader('', $langs->trans("RepeatableInvoices"), $help_url); $form = new Form($db); $formother = new FormOther($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } $companystatic = new Societe($db); @@ -954,7 +954,7 @@ if ($action == 'create') { print dol_get_fiche_head(null, '', '', 0); $rowspan = 4; - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $rowspan++; } if ($object->fk_account > 0) { @@ -1047,7 +1047,7 @@ if ($action == 'create') { } // Project - if (!empty($conf->project->enabled) && is_object($object->thirdparty) && $object->thirdparty->id > 0) { + if (isModEnabled('project') && is_object($object->thirdparty) && $object->thirdparty->id > 0) { $projectid = GETPOST('projectid') ?GETPOST('projectid') : $object->fk_project; $langs->load('projects'); print '
'.$langs->trans('Project').''; @@ -1117,9 +1117,9 @@ if ($action == 'create') { $title = $langs->trans("ProductsAndServices"); - if (empty($conf->service->enabled)) { + if (!isModEnabled('service')) { $title = $langs->trans("Products"); - } elseif (empty($conf->product->enabled)) { + } elseif (!isModEnabled('product')) { $title = $langs->trans("Services"); } @@ -1203,7 +1203,7 @@ if ($action == 'create') { // Thirdparty $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->facture->creer) { @@ -1310,7 +1310,7 @@ if ($action == 'create') { print '
'; @@ -1573,7 +1573,7 @@ if ($action == 'create') { if ($object->frequency > 0) { print '
'; - if (empty($conf->cron->enabled)) { + if (!isModEnabled('cron')) { print info_admin($langs->trans("EnableAndSetupModuleCron", $langs->transnoentitiesnoconv("Module2300Name"))); } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f9075a76211..839a61b2413 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -54,30 +54,28 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; } -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -if (!empty($conf->variants->enabled)) { +if (isModEnabled('variants')) { require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; } // Load translation files required by the page $langs->loadLangs(array('bills', 'companies', 'compta', 'products', 'banks', 'main', 'withdrawals')); - -if (!empty($conf->incoterm->enabled)) { +if (isModEnabled('incoterm')) { $langs->load('incoterm'); } - -if (!empty($conf->margin->enabled)) { +if (isModEnabled('margin')) { $langs->load('margins'); } @@ -549,7 +547,7 @@ if (empty($reshook)) { } } } - } elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) { // Set incoterm + } elseif ($action == 'set_incoterms' && isModEnabled('incoterm')) { // Set incoterm $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); } elseif ($action == 'setbankaccount' && $usercancreate) { // bank account $result = $object->setBankAccount(GETPOST('fk_account', 'int')); @@ -2105,7 +2103,7 @@ if (empty($reshook)) { $error++; } - if (!$error && !empty($conf->variants->enabled) && $prod_entry_mode != 'free') { + if (!$error && isModEnabled('variants') && $prod_entry_mode != 'free') { if ($combinations = GETPOST('combinations', 'array')) { //Check if there is a product with the given combination $prodcomb = new ProductCombination($db); @@ -2952,7 +2950,7 @@ $formmargin = new FormMargin($db); $soc = new Societe($db); $paymentstatic = new Paiement($db); $bankaccountstatic = new Account($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -3074,7 +3072,7 @@ if ($action == 'create') { $remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_percent) ? $soc->remise_percent : 0)); $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled('multicurrency')) { if (!empty($objectsrc->multicurrency_code)) { $currency_code = $objectsrc->multicurrency_code; } @@ -3096,7 +3094,7 @@ if ($action == 'create') { $remise_absolue = 0; $dateinvoice = (empty($dateinvoice) ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $dateinvoice); // Do not set 0 here (0 for a date is 1970) - if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) { + if (isModEnabled('multicurrency') && !empty($soc->multicurrency_code)) { $currency_code = $soc->multicurrency_code; } } @@ -3738,7 +3736,7 @@ if ($action == 'create') { } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load('projects'); print '
'.$langs->trans('Project').''; print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); @@ -3747,7 +3745,7 @@ if ($action == 'create') { } // Incoterms - if (!empty($conf->incoterm->enabled)) { + if (isModEnabled('incoterm')) { print '
'; @@ -3795,7 +3793,7 @@ if ($action == 'create') { print "
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; @@ -3916,7 +3914,7 @@ if ($action == 'create') { } print '
'.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc)."
'.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).'
'.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva)."
'.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc)."
'; @@ -4650,7 +4648,7 @@ if ($action == 'create') { } // Incoterms - if (!empty($conf->incoterm->enabled)) { + if (isModEnabled('incoterm')) { print '
'; print ''; print ''; @@ -4883,7 +4881,7 @@ if ($action == 'create') { $nbrows = 8; $nbcols = 3; - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $nbrows++; } if (isModEnabled("banque")) { @@ -4899,10 +4897,10 @@ if ($action == 'create') { if ($selleruserevenustamp) { $nbrows++; } - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled('multicurrency')) { $nbrows += 5; } - if (!empty($conf->incoterm->enabled)) { + if (isModEnabled('incoterm')) { $nbrows += 1; } @@ -4997,7 +4995,7 @@ if ($action == 'create') { print ''; print ''; print ''; - if (! empty($conf->banque->enabled)) print ''; + if (isModEnabled('banque')) print ''; print ''; print ''; print ''; @@ -5111,7 +5109,7 @@ if ($action == 'create') { $bankaccountstatic->number = $objp->banumber; $bankaccountstatic->currency_code = $objp->bacurrency_code; - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $bankaccountstatic->account_number = $objp->account_number; $accountingjournal = new AccountingJournal($db); @@ -5339,7 +5337,7 @@ if ($action == 'create') { print ''; // Margin Infos - if (!empty($conf->margin->enabled)) { + if (isModEnabled('margin')) { $formmargin->displayMarginInfos($object); } @@ -5562,7 +5560,7 @@ if ($action == 'create') { } // POS Ticket - if (!empty($conf->takepos->enabled) && $object->module_source == 'takepos') { + if (isModEnabled('takepos') && $object->module_source == 'takepos') { $langs->load("cashdesk"); $receipt_url = DOL_URL_ROOT."/takepos/receipt.php"; print ''.$langs->trans('POSTicket').''; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0d2840adb97..ab0fd8029d8 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -47,10 +47,10 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php'; require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; } diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 78d1aaaa1cc..6b7d8108bda 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -137,7 +137,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->facture->creer) { diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 5c57f89f51b..36ed546ab41 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -92,20 +92,24 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; * View */ -if (empty($object->id)) { - llxHeader(); - $langs->load('errors'); - echo '
'.$langs->trans("ErrorRecordNotFound").'
'; - llxFooter(); - exit; -} +$form = new Form($db); -$title = $object->ref." - ".$langs->trans('Documents'); +if (empty($object->id)) { + $title = $langs->trans('Documents'); +} else { + $title = $object->ref." - ".$langs->trans('Documents'); +} $help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; llxHeader('', $title, $help_url); -$form = new Form($db); +if (empty($object->id)) { + $langs->load('errors'); + echo '
'.$langs->trans("ErrorRecordNotFound").'
'; + + llxFooter(); + exit; +} if ($id > 0 || !empty($ref)) { if ($object->fetch($id, $ref) > 0) { @@ -137,7 +141,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->facture->creer) { diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index ddd74de0211..de08730d2c5 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -97,7 +97,7 @@ $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_cl // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); // Project -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->facture->creer) { diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 1f516c31795..71573505a7f 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -257,7 +257,7 @@ llxHeader('', $langs->trans("RepeatableInvoices"), 'ch-facture.html#s-fac-factur $form = new Form($db); $formother = new FormOther($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } $companystatic = new Societe($db); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 5442fd1704a..51257583ef7 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -39,7 +39,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -if (!empty($conf->margin->enabled)) { +if (isModEnabled('margin')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; } require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'; @@ -53,7 +53,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; } @@ -237,13 +237,13 @@ $arrayfields = array( 'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150), // Not enabled by default because slow 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>165), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>166), - 'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>280), - 'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>285), - 'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>290), - 'f.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>291), - 'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>292), - 'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>295), - 'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>296), // Not enabled by default because slow + 'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>280), + 'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>285), + 'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>290), + 'f.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>291), + 'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>292), + 'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>295), + 'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>296), // Not enabled by default because slow 'total_pa' => array('label' => ((isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == '1') ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)), 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) ? 0 : 1)), 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (empty($conf->margin->enabled) || empty($user->rights->margins->liretous) || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)), @@ -545,7 +545,7 @@ $form = new Form($db); $formother = new FormOther($db); $formfile = new FormFile($db); $formmargin = null; -if (!empty($conf->margin->enabled)) { +if (isModEnabled('margin')) { $formmargin = new FormMargin($db); } $bankaccountstatic = new Account($db); @@ -1200,7 +1200,7 @@ if ($resql) { $moreforfilter .= ''; } // Filter on product tags - if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { + if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $tmptitle = $langs->trans('IncludingProductWithTag'); @@ -1208,7 +1208,7 @@ if ($resql) { $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth250', 1); $moreforfilter .= '
'; } - if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { + if (isModEnabled('categorie') && $user->rights->categorie->lire) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $moreforfilter .= '
'; $tmptitle = $langs->trans('CustomersProspectsCategoriesShort'); @@ -1721,7 +1721,7 @@ if ($resql) { $totalarray['val']['f.total_ttc'] = 0; $with_margin_info = false; - if (!empty($conf->margin->enabled) && ( + if (isModEnabled('margin') && ( !empty($arrayfields['total_pa']['checked']) || !empty($arrayfields['total_margin']['checked']) || !empty($arrayfields['total_margin_rate']['checked']) diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index 711921ee08e..b15e11dc614 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -29,7 +29,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -77,19 +77,24 @@ if (empty($reshook)) { * View */ +$form = new Form($db); + +if (empty($object->id)) { + $title = $object->ref." - ".$langs->trans('Notes'); +} else { + $title = $langs->trans('Notes'); +} +$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; + +llxHeader('', $title, $helpurl); + if (empty($object->id)) { - llxHeader(); $langs->load('errors'); echo '
'.$langs->trans("ErrorRecordNotFound").'
'; llxFooter(); exit; } -$title = $object->ref." - ".$langs->trans('Notes'); -$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; -llxHeader('', $title, $helpurl); - -$form = new Form($db); if ($id > 0 || !empty($ref)) { $object = new Facture($db); @@ -114,7 +119,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->facture->creer) { diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 8bd953f98b5..5a10c2055c0 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -349,7 +349,7 @@ if ($object->id > 0) { } } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($usercancreate) { @@ -616,7 +616,7 @@ if ($object->id > 0) { print '
'; print $langs->trans('IncotermLabel'); @@ -4788,7 +4786,7 @@ if ($action == 'create') { $sign = -1; // We invert sign for output } - if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { + if (isModEnabled('multicurrency') && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT print '
'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).''.price($sign * $object->multicurrency_total_ht, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'' . $langs->trans('ListOfNextSituationInvoices') . '' . $langs->trans('AmountHT') . '' . $langs->trans('AmountTTC') . ' 
'; - if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { + if (isModEnabled('multicurrency') && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT print ''; print ''; diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index cb0e38b7a34..73b9d94bdda 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php'; -if (!empty($conf->category->enabled)) { +if (isModEnabled('categorie')) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; } @@ -72,7 +72,7 @@ $endyear = $year; /* * View */ -if (!empty($conf->category->enabled)) { +if (isModEnabled('categorie')) { $langs->load('categories'); } $form = new Form($db); @@ -299,7 +299,7 @@ if ($user->admin) { print ''; // Category -if (!empty($conf->category->enabled)) { +if (isModEnabled('categorie')) { if ($mode == 'customer') { $cat_type = Categorie::TYPE_CUSTOMER; $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Customer")); diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 55ee99f4cb6..e8ef524152a 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -50,7 +50,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; // Load translation files required by the page $langs->loadLangs(array('compta', 'bills')); -if (!empty($conf->commande->enabled)) { +if (isModEnabled('commande')) { $langs->load("orders"); } diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index fda83a75668..ea320007f4d 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -48,10 +48,10 @@ $date_endyear = GETPOST('date_endyear'); if ($user->socid > 0) { $socid = $user->socid; } -if (!empty($conf->comptabilite->enabled)) { +if (isModEnabled('comptabilite')) { $result = restrictedArea($user, 'compta', '', '', 'resultat'); } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); } diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 367ffffbdea..44cdcde6778 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -50,10 +50,10 @@ $date_endyear = GETPOST('date_endyear'); if ($user->socid > 0) { $socid = $user->socid; } -if (!empty($conf->comptabilite->enabled)) { +if (isModEnabled('comptabilite')) { $result = restrictedArea($user, 'compta', '', '', 'resultat'); } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); } diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 5aa41f10405..a2b33f4fc7b 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -597,7 +597,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''; print ''; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled('multicurrency')) { print ''; print ''; print ''; @@ -640,7 +640,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT'); // Multicurrency Price - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled('multicurrency')) { $multicurrency_payment = $invoice->getSommePaiement(1); $multicurrency_creditnotes = $invoice->getSumCreditNotesUsed(1); $multicurrency_deposits = $invoice->getSumDepositsUsed(1); @@ -676,12 +676,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } // Currency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled('multicurrency')) { print '\n"; } // Multicurrency Price - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled('multicurrency')) { print ''; print ''; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled('multicurrency')) { print ''; print ''; print ''; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 6186083c211..310388b9e87 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -656,7 +656,7 @@ class Paiement extends CommonObject } // if dolibarr currency != bank currency then we received an amount in customer currency (currently I don't manage the case : my currency is USD, the customer currency is EUR and he paid me in GBP. Seems no sense for me) - if (!empty($conf->multicurrency->enabled) && $conf->currency != $acc->currency_code) { + if (isModEnabled('multicurrency') && $conf->currency != $acc->currency_code) { $totalamount = $this->multicurrency_amount; // We will insert into llx_bank.amount in foreign currency $totalamount_main_currency = $this->amount; // We will also save the amount in main currency into column llx_bank.amount_main_currency } @@ -1165,7 +1165,7 @@ class Paiement extends CommonObject global $conf; $way = 'dolibarr'; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled('multicurrency')) { foreach ($this->multicurrency_amounts as $value) { if (!empty($value)) { // one value found then payment is in invoice currency $way = 'customer'; diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index dc4a2acfda7..240903da4f0 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -132,7 +132,7 @@ $nbofyear = ($year_end - $year_start) + 1; // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING') $modecompta = $conf->global->ACCOUNTING_MODE; -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $modecompta = 'BOOKKEEPING'; } if (GETPOST("modecompta", 'alpha')) { @@ -146,10 +146,10 @@ $socid = GETPOST('socid', 'int'); if ($user->socid > 0) { $socid = $user->socid; } -if (!empty($conf->comptabilite->enabled)) { +if (isModEnabled('comptabilite')) { $result = restrictedArea($user, 'compta', '', '', 'resultat'); } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); } @@ -174,7 +174,7 @@ if ($modecompta == "CREANCES-DETTES") { $calcmode = $langs->trans("CalcModeDebt"); $calcmode .= '
('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')'; $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')'; $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); } @@ -193,7 +193,7 @@ if ($modecompta == "CREANCES-DETTES") { $calcmode = $langs->trans("CalcModeEngagement"); $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')'; $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')'; $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); } @@ -223,7 +223,7 @@ $hselected = 'report'; report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'showaccountdetail'=>$showaccountdetail), $calcmode); -if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { +if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } @@ -537,7 +537,7 @@ if ($modecompta == 'BOOKKEEPING') { * Donations */ - if (!empty($conf->don->enabled)) { + if (isModEnabled('don')) { print ''; if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') { @@ -932,7 +932,7 @@ if ($modecompta == 'BOOKKEEPING') { * Salaries */ - if (!empty($conf->salaries->enabled)) { + if (isModEnabled('salaries')) { print ''; if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') { @@ -1035,7 +1035,7 @@ if ($modecompta == 'BOOKKEEPING') { * Expense report */ - if (!empty($conf->expensereport->enabled)) { + if (isModEnabled('expensereport')) { if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') { $langs->load('trips'); if ($modecompta == 'CREANCES-DETTES') { @@ -1206,7 +1206,7 @@ if ($modecompta == 'BOOKKEEPING') { * Payment Loan */ - if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_LOAN) && !empty($conf->loan->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { + if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_LOAN) && isModEnabled('don') && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { $subtotal_ht = 0; $subtotal_ttc = 0; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 90c24e8e905..e9706e9216f 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -110,7 +110,7 @@ $nbofyear = ($year_end - $year_start) + 1; // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING') $modecompta = $conf->global->ACCOUNTING_MODE; -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $modecompta = 'BOOKKEEPING'; } if (GETPOST("modecompta", 'alpha')) { @@ -122,10 +122,10 @@ $socid = GETPOST('socid', 'int'); if ($user->socid > 0) { $socid = $user->socid; } -if (!empty($conf->comptabilite->enabled)) { +if (isModEnabled('comptabilite')) { $result = restrictedArea($user, 'compta', '', '', 'resultat'); } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); } @@ -151,7 +151,7 @@ if ($modecompta == 'CREANCES-DETTES') { $calcmode = $langs->trans("CalcModeDebt"); $calcmode .= '
('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')'; $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')'; $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); } @@ -171,7 +171,7 @@ if ($modecompta == 'CREANCES-DETTES') { $calcmode = $langs->trans("CalcModeEngagement"); $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')'; $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')'; $calcmode = str_replace(array('{s1}', '{s2}'), array('', ''), $calcmode); } @@ -200,7 +200,7 @@ $hselected = 'report'; report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta), $calcmode); -if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { +if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } @@ -391,7 +391,7 @@ if (isModEnabled('facture') && ($modecompta == 'CREANCES-DETTES' || $modecompta $subtotal_ht = 0; $subtotal_ttc = 0; -if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { +if (isModEnabled('tax') && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { if ($modecompta == 'CREANCES-DETTES') { // TVA collected to pay $sql = "SELECT sum(f.total_tva) as amount, date_format(f.datef,'%Y-%m') as dm"; @@ -555,7 +555,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom $subtotal_ht = 0; $subtotal_ttc = 0; -if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { +if (isModEnabled('tax') && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT c.libelle as nom, date_format(cs.date_ech,'%Y-%m') as dm, sum(cs.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; @@ -613,7 +613,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom * Salaries */ -if (!empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { +if (isModEnabled('salaries') && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { if ($modecompta == 'CREANCES-DETTES') { $column = 's.dateep'; // we use the date of end of period of salary @@ -675,7 +675,7 @@ if (!empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $mo * Expense reports */ -if (!empty($conf->expensereport->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { +if (!isModEnabled('expensereport') && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { $langs->load('trips'); if ($modecompta == 'CREANCES-DETTES') { @@ -737,7 +737,7 @@ if (!empty($conf->expensereport->enabled) && ($modecompta == 'CREANCES-DETTES' | * Donation get dunning payments */ -if (!empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { +if (isModEnabled('don') && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { $subtotal_ht = 0; $subtotal_ttc = 0; @@ -867,7 +867,7 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY) && isModEnabled("ba * Payement Loan */ -if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_LOAN) && !empty($conf->loan->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { +if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_LOAN) && isModEnabled('loan') && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) { $sql = "SELECT date_format(p.datep, '%Y-%m') AS dm, SUM(p.amount_capital + p.amount_insurance + p.amount_interest) AS amount"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_loan AS p, ".MAIN_DB_PREFIX."loan as l"; $sql .= " WHERE l.entity IN (".getEntity('variouspayment').")"; @@ -907,7 +907,7 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_LOAN) && !empty($conf->loan * Request in mode BOOKKEEPING */ -if (!empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING')) { +if (isModEnabled('accounting') && ($modecompta == 'BOOKKEEPING')) { $predefinedgroupwhere = "("; $predefinedgroupwhere .= " (aa.pcg_type = 'EXPENSE')"; $predefinedgroupwhere .= " OR "; diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 81e6672a1e4..57157ec0140 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -137,7 +137,7 @@ if ($cat_id == 0) { // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING') $modecompta = $conf->global->ACCOUNTING_MODE; -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $modecompta = 'BOOKKEEPING'; } if (GETPOST("modecompta")) { @@ -151,10 +151,10 @@ $socid = GETPOST('socid', 'int'); if ($user->socid > 0) { $socid = $user->socid; } -if (!empty($conf->comptabilite->enabled)) { +if (isModEnabled('comptabilite')) { $result = restrictedArea($user, 'compta', '', '', 'resultat'); } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); } @@ -193,7 +193,7 @@ if ($modecompta == "CREANCES-DETTES") { $name = $langs->trans("AnnualByAccountDueDebtMode"); $calcmode = $langs->trans("CalcModeDebt"); $calcmode .= '
('.$langs->trans("SeeReportInInputOutputMode", '', '').')'; - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '', '').')'; } $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); @@ -210,7 +210,7 @@ if ($modecompta == "CREANCES-DETTES") { $name = $langs->trans("AnnualByAccountInputOutputMode"); $calcmode = $langs->trans("CalcModeEngagement"); $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '', '').')'; - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '', '').')'; } $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); @@ -238,7 +238,7 @@ if ($modecompta == "CREANCES-DETTES") { report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'action' => ''), $calcmode); -if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { +if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index f6bc9b5fa02..945bd4a3771 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -34,11 +34,11 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; } @@ -333,7 +333,7 @@ $form = new Form($db); $formfile = new FormFile($db); $formsocialcontrib = new FormSocialContrib($db); $bankaccountstatic = new Account($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -407,7 +407,7 @@ if ($action == 'create') { print ''; // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $formproject = new FormProjets($db); // Associated project @@ -540,7 +540,7 @@ if ($id > 0) { } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->tax->charges->creer) { @@ -733,7 +733,7 @@ if ($id > 0) { $bankaccountstatic->number = $objp->banumber; $bankaccountstatic->currency_code = $objp->bacurrency_code; - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $bankaccountstatic->account_number = $objp->account_number; $accountingjournal = new AccountingJournal($db); diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index 2b0d17337a5..741100a53a3 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -101,7 +101,7 @@ if ($action == 'setlib' && $user->rights->tax->charges->creer) { */ $form = new Form($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -121,7 +121,7 @@ if ($object->id) { $morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' : '; if (!empty($object->fk_project)) { diff --git a/htdocs/compta/sociales/info.php b/htdocs/compta/sociales/info.php index 0976a76c26d..98440da6486 100644 --- a/htdocs/compta/sociales/info.php +++ b/htdocs/compta/sociales/info.php @@ -25,7 +25,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -68,7 +68,7 @@ if ($action == 'setlib' && $user->rights->tax->charges->creer) { $form = new Form($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -90,7 +90,7 @@ $morehtmlref = '
'; $morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); // Project -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' : '; if (!empty($object->fk_project)) { diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 80b231ac381..520f074a0c1 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -179,7 +179,7 @@ $formother = new FormOther($db); $bankstatic = new Account($db); $formsocialcontrib = new FormSocialContrib($db); $chargesociale_static = new ChargeSociales($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $projectstatic = new Project($db); } @@ -187,7 +187,7 @@ llxHeader('', $langs->trans("SocialContributions")); $sql = "SELECT cs.rowid, cs.fk_type as type, cs.fk_user,"; $sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode, cs.fk_account,"; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,"; } $sql .= " c.libelle as type_label, c.accountancy_code as type_accountancy_code,"; @@ -197,7 +197,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,"; $sql .= " ".MAIN_DB_PREFIX."chargesociales as cs"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON (cs.fk_account = ba.rowid)"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as pay ON (cs.fk_mode_reglement = pay.id)'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = cs.fk_projet"; } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid"; @@ -211,7 +211,7 @@ if ($search_ref) { if ($search_label) { $sql .= natural_search("cs.libelle", $search_label); } -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { if ($search_project_ref != '') { $sql .= natural_search("p.ref", $search_project_ref); } @@ -247,7 +247,7 @@ if ($search_typeid > 0) { $sql .= " AND cs.fk_type = ".((int) $search_typeid); } $sql .= " GROUP BY cs.rowid, cs.fk_type, cs.fk_user, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, cs.fk_account, c.libelle, c.accountancy_code, ba.label, ba.ref, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos, pay.code, u.lastname"; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $sql .= ", p.rowid, p.ref, p.title"; } $sql .= $db->order($sortfield, $sortorder); @@ -553,7 +553,7 @@ while ($i < min($num, $limit)) { $chargesociale_static->label = $obj->label; $chargesociale_static->type_label = $obj->type_label; - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $projectstatic->id = $obj->project_id; $projectstatic->ref = $obj->project_ref; $projectstatic->title = $obj->project_label; @@ -589,7 +589,7 @@ while ($i < min($num, $limit)) { if (!empty($arrayfields['cs.fk_type']['checked'])) { $typelabeltoshow = $obj->type_label; $typelabelpopup = $obj->type_label; - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $typelabelpopup .= ' - '.$langs->trans("AccountancyCode").': '.$obj->type_accountancy_code; } print '
'; diff --git a/htdocs/compta/sociales/note.php b/htdocs/compta/sociales/note.php index 8ede1c3b502..59af7a36870 100644 --- a/htdocs/compta/sociales/note.php +++ b/htdocs/compta/sociales/note.php @@ -25,7 +25,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -93,7 +93,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' : '; if (!empty($object->fk_project)) { diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index 7d59f16cd24..0d1482d53ec 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php'; -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; } @@ -341,7 +341,7 @@ while ($i < min($num, $limit)) { $accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code); $accountstatic->clos = $obj->clos; - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $accountstatic->account_number = $obj->account_number; $accountstatic->accountancy_journal = $obj->account_journal; } diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index e188cdae859..86a547204f7 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -282,7 +282,7 @@ $description .= ' socid > 0) { $socid = $user->socid; } -if (!empty($conf->comptabilite->enabled)) { +if (isModEnabled('comptabilite')) { $result = restrictedArea($user, 'compta', '', '', 'resultat'); } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); } @@ -272,7 +272,7 @@ if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) { report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode); -if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { +if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index b1d5851ca4a..611ee74eae4 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -39,10 +39,10 @@ $socid = GETPOST('socid', 'int'); if ($user->socid > 0) { $socid = $user->socid; } -if (!empty($conf->comptabilite->enabled)) { +if (isModEnabled('comptabilite')) { $result = restrictedArea($user, 'compta', '', '', 'resultat'); } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); } @@ -231,7 +231,7 @@ if (!empty($modecompta)) { report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode); -if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { +if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } @@ -500,7 +500,7 @@ if (count($amount)) { if (isModEnabled("propal") && $key > 0) { print ' '.img_picto($langs->trans("ProposalStats"), "stats").' '; } - if (!empty($conf->commande->enabled) && $key > 0) { + if (isModEnabled('commande') && $key > 0) { print ' '.img_picto($langs->trans("OrderStats"), "stats").' '; } if (isModEnabled('facture') && $key > 0) { diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 466b0307df6..24f832c552d 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -68,10 +68,10 @@ if (GETPOST('subcat', 'alpha') === 'yes') { if ($user->socid > 0) { $socid = $user->socid; } -if (!empty($conf->comptabilite->enabled)) { +if (isModEnabled('comptabilite')) { $result = restrictedArea($user, 'compta', '', '', 'resultat'); } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); } @@ -256,7 +256,7 @@ if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) { report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode); -if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { +if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } @@ -676,7 +676,7 @@ if (count($amount)) { if (isModEnabled("propal") && $key > 0) { print ' '.img_picto($langs->trans("ProposalStats"), "stats").' '; } - if (!empty($conf->commande->enabled) && $key > 0) { + if (isModEnabled('commande') && $key > 0) { print ' '.img_picto($langs->trans("OrderStats"), "stats").' '; } if (isModEnabled('facture') && $key > 0) { diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 4051055af60..a81c732017f 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -109,7 +109,7 @@ $nbofyear = ($year_end - $year_start) + 1; // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING') $modecompta = $conf->global->ACCOUNTING_MODE; -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $modecompta = 'BOOKKEEPING'; } if (GETPOST("modecompta")) { @@ -120,10 +120,10 @@ if (GETPOST("modecompta")) { if ($user->socid > 0) { $socid = $user->socid; } -if (!empty($conf->comptabilite->enabled)) { +if (isModEnabled('comptabilite')) { $result = restrictedArea($user, 'compta', '', '', 'resultat'); } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); } @@ -153,7 +153,7 @@ if ($modecompta == "CREANCES-DETTES") { $name = $langs->trans("Turnover"); $calcmode = $langs->trans("CalcModeDebt"); //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')'; $calcmode = str_replace('{link1}', '', $calcmode); $calcmode = str_replace('{link2}', '', $calcmode); @@ -171,7 +171,7 @@ if ($modecompta == "CREANCES-DETTES") { $name = $langs->trans("TurnoverCollected"); $calcmode = $langs->trans("CalcModeEngagement"); //$calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; - //if (!empty($conf->accounting->enabled)) { + //if (isModEnabled('accounting')) { //$calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; //} $periodlink = ($year_start ? "".img_previous()."".img_next()."" : ""); @@ -201,7 +201,7 @@ if (!empty($modecompta)) { } report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode); -if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { +if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } diff --git a/htdocs/compta/stats/supplier_turnover.php b/htdocs/compta/stats/supplier_turnover.php index cd70671af61..abbb92223cb 100644 --- a/htdocs/compta/stats/supplier_turnover.php +++ b/htdocs/compta/stats/supplier_turnover.php @@ -103,7 +103,7 @@ $nbofyear = ($year_end - $year_start) + 1; // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING') $modecompta = $conf->global->ACCOUNTING_MODE; -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $modecompta = 'BOOKKEEPING'; } if (GETPOST("modecompta")) { @@ -114,10 +114,10 @@ if (GETPOST("modecompta")) { if ($user->socid > 0) { $socid = $user->socid; } -if (!empty($conf->comptabilite->enabled)) { +if (isModEnabled('comptabilite')) { $result = restrictedArea($user, 'compta', '', '', 'resultat'); } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); } @@ -142,7 +142,7 @@ if ($modecompta == "BOOKKEEPINGCOLLECTED") { if ($modecompta == "CREANCES-DETTES") { $name = $langs->trans("PurchaseTurnover"); $calcmode = $langs->trans("CalcModeDebt"); - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $calcmode .= '
('.$langs->trans("SeeReportInBookkeepingMode", '{link1}', '{link2}').')'; $calcmode = str_replace('{link1}', '', $calcmode); $calcmode = str_replace('{link2}', '', $calcmode); @@ -187,7 +187,7 @@ if (!empty($modecompta)) { } report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $moreparam, $calcmode); -if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { +if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } diff --git a/htdocs/compta/stats/supplier_turnover_by_prodserv.php b/htdocs/compta/stats/supplier_turnover_by_prodserv.php index f36383ad94b..d2bd20964f8 100644 --- a/htdocs/compta/stats/supplier_turnover_by_prodserv.php +++ b/htdocs/compta/stats/supplier_turnover_by_prodserv.php @@ -197,10 +197,10 @@ $socid = GETPOST('socid', 'int'); if ($user->socid > 0) { $socid = $user->socid; } -if (!empty($conf->comptabilite->enabled)) { +if (isModEnabled('comptabilite')) { $result = restrictedArea($user, 'compta', '', '', 'resultat'); } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); } @@ -252,7 +252,7 @@ if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) { report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode); -if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { +if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php index d13bcfbf349..2a405ba870f 100644 --- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php +++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php @@ -168,10 +168,10 @@ foreach ($allparams as $key => $value) { if ($user->socid > 0) { $socid = $user->socid; } -if (!empty($conf->comptabilite->enabled)) { +if (isModEnabled('comptabilite')) { $result = restrictedArea($user, 'compta', '', '', 'resultat'); } -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); } @@ -224,7 +224,7 @@ if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) { report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode); -if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { +if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index b4f16f0e564..5f089a4e205 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/vat.lib.php'; -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; } @@ -719,7 +719,7 @@ if ($id > 0) { $bankaccountstatic->number = $objp->banumber; $bankaccountstatic->currency_code = $objp->bacurrency_code; - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $bankaccountstatic->account_number = $objp->account_number; $accountingjournal = new AccountingJournal($db); diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php index dc362e60051..745742b1c8e 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/vat.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -102,7 +102,7 @@ if ($action == 'setlib' && $permissiontoadd) { */ $form = new Form($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } diff --git a/htdocs/compta/tva/payments.php b/htdocs/compta/tva/payments.php index 9e7c19c8754..eba36a10625 100644 --- a/htdocs/compta/tva/payments.php +++ b/htdocs/compta/tva/payments.php @@ -118,7 +118,7 @@ if ($year) { $param .= '&year='.$year; } -if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) { +if (isModEnabled('tax') && $user->rights->tax->charges->lire) { print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print '
'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).''.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'
'.$arraytitle.''.$langs->trans('Date').''.$langs->trans('DateMaxPayment').''.$langs->trans('Currency').''.$langs->trans('MulticurrencyAmountTTC').''.$multicurrencyalreadypayedlabel.''.$objp->multicurrency_code."'; if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) { print price($sign * $objp->multicurrency_total_ttc); @@ -814,7 +814,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Print total print '
'.$langs->trans('TotalTTC').'
'.$langs->trans("Donations").'
'.$langs->trans("Salaries").'
'.img_picto('', 'user', 'class="pictofixedwidth"').$form->select_dolusers($fk_user, 'userid', 1).'
'.dol_escape_htmltag($typelabeltoshow).'
'; print ''; diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 5f07922b2e4..29706f48b49 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -29,6 +29,8 @@ * \brief Card of a contact */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; @@ -49,12 +51,14 @@ $langs->loadLangs(array('companies', 'users', 'other', 'commercial')); $mesg = ''; $error = 0; $errors = array(); +// Get parameters $action = (GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view'); $confirm = GETPOST('confirm', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $id = GETPOST('id', 'int'); $socid = GETPOST('socid', 'int'); +// Initialize objects $object = new Contact($db); $extrafields = new ExtraFields($db); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index d486432f142..d7eb7f53d82 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -32,6 +32,8 @@ * \brief Card of a contact */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; @@ -52,14 +54,15 @@ $langs->loadLangs(array('companies', 'users', 'other', 'commercial')); $mesg = ''; $error = 0; $errors = array(); +// Get parameters $action = (GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view'); $confirm = GETPOST('confirm', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); - $id = GETPOST('id', 'int'); $socid = GETPOST('socid', 'int'); +// Initialize technical object $object = new Contact($db); $extrafields = new ExtraFields($db); diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index c3cd54d890e..fff1ba17644 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -22,9 +22,11 @@ /** * \file htdocs/contact/consumption.php * \ingroup societe - * \brief Add a tab on thirpdarty view to list all products/services bought or sells by thirdparty + * \brief Add a tab on thirdparty view to list all products/services bought or sells by thirdparty */ + +// Load Dolibarr environment require "../main.inc.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 3fac8adea15..f62e82ee5a1 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -23,6 +23,8 @@ * \brief Page with attached files on contact */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -33,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; // Load translation files required by the page $langs->loadLangs(array('other', 'companies', 'contact')); +// Get parameters $id = GETPOST('id', 'int'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); diff --git a/htdocs/contact/info.php b/htdocs/contact/info.php index 4cea1cae85b..64688635179 100644 --- a/htdocs/contact/info.php +++ b/htdocs/contact/info.php @@ -23,6 +23,8 @@ * \brief Onglet info d'un contact */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index f5810db2b13..d5c0d333d03 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -33,6 +33,8 @@ * \brief Page to list all contacts */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -44,6 +46,7 @@ $langs->loadLangs(array("companies", "suppliers", "categories")); $socialnetworks = getArrayOfSocialNetworks(); +// Get parameters $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 42dcd1d493b..f9157a6a3c2 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -156,7 +156,7 @@ class CMailFile * @param string $errors_to Email for errors-to * @param string $css Css option * @param string $trackid Tracking string (contains type and id of related element) - * @param string $moreinheader More in header. $moreinheader must contains the "\r\n" (TODO not supported for other MAIL_SEND_MODE different than 'phpmail' and 'smtps' for the moment) + * @param string $moreinheader More in header. $moreinheader must contains the "\r\n" (TODO not supported for other MAIL_SEND_MODE different than 'mail' and 'smtps' for the moment) * @param string $sendcontext 'standard', 'emailing', ... (used to define which sending mode and parameters to use) * @param string $replyto Reply-to email (will be set to same value than From by default if not provided) */ @@ -173,12 +173,11 @@ class CMailFile $this->sendcontext = $sendcontext; - // Define this->sendmode + // Define this->sendmode ('mail', 'smtps', 'siwftmailer', ...) according to $sendcontext ('standard', 'emailing', 'ticket') $this->sendmode = ''; if (!empty($this->sendcontext)) { $smtpContextKey = strtoupper($this->sendcontext); - $keyForSMTPSendMode = 'MAIN_MAIL_SENDMODE_'.$smtpContextKey; - $smtpContextSendMode = empty($conf->global->{$keyForSMTPSendMode}) ? '' : $conf->global->{$keyForSMTPSendMode}; + $smtpContextSendMode = getDolGlobalString('MAIN_MAIL_SENDMODE_'.$smtpContextKey); if (!empty($smtpContextSendMode) && $smtpContextSendMode != 'default') { $this->sendmode = $smtpContextSendMode; } @@ -329,8 +328,7 @@ class CMailFile $keyforsslseflsigned = 'MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED'; if (!empty($this->sendcontext)) { $smtpContextKey = strtoupper($this->sendcontext); - $keyForSMTPSendMode = 'MAIN_MAIL_SENDMODE_'.$smtpContextKey; - $smtpContextSendMode = empty($conf->global->{$keyForSMTPSendMode}) ? '' : $conf->global->{$keyForSMTPSendMode}; + $smtpContextSendMode = getDolGlobalString('MAIN_MAIL_SENDMODE_'.$smtpContextKey); if (!empty($smtpContextSendMode) && $smtpContextSendMode != 'default') { $keyforsslseflsigned = 'MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_'.$smtpContextKey; } @@ -701,8 +699,7 @@ class CMailFile $keyforsslseflsigned = 'MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED'; if (!empty($this->sendcontext)) { $smtpContextKey = strtoupper($this->sendcontext); - $keyForSMTPSendMode = 'MAIN_MAIL_SENDMODE_'.$smtpContextKey; - $smtpContextSendMode = empty($conf->global->{$keyForSMTPSendMode}) ? '' : $conf->global->{$keyForSMTPSendMode}; + $smtpContextSendMode = getDolGlobalString('MAIN_MAIL_SENDMODE_'.$smtpContextKey); if (!empty($smtpContextSendMode) && $smtpContextSendMode != 'default') { $keyforsmtpserver = 'MAIN_MAIL_SMTP_SERVER_'.$smtpContextKey; $keyforsmtpport = 'MAIN_MAIL_SMTP_PORT_'.$smtpContextKey; @@ -1537,15 +1534,26 @@ class CMailFile $keyforsmtpport = 'MAIN_MAIL_SMTP_PORT'; $keyforsmtpid = 'MAIN_MAIL_SMTPS_ID'; $keyforsmtppw = 'MAIN_MAIL_SMTPS_PW'; + $keyforsmtpauthtype = 'MAIN_MAIL_SMTPS_AUTH_TYPE'; + $keyforsmtpoauthservice = 'MAIN_MAIL_SMTPS_OAUTH_SERVICE'; $keyfortls = 'MAIN_MAIL_EMAIL_TLS'; $keyforstarttls = 'MAIN_MAIL_EMAIL_STARTTLS'; - if ($this->sendcontext == 'emailing' && !empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') { - $keyforsmtpserver = 'MAIN_MAIL_SMTP_SERVER_EMAILING'; - $keyforsmtpport = 'MAIN_MAIL_SMTP_PORT_EMAILING'; - $keyforsmtpid = 'MAIN_MAIL_SMTPS_ID_EMAILING'; - $keyforsmtppw = 'MAIN_MAIL_SMTPS_PW_EMAILING'; - $keyfortls = 'MAIN_MAIL_EMAIL_TLS_EMAILING'; - $keyforstarttls = 'MAIN_MAIL_EMAIL_STARTTLS_EMAILING'; + $keyforsslseflsigned = 'MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED'; + + if (!empty($this->sendcontext)) { + $smtpContextKey = strtoupper($this->sendcontext); + $smtpContextSendMode = getDolGlobalString('MAIN_MAIL_SENDMODE_'.$smtpContextKey); + if (!empty($smtpContextSendMode) && $smtpContextSendMode != 'default') { + $keyforsmtpserver = 'MAIN_MAIL_SMTP_SERVER_'.$smtpContextKey; + $keyforsmtpport = 'MAIN_MAIL_SMTP_PORT_'.$smtpContextKey; + $keyforsmtpid = 'MAIN_MAIL_SMTPS_ID_'.$smtpContextKey; + $keyforsmtppw = 'MAIN_MAIL_SMTPS_PW_'.$smtpContextKey; + $keyforsmtpauthtype = 'MAIN_MAIL_SMTPS_AUTH_TYPE_'.$smtpContextKey; + $keyforsmtpoauthservice = 'MAIN_MAIL_SMTPS_OAUTH_SERVICE_'.$smtpContextKey; + $keyfortls = 'MAIN_MAIL_EMAIL_TLS_'.$smtpContextKey; + $keyforstarttls = 'MAIN_MAIL_EMAIL_STARTTLS_'.$smtpContextKey; + $keyforsslseflsigned = 'MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_'.$smtpContextKey; + } } // If we use SSL/TLS diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a8ae8a0af33..c2f17314c81 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1918,10 +1918,11 @@ class Form * @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on). * @param int $outputmode 0=HTML select string, 1=Array * @param bool $multiple add [] in the name of element and add 'multiple' attribut + * @param int $forcecombo Force the component to be a simple combo box without ajax * @return string HTML select string * @see select_dolgroups() */ - public function select_dolusers($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $show_every = 0, $enableonlytext = '', $morecss = '', $noactive = 0, $outputmode = 0, $multiple = false) + public function select_dolusers($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $show_every = 0, $enableonlytext = '', $morecss = '', $noactive = 0, $outputmode = 0, $multiple = false, $forcecombo = 0) { // phpcs:enable global $conf, $user, $langs, $hookmanager; @@ -2124,7 +2125,7 @@ class Form } $out .= ''; - if ($num) { + if ($num && !$forcecombo) { // Enhance with select2 include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; $out .= ajax_combobox($htmlname); diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 61f62f28a54..f12acbe1901 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1072,6 +1072,7 @@ class FormMail extends Form // multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time $tmparray = $this->withto; foreach ($tmparray as $key => $val) { + $tmparray[$key] = str_replace(array('<', '>'), array('(', ')'), $tmparray[$key]); $tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true); } @@ -1080,6 +1081,7 @@ class FormMail extends Form if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend') { $withtoselected = array_keys($tmparray); } + $out .= $form->multiselectarray("receiver", $tmparray, $withtoselected, null, null, 'inline-block minwidth500', null, ""); } } @@ -1107,6 +1109,7 @@ class FormMail extends Form // multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time $tmparray = $this->withtocc; foreach ($tmparray as $key => $val) { + $tmparray[$key] = str_replace(array('<', '>'), array('(', ')'), $tmparray[$key]); $tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true); } $withtoccselected = GETPOST("receivercc", 'array'); // Array of selected value @@ -1510,7 +1513,7 @@ class FormMail extends Form /** - * Set substit array from object. This is call when suggesting the email template into forms before sending email. + * Set ->substit (and ->substit_line) array from object. This is call when suggesting the email template into forms before sending email. * * @param CommonObject $object Object to use * @param Translate $outputlangs Object lang diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 2e4035e2131..4c7c078cc51 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -328,7 +328,7 @@ class FormTicket print ''; // Severity - print ''; @@ -643,7 +643,7 @@ class FormTicket print dol_get_fiche_end(); } - print '
'; + print '

'; print $form->buttonsSaveCancel(((isset($this->withreadid) && $this->withreadid > 0) ? "SendResponse" : "CreateTicket"), ($this->withcancel ? "Cancel" : "")); diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index a60c3fdd8f5..8805f7376c2 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -652,7 +652,7 @@ class Utils * @param string $outputfile A path for an output file (used only when method is 2). For example: $conf->admin->dir_temp.'/out.tmp'; * @param int $execmethod 0=Use default method (that is 1 by default), 1=Use the PHP 'exec', 2=Use the 'popen' method * @param string $redirectionfile If defined, a redirection of output to this file is added. - * @param int $noescapecommand 1=Do not escape command. Warning: Using this parameter need you alreay sanitized the command. if not, it will lead to security vulnerability. + * @param int $noescapecommand 1=Do not escape command. Warning: Using this parameter needs you alreay have sanitized the command. if not, it will lead to security vulnerability. * This parameter is provided for backward compatibility with external modules. Always use 0 in core. * @param string $redirectionfileerr If defined, a redirection of error is added to this file instead of to channel 1. * @return array array('result'=>...,'output'=>...,'error'=>...). result = 0 means OK. diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 147938fb53a..32526574294 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1261,7 +1261,6 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0, $hookmanager->initHooks(array('fileslib')); $parameters = array( - 'GET' => $_GET, 'file' => $file, 'disableglob'=> $disableglob, 'nophperrors' => $nophperrors diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3174fb132cd..53204c4cc41 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7064,7 +7064,7 @@ function dol_html_entity_decode($a, $b, $c = 'UTF-8', $keepsomeentities = 0) if ($keepsomeentities) { $newstring = strtr($newstring, array('&'=>'__andamp__', '<'=>'__andlt__', '>'=>'__andgt__', '"'=>'__dquot__')); } - $newstring = html_entity_decode($newstring, $b, $c); + $newstring = html_entity_decode((string) $newstring, (int) $b, (string) $c); if ($keepsomeentities) { $newstring = strtr($newstring, array('__andamp__'=>'&', '__andlt__'=>'<', '__andgt__'=>'>', '__dquot__'=>'"')); } @@ -7671,6 +7671,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__ONLINE_PAYMENT_URL__'] = $paymenturl; if (is_object($object) && $object->element == 'propal') { + require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php'; $substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'proposal', $object->ref); } if (!empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'propal') { @@ -10418,8 +10419,8 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st /** * Function dolGetButtonAction * - * @param string $label label of button without HTML : use in alt attribute for accessibility $html is not empty - * @param string $html optional : content with html + * @param string $label label or tooltip of button. Also used as tooltip in title attribute. Can be escaped HTML content or full simple text. + * @param string $text optional : short label on button. Can be escaped HTML content or full simple text. * @param string $actionType default, delete, danger * @param string $url the url for link * @param string $id attribute id of button @@ -10444,7 +10445,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st * // phpcs:enable * @return string html button */ -function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = '', $id = '', $userRight = 1, $params = array()) +function dolGetButtonAction($label, $text = '', $actionType = 'default', $url = '', $id = '', $userRight = 1, $params = array()) { global $hookmanager, $action, $object, $langs; @@ -10464,8 +10465,8 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = 'title' => $label ); - if (empty($html)) { - $html = $label; + if (empty($text)) { + $text = $label; $attr['title'] = ''; // if html not set, leave label on title is redundant } else { $attr['aria-label'] = $label; @@ -10544,7 +10545,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = 'attr' => $attr, 'tag' => $tag, 'label' => $label, - 'html' => $html, + 'html' => $text, 'actionType' => $actionType, 'url' => $url, 'id' => $id, @@ -10556,7 +10557,11 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { - return '<' . $tag . ' ' . $compiledAttributes . '>' . $html . ''; + if (dol_textishtml($text)) { // If content already HTML encoded + return '<' . $tag . ' ' . $compiledAttributes . '>' . $text . ''; + } else { + return '<' . $tag . ' ' . $compiledAttributes . '>' . dol_escape_htmltag($text) . ''; + } } else { return $hookmanager->resPrint; } diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index c2468c98169..c7714501d90 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2009 Laurent Destailleur + * Copyright (C) 2022 Alexandre Spangaro * * 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 @@ -53,7 +54,7 @@ function takepos_admin_prepare_head() $head[$h][2] = 'bar'; $h++; - $numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS); + $numterminals = max(1, getDolGlobalInt('TAKEPOS_NUM_TERMINALS', 1)); for ($i = 1; $i <= $numterminals; $i++) { $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/terminal.php?terminal='.$i; $head[$h][1] = getDolGlobalString('TAKEPOS_TERMINAL_NAME_'.$i, $langs->trans("TerminalName", $i)); diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 0580c6c8cc0..8a9186e49c0 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -119,7 +119,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->product->enabled', __HANDLER__, 'left', 2801__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/card.php?mainmenu=products&leftmenu=product&action=create&type=0', 'NewProduct', 1, 'products', '$user->rights->produit->creer', '', 2, 0, __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->product->enabled', __HANDLER__, 'left', 2802__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/list.php?mainmenu=products&leftmenu=product&type=0', 'List', 1, 'products', '$user->rights->produit->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->product->enabled', __HANDLER__, 'left', 2803__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassort.php?mainmenu=products&type=0', 'MenuStocks', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->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->productbatch->enabled', __HANDLER__, 'left', 2805__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassortlot.php?mainmenu=products&type=0', 'StocksByLotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 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->productbatch->enabled', __HANDLER__, 'left', 2805__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassortlot.php?mainmenu=products&type=0&search_subjecttolotserial=1', 'StocksByLotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 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->productbatch->enabled', __HANDLER__, 'left', 2806__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/stock/productlot_list.php?mainmenu=products', 'LotSerial', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 6, __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->variants->enabled', __HANDLER__, 'left', 2807__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/variants/list.php?mainmenu=products', 'VariantAttributes', 1, 'products', '$user->rights->produit->lire', '', 2, 7, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 4707657d3e3..7e8f9923593 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1812,11 +1812,11 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef if (isModEnabled('comptabilite')) { // Files if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) { - $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'files'); + $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'files', 0, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); } // Bilan, resultats - $newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy", $langs->trans("Reportings"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'ca'); + $newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy", $langs->trans("Reportings"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'ca', 0, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || preg_match('/report/', $leftmenu)) { $newmenu->add("/compta/resultat/index.php?leftmenu=report", $langs->trans("MenuReportInOut"), 1, $user->rights->compta->resultat->lire); @@ -1998,7 +1998,7 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme } if (isModEnabled('productbatch')) { $langs->load("stocks"); - $newmenu->add("/product/reassortlot.php?type=0", $langs->trans("StocksByLotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); + $newmenu->add("/product/reassortlot.php?type=0&search_subjecttolotserial=1", $langs->trans("StocksByLotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); $newmenu->add("/product/stock/productlot_list.php", $langs->trans("LotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); } if (isModEnabled('variants')) { diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_simple.php b/htdocs/core/modules/takepos/mod_takepos_ref_simple.php index 41b7bb8c90e..31eb9345110 100644 --- a/htdocs/core/modules/takepos/mod_takepos_ref_simple.php +++ b/htdocs/core/modules/takepos/mod_takepos_ref_simple.php @@ -15,8 +15,8 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * or see http://www.gnu.org/ + * along with this program. If not, see . + * or see https://www.gnu.org/ */ /** @@ -24,6 +24,7 @@ * \ingroup takepos * \brief File with Simple ref numbering module for takepos */ + dol_include_once('/core/modules/takepos/modules_takepos.php'); /** @@ -80,10 +81,10 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos } /** - * Test si les numeros deja en vigueur dans la base ne provoquent pas de - * de conflits qui empechera cette numerotation de fonctionner. + * Test if the numbers already in the database do not cause any conflicts that will prevent this + * of conflicts that will prevent this numbering from working. * - * @return boolean false si conflit, true si ok + * @return boolean false if KO (there is a conflict), true if OK */ public function canBeActivated() { diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php index 7e46c10a341..7b515ca6b3b 100644 --- a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php +++ b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php @@ -17,8 +17,8 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * or see http://www.gnu.org/ + * along with this program. If not, see . + * or see https://www.gnu.org/ */ /** @@ -26,6 +26,7 @@ * \ingroup takepos * \brief File with Universal ref numbering module for takepos */ + dol_include_once('/core/modules/takepos/modules_takepos.php'); /** @@ -51,17 +52,17 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos public $nom = 'Universal'; /** - * Renvoi la description du modele de numerotation + * return description of the numbering model * * @return string Texte descripif */ public function info() { - global $conf, $langs; + global $db, $langs; $langs->load('cashdesk@cashdesk'); - $form = new Form($this->db); + $form = new Form($db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte .= ''; @@ -77,11 +78,11 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos $tooltip .= $langs->trans('GenericMaskCodes5'); $tooltip .= $langs->trans('CashDeskGenericMaskCodes6'); - // Parametrage du prefix + // Setting up the prefix $texte .= '
'; - $texte .= ''; + $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; @@ -92,7 +93,7 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos } /** - * Renvoi un exemple de numerotation + * Return an example of numbering * * @return string Example */ @@ -121,12 +122,12 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos */ public function getNextValue($objsoc = null, $invoice = null, $mode = 'next') { - global $db, $conf; + global $db; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - // On defini critere recherche compteur - $mask = $conf->global->TAKEPOS_REF_UNIVERSAL_MASK; + // We define search criteria counter + $mask = getDolGlobalString('TAKEPOS_REF_UNIVERSAL_MASK'); if (!$mask) { $this->error = 'NotConfigured'; @@ -136,9 +137,10 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos // Get entities $entity = getEntity('invoicenumber', 1, $invoice); + $date = (empty($invoice->date) ? dol_now() : $invoice->date); $pos_source = is_object($invoice) && $invoice->pos_source > 0 ? $invoice->pos_source : 0; $mask = str_replace('{TN}', $pos_source, $mask); - $numFinal = get_next_value($db, $mask, 'facture', 'ref', '', $objsoc, $invoice->date, $mode, false, null, $entity); + $numFinal = get_next_value($db, $mask, 'facture', 'ref', '', $objsoc, $date, $mode, false, null, $entity); return $numFinal; } diff --git a/htdocs/core/modules/takepos/modules_takepos.php b/htdocs/core/modules/takepos/modules_takepos.php index 24fa70b7f28..89b3dbde5bc 100644 --- a/htdocs/core/modules/takepos/modules_takepos.php +++ b/htdocs/core/modules/takepos/modules_takepos.php @@ -16,14 +16,14 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * or see http://www.gnu.org/ + * along with this program. If not, see . + * or see https://www.gnu.org/ */ /** * \file htdocs/core/modules/takepos/modules_takepos.php * \ingroup takepos - * \brief Fichier contenant la classe mere de numerotation des tickets de caisse + * \brief File containing the parent class for the numbering of cash register receipts */ diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 5fbb227bc69..596feae69d1 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -156,7 +156,7 @@ if ($action == 'presend') { $formmail->inreplyto = empty($inreplyto) ? '' : $inreplyto; $formmail->withfrom = 1; - // Fill list of recipient with email inside <>. + // Define $liste, a list of recipients with email inside <>. $liste = array(); if ($object->element == 'expensereport') { $fuser = new User($db); @@ -202,16 +202,6 @@ if ($action == 'presend') { } } - $formmail->withto = $liste; - $formmail->withtofree = (GETPOST('sendto', 'alphawithlgt') ? GETPOST('sendto', 'alphawithlgt') : '1'); - $formmail->withtocc = $liste; - $formmail->withtoccc = getDolGlobalString('MAIN_EMAIL_USECCC'); - $formmail->withtopic = $topicmail; - $formmail->withfile = 2; - $formmail->withbody = 1; - $formmail->withdeliveryreceipt = 1; - $formmail->withcancel = 1; - //$arrayoffamiliestoexclude=array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...); if (!isset($arrayoffamiliestoexclude)) { $arrayoffamiliestoexclude = null; @@ -219,6 +209,7 @@ if ($action == 'presend') { // Make substitution in email content if ($object) { + // First we set ->substit (useless, it will be erased later) and ->substit_lines $formmail->setSubstitFromObject($object, $langs); } $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object); @@ -237,7 +228,7 @@ if ($action == 'presend') { ); complete_substitutions_array($substitutionarray, $outputlangs, $object, $parameters); - // Find the good contact address + // Find all external contact addresses $tmpobject = $object; if (($object->element == 'shipping' || $object->element == 'reception')) { $origin = $object->origin; @@ -289,17 +280,46 @@ if ($action == 'presend') { if (is_array($contactarr) && count($contactarr) > 0) { require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $contactstatic = new Contact($db); + $tmpcompany = new Societe($db); foreach ($contactarr as $contact) { $contactstatic->fetch($contact['id']); + // Complete substitution array $substitutionarray['__CONTACT_NAME_'.$contact['code'].'__'] = $contactstatic->getFullName($outputlangs, 1); $substitutionarray['__CONTACT_LASTNAME_'.$contact['code'].'__'] = $contactstatic->lastname; $substitutionarray['__CONTACT_FIRSTNAME_'.$contact['code'].'__'] = $contactstatic->firstname; $substitutionarray['__CONTACT_TITLE_'.$contact['code'].'__'] = $contactstatic->getCivilityLabel(); + + // Complete $liste with the $contact + if (empty($liste[$contact['id']])) { // If this contact id not already into the $liste + $contacttoshow = ''; + if (isset($object->thirdparty) && is_object($object->thirdparty)) { + if ($contactstatic->fk_soc != $object->thirdparty->id) { + $tmpcompany->fetch($contactstatic->fk_soc); + if ($tmpcompany->id > 0) { + $contacttoshow .= $tmpcompany->name.': '; + } + } + } + $contacttoshow .= $contactstatic->getFullName($outputlangs, 1); + $contacttoshow .= " <".($contactstatic->email ? $contactstatic->email : $langs->transnoentitiesnoconv("NoEMail")) .">"; + $liste[$contact['id']] = $contacttoshow; + } } } + $formmail->withto = $liste; + $formmail->withtofree = (GETPOST('sendto', 'alphawithlgt') ? GETPOST('sendto', 'alphawithlgt') : '1'); + $formmail->withtocc = $liste; + $formmail->withtoccc = getDolGlobalString('MAIN_EMAIL_USECCC'); + $formmail->withtopic = $topicmail; + $formmail->withfile = 2; + $formmail->withbody = 1; + $formmail->withdeliveryreceipt = 1; + $formmail->withcancel = 1; + // Array of substitutions $formmail->substit = $substitutionarray; diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index cb38d7a3546..54e64ccc769 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -71,7 +71,7 @@ if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf- if (in_array($object->element, array('propal', 'commande', 'order', 'facture', 'facturerec', 'invoice', 'supplier_proposal', 'order_supplier', 'invoice_supplier', 'invoice_supplier_rec'))) { $colspan++; // With this, there is a column move button } -if (!empty($conf->asset->enabled) && $object->element == 'invoice_supplier') { +if (isModEnabled('asset') && $object->element == 'invoice_supplier') { $colspan++; } diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 761be27b512..b2974ffbbfc 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -73,7 +73,7 @@ if (in_array($object->element, array('propal', 'supplier_proposal', 'facture', ' if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { $colspan += 2; } -if (!empty($conf->asset->enabled) && $object->element == 'invoice_supplier') { +if (isModEnabled('asset') && $object->element == 'invoice_supplier') { $colspan++; } diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 762e9b4eefa..79d4ebeae11 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -160,7 +160,7 @@ if ($outputalsopricetotalwithtax) { print ''; } -if (!empty($conf->asset->enabled) && $object->element == 'invoice_supplier') { +if (isModEnabled('asset') && $object->element == 'invoice_supplier') { print ''; } diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index c93e0d5c4cd..b660bd89d93 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -397,7 +397,7 @@ if ($this->statut == 0 && !empty($object_rights->creer) && $action != 'selectlin } } - if (!empty($conf->asset->enabled) && $object->element == 'invoice_supplier') { + if (isModEnabled('asset') && $object->element == 'invoice_supplier') { print '\n"; - if (empty($conf->societe->enabled) || empty($conf->global->DONATION_USE_THIRDPARTIES)) { + if (!isModEnabled('societe') || empty($conf->global->DONATION_USE_THIRDPARTIES)) { print "".''; print "".''; print "".''; diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 4ffe606c79e..49bd25d0b90 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -314,7 +314,7 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) { $rowspan++; $sectionauto[] = array('position'=>10, 'level'=>1, 'module'=>'product', 'test'=>(isModEnabled("product") || isModEnabled("service")), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } if (isModEnabled("societe")) { - $rowspan++; $sectionauto[] = array('position'=>20, 'level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties"))); + $rowspan++; $sectionauto[] = array('position'=>20, 'level'=>1, 'module'=>'company', 'test'=>isModEnabled('societe'), 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties"))); } if (isModEnabled("propal")) { $rowspan++; $sectionauto[] = array('position'=>30, 'level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals"))); diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index d04983fff11..6bbca0026e1 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -117,7 +117,7 @@ if (isModEnabled("product") || isModEnabled("service")) { $langs->load("products"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'product', 'test'=>(isModEnabled("product") || isModEnabled("service")), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); } if (isModEnabled("societe")) { - $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties"))); + $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>isModEnabled('societe'), 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties"))); } if (isModEnabled("propal")) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals"))); diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index f06e83f4c40..4591ccd0bf3 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -451,7 +451,7 @@ if ($step == 1 || !$datatoexport) { print $label; print ''; // Action button print ''; print ''; } @@ -727,7 +727,7 @@ if ($step == 3 && $datatoimport) { print '">'.img_delete().''; // Action button print ''; print ''; } @@ -1585,7 +1585,7 @@ if ($step == 5 && $datatoimport) { $param .= '&updatekeys[]='.implode('&updatekeys[]=', $updatekeys); } - llxHeader('', $langs->trans("NewImport"), 'EN:Module_Imports_En|FR:Module_Imports|ES:Módulo_Importaciones'); + llxHeader('', $langs->trans("NewImport"), $help_url); $head = import_prepare_head($param, 5); @@ -2051,7 +2051,7 @@ if ($step == 6 && $datatoimport) { $param .= '&enclosure='.urlencode($enclosure); } - llxHeader('', $langs->trans("NewImport"), 'EN:Module_Imports_En|FR:Module_Imports|ES:Módulo_Importaciones'); + llxHeader('', $langs->trans("NewImport"), $help_url); $head = import_prepare_head($param, 6); diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 1b0d8a33231..5db36ee955b 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -71,8 +71,8 @@ ALTER TABLE llx_adherent_type ADD COLUMN caneditamount integer DEFAULT 0 AFTER a ALTER TABLE llx_holiday CHANGE COLUMN date_approve date_approval datetime; -UPDATE llx_holiday SET date_approval = date_valid WHEN statut = 3 AND date_approval IS NULL; -UPDATE llx_holiday SET fk_user_approve = fk_user_valid WHEN statut = 3 AND fk_user_approve IS NULL; +UPDATE llx_holiday SET date_approval = date_valid WHERE statut = 3 AND date_approval IS NULL; +UPDATE llx_holiday SET fk_user_approve = fk_user_valid WHERE statut = 3 AND fk_user_approve IS NULL; ALTER TABLE llx_inventory ADD COLUMN categories_product VARCHAR(255) DEFAULT NULL AFTER fk_product; diff --git a/htdocs/intracommreport/card.php b/htdocs/intracommreport/card.php index 681320e0d75..a5acefca8d6 100644 --- a/htdocs/intracommreport/card.php +++ b/htdocs/intracommreport/card.php @@ -155,10 +155,11 @@ if ($action == 'add' && $permissiontoadd) { * View */ +$title = $langs->trans("IntracommReportTitle"); +llxHeader("", $title); + // Creation mode if ($action == 'create') { - $title = $langs->trans("IntracommReportTitle"); - llxHeader("", $title); print load_fiche_titre($langs->trans("IntracommReportTitle")); print ''; @@ -294,8 +295,6 @@ if ($id > 0 && $action != 'edit') { { global $langs, $formother, $year, $month, $type_declaration; - $title = $langs->trans("IntracommReportDESTitle"); - llxHeader("", $title); print load_fiche_titre($langs->trans("IntracommReportDESTitle")); print dol_get_fiche_head(); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 24343c773d5..ced1f23ed39 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2223,7 +2223,7 @@ NoExternalModuleWithUpdate=No updates found for external modules SwaggerDescriptionFile=Swagger API description file (for use with redoc for example) YouEnableDeprecatedWSAPIsUseRESTAPIsInstead=You enabled deprecated WS API. You should use REST API instead. RandomlySelectedIfSeveral=Randomly selected if several pictures are available -SalesRepresentativeInfo=For Proposals, Orders, Invoces. +SalesRepresentativeInfo=For Proposals, Orders, Invoices. DatabasePasswordObfuscated=Database password is obfuscated in conf file DatabasePasswordNotObfuscated=Database password is NOT obfuscated in conf file APIsAreNotEnabled=APIs modules are not enabled diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 996c98c203a..2ef90f89600 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -498,3 +498,5 @@ RestOfEurope=Rest of Europe (EEC) OutOfEurope=Out of Europe (EEC) CurrentOutstandingBillLate=Current outstanding bill late BecarefullChangeThirdpartyBeforeAddProductToInvoice=Be carefull, depending on your product price settings, you should change thirdparty before adding product to POS. +EmailAlreadyExistsPleaseRewriteYourCompanyName=email already exists please rewrite your company name +TwoRecordsOfCompanyName=more than one record exists for this company please contact us to complete your partnership request" \ No newline at end of file diff --git a/htdocs/langs/en_US/partnership.lang b/htdocs/langs/en_US/partnership.lang index 5c85e4d7830..6490bf23d8b 100644 --- a/htdocs/langs/en_US/partnership.lang +++ b/htdocs/langs/en_US/partnership.lang @@ -28,6 +28,7 @@ PartnershipCheckBacklink=Partnership: Check referring backlink # Menu # NewPartnership=New Partnership +NewPartnershipbyWeb= Your partnership was added successfully. ListOfPartnerships=List of partnership # diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 47483bb8f3b..492cdd48864 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -24,6 +24,7 @@ StockAtDateInFuture=Date in the future StocksByLotSerial=Stocks by lot/serial LotSerial=Lots/Serials LotSerialList=List of lot/serials +SubjectToLotSerialOnly=Products subject to lot/serial only Movements=Movements ErrorWarehouseRefRequired=Warehouse reference name is required ListOfWarehouses=List of warehouses diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index f34f338c931..3e252e407e4 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -296,7 +296,7 @@ TicketNewEmailBodyInfosTrackUrlCustomer=You can view the progress of the ticket TicketCloseEmailBodyInfosTrackUrlCustomer=You can consult the history of this ticket by clicking the following link TicketEmailPleaseDoNotReplyToThisEmail=Please do not reply directly to this email! Use the link to reply into the interface. TicketPublicInfoCreateTicket=This form allows you to record a support ticket in our management system. -TicketPublicPleaseBeAccuratelyDescribe=Please accurately describe the problem. Provide the most information possible to allow us to correctly identify your request. +TicketPublicPleaseBeAccuratelyDescribe=Please accurately describe your question. Provide the most information possible to allow us to correctly identify your request. TicketPublicMsgViewLogIn=Please enter ticket tracking ID TicketTrackId=Public Tracking ID OneOfTicketTrackId=One of your tracking ID diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 56a85f5d03d..ef64b2e5a74 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1153,6 +1153,11 @@ if (!defined('NOLOGIN')) { $conf->theme = $user->conf->MAIN_THEME; $conf->css = "/theme/".$conf->theme."/style.css.php"; } +} else { + // We may have NOLOGIN set, but NOREQUIREUSER not + if (!empty($user) && method_exists($user, 'loadDefaultValues')) { + $user->loadDefaultValues(); // Load default values for everybody (works even if $user->id = 0 + } } diff --git a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php index 3c6196cee2f..2c76818ab84 100644 --- a/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php +++ b/htdocs/modulebuilder/template/core/triggers/interface_99_modMyModule_MyModuleTriggers.class.php @@ -177,7 +177,7 @@ class InterfaceMyModuleTriggers extends DolibarrTriggers //case 'ORDER_SUPPLIER_REFUSE': //case 'ORDER_SUPPLIER_CANCEL': //case 'ORDER_SUPPLIER_SENTBYMAIL': - //case 'ORDER_SUPPLIER_DISPATCH': + //case 'ORDER_SUPPLIER_RECEIVE': //case 'LINEORDER_SUPPLIER_DISPATCH': //case 'LINEORDER_SUPPLIER_CREATE': //case 'LINEORDER_SUPPLIER_UPDATE': diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 761fe2a148f..5f0159ce567 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -41,6 +41,8 @@ * \brief Page to show product */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; @@ -88,6 +90,7 @@ $mesg = ''; $error = 0; $errors = array(); $refalreadyexists = 0; +// Get parameters $id = GETPOST('id', 'int'); $ref = (GETPOSTISSET('ref') ? GETPOST('ref', 'alpha') : null); $type = (GETPOSTISSET('type') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT); @@ -107,6 +110,7 @@ $accountancy_code_buy_intra = GETPOST('accountancy_code_buy_intra', 'alpha'); $accountancy_code_buy_export = GETPOST('accountancy_code_buy_export', 'alpha'); $checkmandatory = GETPOST('accountancy_code_buy_export', 'alpha'); + // by default 'alphanohtml' (better security); hidden conf MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML allows basic html $label_security_check = empty($conf->global->MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML) ? 'alphanohtml' : 'restricthtml'; diff --git a/htdocs/product/document.php b/htdocs/product/document.php index d83a684a308..2aaa2356879 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -28,6 +28,8 @@ * \brief Page des documents joints sur les produits */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -38,9 +40,12 @@ if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL)) { require_once DOL_DOCUMENT_ROOT.'/product/class/propalmergepdfproduct.class.php'; } + // Load translation files required by the page $langs->loadLangs(array('other', 'products')); + +// Get parameters $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); @@ -74,7 +79,7 @@ if (!$sortfield) { $sortfield = "position_name"; } - +// Initialize objects $object = new Product($db); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref); @@ -93,6 +98,7 @@ if ($id > 0 || !empty($ref)) { } } } + $modulepart = 'produit'; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index c5b8004efa8..164dac7d185 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -521,7 +521,7 @@ if ($id > 0 || $ref) { print ''; // Availability - if (!empty($conf->global->FOURN_PRODUCT_AVAILABILITY)) { + if (getDolGlobalInt('FOURN_PRODUCT_AVAILABILITY')) { $langs->load("propal"); print ''; - print '\n"; + print '\n"; print ''; // Delivery date planned diff --git a/htdocs/resource/agenda.php b/htdocs/resource/agenda.php index 27edf4457e5..a5af098f10b 100644 --- a/htdocs/resource/agenda.php +++ b/htdocs/resource/agenda.php @@ -135,7 +135,7 @@ if ($object->id > 0) { } llxHeader('', $title); - if (!empty($conf->notification->enabled)) { + if (isModEnabled('notification')) { $langs->load("mails"); } $type = $langs->trans('ResourceSingular'); diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index b4f76a93ae3..80e25fa9c25 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -29,7 +29,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/resource/class/dolresource.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -349,7 +349,7 @@ if (!$ret) { // Thirdparty //$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); //$morehtmlref.='
'.$langs->trans('Project') . ' '; $morehtmlref .= $langs->trans('Project').': '; @@ -517,7 +517,7 @@ if (!$ret) { // Thirdparty $morehtmlref .= $langs->trans('ThirdParty').' : '.$fichinter->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->commande->creer) { diff --git a/htdocs/salaries/admin/salaries.php b/htdocs/salaries/admin/salaries.php index f69e17336c6..5343d4831ba 100644 --- a/htdocs/salaries/admin/salaries.php +++ b/htdocs/salaries/admin/salaries.php @@ -27,7 +27,7 @@ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/salaries.lib.php'; -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; } @@ -83,7 +83,7 @@ if (preg_match('/^(set|del)_?([A-Z_]+)$/', $action, $reg)) { llxHeader('', $langs->trans('SalariesSetup')); $form = new Form($db); -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { $formaccounting = new FormAccounting($db); } @@ -119,7 +119,7 @@ foreach ($list as $key) { // Value print ''; // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $formproject = new FormProjets($db); print ''; } - print '\n"; + print '\n"; print ""; $totalpaid += $objp->amount; $i++; @@ -1003,14 +1003,14 @@ if ($id) { print ''; } - print '\n"; - print '\n"; + print '\n"; + print '\n"; $resteapayer = $object->amount - $totalpaid; $cssforamountpaymentcomplete = 'amountpaymentcomplete'; print '"; - print '\n"; + print '\n"; print "
'; + print '
'; $this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', 2, 1); print '
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 1).'   
'.$langs->trans('TotalTTCShort').''; $coldisplay++; if (!empty($product_static->accountancy_code_buy) || diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 49e2965787b..954949e427c 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -974,6 +974,8 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->trackid = 'tas'.$object->id; } elseif (preg_match('/^TICKET_/', $action)) { $object->trackid = 'tic'.$object->id; + } elseif (preg_match('/^USER_/', $action)) { + $object->trackid = 'use'.$object->id; } else { $object->trackid = ''; } diff --git a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php index d706488129e..b131dd0391f 100644 --- a/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php +++ b/htdocs/core/triggers/interface_99_modZapier_ZapierTriggers.class.php @@ -236,7 +236,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers // case 'ORDER_SUPPLIER_REFUSE': // case 'ORDER_SUPPLIER_CANCEL': // case 'ORDER_SUPPLIER_SENTBYMAIL': - // case 'ORDER_SUPPLIER_DISPATCH': + // case 'ORDER_SUPPLIER_RECEIVE': // case 'LINEORDER_SUPPLIER_DISPATCH': // case 'LINEORDER_SUPPLIER_CREATE': // case 'LINEORDER_SUPPLIER_UPDATE': diff --git a/htdocs/datapolicy/class/actions_datapolicy.class.php b/htdocs/datapolicy/class/actions_datapolicy.class.php index 6b7e27c67aa..ffd43bbf8ac 100644 --- a/htdocs/datapolicy/class/actions_datapolicy.class.php +++ b/htdocs/datapolicy/class/actions_datapolicy.class.php @@ -94,7 +94,7 @@ class ActionsDatapolicy $langs->load('datapolicy@datapolicy'); $error = 0; // Error counter - if (GETPOST('socid') && $parameters['currentcontext'] == 'thirdpartycard') { + if (GETPOST('socid') && $parameters['currentcontext'] == 'thirdpartycard' && !empty($object)) { $object->fetch(GETPOST('socid')); } diff --git a/htdocs/don/card.php b/htdocs/don/card.php index c867418cfbb..bf9ba2e6388 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -460,7 +460,7 @@ if ($action == 'create') { print $form->selectyesno("public", $public_donation, 1); print "
'.$langs->trans("Company").'
'.$langs->trans("Lastname").'
'.$langs->trans("Firstname").'
'; if ($objexport->array_export_perms[$key]) { - print ''.img_picto($langs->trans("NewExport"), 'next', 'class="fa-15x"').''; + print ''.img_picto($langs->trans("NewExport"), 'next', 'class="fa-15"').''; } else { print ''.$langs->trans("NotEnoughPermissions").''; } diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 5dd20832088..2f0f7966679 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -373,19 +373,6 @@ if ($action == 'dispatch' && $permissiontoreceive) { } } - if (!$error) { - global $conf, $langs, $user; - // Call trigger - - $result = $object->call_trigger('ORDER_SUPPLIER_DISPATCH', $user); - // End call triggers - - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - $error++; - } - } - if ($result >= 0 && !$error) { $db->commit(); diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 354c92eb534..5676cd4aae3 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -741,7 +741,6 @@ if ($search_billed > 0) { //$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; $help_url = ''; -// llxHeader('',$title,$help_url); $sql = 'SELECT'; if ($sall || $search_product_category > 0) { diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index f9419653c2f..47e6786f2f0 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -404,8 +404,6 @@ $facturestatic = new FactureFournisseur($db); $formcompany = new FormCompany($db); $thirdparty = new Societe($db); -// llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:FactureFournisseur|ES:Facturas_de_proveedores'); - $sql = "SELECT"; if ($search_all || $search_product_category > 0) { $sql = 'SELECT DISTINCT'; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 9b8462c1adf..102d37620bc 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -79,12 +79,12 @@ class Holiday extends CommonObject public $statut = ''; // 1=draft, 2=validated, 3=approved /** - * @var int ID of user that must approve. TODO: there is no date for validation (date_valid is used for approval), add one. + * @var int ID of user that must approve. Real user for approval is fk_user_valid (old version) or fk_user_approve (new versions) */ public $fk_validator; /** - * @var int Date of approval. TODO: Add a field for approval date and use date_valid instead for validation. + * @var int Date of validation or approval. TODO: Use date_valid instead for validation. */ public $date_valid = ''; diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 85de7b09f61..3ea0d87d3cd 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -60,6 +60,17 @@ if (!$sortorder) { } +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('defineholidaylist')); +$extrafields = new ExtraFields($db); + +$holiday = new Holiday($db); + + +if (empty($conf->holiday->enabled)) { + accessforbidden('Module not enabled'); +} + // Protection if external user if ($user->socid > 0) { accessforbidden(); @@ -71,23 +82,6 @@ if (empty($user->rights->holiday->read)) { } -// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array -$hookmanager->initHooks(array('defineholidaylist')); -$extrafields = new ExtraFields($db); - -$holiday = new Holiday($db); - -if (empty($conf->holiday->enabled)) { - llxHeader('', $langs->trans('CPTitreMenu')); - print '
'; - print ''.$langs->trans('NotActiveModCP').''; - print '
'; - llxFooter(); - exit(); -} - - - /* * Actions */ @@ -212,7 +206,6 @@ $title = $langs->trans('CPTitreMenu'); llxHeader('', $title); - $typeleaves = $holiday->getTypes(1, 1); $result = $holiday->updateBalance(); // Create users into table holiday if they don't exists. TODO Remove this whif we use field into table user. if ($result < 0) { diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 5978b6a31be..d4d2c3fff36 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -59,29 +59,6 @@ $id = GETPOST('id', 'int'); $childids = $user->getAllChildIds(1); -// Security check -$socid = 0; -if ($user->socid > 0) { // Protection if external user - //$socid = $user->socid; - accessforbidden(); -} -$result = restrictedArea($user, 'holiday', '', ''); -// If we are on the view of a specific user -if ($id > 0) { - $canread = 0; - if ($id == $user->id) { - $canread = 1; - } - if (!empty($user->rights->holiday->readall)) { - $canread = 1; - } - if (!empty($user->rights->holiday->read) && in_array($id, $childids)) { - $canread = 1; - } - if (!$canread) { - accessforbidden(); - } -} $diroutputmassaction = $conf->holiday->dir_output.'/temp/massgeneration/'.$user->id; @@ -156,15 +133,36 @@ $arrayfields = array( // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; -if (empty($conf->holiday->enabled)) { - llxHeader('', $langs->trans('CPTitreMenu')); - print '
'; - print ''.$langs->trans('NotActiveModCP').''; - print '
'; - llxFooter(); - exit(); + +// Security check +$socid = 0; +if ($user->socid > 0) { // Protection if external user + //$socid = $user->socid; + accessforbidden(); } +if (empty($conf->holiday->enabled)) accessforbidden('Module not enabled'); + +$result = restrictedArea($user, 'holiday', '', ''); +// If we are on the view of a specific user +if ($id > 0) { + $canread = 0; + if ($id == $user->id) { + $canread = 1; + } + if (!empty($user->rights->holiday->readall)) { + $canread = 1; + } + if (!empty($user->rights->holiday->read) && in_array($id, $childids)) { + $canread = 1; + } + if (!$canread) { + accessforbidden(); + } +} + + + /* * Actions diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index ea71deb4d26..1463b91939e 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -74,11 +74,6 @@ if (!$sortorder) { $sortorder = "DESC"; } -// Si l'utilisateur n'a pas le droit de lire cette page -if (!$user->rights->holiday->readall) { - accessforbidden(); -} - // Load translation files required by the page $langs->loadLangs(array('users', 'other', 'holiday')); @@ -92,12 +87,12 @@ $arrayfields = array(); $arrayofmassactions = array(); if (empty($conf->holiday->enabled)) { - llxHeader('', $langs->trans('CPTitreMenu')); - print '
'; - print ''.$langs->trans('NotActiveModCP').''; - print '
'; - llxFooter(); - exit(); + accessforbidden('Module not enabled'); +} + +// Si l'utilisateur n'a pas le droit de lire cette page +if (!$user->rights->holiday->readall) { + accessforbidden(); } diff --git a/htdocs/hrm/compare.php b/htdocs/hrm/compare.php index c8bb01d85e5..686d5820695 100644 --- a/htdocs/hrm/compare.php +++ b/htdocs/hrm/compare.php @@ -1,9 +1,9 @@ - * Copyright (C) 2021 Gauthier VERDOL - * Copyright (C) 2021 Greg Rastklan - * Copyright (C) 2021 Jean-Pascal BOUDET - * Copyright (C) 2021 Grégory BLEMAND + * Copyright (C) 2021 Gauthier VERDOL + * Copyright (C) 2021 Greg Rastklan + * Copyright (C) 2021 Jean-Pascal BOUDET + * Copyright (C) 2021 Grégory BLEMAND * * 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 @@ -18,7 +18,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . - * \file class/compare.php + * \file htdocs/hrm/compare.php * \ingroup hrm * \brief This file compares skills of user groups * @@ -33,23 +33,29 @@ * */ + +// Load Dolibarr environment require_once '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/class/skill.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/class/evaluation.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/class/position.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm.lib.php'; -$permissiontoread = $user->rights->hrm->evaluation->read || $user->rights->hrm->compare_advance->read; -$permissiontoadd = 0; -if (empty($conf->hrm->enabled)) accessforbidden(); -if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden(); +// Load translation files required by the page $langs->load('hrm'); +// Permissions +$permissiontoread = $user->rights->hrm->evaluation->read || $user->rights->hrm->compare_advance->read; +$permissiontoadd = 0; + +if (empty($conf->hrm->enabled)) accessforbidden(); +if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden(); + /* * View diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 1160ee0fc14..861bde0fb51 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -26,6 +26,8 @@ * \brief Home page for HRM area. */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; @@ -34,6 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; + if (!empty($conf->deplacement->enabled)) { require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; } @@ -48,12 +51,15 @@ if (!empty($conf->holiday->enabled)) { require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; } + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager = new HookManager($db); $hookmanager->initHooks('hrmindex'); // Load translation files required by the page $langs->loadLangs(array('users', 'holiday', 'trips', 'boxes')); +// Get Parameters $socid = GETPOST("socid", "int"); // Protection if external user diff --git a/htdocs/hrm/position.php b/htdocs/hrm/position.php index 78838136a1e..2659321e5fc 100644 --- a/htdocs/hrm/position.php +++ b/htdocs/hrm/position.php @@ -20,9 +20,9 @@ */ /** - * \file position.php - * \ingroup hrm - * \brief Page to create/edit/view position + * \file htdocs/hrm/position.php + * \ingroup hrm + * \brief Page to create/edit/view position */ //if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db @@ -88,10 +88,6 @@ require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_position.lib.php'; require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php'; -$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... -$backtopage = GETPOST('backtopage', 'alpha'); -$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); -$fk_job = GETPOST('fk_job', 'int'); // Get parameters $id = GETPOST('fk_job', 'int'); @@ -105,12 +101,18 @@ $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'positioncard'; // To manage different context of search +$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$backtopage = GETPOST('backtopage', 'alpha'); +$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); +$fk_job = GETPOST('fk_job', 'int'); + // Initialize technical objects $object = new Job($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->hrm->dir_output . '/temp/massgeneration/' . $user->id; + $hookmanager->initHooks(array('positiontab', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels @@ -130,6 +132,7 @@ foreach ($object->fields as $key => $val) { // Load object include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +// Permissions $permissiontoread = $user->rights->hrm->all->read; $permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->hrm->all->delete; diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index f573d3c85f4..2c85007c086 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -394,7 +394,7 @@ if ($step == 1 || !$datatoimport) { print $objimport->array_import_label[$key]; print '
'; if ($objimport->array_import_perms[$key]) { - print ''.img_picto($langs->trans("NewImport"), 'next', 'class="fa-15x"').''; + print ''.img_picto($langs->trans("NewImport"), 'next', 'class="fa-15"').''; } else { print $langs->trans("NotEnoughPermissions"); } @@ -499,7 +499,7 @@ if ($step == 2 && $datatoimport) { print ''; - print ''.img_picto($langs->trans("SelectFormat"), 'next', 'class="fa-15x"').''; + print ''.img_picto($langs->trans("SelectFormat"), 'next', 'class="fa-15"').''; print '
'; - print ''.img_picto($langs->trans("NewImport"), 'next', 'class="fa-15x"').''; + print ''.img_picto($langs->trans("NewImport"), 'next', 'class="fa-15"').''; print '
'.$langs->trans("Availability").''; $form->selectAvailabilityDelay($object->fk_availability, "oselDispo", 1); @@ -907,15 +907,15 @@ END; $arrayfields = array( 'pfp.datec'=>array('label'=>$langs->trans("AppliedPricesFrom"), 'checked'=>1, 'position'=>1), 's.nom'=>array('label'=>$langs->trans("Suppliers"), 'checked'=>1, 'position'=>2), - 'pfp.fk_availability'=>array('label'=>$langs->trans("Availability"), 'enabled' => !empty($conf->global->FOURN_PRODUCT_AVAILABILITY), 'checked'=>0, 'position'=>4), + 'pfp.fk_availability'=>array('label'=>$langs->trans("Availability"), 'enabled' => getDolGlobalInt('FOURN_PRODUCT_AVAILABILITY'), 'checked'=>0, 'position'=>4), 'pfp.quantity'=>array('label'=>$langs->trans("QtyMin"), 'checked'=>1, 'position'=>5), 'pfp.unitprice'=>array('label'=>$langs->trans("UnitPriceHT"), 'checked'=>1, 'position'=>9), - 'pfp.multicurrency_unitprice'=>array('label'=>$langs->trans("UnitPriceHTCurrency"), 'enabled' => (!empty($conf->multicurrency->enabled)), 'checked'=>0, 'position'=>10), + 'pfp.multicurrency_unitprice'=>array('label'=>$langs->trans("UnitPriceHTCurrency"), 'enabled' => isModEnabled('multicurrency'), 'checked'=>0, 'position'=>10), 'pfp.delivery_time_days'=>array('label'=>$langs->trans("NbDaysToDelivery"), 'checked'=>1, 'position'=>13), 'pfp.supplier_reputation'=>array('label'=>$langs->trans("ReputationForThisProduct"), 'checked'=>1, 'position'=>14), 'pfp.fk_barcode_type'=>array('label'=>$langs->trans("BarcodeType"), 'enabled' => isModEnabled('barcode'), 'checked'=>0, 'position'=>15), 'pfp.barcode'=>array('label'=>$langs->trans("BarcodeValue"), 'enabled' => isModEnabled('barcode'), 'checked'=>0, 'position'=>16), - 'pfp.packaging'=>array('label'=>$langs->trans("PackagingForThisProduct"), 'enabled' => !empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING), 'checked'=>0, 'position'=>17), + 'pfp.packaging'=>array('label'=>$langs->trans("PackagingForThisProduct"), 'enabled' => getDolGlobalInt('PRODUCT_USE_SUPPLIER_PACKAGING'), 'checked'=>0, 'position'=>17), 'pfp.tms'=>array('label'=>$langs->trans("DateModification"), 'enabled' => isModEnabled('barcode'), 'checked'=>1, 'position'=>18), ); diff --git a/htdocs/product/index.php b/htdocs/product/index.php index f2b29926b21..e976e176224 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -28,6 +28,8 @@ * \brief Homepage products and services */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -47,6 +49,7 @@ $langs->loadLangs(array('products', 'stocks')); // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks $hookmanager->initHooks(array('productindex')); +// Initialize objects $product_static = new Product($db); // Security check diff --git a/htdocs/product/list.php b/htdocs/product/list.php index ebcfed98c80..38c3c0c80ea 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -33,6 +33,8 @@ * \brief Page to list products and services */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; @@ -51,12 +53,15 @@ if (!empty($conf->productbatch->enabled)) { $langs->load("productbatch"); } + +// Get parameters $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); +// Search Criterias $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_id = GETPOST("search_id", 'alpha'); $search_ref = GETPOST("search_ref", 'alpha'); diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 10e70545af6..bec2b772d58 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -41,7 +41,7 @@ $snom = GETPOST("snom", 'alpha'); $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $type = GETPOSTISSET('type') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT; $search_barcode = GETPOST("search_barcode", 'alpha'); -$toolowstock = GETPOST('toolowstock'); +$search_toolowstock = GETPOST('search_toolowstock'); $tosell = GETPOST("tosell"); $tobuy = GETPOST("tobuy"); $fourn_id = GETPOST("fourn_id", 'int'); @@ -116,7 +116,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $tobuy = ""; $search_sale = ""; $search_categ = ""; - $toolowstock = ''; + $search_toolowstock = ''; $fourn_id = ''; $sbarcode = ''; $search_stock_physique = ''; @@ -210,7 +210,7 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldSelect', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql_having = ''; -if ($toolowstock) { +if ($search_toolowstock) { $sql_having .= " HAVING SUM(".$db->ifsql('s.reel IS NULL', '0', 's.reel').") < p.seuil_stock_alerte"; } if ($search_stock_physique != '') { @@ -296,8 +296,8 @@ if ($resql) { if ($search_categ > 0) { $param .= "&search_categ=".urlencode($search_categ); } - if ($toolowstock) { - $param .= "&toolowstock=".urlencode($toolowstock); + if ($search_toolowstock) { + $param .= "&search_toolowstock=".urlencode($search_toolowstock); } if ($sbarcode) { $param .= "&sbarcode=".urlencode($sbarcode); @@ -336,7 +336,7 @@ if ($resql) { } $moreforfilter .= '
'; - $moreforfilter .= $langs->trans("StockTooLow").' '; + $moreforfilter .= ''; $moreforfilter .= '
'; if (!empty($moreforfilter)) { diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index a39dc246772..87a49e1bce1 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -52,7 +52,8 @@ $type = GETPOSTISSET('type') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT; $search_barcode = GETPOST("search_barcode", 'alpha'); $search_warehouse = GETPOST('search_warehouse', 'alpha'); $search_batch = GETPOST('search_batch', 'alpha'); -$toolowstock = GETPOST('toolowstock'); +$search_toolowstock = GETPOST('search_toolowstock'); +$search_subjecttolotserial = GETPOST('search_subjecttolotserial'); $tosell = GETPOST("tosell"); $tobuy = GETPOST("tobuy"); $fourn_id = GETPOST("fourn_id", 'int'); @@ -173,7 +174,8 @@ if (empty($reshook)) { $tobuy = ""; $search_sale = ""; $search_categ = ""; - $toolowstock = ''; + $search_toolowstock = ''; + $search_subjecttolotserial = ''; $search_batch = ''; $search_warehouse = ''; $fourn_id = ''; @@ -252,6 +254,9 @@ if (dol_strlen($type)) { $sql .= " AND p.fk_product_type <> '1'"; } } +if ($search_subjecttolotserial) { + $sql .= " AND p.tobatch > 0"; +} if ($sref) { $sql .= natural_search("p.ref", $sref); } @@ -318,7 +323,7 @@ $sql .= " e.ref, e.lieu, e.fk_parent,"; $sql .= " pb.batch, pb.eatby, pb.sellby,"; $sql .= " pl.rowid, pl.eatby, pl.sellby"; $sql_having = ''; -if ($toolowstock) { +if ($search_toolowstock) { $sql_having .= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet } if ($search_stock_physique != '') { @@ -437,8 +442,11 @@ if ($sbarcode) { if ($search_warehouse) { $param .= "&search_warehouse=".urlencode($search_warehouse); } -if ($toolowstock) { - $param .= "&toolowstock=".urlencode($toolowstock); +if ($search_toolowstock) { + $param .= "&search_toolowstock=".urlencode($search_toolowstock); +} +if ($search_subjecttolotserial) { + $param .= "&search_subjecttolotserial=".urlencode($search_subjecttolotserial); } if ($search_sale) { $param .= "&search_sale=".urlencode($search_sale); @@ -487,7 +495,7 @@ if (!empty($conf->categorie->enabled)) { $moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ', 1); $moreforfilter .= ''; } -//$moreforfilter.=$langs->trans("StockTooLow").' '; +$moreforfilter.=''; if (!empty($moreforfilter)) { print '
'; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index f395173b327..04e32a80c5d 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -2040,7 +2040,6 @@ class Project extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) @@ -2056,10 +2055,14 @@ class Project extends CommonObject // For external user, no check is done on company because readability is managed by public status of project and assignement. //$socid=$user->socid; - $projectsListId = null; - if (empty($user->rights->projet->all->lire)) { - $projectsListId = $this->getProjectsAuthorizedForUser($user, 0, 1); - } + $response = new WorkboardResponse(); + $response->warning_delay = $conf->project->warning_delay / 60 / 60 / 24; + $response->label = $langs->trans("OpenedProjects"); + $response->labelShort = $langs->trans("Opened"); + $response->url = DOL_URL_ROOT.'/projet/list.php?search_project_user=-1&search_status=1&mainmenu=project'; + $response->img = img_object('', "projectpub"); + $response->nbtodo = 0; + $response->nbtodolate = 0; $sql = "SELECT p.rowid, p.fk_statut as status, p.fk_opp_status, p.datee as datee"; $sql .= " FROM (".MAIN_DB_PREFIX."projet as p"; @@ -2069,9 +2072,19 @@ class Project extends CommonObject //if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; $sql .= " WHERE p.fk_statut = 1"; $sql .= " AND p.entity IN (".getEntity('project').')'; - if (!empty($projectsListId)) { + + + $projectsListId = null; + if (!$user->rights->projet->all->lire) { + $response->url = DOL_URL_ROOT.'/projet/list.php?search_status=1&mainmenu=project'; + $projectsListId = $this->getProjectsAuthorizedForUser($user, 0, 1); + if (empty($projectsListId)) { + return $response; + } + $sql .= " AND p.rowid IN (".$this->db->sanitize($projectsListId).")"; } + // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".((int) $socid).")"; // For external user, no check is done on company permission because readability is managed by public status of project and assignement. @@ -2082,16 +2095,6 @@ class Project extends CommonObject if ($resql) { $project_static = new Project($this->db); - $response = new WorkboardResponse(); - $response->warning_delay = $conf->project->warning_delay / 60 / 60 / 24; - $response->label = $langs->trans("OpenedProjects"); - $response->labelShort = $langs->trans("Opened"); - if ($user->rights->projet->all->lire) { - $response->url = DOL_URL_ROOT.'/projet/list.php?search_status=1&mainmenu=project'; - } else { - $response->url = DOL_URL_ROOT.'/projet/list.php?search_project_user=-1&search_status=1&mainmenu=project'; - } - $response->img = img_object('', "projectpub"); // This assignment in condition is not a bug. It allows walking the results. while ($obj = $this->db->fetch_object($resql)) { @@ -2107,12 +2110,11 @@ class Project extends CommonObject } return $response; - } else { - $this->error = $this->db->error(); - return -1; } - } + $this->error = $this->db->error(); + return -1; + } /** * Function used to replace a thirdparty id with another one. diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php index 9b2314deacc..f1295c10424 100644 --- a/htdocs/projet/class/projectstats.class.php +++ b/htdocs/projet/class/projectstats.class.php @@ -528,4 +528,22 @@ class ProjectStats extends Stats // var_dump($res);print '
'; return $res; } + + /** + * Return average of entity by month + * @param int $year year number + * @return int value + */ + protected function getAverageByMonth($year) + { + $sql = "SELECT date_format(datef,'%m') as dm, AVG(f.".$this->field.")"; + $sql .= " FROM ".$this->from; + $sql .= $this->join; + $sql .= " WHERE f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'"; + $sql .= " AND ".$this->where; + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'DESC'); + + return $this->_getAverageByMonth($year, $sql); + } } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index c1e18d60309..7cfb66288e1 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -199,7 +199,7 @@ foreach ($object->fields as $key => $val) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; // Add non object fields to fields for list -$arrayfields['s.nom'] = array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>21, 'enabled'=>(empty($conf->societe->enabled) ? 0 : 1)); +$arrayfields['s.nom'] = array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'position'=>21, 'enabled'=>(!isModEnabled('societe') ? 0 : 1)); $arrayfields['s.name_alias'] = array('label'=>"AliasNameShort", 'checked'=>0, 'position'=>22); $arrayfields['commercial'] = array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>0, 'position'=>23); $arrayfields['c.assigned'] = array('label'=>$langs->trans("AssignedTo"), 'checked'=>-1, 'position'=>120); diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php index 9178d37ddc6..a50892c9e08 100644 --- a/htdocs/public/partnership/new.php +++ b/htdocs/public/partnership/new.php @@ -67,7 +67,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); $action = GETPOST('action', 'aZ09'); // Load translation files -$langs->loadLangs(array("main", "members", "companies", "install", "other")); +$langs->loadLangs(array("main", "members", "partnership", "companies", "install", "other")); // Security check if (empty($conf->partnership->enabled)) { @@ -178,10 +178,10 @@ if (empty($reshook) && $action == 'add') { $db->begin(); - /*if (GETPOST('typeid') <= 0) { + if (GETPOST('partnershiptype', 'int') <= 0) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"))."
\n"; - }*/ + } if (!GETPOST('societe')) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("societe"))."
\n"; @@ -208,7 +208,6 @@ if (empty($reshook) && $action == 'add') { if (!$error) { $partnership = new Partnership($db); - $partnershipt = new PartnershipType($db); // We try to find the thirdparty or the member if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty') == 'thirdparty') { @@ -217,47 +216,27 @@ if (empty($reshook) && $action == 'add') { $partnership->fk_soc = 0; } - $partnership->status = 0; - $partnership->note_private = GETPOST('note_private'); - $partnership->date_creation = dol_now(); + $partnership->status = 0; + $partnership->note_private = GETPOST('note_private'); + $partnership->date_creation = dol_now(); $partnership->date_partnership_start = dol_now(); - $partnership->fk_user_creat = 0; - - /*$partnershipt->fetch(0, 'default'); - if ($partnershipt->id > 0) { - $partnership->fk_type = $partnershipt->id; - }*/ - $partnership->fk_type = GETPOST('partnershiptype', 'int'); - - //$partnership->firstname = GETPOST('firstname'); - //$partnership->lastname = GETPOST('lastname'); - //$partnership->address = GETPOST('address'); - //$partnership->zip = GETPOST('zipcode'); - //$partnership->town = GETPOST('town'); - //$partnership->email = GETPOST('email'); - //$partnership->country_id = GETPOST('country_id', 'int'); - //$partnership->state_id = GETPOST('state_id', 'int'); - //$partnership->typeid = $conf->global->PARTNERSHIP_NEWFORM_FORCETYPE ? $conf->global->PARTNERSHIP_NEWFORM_FORCETYPE : GETPOST('typeid', 'int'); + $partnership->fk_user_creat = 0; + $partnership->fk_type = GETPOST('partnershiptype', 'int'); + //$partnership->typeid = $conf->global->PARTNERSHIP_NEWFORM_FORCETYPE ? $conf->global->PARTNERSHIP_NEWFORM_FORCETYPE : GETPOST('typeid', 'int'); // test if societe already exist - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe WHERE nom='".$db->escape(GETPOST('societe'))."'"; - $result = $db->query($sql); - if ($result) { - $num = $db->num_rows($result); - } - if ($num = 0) { // si il ya pas d'entree sur le nom on teste l'email - $sql1 = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe WHERE email='".$db->escape(GETPOST('email'))."'"; - $result1 = $db->query($sql1); - if ($result1) { - $num1 = $db->num_rows($result1); - } - if ($num1 != 0) { + $company = new Societe($db); + $result = $company->fetch(0, GETPOST('societe')); + if ($result == 0) { // si il ya pas d'entree sur le nom on teste l'email + $result1 = $company->fetch(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, GETPOST('email')); + if ($result1 > 0) { $error++; - $errmsg = "email already exists please rewrite your company name"; + $errmsg = $langs->trans("EmailAlreadyExistsPleaseRewriteYourCompanyName"); } else { //create thirdparty $company = new Societe($db); + $company->name = GETPOST('societe'); $company->address = GETPOST('address'); $company->zip = GETPOST('zipcode'); $company->town = GETPOST('town'); @@ -274,12 +253,34 @@ if (empty($reshook) && $action == 'add') { $partnership->fk_soc = $company->id; } - } elseif ($num > 1) { + } elseif ($result == -2) { $error++; - $errmsg = 'more than one entry exist for this company please contact us to complete your partnership request'; + $errmsg = $langs->trans("TwoRecordsOfCompanyName"); } else { - $company = $db->fetch_object($result); - $partnership->fk_soc = $company->rowid; + $partnership->fk_soc = $company->id; + // update thirdparty fields + if (empty($company->address)) { + $company->address = GETPOST('address'); + } + if (empty($company->zip)) { + $company->zip = GETPOST('zipcode'); + } + if (empty($company->town)) { + $company->town = GETPOST('town'); + } + if (empty($company->country_id)) { + $company->country_id = GETPOST('country_id', 'int'); + } + if (empty($company->email)) { + $company->email = GETPOST('email'); + } + if (empty($company->state_id)) { + $company->state_id = GETPOST('state_id', 'int'); + } + if (empty($company->name_alias)) { + $company->name_alias = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname')); + } + $company->update(0); } // Fill array 'array_options' with data from add form diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index b92dcbf9824..2eaa51ac2fe 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -217,7 +217,13 @@ if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumb if ($urllogo) { print '
'; print '
'; + if (!empty($mysoc->url)) { + print ''; + } print ''; + if (!empty($mysoc->url)) { + print ''; + } print '
'; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { print ''; diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 4defe2be01f..7ebbdb05af3 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -22,9 +22,10 @@ * \brief Display public form to add new ticket */ +/* We need object $user->default_values if (!defined('NOREQUIREUSER')) { define('NOREQUIREUSER', '1'); -} +}*/ if (!defined('NOTOKENRENEWAL')) { define('NOTOKENRENEWAL', '1'); } @@ -37,9 +38,6 @@ if (!defined('NOREQUIREHTML')) { if (!defined('NOLOGIN')) { define("NOLOGIN", 1); // This means this output page does not require to be logged. } -if (!defined('NOCSRFCHECK')) { - define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. -} if (!defined('NOIPCHECK')) { define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip } @@ -75,6 +73,9 @@ $socid = GETPOST('socid', 'int'); $suffix = ""; $action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); + +$backtopage = ''; // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('publicnewticketcard', 'globalcard')); @@ -107,298 +108,265 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } // Add file in email form -if (empty($reshook) && GETPOST('addfile', 'alpha') && !GETPOST('save', 'alpha')) { - ////$res = $object->fetch('','',GETPOST('track_id')); - ////if($res > 0) - ////{ - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +if (empty($reshook)) { + if ($cancel) { + $backtopage = DOL_URL_ROOT.'/public/ticket/index.php'; - // Set tmp directory TODO Use a dedicated directory for temp mails files - $vardir = $conf->ticket->dir_output; - $upload_dir_tmp = $vardir.'/temp/'.session_id(); - if (!dol_is_dir($upload_dir_tmp)) { - dol_mkdir($upload_dir_tmp); + header("Location: ".$backtopage); + exit; } - dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, '', 0); - $action = 'create_ticket'; - ////} -} + if (GETPOST('addfile', 'alpha') && !GETPOST('save', 'alpha')) { + ////$res = $object->fetch('','',GETPOST('track_id')); + ////if($res > 0) + ////{ + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -// Remove file -if (empty($reshook) && GETPOST('removedfile', 'alpha') && !GETPOST('save', 'alpha')) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + // Set tmp directory TODO Use a dedicated directory for temp mails files + $vardir = $conf->ticket->dir_output; + $upload_dir_tmp = $vardir.'/temp/'.session_id(); + if (!dol_is_dir($upload_dir_tmp)) { + dol_mkdir($upload_dir_tmp); + } - // Set tmp directory - $vardir = $conf->ticket->dir_output.'/'; - $upload_dir_tmp = $vardir.'/temp/'.session_id(); + dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, '', 0); + $action = 'create_ticket'; + ////} + } - // TODO Delete only files that was uploaded from email form - dol_remove_file_process(GETPOST('removedfile'), 0, 0); - $action = 'create_ticket'; -} + // Remove file + if (GETPOST('removedfile', 'alpha') && !GETPOST('save', 'alpha')) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) { - $error = 0; - $origin_email = GETPOST('email', 'alpha'); - if (empty($origin_email)) { - $error++; - array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email"))); - $action = ''; - } else { - // Search company saved with email - $searched_companies = $object->searchSocidByEmail($origin_email, '0'); + // Set tmp directory + $vardir = $conf->ticket->dir_output.'/'; + $upload_dir_tmp = $vardir.'/temp/'.session_id(); - // Chercher un contact existant avec cette adresse email - // Le premier contact trouvé est utilisé pour déterminer le contact suivi - $contacts = $object->searchContactByEmail($origin_email); + // TODO Delete only files that was uploaded from email form + dol_remove_file_process(GETPOST('removedfile'), 0, 0); + $action = 'create_ticket'; + } - // Option to require email exists to create ticket - if (!empty($conf->global->TICKET_EMAIL_MUST_EXISTS) && !$contacts[0]->socid) { + if ($action == 'create_ticket' && GETPOST('save', 'alpha')) { + $error = 0; + $origin_email = GETPOST('email', 'alpha'); + if (empty($origin_email)) { $error++; - array_push($object->errors, $langs->trans("ErrorEmailMustExistToCreateTicket")); + array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email"))); $action = ''; - } - } + } else { + // Search company saved with email + $searched_companies = $object->searchSocidByEmail($origin_email, '0'); - $contact_lastname = ''; - $contact_firstname = ''; - $company_name = ''; - $contact_phone = ''; - if ($with_contact) { - // set linked contact to add in form - if (is_array($contacts) && count($contacts) == 1) { - $with_contact = current($contacts); - } + // Chercher un contact existant avec cette adresse email + // Le premier contact trouvé est utilisé pour déterminer le contact suivi + $contacts = $object->searchContactByEmail($origin_email); - // check mandatory fields on contact - $contact_lastname = trim(GETPOST('contact_lastname', 'alphanohtml')); - $contact_firstname = trim(GETPOST('contact_firstname', 'alphanohtml')); - $company_name = trim(GETPOST('company_name', 'alphanohtml')); - $contact_phone = trim(GETPOST('contact_phone', 'alphanohtml')); - if (!($with_contact->id > 0)) { - // check lastname - if (empty($contact_lastname)) { + // Option to require email exists to create ticket + if (!empty($conf->global->TICKET_EMAIL_MUST_EXISTS) && !$contacts[0]->socid) { $error++; - array_push($object->errors, $langs->trans('ErrorFieldRequired', $langs->transnoentities('Lastname'))); - $action = ''; - } - // check firstname - if (empty($contact_firstname)) { - $error++; - array_push($object->errors, $langs->trans('ErrorFieldRequired', $langs->transnoentities('Firstname'))); + array_push($object->errors, $langs->trans("ErrorEmailMustExistToCreateTicket")); $action = ''; } } - } - if (!GETPOST("subject", "restricthtml")) { - $error++; - array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject"))); - $action = ''; - } - if (!GETPOST("message", "restricthtml")) { - $error++; - array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Message"))); - $action = ''; - } + $contact_lastname = ''; + $contact_firstname = ''; + $company_name = ''; + $contact_phone = ''; + if ($with_contact) { + // set linked contact to add in form + if (is_array($contacts) && count($contacts) == 1) { + $with_contact = current($contacts); + } - // Check email address - if (!empty($origin_email) && !isValidEmail($origin_email)) { - $error++; - array_push($object->errors, $langs->trans("ErrorBadEmailAddress", $langs->transnoentities("email"))); - $action = ''; - } + // check mandatory fields on contact + $contact_lastname = trim(GETPOST('contact_lastname', 'alphanohtml')); + $contact_firstname = trim(GETPOST('contact_firstname', 'alphanohtml')); + $company_name = trim(GETPOST('company_name', 'alphanohtml')); + $contact_phone = trim(GETPOST('contact_phone', 'alphanohtml')); + if (!($with_contact->id > 0)) { + // check lastname + if (empty($contact_lastname)) { + $error++; + array_push($object->errors, $langs->trans('ErrorFieldRequired', $langs->transnoentities('Lastname'))); + $action = ''; + } + // check firstname + if (empty($contact_firstname)) { + $error++; + array_push($object->errors, $langs->trans('ErrorFieldRequired', $langs->transnoentities('Firstname'))); + $action = ''; + } + } + } - // Check Captcha code if is enabled - if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) || !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA_TICKET)) { - $sessionkey = 'dol_antispam_value'; - $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) === strtolower(GETPOST('code', 'restricthtml')))); - if (!$ok) { + if (!GETPOST("subject", "restricthtml")) { $error++; - array_push($object->errors, $langs->trans("ErrorBadValueForCode")); + array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject"))); $action = ''; } - } - - if (!$error) { - $object->db->begin(); - - $object->track_id = generate_random_id(16); - - $object->subject = GETPOST("subject", "restricthtml"); - $object->message = GETPOST("message", "restricthtml"); - $object->origin_email = $origin_email; - - $object->type_code = GETPOST("type_code", 'aZ09'); - $object->category_code = GETPOST("category_code", 'aZ09'); - $object->severity_code = GETPOST("severity_code", 'aZ09'); - - if (!is_object($user)) { - $user = new User($db); + if (!GETPOST("message", "restricthtml")) { + $error++; + array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Message"))); + $action = ''; } - // create third-party with contact - $usertoassign = 0; - if ($with_contact && !($with_contact->id > 0)) { - $company = new Societe($db); - if (!empty($company_name)) { - $company->name = $company_name; - } else { - $company->particulier = 1; - $company->name = dolGetFirstLastname($contact_firstname, $contact_lastname); - } - $result = $company->create($user); - if ($result < 0) { + // Check email address + if (!empty($origin_email) && !isValidEmail($origin_email)) { + $error++; + array_push($object->errors, $langs->trans("ErrorBadEmailAddress", $langs->transnoentities("email"))); + $action = ''; + } + + // Check Captcha code if is enabled + if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) || !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA_TICKET)) { + $sessionkey = 'dol_antispam_value'; + $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) === strtolower(GETPOST('code', 'restricthtml')))); + if (!$ok) { $error++; - $errors = ($company->error ? array($company->error) : $company->errors); - array_push($object->errors, $errors); + array_push($object->errors, $langs->trans("ErrorBadValueForCode")); + $action = ''; + } + } + + if (!$error) { + $object->db->begin(); + + $object->track_id = generate_random_id(16); + + $object->subject = GETPOST("subject", "restricthtml"); + $object->message = GETPOST("message", "restricthtml"); + $object->origin_email = $origin_email; + + $object->type_code = GETPOST("type_code", 'aZ09'); + $object->category_code = GETPOST("category_code", 'aZ09'); + $object->severity_code = GETPOST("severity_code", 'aZ09'); + + if (!is_object($user)) { + $user = new User($db); + } + + // create third-party with contact + $usertoassign = 0; + if ($with_contact && !($with_contact->id > 0)) { + $company = new Societe($db); + if (!empty($company_name)) { + $company->name = $company_name; + } else { + $company->particulier = 1; + $company->name = dolGetFirstLastname($contact_firstname, $contact_lastname); + } + $result = $company->create($user); + if ($result < 0) { + $error++; + $errors = ($company->error ? array($company->error) : $company->errors); + array_push($object->errors, $errors); + $action = 'create_ticket'; + } + + // create contact and link to this new company + if (!$error) { + $with_contact->email = $origin_email; + $with_contact->lastname = $contact_lastname; + $with_contact->firstname = $contact_firstname; + $with_contact->socid = $company->id; + $with_contact->phone_pro = $contact_phone; + $result = $with_contact->create($user); + if ($result < 0) { + $error++; + $errors = ($with_contact->error ? array($with_contact->error) : $with_contact->errors); + array_push($object->errors, $errors); + $action = 'create_ticket'; + } else { + $contacts = array($with_contact); + } + } + } + + if (is_array($searched_companies)) { + $object->fk_soc = $searched_companies[0]->id; + } + + if (is_array($contacts) and count($contacts) > 0) { + $object->fk_soc = $contacts[0]->socid; + $usertoassign = $contacts[0]->id; + } + + $ret = $extrafields->setOptionalsFromPost(null, $object); + + // Generate new ref + $object->ref = $object->getDefaultRef(); + + $object->context['disableticketemail'] = 1; // Disable emails sent by ticket trigger when creation is done from this page, emails are already sent later + + $id = $object->create($user); + if ($id <= 0) { + $error++; + $errors = ($object->error ? array($object->error) : $object->errors); + array_push($object->errors, $object->error ? array($object->error) : $object->errors); $action = 'create_ticket'; } - // create contact and link to this new company + if (!$error && $id > 0) { + if ($usertoassign > 0) { + $object->add_contact($usertoassign, "SUPPORTCLI", 'external', 0); + } + } + if (!$error) { - $with_contact->email = $origin_email; - $with_contact->lastname = $contact_lastname; - $with_contact->firstname = $contact_firstname; - $with_contact->socid = $company->id; - $with_contact->phone_pro = $contact_phone; - $result = $with_contact->create($user); - if ($result < 0) { - $error++; - $errors = ($with_contact->error ? array($with_contact->error) : $with_contact->errors); - array_push($object->errors, $errors); - $action = 'create_ticket'; - } else { - $contacts = array($with_contact); - } + $object->db->commit(); + $action = "infos_success"; + } else { + $object->db->rollback(); + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'create_ticket'; } - } - if (is_array($searched_companies)) { - $object->fk_soc = $searched_companies[0]->id; - } + if (!$error) { + $res = $object->fetch($id); + if ($res) { + // Create form object + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $formmail = new FormMail($db); - if (is_array($contacts) and count($contacts) > 0) { - $object->fk_soc = $contacts[0]->socid; - $usertoassign = $contacts[0]->id; - } + // Init to avoid errors + $filepath = array(); + $filename = array(); + $mimetype = array(); - $ret = $extrafields->setOptionalsFromPost(null, $object); + $attachedfiles = $formmail->get_attached_files(); + $filepath = $attachedfiles['paths']; + $filename = $attachedfiles['names']; + $mimetype = $attachedfiles['mimes']; - // Generate new ref - $object->ref = $object->getDefaultRef(); + // Send email to customer - $object->context['disableticketemail'] = 1; // Disable emails sent by ticket trigger when creation is done from this page, emails are already sent later + $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubject', $object->ref, $object->track_id); + $message = ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody')).'

'; + $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket').'
'; - $id = $object->create($user); - if ($id <= 0) { - $error++; - $errors = ($object->error ? array($object->error) : $object->errors); - array_push($object->errors, $object->error ? array($object->error) : $object->errors); - $action = 'create_ticket'; - } + $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; + $infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', ''.$object->track_id.'').'
'; + $infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl').'

'; - if (!$error && $id > 0) { - if ($usertoassign > 0) { - $object->add_contact($usertoassign, "SUPPORTCLI", 'external', 0); - } - } + $message .= $infos_new_ticket; + $message .= getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE', $langs->transnoentities('TicketMessageMailSignatureText', $mysoc->name)); - if (!$error) { - $object->db->commit(); - $action = "infos_success"; - } else { - $object->db->rollback(); - setEventMessages($object->error, $object->errors, 'errors'); - $action = 'create_ticket'; - } + $sendto = GETPOST('email', 'alpha'); - if (!$error) { - $res = $object->fetch($id); - if ($res) { - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $formmail = new FormMail($db); - - // Init to avoid errors - $filepath = array(); - $filename = array(); - $mimetype = array(); - - $attachedfiles = $formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - // Send email to customer - - $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubject', $object->ref, $object->track_id); - $message = ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody')).'

'; - $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket').'
'; - - $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; - $infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', ''.$object->track_id.'').'
'; - $infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl').'

'; - - $message .= $infos_new_ticket; - $message .= getDolGlobalString('TICKET_MESSAGE_MAIL_SIGNATURE', $langs->transnoentities('TicketMessageMailSignatureText', $mysoc->name)); - - $sendto = GETPOST('email', 'alpha'); - - $from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; - $replyto = $from; - $sendtocc = ''; - $deliveryreceipt = 0; - - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; - $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; - } - include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', 'tic'.$object->id, '', 'ticket'); - if ($mailfile->error || $mailfile->errors) { - setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - } else { - $result = $mailfile->sendfile(); - } - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; - } - - // Send email to TICKET_NOTIFICATION_EMAIL_TO - $sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; - if ($sendto) { - $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin', $object->ref, $object->track_id); - $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id).'

'; - $message_admin .= '
  • '.$langs->trans('Title').' : '.$object->subject.'
  • '; - $message_admin .= '
  • '.$langs->trans('Type').' : '.$object->type_label.'
  • '; - $message_admin .= '
  • '.$langs->trans('Category').' : '.$object->category_label.'
  • '; - $message_admin .= '
  • '.$langs->trans('Severity').' : '.$object->severity_label.'
  • '; - $message_admin .= '
  • '.$langs->trans('From').' : '.$object->origin_email.'
  • '; - // Extrafields - $extrafields->fetch_name_optionals_label($object->table_element); - if (is_array($object->array_options) && count($object->array_options) > 0) { - foreach ($object->array_options as $key => $value) { - $key = substr($key, 8); // remove "options_" - $message_admin .= '
  • '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' : '.$extrafields->showOutputField($key, $value, '', $object->table_element).'
  • '; - } - } - $message_admin .= '
'; - - $message_admin .= '

'.$langs->trans('Message').' :
'.$object->message.'

'; - $message_admin .= '

'.$langs->trans('SeeThisTicketIntomanagementInterface').'

'; - - $from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; + $from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM').'>'; $replyto = $from; + $sendtocc = ''; + $deliveryreceipt = 0; if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; } include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', 'tic'.$object->id, '', 'ticket'); + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', 'tic'.$object->id, '', 'ticket'); if ($mailfile->error || $mailfile->errors) { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); } else { @@ -407,36 +375,78 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) { if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; } + + // Send email to TICKET_NOTIFICATION_EMAIL_TO + $sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + if ($sendto) { + $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin', $object->ref, $object->track_id); + $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id).'

'; + $message_admin .= '
  • '.$langs->trans('Title').' : '.$object->subject.'
  • '; + $message_admin .= '
  • '.$langs->trans('Type').' : '.$object->type_label.'
  • '; + $message_admin .= '
  • '.$langs->trans('Category').' : '.$object->category_label.'
  • '; + $message_admin .= '
  • '.$langs->trans('Severity').' : '.$object->severity_label.'
  • '; + $message_admin .= '
  • '.$langs->trans('From').' : '.$object->origin_email.'
  • '; + // Extrafields + $extrafields->fetch_name_optionals_label($object->table_element); + if (is_array($object->array_options) && count($object->array_options) > 0) { + foreach ($object->array_options as $key => $value) { + $key = substr($key, 8); // remove "options_" + $message_admin .= '
  • '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' : '.$extrafields->showOutputField($key, $value, '', $object->table_element).'
  • '; + } + } + $message_admin .= '
'; + + $message_admin .= '

'.$langs->trans('Message').' :
'.$object->message.'

'; + $message_admin .= '

'.$langs->trans('SeeThisTicketIntomanagementInterface').'

'; + + $from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; + $replyto = $from; + + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; + $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; + } + include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', 'tic'.$object->id, '', 'ticket'); + if ($mailfile->error || $mailfile->errors) { + setEventMessages($mailfile->error, $mailfile->errors, 'errors'); + } else { + $result = $mailfile->sendfile(); + } + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; + } + } } - } - // Copy files into ticket directory - $destdir = $conf->ticket->dir_output.'/'.$object->ref; - if (!dol_is_dir($destdir)) { - dol_mkdir($destdir); - } - foreach ($filename as $i => $val) { - dol_move($filepath[$i], $destdir.'/'.$filename[$i], 0, 1); - $formmail->remove_attached_files($i); - } + // Copy files into ticket directory + $destdir = $conf->ticket->dir_output.'/'.$object->ref; + if (!dol_is_dir($destdir)) { + dol_mkdir($destdir); + } + foreach ($filename as $i => $val) { + dol_move($filepath[$i], $destdir.'/'.$filename[$i], 0, 1); + $formmail->remove_attached_files($i); + } - //setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs'); + //setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs'); - // Make a redirect to avoid to have ticket submitted twice if we make back - $messagetoshow = $langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '{s1}', '{s2}'); - $messagetoshow = str_replace(array('{s1}', '{s2}'), array(''.$object->track_id.'', ''.$object->ref.''), $messagetoshow); - setEventMessages($messagetoshow, null, 'warnings'); - setEventMessages($langs->trans('PleaseRememberThisId'), null, 'warnings'); - header("Location: index.php".(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'')); - exit; + // Make a redirect to avoid to have ticket submitted twice if we make back + $messagetoshow = $langs->trans('MesgInfosPublicTicketCreatedWithTrackId', '{s1}', '{s2}'); + $messagetoshow = str_replace(array('{s1}', '{s2}'), array(''.$object->track_id.'', ''.$object->ref.''), $messagetoshow); + setEventMessages($messagetoshow, null, 'warnings'); + setEventMessages($langs->trans('PleaseRememberThisId'), null, 'warnings'); + + header("Location: index.php".(!empty($entity) && isModEnabled('multicompany')?'?entity='.$entity:'')); + exit; + } + } else { + setEventMessages($object->error, $object->errors, 'errors'); } - } else { - setEventMessages($object->error, $object->errors, 'errors'); } } - /* * View */ @@ -468,6 +478,7 @@ if ($action != "infos_success") { $formticket->ispublic = 1; $formticket->withfile = 2; $formticket->action = 'create_ticket'; + $formticket->withcancel = 1; $formticket->param = array('returnurl' => $_SERVER['PHP_SELF'].($conf->entity > 1 ? '?entity='.$conf->entity : '')); @@ -480,7 +491,7 @@ if ($action != "infos_success") { print $langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentities("Ticket")); print '
'; } else { - print '
'.$langs->trans('TicketPublicInfoCreateTicket').'
'; + //print '
'.$langs->trans('TicketPublicInfoCreateTicket').'
'; $formticket->showForm(0, 'edit', 1, $with_contact); } } diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index bff53d91edb..2f4bd720219 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -22,9 +22,6 @@ * \brief Public page to add and manage ticket */ -if (!defined('NOCSRFCHECK')) { - define('NOCSRFCHECK', '1'); -} if (!defined('NOREQUIREMENU')) { define('NOREQUIREMENU', '1'); } @@ -83,11 +80,14 @@ $arrayofcss = array('/ticket/css/styles.css.php'); llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); print '
'; -print '

'.(getDolGlobalString("TICKET_PUBLIC_TEXT_HOME", $langs->trans("TicketPublicDesc"))).'

'; + +print '

'.(getDolGlobalString("TICKET_PUBLIC_TEXT_HOME", ''.$langs->trans("TicketPublicDesc")).'

')).'

'; +print '
'; + print ''; print '
'; diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index ec7698ceb00..7af60f50e83 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -21,10 +21,6 @@ * \brief Public file to list tickets */ -if (!defined('NOCSRFCHECK')) { - define('NOCSRFCHECK', '1'); -} -// Do not check anti CSRF attack test if (!defined('NOREQUIREMENU')) { define('NOREQUIREMENU', '1'); } @@ -60,8 +56,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $langs->loadLangs(array("companies", "other", "ticket")); // Get parameters -$track_id = GETPOST('track_id', 'alpha'); $action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); + +$track_id = GETPOST('track_id', 'alpha'); $email = strtolower(GETPOST('email', 'alpha')); if (GETPOST('btn_view_ticket_list')) { @@ -90,6 +88,13 @@ if (empty($conf->ticket->enabled)) { * Actions */ +if ($cancel) { + $backtopage = DOL_URL_ROOT.'/public/ticket/index.php'; + + header("Location: ".$backtopage); + exit; +} + if ($action == "view_ticketlist") { $error = 0; $display_ticket_list = false; @@ -185,9 +190,10 @@ $arrayofcss = array('/ticket/css/styles.css.php'); llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); -print '
'; if ($action == "view_ticketlist") { + print '
'; + print '
'; if ($display_ticket_list) { // Filters @@ -348,25 +354,25 @@ if ($action == "view_ticketlist") { } } $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as uc ON uc.rowid=t.fk_user_create"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as ua ON ua.rowid=t.fk_user_assign"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact as ec ON ec.element_id=t.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_contact as tc ON ec.fk_c_type_contact=tc.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople sp ON ec.fk_socpeople=sp.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code = t.type_code"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code = t.category_code"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code = t.severity_code"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as uc ON uc.rowid = t.fk_user_create"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as ua ON ua.rowid = t.fk_user_assign"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact as ec ON ec.element_id = t.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_contact as tc ON ec.fk_c_type_contact = tc.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople sp ON ec.fk_socpeople = sp.rowid"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."ticket_extrafields as ef on (t.rowid = ef.fk_object)"; } $sql .= " WHERE t.entity IN (".getEntity('ticket').")"; $sql .= " AND ((tc.source = 'external'"; $sql .= " AND tc.element='".$db->escape($object->element)."'"; - $sql .= " AND tc.active=1)"; - $sql .= " OR (sp.email='".$db->escape($_SESSION['email_customer'])."'"; - $sql .= " OR s.email='".$db->escape($_SESSION['email_customer'])."'"; - $sql .= " OR t.origin_email='".$db->escape($_SESSION['email_customer'])."'))"; + $sql .= " AND tc.active=1"; + $sql .= " AND sp.email='".$db->escape($_SESSION['email_customer'])."')"; // email found into an external contact + $sql .= " OR s.email='".$db->escape($_SESSION['email_customer'])."'"; // or email of the linked company + $sql .= " OR t.origin_email='".$db->escape($_SESSION['email_customer'])."')"; // or email of the requester // Manage filter if (!empty($filter)) { foreach ($filter as $key => $value) { @@ -704,12 +710,18 @@ if ($action == "view_ticketlist") { } '; } + } else { + dol_print_error($db); } } else { print ''; } + + print '
'; } else { - print '

'.$langs->trans("TicketPublicMsgViewLogIn").'

'; + print '
'; + + print '

'.$langs->trans("TicketPublicMsgViewLogIn").'

'; print '
'; print '
'; @@ -728,13 +740,15 @@ if ($action == "view_ticketlist") { print '

'; print ''; + print '   '; + print ''; print "

\n"; print "\n"; print "
\n"; -} -print "
"; + print "
"; +} // End of page htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix, $object); diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 50885cfc822..de76e2f9904 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -22,10 +22,6 @@ * \brief Public file to show one ticket */ -if (!defined('NOCSRFCHECK')) { - define('NOCSRFCHECK', '1'); -} -// Do not check anti CSRF attack test if (!defined('NOREQUIREMENU')) { define('NOREQUIREMENU', '1'); } @@ -61,9 +57,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $langs->loadLangs(array("companies", "other", "ticket")); // Get parameters -$track_id = GETPOST('track_id', 'alpha'); -$cancel = GETPOST('cancel', 'alpha'); $action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); + +$track_id = GETPOST('track_id', 'alpha'); $email = GETPOST('email', 'email'); if (GETPOST('btn_view_ticket')) { @@ -85,6 +82,8 @@ if (empty($conf->ticket->enabled)) { */ if ($cancel) { + $backtopage = DOL_URL_ROOT.'/public/ticket/index.php'; + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; @@ -406,6 +405,8 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a print '

'; print ''; + print '   '; + print ''; print "

\n"; print "\n"; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index e548beca63c..00f534a388c 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1454,7 +1454,7 @@ if ($action == 'create') { // Date creation print '
'.$langs->trans("DateCreation").''.dol_print_date($object->date_creation, "dayhour")."'.dol_print_date($object->date_creation, "dayhour", "tzuserrel")."
'; - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { print $formaccounting->select_account(getDolGlobalString($key), $key, 1, '', 1, 1); } else { print ''; diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index ce2ef50150d..d5ccbdec38f 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -35,14 +35,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/salaries.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } // Load translation files required by the page $langs->loadLangs(array("compta", "banks", "bills", "users", "salaries", "hrm", "trips")); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $langs->load("projects"); } @@ -441,7 +441,7 @@ if ($action == "update_extras" && !empty($user->rights->salaries->read)) { $form = new Form($db); $formfile = new FormFile($db); -if (!empty($conf->project->enabled)) $formproject = new FormProjets($db); +if (isModEnabled('project')) $formproject = new FormProjets($db); $title = $langs->trans('Salary')." - ".$langs->trans('Card'); $help_url = ""; @@ -559,7 +559,7 @@ if ($action == 'create') { print '
'.$langs->trans("Project").''; @@ -794,7 +794,7 @@ if ($id) { } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->salaries->write) { if ($action != 'classify') { @@ -979,7 +979,7 @@ if ($id) { $bankaccountstatic->number = $objp->banumber; $bankaccountstatic->currency_code = $objp->bacurrency_code; - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $bankaccountstatic->account_number = $objp->account_number; $accountingjournal = new AccountingJournal($db); @@ -992,7 +992,7 @@ if ($id) { print $bankaccountstatic->getNomUrl(1, 'transactions'); print '
'.price($objp->amount)."'.price($objp->amount)."
'.$langs->trans("AlreadyPaid")." :".price($totalpaid)."
'.$langs->trans("AmountExpected")." :".price($object->amount)."
'.$langs->trans("AlreadyPaid")." :".price($totalpaid)."
'.$langs->trans("AmountExpected")." :".price($object->amount)."
'.$langs->trans("RemainderToPay")." :'.price($resteapayer)."
'.price($resteapayer)."
"; print ''; diff --git a/htdocs/salaries/document.php b/htdocs/salaries/document.php index 971291580bf..eb4c63390a8 100644 --- a/htdocs/salaries/document.php +++ b/htdocs/salaries/document.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/salaries.lib.php'; require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -132,7 +132,7 @@ if ($action == 'setlabel' && $user->rights->salaries->write) { */ $form = new Form($db); -if (!empty($conf->project->enabled)) $formproject = new FormProjets($db); +if (isModEnabled('project')) $formproject = new FormProjets($db); $title = $langs->trans('Salary')." - ".$langs->trans('Documents'); $help_url = ""; @@ -176,7 +176,7 @@ if ($object->id) { $morehtmlref .= '
'.$langs->trans('Employee').' : '.$userstatic->getNomUrl(-1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->salaries->write) { if ($action != 'classify') { diff --git a/htdocs/salaries/info.php b/htdocs/salaries/info.php index a2f05b791a6..7c8962499ce 100644 --- a/htdocs/salaries/info.php +++ b/htdocs/salaries/info.php @@ -28,7 +28,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/salaries.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -100,7 +100,7 @@ if ($action == 'setlabel' && $user->rights->salaries->write) { * View */ -if (!empty($conf->project->enabled)) $formproject = new FormProjets($db); +if (isModEnabled('project')) $formproject = new FormProjets($db); $title = $langs->trans('Salary')." - ".$langs->trans('Info'); $help_url = ""; @@ -139,7 +139,7 @@ if ($action != 'editlabel') { $morehtmlref .= '
'.$langs->trans('Employee').' : '.$userstatic->getNomUrl(-1); // Project -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->salaries->write) { if ($action != 'classify') { diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 82a6199407e..dd44155ea5a 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -27,7 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; } @@ -591,7 +591,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $accountstatic->account_number = $obj->account_number; $accountstatic->clos = $obj->clos; - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $accountstatic->account_number = $obj->account_number; $accountingjournal = new AccountingJournal($db); diff --git a/htdocs/salaries/payment_salary/card.php b/htdocs/salaries/payment_salary/card.php index f5e8d465378..3e41e4269f6 100644 --- a/htdocs/salaries/payment_salary/card.php +++ b/htdocs/salaries/payment_salary/card.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'; -if (isModEnabled("banque")) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array('bills', 'banks', 'companies', 'salaries')); diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index e7a1e02e1e7..6893d701d96 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -28,7 +28,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; -if (!empty($conf->accounting->enabled)) { +if (isModEnabled('accounting')) { require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; } @@ -625,7 +625,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $accountstatic->currency_code = $langs->trans("Currency".$obj->currency_code); $accountstatic->clos = $obj->clos; - if (!empty($conf->accounting->enabled)) { + if (isModEnabled('accounting')) { $accountstatic->account_number = $obj->account_number; $accountingjournal = new AccountingJournal($db); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 5d557d30a02..06fdbfba0a5 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -34,6 +34,8 @@ * \brief Third party card page */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; @@ -62,7 +64,10 @@ if (! empty($conf->eventorganization->enabled)) { } +// Load translation files required by the page + $langs->loadLangs(array("companies", "commercial", "bills", "banks", "users")); + if (!empty($conf->adherent->enabled)) { $langs->load("members"); } @@ -81,13 +86,15 @@ if (!empty($conf->accounting->enabled)) { $error = 0; $errors = array(); + +// Get parameters $action = (GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'); $cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); $backtopagejsfields = GETPOST('backtopagejsfields', 'alpha'); $dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09'); -$confirm = GETPOST('confirm', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); if ($user->socid) { @@ -96,6 +103,7 @@ if ($user->socid) { if (empty($socid) && $action == 'view') { $action = 'create'; } + $id = $socid; $object = new Societe($db); @@ -128,12 +136,13 @@ if (!empty($canvas)) { $objcanvas->getCanvas('thirdparty', 'card', $canvas); } -$permissiontoread = $user->rights->societe->lire; -$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +// Permissions +$permissiontoread = $user->rights->societe->lire; +$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->societe->supprimer || ($permissiontoadd && isset($object->status) && $object->status == 0); -$permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->societe->creer; // Used by the include of actions_dellink.inc.php -$upload_dir = $conf->societe->multidir_output[isset($object->entity) ? $object->entity : 1]; +$permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->societe->creer; // Used by the include of actions_dellink.inc.php +$upload_dir = $conf->societe->multidir_output[isset($object->entity) ? $object->entity : 1]; // Security check $result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0); diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index a7b78174cf1..f2357c96a16 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -550,7 +550,7 @@ class Thirdparties extends DolibarrApi { global $conf; - if (empty($conf->societe->enabled)) { + if (!isModEnabled('societe')) { throw new RestException(501, 'Module "Thirdparties" needed for this request'); } diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 03c78a0c07b..53408fd00ff 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -26,12 +26,18 @@ * \brief Add a tab on thirdparty view to list all products/services bought or sells by thirdparty */ +// Load Dolibarr environment require "../main.inc.php"; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array("companies", "bills", "orders", "suppliers", "propal", "interventions", "contracts", "products")); + + $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'thirdpartylist'; // Security check @@ -46,11 +52,11 @@ if ($socid > 0) { } // Sort & Order fields -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -$optioncss = GETPOST('optioncss', 'alpha'); +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +$optioncss = GETPOST('optioncss', 'alpha'); if (empty($page) || $page == -1) { $page = 0; @@ -78,12 +84,11 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $year = ''; $month = ''; } + // Customer or supplier selected in drop box $thirdTypeSelect = GETPOST("third_select_id", 'az09'); $type_element = GETPOST('type_element') ? GETPOST('type_element') : ''; -// Load translation files required by the page -$langs->loadLangs(array("companies", "bills", "orders", "suppliers", "propal", "interventions", "contracts", "products")); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('consumptionthirdparty', 'globalcard')); diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index 4ecfc2a8cf4..1bc64658735 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -31,6 +31,7 @@ * \brief Page of contacts of thirdparties */ +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; @@ -46,7 +47,9 @@ if (!empty($conf->adherent->enabled)) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; } +// Load translation files required by the page $langs->loadLangs(array("companies", "commercial", "bills", "banks", "users")); + if (!empty($conf->categorie->enabled)) { $langs->load("categories"); } @@ -59,18 +62,23 @@ if (!empty($conf->notification->enabled)) { $mesg = ''; $error = 0; $errors = array(); + +// Get parameters $action = (GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'); -$cancel = GETPOST('cancel', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); -$confirm = GETPOST('confirm'); -$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); +$confirm = GETPOST('confirm'); +$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); + if ($user->socid) { $socid = $user->socid; } + if (empty($socid) && $action == 'view') { $action = 'create'; } +// Initialize objects $object = new Societe($db); $extrafields = new ExtraFields($db); diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 707c573f116..92c7efb63d9 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -26,30 +26,36 @@ * \ingroup societe */ +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + +// Load translation files required by the page $langs->loadLangs(array("companies", "other")); -$action = GETPOST('action', 'aZ09'); -$confirm = GETPOST('confirm'); -$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); -$ref = GETPOST('ref', 'alpha'); // Get parameters -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +$action = GETPOST('action', 'aZ09'); +$confirm = GETPOST('confirm'); +$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int')); +$ref = GETPOST('ref', 'alpha'); + +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); + if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 -$offset = $limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; + +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; if (!empty($conf->global->MAIN_DOC_SORT_FIELD)) { $sortfield = $conf->global->MAIN_DOC_SORT_FIELD; @@ -65,6 +71,7 @@ if (!$sortfield) { $sortfield = "position_name"; } +// Initialize objects $object = new Societe($db); if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref); diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index a13d8a3de99..c90dc1537d1 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -27,16 +27,21 @@ * \brief Home page for third parties area */ +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -$hookmanager = new HookManager($db); + +// Load translation files required by the page +$langs->load("companies"); + // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager = new HookManager($db); $hookmanager->initHooks(array('thirdpartiesindex')); -$langs->load("companies"); + $socid = GETPOST('socid', 'int'); if ($user->socid) { @@ -51,6 +56,7 @@ $thirdparty_static = new Societe($db); if (!isset($form) || !is_object($form)) { $form = new Form($db); } + // Load $resultboxes $resultboxes = FormOther::getBoxesArea($user, "3"); @@ -150,7 +156,7 @@ if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) + if (isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS)) { $dataseries[] = array($langs->trans("Customers"), round($third['customer'])); } - if ((($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled('supplier_order') && $user->rights->supplier_order->lire) || (isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) { + if (((isModEnabled('fournisseur') && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled('supplier_order') && $user->rights->supplier_order->lire) || (isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) { $dataseries[] = array($langs->trans("Suppliers"), round($third['supplier'])); } if (isModEnabled('societe')) { diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index bf3ec6eb041..c8f0045d619 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -34,6 +34,8 @@ * \brief Page to show list of third parties */ + +// Load Dolibarr environment require_once '../main.inc.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; @@ -42,20 +44,27 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; + +// Load translation files required by the page $langs->loadLangs(array("companies", "commercial", "customers", "suppliers", "bills", "compta", "categories", "cashdesk")); -$action = GETPOST('action', 'aZ09'); + +// Get parameters +$action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); -$confirm = GETPOST('confirm', 'alpha'); -$toselect = GETPOST('toselect', 'array'); +$confirm = GETPOST('confirm', 'alpha'); +$toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'thirdpartylist'; -$optioncss = GETPOST('optioncss', 'alpha'); +$optioncss = GETPOST('optioncss', 'alpha'); + if ($contextpage == 'poslist') { $optioncss = 'print'; } + $mode = GETPOST("mode", 'alpha'); +// search fields $search_all = trim(GETPOST('search_all', 'alphanohtml') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_cti = preg_replace('/^0+/', '', preg_replace('/[^0-9]/', '', GETPOST('search_cti', 'alphanohtml'))); // Phone number without any special chars @@ -98,6 +107,7 @@ $search_stcomm = GETPOST('search_stcomm', 'int'); $search_import_key = trim(GETPOST("search_import_key", "alpha")); $search_parent_name = trim(GETPOST('search_parent_name', 'alpha')); + $type = GETPOST('type', 'alpha'); $place = GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : '0'; // $place is string id of table for Bar or Restaurant diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index b932fb11595..dabc5d7e39e 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -26,20 +26,28 @@ * \ingroup societe */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -$action = GETPOST('action', 'aZ09'); +// Load translation files required by the page $langs->load("companies"); -$id = GETPOST('id') ?GETPOST('id', 'int') : GETPOST('socid', 'int'); +// Get parameters +$id = GETPOST('id') ?GETPOST('id', 'int') : GETPOST('socid', 'int'); +$action = GETPOST('action', 'aZ09'); + + +// Initialize objects $object = new Societe($db); if ($id > 0) { $object->fetch($id); } +// Permissions $permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -50,6 +58,7 @@ if ($user->socid > 0) { unset($action); $socid = $user->socid; } + $result = restrictedArea($user, 'societe', $object->id, '&societe'); diff --git a/htdocs/societe/partnership.php b/htdocs/societe/partnership.php index d9b3d3127f9..4e0552d3c15 100644 --- a/htdocs/societe/partnership.php +++ b/htdocs/societe/partnership.php @@ -121,7 +121,7 @@ $result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid * Actions */ -$parameters = array(); +$parameters = array('socid' => $id); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 2c2c125530b..5b9bd1046ef 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -29,6 +29,8 @@ * \brief Tab of payment modes for the customer */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; @@ -40,8 +42,11 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; + +// Load translation files required by the page $langs->loadLangs(array("companies", "commercial", "banks", "bills", 'paypal', 'stripe', 'withdrawals')); + // Security check $socid = GETPOST("socid", "int"); if ($user->socid) { @@ -49,12 +54,15 @@ if ($user->socid) { } $result = restrictedArea($user, 'societe', '', ''); + +// Get parameters $id = GETPOST("id", "int"); $source = GETPOST("source", "alpha"); // source can be a source or a paymentmode $ribid = GETPOST("ribid", "int"); $action = GETPOST("action", 'alpha', 3); $cancel = GETPOST('cancel', 'alpha'); +// Initialize objects $object = new Societe($db); $object->fetch($socid); @@ -70,6 +78,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('thirdpartybancard', 'globalcard')); +// Permissions $permissiontoread = $user->rights->societe->lire; $permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_builddoc.inc.php diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 314fb663631..a9f17f4b50a 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -26,6 +26,8 @@ * \brief Page to show product prices by customer */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -38,13 +40,17 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $prodcustprice = new Productcustomerprice($db); } + +// Load translation files required by the page $langs->loadLangs(array("products", "companies", "bills")); -$action = GETPOST('action', 'aZ09'); -$search_prod = GETPOST('search_prod', 'alpha'); -$cancel = GETPOST('cancel', 'alpha'); -$search_label = GETPOST('search_label', 'alpha'); -$search_price = GETPOST('search_price'); + +// Get parameters +$action = GETPOST('action', 'aZ09'); +$search_prod = GETPOST('search_prod', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$search_label = GETPOST('search_label', 'alpha'); +$search_price = GETPOST('search_price'); $search_price_ttc = GETPOST('search_price_ttc'); // Security check @@ -54,6 +60,7 @@ if ($user->socid) { } $result = restrictedArea($user, 'societe', $socid, '&societe'); +// Initialize objects $object = new Societe($db); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php index ef68a03ab78..f704273db60 100644 --- a/htdocs/societe/project.php +++ b/htdocs/societe/project.php @@ -28,11 +28,14 @@ * \brief Page of third party projects */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -$langs->loadLangs(array("companies", "projects")); +// Load translation files required by the page +$langs->loadLangs(array('companies', 'projects')); // Security check $socid = GETPOST('socid', 'int'); diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index b1e5174820c..a061933ba11 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -26,14 +26,18 @@ * \brief Onglet de gestion des contacts additionnel d'une société */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -$langs->loadLangs(array("orders", "companies")); +// Load translation files required by the page +$langs->loadLangs(array('companies', 'orders')); +// Get parameters $id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('socid', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); @@ -62,6 +66,8 @@ if ($user->socid) { } $result = restrictedArea($user, 'societe', $id, ''); + +// Initialize objects $object = new Societe($db); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 2d346282c4c..424d18c2058 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -28,6 +28,8 @@ * \brief Page of web sites accounts */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; @@ -35,13 +37,17 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; + +// Load translation files required by the page $langs->loadLangs(array("companies", "website")); -$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... -$show_files = GETPOST('show_files', 'int'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'websitelist'; // To manage different context of search -$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page -$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') + +// Get parameters +$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$show_files = GETPOST('show_files', 'int'); +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'websitelist'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') // Security check $id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('socid', 'int'); diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index db6d6c8c67d..2f37de1a1b0 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -1,6 +1,7 @@ - * Copyright (C) 2011-2017 Juanjo Menent +/* Copyright (C) 2008-2011 Laurent Destailleur + * Copyright (C) 2011-2017 Juanjo Menent + * Copyright (C) 2022 Alexandre Spangaro * * 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 @@ -67,7 +68,7 @@ if (GETPOST('action', 'alpha') == 'set') { } } -if ($conf->global->TAKEPOS_ORDER_NOTES == 1) { +if (getDolGlobalInt('TAKEPOS_ORDER_NOTES') == 1) { $extrafields = new ExtraFields($db); $extrafields->addExtraField('order_notes', 'Order notes', 'varchar', 0, 255, 'facturedet', 0, 0, '', '', 0, '', 0, 1); } @@ -79,6 +80,7 @@ if ($conf->global->TAKEPOS_ORDER_NOTES == 1) { $form = new Form($db); $formproduct = new FormProduct($db); +$arrayofjs = array(); $arrayofcss = array("/takepos/css/colorbox.css"); llxHeader('', $langs->trans("CashDeskSetup"), '', '', 0, 0, $arrayofjs, $arrayofcss); @@ -112,7 +114,7 @@ print ''; print '
'; -if ($conf->global->TAKEPOS_BAR_RESTAURANT) { +if (getDolGlobalInt('TAKEPOS_BAR_RESTAURANT')) { print '
'; print ' '.$langs->trans("DefineTablePlan").'
'; print '

'; @@ -171,12 +173,12 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) { print ajax_constantonoff("TAKEPOS_SUPPLEMENTS", array(), $conf->entity, 0, 0, 1, 0); print '
'; print $langs->trans("SupplementCategory"); print ''; - print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_SUPPLEMENTS_CATEGORY, 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0); + print $form->select_all_categories(Categorie::TYPE_PRODUCT, getDolGlobalString('TAKEPOS_SUPPLEMENTS_CATEGORY'), 'TAKEPOS_SUPPLEMENTS_CATEGORY', 64, 0, 0); print ajax_combobox('TAKEPOS_SUPPLEMENTS_CATEGORY'); print "
'; } - if ($conf->global->TAKEPOS_AUTO_ORDER) { + if (getDolGlobalInt('TAKEPOS_AUTO_ORDER')) { print '
'; print ''; print ''; diff --git a/htdocs/takepos/admin/other.php b/htdocs/takepos/admin/other.php index 64088473c69..6200fce8768 100644 --- a/htdocs/takepos/admin/other.php +++ b/htdocs/takepos/admin/other.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/takepos/admin/setup.php + * \file htdocs/takepos/admin/other.php * \ingroup takepos * \brief Setup page for TakePos module */ diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index bf5f5e8b931..7cc5da97f64 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -1,8 +1,9 @@ - * Copyright (C) 2011-2017 Juanjo Menent - * Copyright (C) 2019 Andreu Bisquerra Gaya - * Copyright (C) 2021 Nicolas ZABOURI +/* Copyright (C) 2008-2011 Laurent Destailleur + * Copyright (C) 2011-2017 Juanjo Menent + * Copyright (C) 2019 Andreu Bisquerra Gaya + * Copyright (C) 2021 Nicolas ZABOURI + * Copyright (C) 2022 Alexandre Spangaro * * 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 @@ -19,7 +20,7 @@ */ /** - * \file htdocs/takepos/admin/terminal.php + * \file htdocs/takepos/admin/receipt.php * \ingroup takepos * \brief Setup page for TakePos module */ @@ -47,10 +48,7 @@ if (GETPOST('action', 'alpha') == 'set') { $res = dolibarr_set_const($db, "TAKEPOS_HEADER", GETPOST('TAKEPOS_HEADER', 'restricthtml'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_FOOTER", GETPOST('TAKEPOS_FOOTER', 'restricthtml'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_RECEIPT_NAME", GETPOST('TAKEPOS_RECEIPT_NAME', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_SHOW_CUSTOMER", GETPOST('TAKEPOS_SHOW_CUSTOMER', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_AUTO_PRINT_TICKETS", GETPOST('TAKEPOS_AUTO_PRINT_TICKETS', 'int'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_PRINT_PAYMENT_METHOD", GETPOST('TAKEPOS_PRINT_PAYMENT_METHOD', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT', GETPOST('TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT', 'alphanohtml'), 'chaine', 0, '', $conf->entity); dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); @@ -69,7 +67,7 @@ if (GETPOST('action', 'alpha') == 'set') { } elseif (GETPOST('action', 'alpha') == 'setmethod') { dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity); // TakePOS connector require ReceiptPrinter module - if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector" && !$conf->receiptprinter->enabled) { + if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector" && !isModEnabled('receiptprinter')) { activateModule("modReceiptPrinter"); } } @@ -119,15 +117,15 @@ print '\n"; // Print payment method print '\n"; } @@ -236,7 +234,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "browser" || $conf->global->TAKEPOS_P print '\n"; @@ -247,7 +245,7 @@ print '\n"; -if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector" && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) { +if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector" && filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) { print '\n"; } -if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector" && filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true) { +if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector" && filter_var(getDolGlobalString('TAKEPOS_PRINT_SERVER'), FILTER_VALIDATE_URL) == true) { print '
'; print $langs->trans('DolibarrReceiptPrinter'); print ''; print $langs->trans('ReceiptPrinterMethodDescription'); -if ($conf->receiptprinter->enabled) { - if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { +if (isModEnabled('receiptprinter')) { + if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { print '
'; print img_picto('', 'printer', 'class="paddingright"').''.$langs->trans("Setup").''; } } print '
'; -if ($conf->receiptprinter->enabled) { - if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { +if (isModEnabled('receiptprinter')) { + if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; @@ -148,7 +146,7 @@ print $langs->trans('TakeposConnectorMethodDescription'); if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { print '
'; print $langs->trans("URL")." / ".$langs->trans("IPAddress").' ('.$langs->trans("TakeposConnectorNecesary").')'; - print ' '; + print ' '; } print '
'; @@ -221,14 +219,14 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "browser" || $conf->global->TAKEPOS_P print '
'; print $langs->trans('PrintCustomerOnReceipts'); print ''; - print $form->selectyesno("TAKEPOS_SHOW_CUSTOMER", $conf->global->TAKEPOS_SHOW_CUSTOMER, 1); + print ajax_constantonoff("TAKEPOS_SHOW_CUSTOMER", array(), $conf->entity, 0, 0, 1, 0); print "
'; print $langs->trans('PrintPaymentMethodOnReceipts'); print ''; - print $form->selectyesno("TAKEPOS_PRINT_PAYMENT_METHOD", $conf->global->TAKEPOS_PRINT_PAYMENT_METHOD, 1); + print ajax_constantonoff("TAKEPOS_PRINT_PAYMENT_METHOD", array(), $conf->entity, 0, 0, 1, 0); print "
'; print $langs->trans("AutoPrintTickets"); print ''; -print $form->selectyesno("TAKEPOS_AUTO_PRINT_TICKETS", $conf->global->TAKEPOS_AUTO_PRINT_TICKETS, 1); +print ajax_constantonoff("TAKEPOS_AUTO_PRINT_TICKETS", array(), $conf->entity, 0, 0, 1, 0); print "
'; print ajax_constantonoff("TAKEPOS_SHOW_HT_RECEIPT", array(), $conf->entity, 0, 0, 1, 0); print "
'; print $langs->trans('WeighingScale'); print ''; @@ -255,7 +253,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector" && filter_var($con print "
'; print $langs->trans('CustomerDisplay'); print ''; diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 13c3b6ae80e..543b5ba160f 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -1,7 +1,8 @@ - * Copyright (C) 2011-2017 Juanjo Menent - * Copyright (C) 2021 Nicolas ZABOURI +/* Copyright (C) 2008-2011 Laurent Destailleur + * Copyright (C) 2011-2017 Juanjo Menent + * Copyright (C) 2021 Nicolas ZABOURI + * Copyright (C) 2022 Alexandre Spangaro * * 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 @@ -78,7 +79,7 @@ if ($action == 'set') { $res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_ADDON", GETPOST('TAKEPOS_ADDON', 'alpha'), 'int', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity); - if (!empty($conf->global->TAKEPOS_ENABLE_SUMUP)) { + if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) { $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_AFFILIATE", GETPOST('TAKEPOS_SUMUP_AFFILIATE', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_APPID", GETPOST('TAKEPOS_SUMUP_APPID', 'alpha'), 'chaine', 0, '', $conf->entity); } @@ -142,13 +143,13 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); print load_fiche_titre($langs->trans('CashDeskRefNumberingModules'), '', ''); -print ''; +print '
'; print ''; print '\n"; print '\n"; print '\n"; -print ''; -print ''; +print ''; +print ''; print ''."\n"; clearstatcache(); @@ -195,8 +196,8 @@ foreach ($dirmodels as $reldir) { } print ''."\n"; - print '\n"; @@ -458,7 +459,7 @@ print ''; // Sumup options -if ($conf->global->TAKEPOS_ENABLE_SUMUP) { +if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) { print '
'; print '
'; diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 2ac8607fe33..dcf9ef08cee 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -1,7 +1,8 @@ * Copyright (C) 2011-2017 Juanjo Menent - * Copyright (C) 2021 Thibault FOUCART + * Copyright (C) 2021 Thibault FOUCART + * Copyright (C) 2022 Alexandre Spangaro * * 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 @@ -80,7 +81,7 @@ if (GETPOST('action', 'alpha') == 'set') { if (!empty($conf->stripe->enabled) && !empty($conf->global->STRIPE_CARD_PRESENT)) { $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL".$terminaltouse, GETPOST('CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity); } - if (!empty($conf->global->TAKEPOS_ENABLE_SUMUP)) { + if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) { $res = dolibarr_set_const($db, "CASHDESK_ID_BANKACCOUNT_SUMUP".$terminaltouse, (GETPOST('CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity); } foreach ($paiements as $modep) { @@ -157,7 +158,7 @@ print ''; print '
'; print ''; $atleastonefound = 0; @@ -165,24 +166,24 @@ if (isModEnabled("banque")) { print ''; print ''; print ''; print ''; print ''; print ''; @@ -224,12 +225,12 @@ if (isModEnabled("banque")) { print ''; } - if ($conf->global->TAKEPOS_ENABLE_SUMUP) { + if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) { print ''; print ''; @@ -247,18 +248,18 @@ if (isModEnabled("banque")) { } $cour = preg_match('/^LIQ.*/', $modep->code) ? 2 : 1; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - $form->select_comptes($conf->global->$name, $name, 0, "courant=".$cour, 1); + $form->select_comptes(getDolGlobalInt($name), $name, 0, "courant=".$cour, 1); print ''; } } -if (!empty($conf->stock->enabled)) { +if (isModEnabled('stock')) { print ''; // Force warehouse (this is not a default value) print ''; - if (!empty($conf->productbatch->enabled) && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK) && !$conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}) { + if (isModEnabled('productbatch') && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK) && !$conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}) { print ''; print ''; print ''; - if ($conf->global->TAKEPOS_ORDER_PRINTERS) { + if (getDolGlobalInt('TAKEPOS_ORDER_PRINTERS')) { print ''; print ''; print ''; print ''; print ''; print ''; } } @@ -324,23 +325,23 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TA } print ''; print ''; - if ($conf->global->TAKEPOS_ORDER_PRINTERS) { + if (getDolGlobalInt('TAKEPOS_ORDER_PRINTERS')) { print ''; print ''; } } print ''; print ''; // Numbering module -if ($conf->global->TAKEPOS_ADDON == "terminal") { +if (getDolGlobalString('TAKEPOS_ADDON') == "terminal") { print ''; print ''; @@ -441,11 +442,11 @@ print $form->textwithpicto($langs->trans('Footer'), $htmltext, 1, 'help', '', 0, print ''; print ''; diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 8f2bbc94fc0..55fbd6e3f0e 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -58,7 +58,7 @@ $setterminal = GETPOST('setterminal', 'int'); $setcurrency = GETPOST('setcurrency', 'aZ09'); if (empty($_SESSION["takeposterminal"])) { - if ($conf->global->TAKEPOS_NUM_TERMINALS == "1") { + if (getDolGlobalInt('TAKEPOS_NUM_TERMINALS') == 1) { $_SESSION["takeposterminal"] = 1; // Use terminal 1 if there is only 1 terminal } elseif (!empty($_COOKIE["takeposterminal"])) { $_SESSION["takeposterminal"] = preg_replace('/[^a-zA-Z0-9_\-]/', '', $_COOKIE["takeposterminal"]); // Restore takeposterminal from previous session @@ -964,7 +964,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { ?> multicurrency->enabled)) { + if (isModEnabled('multicurrency')) { print ''; print ''.$langs->trans("Currency").''; print ''; @@ -978,7 +978,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
stock->enabled)) { + if (isModEnabled('stock')) { ?>
@@ -1028,7 +1028,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { -multicurrency->enabled)) { ?> +'; $htmlforlines .= 'multicurrency->enabled) && $_SESSION["takeposcustomercurrency"] != "" && $conf->currency != $_SESSION["takeposcustomercurrency"]) { +if (isModEnabled('multicurrency') && $_SESSION["takeposcustomercurrency"] != "" && $conf->currency != $_SESSION["takeposcustomercurrency"]) { //Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; $multicurrency = new MultiCurrency($db); @@ -287,7 +287,7 @@ if ($conf->global->TAKEPOS_PRINT_PAYMENT_METHOD) { echo $langs->transnoentitiesnoconv("PaymentTypeShort".$row->code); echo ''; echo ''; // Timing (Duration sum of linked fichinter) - if (!empty($conf->ficheinter->enabled)) { + if (isModEnabled('ficheinter')) { $object->fetchObjectLinked(); $num = count($object->linkedObjects); $timing = 0; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 07cdbeac7b3..cef664db636 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1841,7 +1841,7 @@ class Ticket extends CommonObject $error = 0; // Valid and close fichinter linked - if (!empty($conf->ficheinter->enabled) && !empty($conf->global->WORKFLOW_TICKET_CLOSE_INTERVENTION)) { + if (isModEnabled('ficheinter') && !empty($conf->global->WORKFLOW_TICKET_CLOSE_INTERVENTION)) { dol_syslog("We have closed the ticket, so we close all linked interventions"); $this->fetchObjectLinked($this->id, $this->element, null, 'fichinter'); if ($this->linkedObjectsIds) { diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php index 1ee1ef163bb..b410c901096 100644 --- a/htdocs/ticket/contact.php +++ b/htdocs/ticket/contact.php @@ -224,7 +224,7 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) { } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->ticket->write) { diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index 1fe4356ea6a..b0481225a4a 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -159,7 +159,7 @@ if ($object->id) { } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->ticket->write) { diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index edb289925b1..f4c2f181911 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -185,7 +185,7 @@ if (isModEnabled("societe")) { } // Project -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project'); if ($user->rights->ticket->write) { diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 853c4d91e2f..c4e2715f664 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -730,12 +730,18 @@ if (!empty($conf->stock->enabled)) { $formproduct = new FormProduct($db); } +if ($object->id > 0) { + $person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname; + $title = $person_name." - ".$langs->trans('Card'); +} else { + $title = $langs->trans("NewUser"); +} $help_url = ''; -if ($action == 'create' || $action == 'adduserldap') { - $title = $langs->trans("NewUser"); - llxHeader('', $title, $help_url); +llxHeader('', $title, $help_url); + +if ($action == 'create' || $action == 'adduserldap') { print load_fiche_titre($langs->trans("NewUser"), '', 'user'); print ''.$langs->trans("CreateInternalUserDesc")."
\n"; @@ -1353,10 +1359,6 @@ if ($action == 'create' || $action == 'adduserldap') { } } - $person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname; - $title = $person_name." - ".$langs->trans('Card'); - llxHeader('', $title, $help_url); - // Show tabs if ($mode == 'employee') { // For HRM module development $title = $langs->trans("Employee"); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index c7c10fe10cd..5a7a3bc030d 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -316,7 +316,9 @@ class User extends CommonObject * @var stdClass To store personal config */ public $conf; - public $default_values; // To store default values for user + + public $default_values; // To store default values for user. Loaded by loadDefaultValues(). + public $lastsearch_values_tmp; // To store current search criterias for user public $lastsearch_values; // To store last saved search criterias for user @@ -2825,7 +2827,7 @@ class User extends CommonObject $result .= (($option == 'nolink') ? '' : $linkstart); if ($withpictoimg) { $paddafterimage = ''; - if (abs($withpictoimg) == 1) { + if (abs((int) $withpictoimg) == 1) { $paddafterimage = 'style="margin-'.($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right').': 3px;"'; } // Only picto diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index fe058849899..7337bf57f94 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -370,9 +370,12 @@ if ($action === 'confirm_deletecombination') { $form = new Form($db); -if (!empty($id) || !empty($ref)) { - llxHeader("", "", $langs->trans("CardProduct".$object->type)); +$title = $langs->trans("Variant"); +llxHeader("", $title); + + +if (!empty($id) || !empty($ref)) { $showbarcode = empty($conf->barcode->enabled) ? 0 : 1; if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) { $showbarcode = 0; @@ -932,9 +935,6 @@ if (!empty($id) || !empty($ref)) { print ''; print ''; } -} else { - llxHeader(); - // not found } // End of page diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 0f9595f6206..0b599ba640b 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -30,6 +30,7 @@ if (!defined('DISABLE_JS_GRAHP')) define('DISABLE_JS_GRAPH', 1); //header('X-XSS-Protection:0'); // Disable XSS filtering protection of some browsers (note: use of Content-Security-Policy is more efficient). Disabled as deprecated. +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -45,8 +46,10 @@ require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +// Load translation files required by the page $langs->loadLangs(array("admin", "other", "website", "errors")); +// Security check if (!$user->rights->website->read) { accessforbidden(); } diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index 249398c322e..261839940e5 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -32,9 +32,9 @@ require_once DOL_DOCUMENT_ROOT.'/website/lib/websiteaccount.lib.php'; $langs->loadLangs(array("website", "other")); // Get parameters -$id = GETPOST('id', 'int'); +$id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); @@ -43,7 +43,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); $object = new SocieteAccount($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->website->dir_output.'/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('websiteaccountcard')); // Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('websiteaccountcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -68,9 +68,10 @@ if (empty($action) && empty($id) && empty($ref)) { //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'website', $id); -$permissionnote = $user->rights->websiteaccount->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->websiteaccount->write; // Used by the include of actions_dellink.inc.php -$permissiontoadd = $user->rights->websiteaccount->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +// Permissions +$permissionnote = $user->rights->websiteaccount->write; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->websiteaccount->write; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->rights->websiteaccount->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
'.$langs->trans("Name")."'.$langs->trans("Description")."'.$langs->trans("Example")."'.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'; - if ($conf->global->TAKEPOS_REF_ADDON == "$file") { + print ''; + if (getDolGlobalString('TAKEPOS_REF_ADDON') == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''; @@ -276,7 +277,7 @@ if (isModEnabled("service")) { print '
'; print $form->textwithpicto($langs->trans("RootCategoryForProductsToSell"), $langs->trans("RootCategoryForProductsToSellDesc")); print ''; -print img_object('', 'category', 'class="paddingright"').$form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEPOS_ROOT_CATEGORY_ID, 'TAKEPOS_ROOT_CATEGORY_ID', 64, 0, 0); +print img_object('', 'category', 'class="paddingright"').$form->select_all_categories(Categorie::TYPE_PRODUCT, getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID'), 'TAKEPOS_ROOT_CATEGORY_ID', 64, 0, 0); print ajax_combobox('TAKEPOS_ROOT_CATEGORY_ID'); print "
'.$langs->trans("CashDeskThirdPartyForSell").''; -print $form->select_company($conf->global->{'CASHDESK_ID_THIRDPARTY'.$terminaltouse}, 'socid', '(s.client IN (1, 3) AND s.status = 1)', 1, 0, 0, array(), 0); +print $form->select_company(getDolGlobalInt('CASHDESK_ID_THIRDPARTY'.$terminaltouse), 'socid', '(s.client IN (1, 3) AND s.status = 1)', 1, 0, 0, array(), 0); print '
'.$langs->trans("CashDeskBankAccountForSell").''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 0, "courant=2", 1); - if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse})) { + $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 0, "courant=2", 1); + if (getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse)) { $atleastonefound++; } print '
'.$langs->trans("CashDeskBankAccountForCheque").''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 0, "courant=1", 1); - if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse})) { + $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 0, "courant=1", 1); + if (getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse)) { $atleastonefound++; } print '
'.$langs->trans("CashDeskBankAccountForCB").''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 0, "courant=1", 1); - if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse})) { + $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 0, "courant=1", 1); + if (getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse)) { $atleastonefound++; } print '
'.$langs->trans("CashDeskBankAccountForSumup").''; print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 0, "courant=1", 1); - if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse})) { + $form->select_comptes(getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse), 'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 0, "courant=1", 1); + if (getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse)) { $atleastonefound++; } print '
'.$langs->trans("CashDeskDoNotDecreaseStock").''; - if (empty($conf->productbatch->enabled) || !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) { - print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK'.$terminal, $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}, 1); + if (!isModEnabled('productbatch') || getDolGlobalInt('CASHDESK_FORCE_DECREASE_STOCK')) { + print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK'.$terminal, getDolGlobalInt('CASHDESK_NO_DECREASE_STOCK'.$terminal), 1); } else { - if (!$conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}) { + if (getDolGlobalInt('CASHDESK_NO_DECREASE_STOCK'.$terminal)) { $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK".$terminal, 1, 'chaine', 0, '', $conf->entity); } print $langs->trans("Yes").'
'; @@ -280,7 +281,7 @@ if (!empty($conf->stock->enabled)) { } print '
'.$langs->trans('CashDeskForceDecreaseStockLabel').''; print ''.$langs->trans('CashDeskForceDecreaseStockDesc').''; @@ -288,11 +289,11 @@ if (!empty($conf->stock->enabled)) { } } -if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { +if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter" || getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") { // Select printer to use with terminal require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php'; $printer = new dolReceiptPrinter($db); - if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { + if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") { $printer->listprinters(); $printers = array(); foreach ($printer->listprinters as $key => $value) { @@ -300,20 +301,20 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TA } print '
'.$langs->trans("MainPrinterToUse").''; - print $form->selectarray('TAKEPOS_PRINTER_TO_USE'.$terminal, $printers, (empty($conf->global->{'TAKEPOS_PRINTER_TO_USE'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_PRINTER_TO_USE'.$terminal}), 1); + print $form->selectarray('TAKEPOS_PRINTER_TO_USE'.$terminal, $printers, getDolGlobalInt('TAKEPOS_PRINTER_TO_USE'.$terminal), 1); print '
'.$langs->trans("OrderPrinterToUse").' - '.$langs->trans("Printer").' 1'; - print $form->selectarray('TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminal, $printers, (empty($conf->global->{'TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminal}), 1); + print $form->selectarray('TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminal, $printers, getDolGlobalInt('TAKEPOS_ORDER_PRINTER1_TO_USE'.$terminal), 1); print '
'.$langs->trans("OrderPrinterToUse").' - '.$langs->trans("Printer").' 2'; - print $form->selectarray('TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminal, $printers, (empty($conf->global->{'TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminal}), 1); + print $form->selectarray('TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminal, $printers, getDolGlobalInt('TAKEPOS_ORDER_PRINTER2_TO_USE'.$terminal), 1); print '
'.$langs->trans("OrderPrinterToUse").' - '.$langs->trans("Printer").' 3'; - print $form->selectarray('TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminal, $printers, (empty($conf->global->{'TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminal}), 1); + print $form->selectarray('TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminal, $printers, getDolGlobalInt('TAKEPOS_ORDER_PRINTER3_TO_USE'.$terminal), 1); print '
'.$langs->trans("MainTemplateToUse").' ('.$langs->trans("SetupReceiptTemplate").')'; - print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal, $templates, (empty($conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal}), 1); + print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal, $templates, getDolGlobalInt('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal), 1); print '
'.$langs->trans("OrderTemplateToUse").''; - print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal, $templates, (empty($conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal}), 1); + print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal, $templates, getDolGlobalInt('TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$terminal), 1); print '
'.$langs->trans('CashDeskReaderKeyCodeForEnter').''; -print ''; +print ''; print '
'; print $langs->trans("BillsNumberingModule"); print ''; @@ -425,11 +426,11 @@ print $form->textwithpicto($langs->trans('Header'), $htmltext, 1, 'help', '', 0, print ''; $variablename = 'TAKEPOS_HEADER'.$terminaltouse; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { +if (!getDolGlobalInt('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { print ''; } else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor($variablename, $conf->global->{$variablename}, '', 80, 'dolibarr_notes'); + $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes'); print $doleditor->Create(); } print '
'; $variablename = 'TAKEPOS_FOOTER'.$terminaltouse; -if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { +if (!getDolGlobalInt('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { print ''; } else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor($variablename, $conf->global->{$variablename}, '', 80, 'dolibarr_notes'); + $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes'); print $doleditor->Create(); } print '
'.vatrate($line->remise_percent, true).''; - if (!empty($conf->stock->enabled) && !empty($user->rights->stock->mouvement->lire)) { + if (isModEnabled('stock') && !empty($user->rights->stock->mouvement->lire)) { $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; if (!empty($conf->global->$constantforkey) && $line->fk_product > 0 && empty($conf->global->TAKEPOS_HIDE_STOCK_ON_LINE)) { $sql = "SELECT e.rowid, e.ref, e.lieu, e.fk_parent, e.statut, ps.reel, ps.rowid as product_stock_id, p.pmp"; @@ -1637,7 +1637,7 @@ if ($placeid > 0) { if (getDolGlobalString('TAKEPOS_SHOW_HT')) { $htmlforlines .= ''; $htmlforlines .= price($line->total_ht, 1, '', 1, -1, -1, $conf->currency); - if (!empty($conf->multicurrency->enabled) && !empty($_SESSION["takeposcustomercurrency"]) && $conf->currency != $_SESSION["takeposcustomercurrency"]) { + if (isModEnabled('multicurrency') && !empty($_SESSION["takeposcustomercurrency"]) && $conf->currency != $_SESSION["takeposcustomercurrency"]) { //Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; $multicurrency = new MultiCurrency($db); @@ -1648,7 +1648,7 @@ if ($placeid > 0) { } $htmlforlines .= ''; $htmlforlines .= price($line->total_ttc, 1, '', 1, -1, -1, $conf->currency); - if (!empty($conf->multicurrency->enabled) && !empty($_SESSION["takeposcustomercurrency"]) && $conf->currency != $_SESSION["takeposcustomercurrency"]) { + if (isModEnabled('multicurrency') && !empty($_SESSION["takeposcustomercurrency"]) && $conf->currency != $_SESSION["takeposcustomercurrency"]) { //Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; $multicurrency = new MultiCurrency($db); diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index b79eedb558f..7b5d4aea6b5 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -226,7 +226,7 @@ if ($resql) { $arrayOfValidBankAccount[$conf->global->$accountname] = $conf->global->$accountname; $arrayOfValidPaymentModes[] = $obj; } - if (empty($conf->banque->enabled)) { + if (!isModEnabled('banque')) { if ($paycode == 'CASH' || $paycode == 'CB') $arrayOfValidPaymentModes[] = $obj; } } @@ -650,8 +650,8 @@ if (!empty($conf->stripe->enabled) && isset($keyforstripeterminalbank) && !empty } } -if ($conf->global->TAKEPOS_ENABLE_SUMUP) { - $keyforsumupbank = "CASHDESK_ID_BANKACCOUNT_SUMUP".$_SESSION["takeposterminal"]; +$keyforsumupbank = "CASHDESK_ID_BANKACCOUNT_SUMUP".$_SESSION["takeposterminal"]; +if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) { if (!empty($conf->global->$keyforsumupbank)) { print ''; } else { diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index 59ed75fb46e..fa12487763e 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -85,7 +85,8 @@ if (empty($action)) { '; $arrayofcss = array('/takepos/css/phone.css'); - top_htmlhead($head, $title, 0, 0, '', ''); + + top_htmlhead($head, $title, 0, 0, '', $arrayofcss); } else { top_httphead('text/html', 1); } diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php index defa7f2fb70..3542aa44014 100644 --- a/htdocs/takepos/receipt.php +++ b/htdocs/takepos/receipt.php @@ -257,7 +257,7 @@ if ($conf->global->TAKEPOS_SHOW_CUSTOMER) { } ?>
'; - $amount_payment = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount; + $amount_payment = (isModEnabled('multicurrency') && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount; if ($row->code == "LIQ") { $amount_payment = $amount_payment + $row->pos_change; // Show amount with excess received if is cash payment } diff --git a/htdocs/theme/eldy/main_menu_fa_icons.inc.php b/htdocs/theme/eldy/main_menu_fa_icons.inc.php index ada1ae23a12..395ab219056 100644 --- a/htdocs/theme/eldy/main_menu_fa_icons.inc.php +++ b/htdocs/theme/eldy/main_menu_fa_icons.inc.php @@ -18,10 +18,6 @@ /* font-size: ; */ } -.fa-15x { - font-size: 1.5em; -} - div.mainmenu.menu { background-image: none; } diff --git a/htdocs/theme/md/main_menu_fa_icons.inc.php b/htdocs/theme/md/main_menu_fa_icons.inc.php index 0e0b144d187..f2f5e247e78 100644 --- a/htdocs/theme/md/main_menu_fa_icons.inc.php +++ b/htdocs/theme/md/main_menu_fa_icons.inc.php @@ -18,10 +18,6 @@ color: var(--colortextbackhmenu); } -.fa-15x { - font-size: 1.5em; -} - div.mainmenu.menu { background-image: none; } diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index 2f919aa436d..a79d30bb377 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -21,11 +21,12 @@ * \brief Page with events on ticket */ +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/ticket/class/actions_ticket.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formticket.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php'; -require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php"; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; @@ -40,12 +41,12 @@ $track_id = GETPOST('track_id', 'alpha', 3); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'aZ09'); -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -$page = is_numeric($page) ? $page : 0; -$page = $page == -1 ? 0 : $page; +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +$page = is_numeric($page) ? $page : 0; +$page = $page == -1 ? 0 : $page; if (!$sortfield) { $sortfield = "a.datep,a.id"; } @@ -64,6 +65,7 @@ if (GETPOST('actioncode', 'array')) { } else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } + $search_agenda_label = GETPOST('search_agenda_label'); $object = new Ticket($db); @@ -184,7 +186,7 @@ if (isModEnabled("societe")) { } // Project -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project'); if ($user->rights->ticket->write) { diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 8b76f5968cb..eabdaa8a16a 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -34,12 +34,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; } -if (!empty($conf->contrat->enabled)) { +if (isModEnabled('contrat')) { include_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php'; include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formcontract.class.php'; @@ -710,15 +710,15 @@ if (empty($reshook)) { $userstat = new User($db); $form = new Form($db); $formticket = new FormTicket($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } $help_url = 'EN:Module_Ticket|FR:DocumentationModuleTicket'; -$page_title = $actionobject->getTitle($action); +$title = $actionobject->getTitle($action); -llxHeader('', $page_title, $help_url); +llxHeader('', $title, $help_url); if ($action == 'create' || $action == 'presend') { $formticket = new FormTicket($db); @@ -965,7 +965,7 @@ if ($action == 'create' || $action == 'presend') { } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->ticket->write) { @@ -1119,7 +1119,7 @@ if ($action == 'create' || $action == 'presend') { print '