Merge branch 'develop' into userbankaccount

This commit is contained in:
Laurent Destailleur 2022-09-02 11:53:02 +02:00 committed by GitHub
commit 19c3763a55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
541 changed files with 4522 additions and 3566 deletions

View File

@ -20,6 +20,7 @@ WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: 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 * 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 ***** ***** 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: 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 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. on the PHP setup). Removal of all PHP warnings on server side is planned for v17.
NEW: Support for recurring purchase invoices. 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: Accountancy - Add hidden feature for accounting reconciliation
NEW: Can store the session into database (instead of beeing managed by PHP) NEW: Can store the session into database (instead of beeing managed by PHP)
NEW: Added MMK currency (Myanmar Kyat) NEW: Added MMK currency (Myanmar Kyat)
NEW: On a form to send an email, we show all emails of contacts of object
Modules Modules
NEW: Module Partnership Management NEW: Module Partnership Management

View File

@ -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/freefont-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`; $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 -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/vendor`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/webmozart`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/webmozart`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/autoload.php`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/autoload.php`;

View File

@ -24,6 +24,7 @@ fi
if [ "x$1" = "xfix" ] if [ "x$1" = "xfix" ]
then then
find ./htdocs -type f -iname "*.php" -exec chmod a-x {} \; 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/*/*.php
chmod a+x ./scripts/*/*.sh chmod a+x ./scripts/*/*.sh
chmod g-w ./scripts/*/*.php chmod g-w ./scripts/*/*.php

View File

@ -97,6 +97,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
$accounting = new AccountingAccount($db); $accounting = new AccountingAccount($db);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('accountancyadminaccount'));
/* /*
* Actions * Actions
@ -109,8 +112,8 @@ if (!GETPOST('confirmmassaction', 'alpha')) {
$massaction = ''; $massaction = '';
} }
$parameters = array(); $parameters = array('chartofaccounts' => $chartofaccounts, 'permissiontoadd' => $permissiontoadd, 'permissiontodelete' => $permissiontodelete);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been monowraponalldified by some hooks $reshook = $hookmanager->executeHooks('doActions', $parameters, $accounting, $action); // Note that $action and $object may have been monowraponalldified by some hooks
if ($reshook < 0) { if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
} }
@ -398,6 +401,11 @@ if ($resql) {
print '<input type="'.(empty($conf->use_javascript_ajax) ? 'submit' : 'button').'" class="button button-edit" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">'; print '<input type="'.(empty($conf->use_javascript_ajax) ? 'submit' : 'button').'" class="button button-edit" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
print '<br>'; print '<br>';
$parameters = array('chartofaccounts' => $chartofaccounts, 'permissiontoadd' => $permissiontoadd, 'permissiontodelete' => $permissiontodelete);
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $accounting, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '<br>'; print '<br>';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro> /* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2017-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -124,7 +124,8 @@ if (!empty($cat_id)) {
$arraykeyvalue = array(); $arraykeyvalue = array();
foreach ($accountingcategory->lines_cptbk as $key => $val) { 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) { if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* *
@ -332,7 +332,9 @@ if ($action == 'valid') {
$html = new Form($db); $html = new Form($db);
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
llxHeader('', $langs->trans("CreateMvts")); $title = $langs->trans("CreateMvts");
llxHeader('', $title);
// Confirmation to delete the command // Confirmation to delete the command
if ($action == 'delete') { if ($action == 'delete') {
@ -341,7 +343,7 @@ if ($action == 'delete') {
} }
if ($action == 'create') { if ($action == 'create') {
print load_fiche_titre($langs->trans("CreateMvts")); print load_fiche_titre($title);
$object = new BookKeeping($db); $object = new BookKeeping($db);
$next_num_mvt = $object->getNextNumMvt('_tmp'); $next_num_mvt = $object->getNextNumMvt('_tmp');
@ -540,6 +542,8 @@ if ($action == 'create') {
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Don't show in tmp mode, inevitably empty
if ($mode != "_tmp") {
// Date document export // Date document export
print '<tr>'; print '<tr>';
print '<td class="titlefield">' . $langs->trans("DateExport") . '</td>'; print '<td class="titlefield">' . $langs->trans("DateExport") . '</td>';
@ -555,6 +559,7 @@ if ($action == 'create') {
print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : '&nbsp;'; print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : '&nbsp;';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
}
// Validate // Validate
/* /*

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* *
@ -1136,6 +1136,9 @@ $totalarray = array();
$totalarray['nbfield'] = 0; $totalarray['nbfield'] = 0;
$total_debit = 0; $total_debit = 0;
$total_credit = 0; $total_credit = 0;
$totalarray['val'] = array ();
$totalarray['val']['totaldebit'] = 0;
$totalarray['val']['totalcredit'] = 0;
while ($i < min($num, $limit)) { while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);

View File

@ -824,17 +824,22 @@ print $hookmanager->resPrint;
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n"; print "</tr>\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 $displayed_account_number = null; // Start with undefined to be able to distinguish with empty
// Loop on record // Loop on record
// -------------------------------------------------------------------- // --------------------------------------------------------------------
$i = 0; $i = 0;
$totalarray = array(); $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)) { while ($i < min($num, $limit)) {
$line = $object->lines[$i]; $line = $object->lines[$i];

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2014-2017 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2014-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2015-2017 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2015-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2020 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2015-2020 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* *
@ -1667,7 +1667,9 @@ class BookKeeping extends CommonObject
$this->doc_type = $obj->doc_type; $this->doc_type = $obj->doc_type;
$this->date_creation = $this->db->jdate($obj->date_creation); $this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->date_modification); $this->date_modification = $this->db->jdate($obj->date_modification);
if ($mode != "_tmp") {
$this->date_export = $this->db->jdate($obj->date_export); $this->date_export = $this->db->jdate($obj->date_export);
}
$this->date_validation = $this->db->jdate($obj->date_validation); $this->date_validation = $this->db->jdate($obj->date_validation);
} else { } else {
$this->error = "Error ".$this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
@ -1764,7 +1766,9 @@ class BookKeeping extends CommonObject
$line->piece_num = $obj->piece_num; $line->piece_num = $obj->piece_num;
$line->date_creation = $obj->date_creation; $line->date_creation = $obj->date_creation;
$line->date_modification = $obj->date_modification; $line->date_modification = $obj->date_modification;
if ($mode != "_tmp") {
$line->date_export = $obj->date_export; $line->date_export = $obj->date_export;
}
$line->date_validation = $obj->date_validation; $line->date_validation = $obj->date_validation;
$this->linesmvt[] = $line; $this->linesmvt[] = $line;

View File

@ -23,6 +23,8 @@
* \brief Home accounting module * \brief Home accounting module
*/ */
// Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2015-2018 Alexandre Spangaro <aspangaro@open-dsi.fr> /* Copyright (C) 2015-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// $formatexportset ùust be defined // $formatexportset must be defined
// Protection to avoid direct call of template // Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) { if (empty($conf) || !is_object($conf)) {
@ -24,11 +24,11 @@ if (empty($conf) || !is_object($conf)) {
exit; exit;
} }
$code = $conf->global->MAIN_INFO_ACCOUNTANT_CODE; $code = getDolGlobalString('MAIN_INFO_ACCOUNTANT_CODE');
$prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC; $prefix = getDolGlobalString('ACCOUNTING_EXPORT_PREFIX_SPEC');
$format = $conf->global->ACCOUNTING_EXPORT_FORMAT; $format = getDolGlobalString('ACCOUNTING_EXPORT_FORMAT');
$nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME; $nodateexport = getDolGlobalInt('ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME');
$siren = $conf->global->MAIN_INFO_SIREN; $siren = getDolGlobalString('MAIN_INFO_SIREN');
$date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S'); $date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S');
$endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d'); $endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d');

View File

@ -167,10 +167,30 @@ if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
print $enabledisablehtml; print $enabledisablehtml;
print '<input type="hidden" id="MEMBER_ENABLE_PUBLIC" name="MEMBER_ENABLE_PUBLIC" value="'.(empty($conf->global->MEMBER_ENABLE_PUBLIC) ? 0 : 1).'">'; print '<input type="hidden" id="MEMBER_ENABLE_PUBLIC" name="MEMBER_ENABLE_PUBLIC" value="'.(empty($conf->global->MEMBER_ENABLE_PUBLIC) ? 0 : 1).'">';
print '<br><br>';
print '<br>';
if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) { if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
print '<br>';
//print $langs->trans('FollowingLinksArePublic').'<br>';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
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 '<div class="urllink">';
print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">';
print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
print '</div>';
print ajax_autoselect('publicurlmember');
print '<br>'; print '<br>';
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
@ -248,29 +268,6 @@ print dol_get_fiche_end();
print '</form>'; print '</form>';
if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
print '<br>';
//print $langs->trans('FollowingLinksArePublic').'<br>';
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
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 '<div class="urllink">';
print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">';
print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/members/new.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
print '</div>';
print ajax_autoselect('publicurlmember');
}
// End of page // End of page
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -29,6 +29,8 @@
* \brief Page of a member * \brief Page of a member
*/ */
// Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.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.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("companies", "bills", "members", "users", "other", "paypal")); $langs->loadLangs(array("companies", "bills", "members", "users", "other", "paypal"));
// Get parameters
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');

View File

@ -663,6 +663,10 @@ class Adherent extends CommonObject
{ {
global $conf, $langs, $hookmanager; 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; $nbrowsaffected = 0;
$error = 0; $error = 0;
@ -2057,7 +2061,7 @@ class Adherent extends CommonObject
$err = 0; $err = 0;
// mailman // mailman
if (!empty($conf->global->ADHERENT_USE_MAILMAN) && !empty($conf->mailmanspip->enabled)) { if (!empty($conf->global->ADHERENT_USE_MAILMAN) && isModEnabled('mailmanspip')) {
$result = $mailmanspip->add_to_mailman($this); $result = $mailmanspip->add_to_mailman($this);
if ($result < 0) { if ($result < 0) {
@ -2077,7 +2081,7 @@ class Adherent extends CommonObject
} }
// spip // spip
if (!empty($conf->global->ADHERENT_USE_SPIP) && !empty($conf->mailmanspip->enabled)) { if (!empty($conf->global->ADHERENT_USE_SPIP) && isModEnabled('mailmanspip')) {
$result = $mailmanspip->add_to_spip($this); $result = $mailmanspip->add_to_spip($this);
if ($result < 0) { if ($result < 0) {
$this->errors[] = $mailmanspip->error; $this->errors[] = $mailmanspip->error;
@ -2128,7 +2132,7 @@ class Adherent extends CommonObject
} }
} }
if ($conf->global->ADHERENT_USE_SPIP && !empty($conf->mailmanspip->enabled)) { if ($conf->global->ADHERENT_USE_SPIP && isModEnabled('mailmanspip')) {
$result = $mailmanspip->del_to_spip($this); $result = $mailmanspip->del_to_spip($this);
if ($result < 0) { if ($result < 0) {
$this->errors[] = $mailmanspip->error; $this->errors[] = $mailmanspip->error;

View File

@ -27,19 +27,24 @@
* \brief Home page of membership module * \brief Home page of membership module
*/ */
// Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.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.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.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); $hookmanager = new HookManager($db);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('membersindex')); $hookmanager->initHooks(array('membersindex'));
// Load translation files required by the page
$langs->loadLangs(array("companies", "members"));
// Security check // Security check
$result = restrictedArea($user, 'adherent'); $result = restrictedArea($user, 'adherent');

View File

@ -27,14 +27,20 @@
* \brief Page to list all members of foundation * \brief Page to list all members of foundation
*/ */
// Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.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.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("members", "companies")); $langs->loadLangs(array("members", "companies"));
// Get parameters
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int'); $show_files = GETPOST('show_files', 'int');
@ -42,6 +48,8 @@ $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'memberslist'; // To manage different context of search
// Search fields
$search = GETPOST("search", 'alpha'); $search = GETPOST("search", 'alpha');
$search_ref = GETPOST("search_ref", 'alpha'); $search_ref = GETPOST("search_ref", 'alpha');
$search_lastname = GETPOST("search_lastname", 'alpha'); $search_lastname = GETPOST("search_lastname", 'alpha');

View File

@ -23,25 +23,34 @@
* \brief Tab for note of a member * \brief Tab for note of a member
*/ */
// Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.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.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("companies", "members", "bills")); $langs->loadLangs(array("companies", "members", "bills"));
// Get parameters
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alphanohtml'); $ref = GETPOST('ref', 'alphanohtml');
// Initialize objects
$object = new Adherent($db); $object = new Adherent($db);
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result > 0) { if ($result > 0) {
$adht = new AdherentType($db); $adht = new AdherentType($db);
$result = $adht->fetch($object->typeid); $result = $adht->fetch($object->typeid);
} }
$permissionnote = $user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php $permissionnote = $user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php
// Fetch object // Fetch object

View File

@ -3,6 +3,7 @@
* Copyright (C) 2011 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -184,7 +185,7 @@ if (!empty($triggers)) {
} }
//print 'module='.$module.' code='.$trigger['code'].'<br>'; //print 'module='.$module.' code='.$trigger['code'].'<br>';
if (isModEnabled('module')) { if (isModEnabled($module)) {
// Discard special case: If option FICHINTER_CLASSIFY_BILLED is not set, we discard both trigger FICHINTER_CLASSIFY_BILLED and FICHINTER_CLASSIFY_UNBILLED // Discard special case: If option FICHINTER_CLASSIFY_BILLED is not set, we discard both trigger FICHINTER_CLASSIFY_BILLED and FICHINTER_CLASSIFY_UNBILLED
if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) { if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) {
continue; continue;

View File

@ -0,0 +1,118 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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 <https://www.gnu.org/licenses/>.
*/
/**
* \file admin/bankline_extrafields.php
* \ingroup bank
* \brief Page to setup extra fields of bankline
*/
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "companies", "bills", "other", "banks"));
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label = ExtraFields::$type2label;
$type2label = [];
foreach ($tmptype2label as $key => $val) {
$type2label[$key] = $langs->transnoentitiesnoconv($val);
}
$action = GETPOST('action', 'aZ09');
$attrname = GETPOST('attrname', 'alpha');
$elementtype = 'bank'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) {
accessforbidden();
}
/*
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
/*
* View
*/
$help_url = '';
$page_name = "BankSetupModule";
llxHeader('', $langs->trans("BankSetupModule"), $help_url);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
$head = bank_admin_prepare_head(null);
print dol_get_fiche_head($head, 'bankline_extrafields', $langs->trans($page_name), -1, 'account');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
print dol_get_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit') {
print '<div class="tabsAction">';
print '<a class="butAction reposition" href="'.$_SERVER["PHP_SELF"].'?action=create">'.$langs->trans("NewAttribute").'</a>';
print "</div>";
}
/*
* Creation of an optional field
*/
if ($action == 'create') {
print '<br><div id="newattrib"></div>';
print load_fiche_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/*
* Edition of an optional field
*/
if ($action == 'edit' && !empty($attrname)) {
print "<br>";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
// End of page
llxFooter();
$db->close();

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com> * Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2022 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -172,7 +173,7 @@ if (!isset($conf->global->MAIN_DELAY_ORDERS_TO_PROCESS)) {
if ($action == 'update') { if ($action == 'update') {
foreach ($modules as $module => $delays) { foreach ($modules as $module => $delays) {
if (isModEnabled('module')) { if (isModEnabled($module)) {
foreach ($delays as $delay) { foreach ($delays as $delay) {
if (GETPOST($delay['code']) != '') { if (GETPOST($delay['code']) != '') {
dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, $delay['code'], GETPOST($delay['code']), 'chaine', 0, '', $conf->entity);
@ -226,7 +227,7 @@ if ($action == 'edit') {
print '<td class="right">'.$langs->trans("LateWarningAfter").'</td></tr>'; print '<td class="right">'.$langs->trans("LateWarningAfter").'</td></tr>';
foreach ($modules as $module => $delays) { foreach ($modules as $module => $delays) {
if (isModEnabled('module')) { if (isModEnabled($module)) {
foreach ($delays as $delay) { foreach ($delays as $delay) {
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']} : 0); $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']} : 0);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -260,7 +261,7 @@ if ($action == 'edit') {
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="right">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="right">'.$langs->trans("Value").'</td></tr>';
foreach ($modules as $module => $delays) { foreach ($modules as $module => $delays) {
if (isModEnabled('module')) { if (isModEnabled($module)) {
foreach ($delays as $delay) { foreach ($delays as $delay) {
$value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']} : 0); $value = (!empty($conf->global->{$delay['code']}) ? $conf->global->{$delay['code']} : 0);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -319,16 +320,20 @@ if (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METE
$cursor = 10; // By default $cursor = 10; // By default
//if (!empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET; //if (!empty($conf->global->MAIN_METEO_OFFSET)) $offset=$conf->global->MAIN_METEO_OFFSET;
//if (!empty($conf->global->MAIN_METEO_GAP)) $cursor=$conf->global->MAIN_METEO_GAP; //if (!empty($conf->global->MAIN_METEO_GAP)) $cursor=$conf->global->MAIN_METEO_GAP;
$level0 = $offset; if (!empty($conf->global->MAIN_METEO_LEVEL0)) { $level0 = $offset;
if (!empty($conf->global->MAIN_METEO_LEVEL0)) {
$level0 = $conf->global->MAIN_METEO_LEVEL0; $level0 = $conf->global->MAIN_METEO_LEVEL0;
} }
$level1 = $offset + 1 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL1)) { $level1 = $offset + 1 * $cursor;
if (!empty($conf->global->MAIN_METEO_LEVEL1)) {
$level1 = $conf->global->MAIN_METEO_LEVEL1; $level1 = $conf->global->MAIN_METEO_LEVEL1;
} }
$level2 = $offset + 2 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL2)) { $level2 = $offset + 2 * $cursor;
if (!empty($conf->global->MAIN_METEO_LEVEL2)) {
$level2 = $conf->global->MAIN_METEO_LEVEL2; $level2 = $conf->global->MAIN_METEO_LEVEL2;
} }
$level3 = $offset + 3 * $cursor; if (!empty($conf->global->MAIN_METEO_LEVEL3)) { $level3 = $offset + 3 * $cursor;
if (!empty($conf->global->MAIN_METEO_LEVEL3)) {
$level3 = $conf->global->MAIN_METEO_LEVEL3; $level3 = $conf->global->MAIN_METEO_LEVEL3;
} }
$text = ''; $options = 'class="valignmiddle" height="60px"'; $text = ''; $options = 'class="valignmiddle" height="60px"';

View File

@ -11,7 +11,7 @@
* Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2011-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2019-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020-2022 Open-Dsi <support@open-dsi.fr> * Copyright (C) 2020-2022 Open-Dsi <support@open-dsi.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -487,46 +487,46 @@ $tabcond[1] = (isModEnabled("societe"));
$tabcond[2] = true; $tabcond[2] = true;
$tabcond[3] = true; $tabcond[3] = true;
$tabcond[4] = true; $tabcond[4] = true;
$tabcond[5] = (isModEnabled("societe") || !empty($conf->adherent->enabled)); $tabcond[5] = (isModEnabled("societe") || isModEnabled('adherent'));
$tabcond[6] = isModEnabled('agenda'); $tabcond[6] = isModEnabled('agenda');
$tabcond[7] = !empty($conf->tax->enabled); $tabcond[7] = isModEnabled('tax');
$tabcond[8] = isModEnabled("societe"); $tabcond[8] = isModEnabled("societe");
$tabcond[9] = true; $tabcond[9] = true;
$tabcond[10] = true; $tabcond[10] = true;
$tabcond[11] = (isModEnabled("societe")); $tabcond[11] = (isModEnabled("societe"));
$tabcond[12] = (!empty($conf->commande->enabled) || isModEnabled("propal") || isModEnabled('facture') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice") || isModEnabled("supplier_order")); $tabcond[12] = (isModEnabled('commande') || isModEnabled("propal") || isModEnabled('facture') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice") || isModEnabled("supplier_order"));
$tabcond[13] = (!empty($conf->commande->enabled) || isModEnabled("propal") || isModEnabled('facture') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice") || isModEnabled("supplier_order")); $tabcond[13] = (isModEnabled('commande') || isModEnabled("propal") || isModEnabled('facture') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice") || isModEnabled("supplier_order"));
$tabcond[14] = (isModEnabled("product") && (!empty($conf->ecotax->enabled) || !empty($conf->global->MAIN_SHOW_ECOTAX_DICTIONNARY))); $tabcond[14] = (isModEnabled("product") && (isModEnabled('ecotax') || !empty($conf->global->MAIN_SHOW_ECOTAX_DICTIONNARY)));
$tabcond[15] = true; $tabcond[15] = true;
$tabcond[16] = (isModEnabled("societe") && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)); $tabcond[16] = (isModEnabled("societe") && empty($conf->global->SOCIETE_DISABLE_PROSPECTS));
$tabcond[17] = (!empty($conf->deplacement->enabled) || !empty($conf->expensereport->enabled)); $tabcond[17] = (isModEnabled('deplacement') || isModEnabled('expensereport'));
$tabcond[18] = isModEnabled("expedition") || isModEnabled("reception"); $tabcond[18] = isModEnabled("expedition") || isModEnabled("reception");
$tabcond[19] = isModEnabled("societe"); $tabcond[19] = isModEnabled("societe");
$tabcond[20] = (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order"); $tabcond[20] = (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order");
$tabcond[21] = isModEnabled("propal"); $tabcond[21] = isModEnabled("propal");
$tabcond[22] = (!empty($conf->commande->enabled) || isModEnabled("propal")); $tabcond[22] = (isModEnabled('commande') || isModEnabled("propal"));
$tabcond[23] = true; $tabcond[23] = true;
$tabcond[24] = !empty($conf->resource->enabled); $tabcond[24] = isModEnabled('resource');
$tabcond[25] = !empty($conf->website->enabled); $tabcond[25] = isModEnabled('website');
//$tabcond[26]= isModEnabled("product"); //$tabcond[26]= isModEnabled("product");
$tabcond[27] = isModEnabled("societe"); $tabcond[27] = isModEnabled("societe");
$tabcond[28] = !empty($conf->holiday->enabled); $tabcond[28] = isModEnabled('holiday');
$tabcond[29] = !empty($conf->project->enabled); $tabcond[29] = !empty($conf->project->enabled);
$tabcond[30] = !empty($conf->label->enabled); $tabcond[30] = isModEnabled('label');
//$tabcond[31]= !empty($conf->accounting->enabled); //$tabcond[31]= !empty($conf->accounting->enabled);
$tabcond[32] = (!empty($conf->holiday->enabled) || !empty($conf->hrm->enabled)); $tabcond[32] = (isModEnabled('holiday') || isModEnabled('hrm'));
$tabcond[33] = !empty($conf->hrm->enabled); $tabcond[33] = isModEnabled('hrm');
$tabcond[34] = !empty($conf->hrm->enabled); $tabcond[34] = isModEnabled('hrm');
$tabcond[35] = !empty($conf->expensereport->enabled) && !empty($conf->global->MAIN_USE_EXPENSE_IK); $tabcond[35] = isModEnabled('expensereport') && !empty($conf->global->MAIN_USE_EXPENSE_IK);
$tabcond[36] = !empty($conf->expensereport->enabled) && !empty($conf->global->MAIN_USE_EXPENSE_IK); $tabcond[36] = isModEnabled('expensereport') && !empty($conf->global->MAIN_USE_EXPENSE_IK);
$tabcond[37] = isModEnabled("product"); $tabcond[37] = isModEnabled("product");
$tabcond[38] = !empty($conf->socialnetworks->enabled); $tabcond[38] = isModEnabled('socialnetworks');
$tabcond[39] = (isModEnabled("societe") && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)); $tabcond[39] = (isModEnabled("societe") && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES));
$tabcond[40] = (isModEnabled("societe") && !empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)); $tabcond[40] = (isModEnabled("societe") && !empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES));
$tabcond[41] = !empty($conf->intracommreport->enabled); $tabcond[41] = isModEnabled('intracommreport');
$tabcond[42] = isModEnabled("product"); $tabcond[42] = isModEnabled("product");
$tabcond[43] = isModEnabled("product") && !empty($conf->productbatch->enabled) && $conf->global->MAIN_FEATURES_LEVEL >= 2; $tabcond[43] = isModEnabled("product") && isModEnabled('productbatch') && $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) // List of help for fields (no more used, help is defined into tabcomplete)
$tabhelp = array(); $tabhelp = array();

View File

@ -22,6 +22,8 @@
* \brief Page to setup ECM (GED) module * \brief Page to setup ECM (GED) module
*/ */
// Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
@ -37,6 +39,8 @@ if (!$user->admin) {
/* /*
* Action * Action
*/ */
// set
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) {
$code = $reg[1]; $code = $reg[1];
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) { 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)) { if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
$code = $reg[1]; $code = $reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0) { if (dolibarr_del_const($db, $code, $conf->entity) > 0) {

View File

@ -34,6 +34,16 @@ include_once DOL_DOCUMENT_ROOT.'/emailcollector/class/emailcollectorfilter.class
include_once DOL_DOCUMENT_ROOT.'/emailcollector/class/emailcollectoraction.class.php'; include_once DOL_DOCUMENT_ROOT.'/emailcollector/class/emailcollectoraction.class.php';
include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php'; include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php';
// use Webklex\PHPIMAP;
require DOL_DOCUMENT_ROOT.'/includes/webklex/php-imap/vendor/autoload.php';
use Webklex\PHPIMAP\ClientManager;
use Webklex\PHPIMAP\Exceptions\ConnectionFailedException;
use Webklex\PHPIMAP\Exceptions\InvalidWhereQueryCriteriaException;
use OAuth\Common\Storage\DoliStorage;
use OAuth\Common\Consumer\Credentials;
if (!$user->admin) { if (!$user->admin) {
accessforbidden(); accessforbidden();
} }
@ -377,6 +387,97 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$connectstringserver = $object->getConnectStringIMAP($usessl); $connectstringserver = $object->getConnectStringIMAP($usessl);
if ($action == 'scan') { if ($action == 'scan') {
if (!empty($conf->global->MAIN_IMAP_USE_PHPIMAP)) {
if ($object->acces_type == 1) {
// Mode OAUth2 with PHP-IMAP
require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // define $supportedoauth2array
$keyforsupportedoauth2array = $object->oauth_service;
if (preg_match('/^.*-/', $keyforsupportedoauth2array)) {
$keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array);
} else {
$keyforprovider = '';
}
$keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
$keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME';
$OAUTH_SERVICENAME = (empty($supportedoauth2array[$keyforsupportedoauth2array]['name']) ? 'Unknown' : $supportedoauth2array[$keyforsupportedoauth2array]['name'].($keyforprovider ? '-'.$keyforprovider : ''));
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
//$debugtext = "Host: ".$this->host."<br>Port: ".$this->port."<br>Login: ".$this->login."<br>Password: ".$this->password."<br>access type: ".$this->acces_type."<br>oauth service: ".$this->oauth_service."<br>Max email per collect: ".$this->maxemailpercollect;
//dol_syslog($debugtext);
$storage = new DoliStorage($db, $conf);
try {
$tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
$expire = true;
// Is token expired or will token expire in the next 30 seconds
// if (is_object($tokenobj)) {
// $expire = ($tokenobj->getEndOfLife() !== -9002 && $tokenobj->getEndOfLife() !== -9001 && time() > ($tokenobj->getEndOfLife() - 30));
// }
// Token expired so we refresh it
if (is_object($tokenobj) && $expire) {
$credentials = new Credentials(
getDolGlobalString('OAUTH_'.$object->oauth_service.'_ID'),
getDolGlobalString('OAUTH_'.$object->oauth_service.'_SECRET'),
getDolGlobalString('OAUTH_'.$object->oauth_service.'_URLAUTHORIZE')
);
$serviceFactory = new \OAuth\ServiceFactory();
$oauthname = explode('-', $OAUTH_SERVICENAME);
// ex service is Google-Emails we need only the first part Google
$apiService = $serviceFactory->createService($oauthname[0], $credentials, $storage, array());
// We have to save the token because Google give it only once
$refreshtoken = $tokenobj->getRefreshToken();
$tokenobj = $apiService->refreshAccessToken($tokenobj);
$tokenobj->setRefreshToken($refreshtoken);
$storage->storeAccessToken($OAUTH_SERVICENAME, $tokenobj);
}
$tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
if (is_object($tokenobj)) {
$token = $tokenobj->getAccessToken();
} else {
$object->error = "Token not found";
return -1;
}
} catch (Exception $e) {
print $e->getMessage();
}
$cm = new ClientManager();
$client = $cm->make([
'host' => $object->host,
'port' => $object->port,
'encryption' => 'ssl',
'validate_cert' => true,
'protocol' => 'imap',
'username' => $object->login,
'password' => $token,
'authentication' => "oauth",
]);
} else {
// Mode login/pass with PHP-IMAP
$cm = new ClientManager();
$client = $cm->make([
'host' => $object->host,
'port' => $object->port,
'encryption' => 'ssl',
'validate_cert' => true,
'protocol' => 'imap',
'username' => $object->login,
'password' => $object->password,
'authentication' => "login",
]);
}
try {
$client->connect();
} catch (ConnectionFailedException $e) {
print $e->getMessage();
}
$f = $client->getFolders(false, $object->source_directory);
$nbemail = $f[0]->examine()["exists"];
$morehtml .= $nbemail;
} else {
try { try {
if ($sourcedir) { if ($sourcedir) {
//$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir); //$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir);
@ -422,6 +523,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
dol_syslog("Imap close"); dol_syslog("Imap close");
imap_close($connection); imap_close($connection);
} }
}
} else { } else {
$morehtml .= '<a class="flat" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=scan&token='.newToken().'">'.img_picto('', 'refresh', 'class="paddingrightonly"').$langs->trans("Refresh").'</a>'; $morehtml .= '<a class="flat" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=scan&token='.newToken().'">'.img_picto('', 'refresh', 'class="paddingrightonly"').$langs->trans("Refresh").'</a>';
} }

View File

@ -130,12 +130,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader( $help_yrl = 'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura';
"",
$langs->trans("BillsSetup"),
'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'
);
llxHeader("", $langs->trans("BillsSetup"), $help_url);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';

View File

@ -63,10 +63,10 @@ $conditions = array(
'NOTE_PRIVATE' => 1, 'NOTE_PRIVATE' => 1,
'SOCIETE' => 1, 'SOCIETE' => 1,
'PRODUCTDESC' => (isModEnabled("product") || isModEnabled("service")), 'PRODUCTDESC' => (isModEnabled("product") || isModEnabled("service")),
'DETAILS' => (isModEnabled('facture') || isModEnabled("propal") || !empty($conf->commande->enabled) || !empty($conf->supplier_proposal->enabled) || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")), 'DETAILS' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande') || isModEnabled('supplier_proposal') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")),
'USERSIGN' => 1, 'USERSIGN' => 1,
'MAILING' => !empty($conf->mailing->enabled), 'MAILING' => !empty($conf->mailing->enabled),
'MAIL' => (isModEnabled('facture') || isModEnabled("propal") || !empty($conf->commande->enabled)), 'MAIL' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande')),
'TICKET' => !empty($conf->ticket->enabled), 'TICKET' => !empty($conf->ticket->enabled),
); );
// Picto // Picto

View File

@ -385,6 +385,20 @@ if ($mode == 'other') {
print '<td class="titlefieldmiddle"></td>'; print '<td class="titlefieldmiddle"></td>';
print '</tr>'; print '</tr>';
// Show Quick Add link
print '<tr class="oddeven"><td>' . $langs->trans("ShowQuickAddLink") . '</td><td>';
print ajax_constantonoff("MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
print '</td>';
print '</tr>';
// Hide wiki link on login page
$pictohelp = '<span class="fa fa-question-circle"></span>';
print '<tr class="oddeven"><td>' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . '</td><td>';
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 '</td>';
print '</tr>';
// Max size of lists // Max size of lists
print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeList") . '</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>'; print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeList") . '</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>';
print '</tr>'; print '</tr>';
@ -449,12 +463,6 @@ if ($mode == 'other') {
print '</tr>'; print '</tr>';
*/ */
// Show Quick Add link
print '<tr class="oddeven"><td>' . $langs->trans("ShowQuickAddLink") . '</td><td>';
print ajax_constantonoff("MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
print '</td>';
print '</tr>';
// Show bugtrack link // Show bugtrack link
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")), $langs->trans("ShowBugTrackLinkDesc")); print $form->textwithpicto($langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")), $langs->trans("ShowBugTrackLinkDesc"));
@ -463,14 +471,6 @@ if ($mode == 'other') {
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Hide wiki link on login page
$pictohelp = '<span class="fa fa-question-circle"></span>';
print '<tr class="oddeven"><td>' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . '</td><td>';
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 '</td>';
print '</tr>';
// Disable javascript and ajax // Disable javascript and ajax
print '<tr class="oddeven"><td>' . $form->textwithpicto($langs->trans("DisableJavascript"), $langs->trans("DisableJavascriptNote")) . '</td><td>'; print '<tr class="oddeven"><td>' . $form->textwithpicto($langs->trans("DisableJavascript"), $langs->trans("DisableJavascriptNote")) . '</td><td>';
print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');

View File

@ -45,10 +45,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
// Load translation files required by the page // Load translation files required by the page
$langsArray=array("errors", "admin", "mails", "languages"); $langsArray=array("errors", "admin", "mails", "languages");
if (!empty($conf->adherent->enabled)) { if (isModEnabled('adherent')) {
$langsArray[]='members'; $langsArray[]='members';
} }
if (!empty($conf->eventorganization->enabled)) { if (isModEnabled('eventorganization')) {
$langsArray[]='eventorganization'; $langsArray[]='eventorganization';
} }
@ -179,10 +179,10 @@ $elementList = array();
$elementList['all'] = '-- '.dol_escape_htmltag($langs->trans("All")).' --'; $elementList['all'] = '-- '.dol_escape_htmltag($langs->trans("All")).' --';
$elementList['none'] = '-- '.dol_escape_htmltag($langs->trans("None")).' --'; $elementList['none'] = '-- '.dol_escape_htmltag($langs->trans("None")).' --';
$elementList['user'] = img_picto('', 'user', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToUser')); $elementList['user'] = img_picto('', 'user', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToUser'));
if (!empty($conf->adherent->enabled) && !empty($user->rights->adherent->lire)) { if (isModEnabled('adherent') && !empty($user->rights->adherent->lire)) {
$elementList['member'] = img_picto('', 'object_member', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToMember')); $elementList['member'] = img_picto('', 'object_member', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToMember'));
} }
if (!empty($conf->recruitment->enabled) && !empty($user->rights->recruitment->recruitmentjobposition->read)) { if (isModEnabled('recruitment') && !empty($user->rights->recruitment->recruitmentjobposition->read)) {
$elementList['recruitmentcandidature_send'] = img_picto('', 'recruitmentcandidature', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('RecruitmentCandidatures')); $elementList['recruitmentcandidature_send'] = img_picto('', 'recruitmentcandidature', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('RecruitmentCandidatures'));
} }
if (isModEnabled("societe") && !empty($user->rights->societe->lire)) { if (isModEnabled("societe") && !empty($user->rights->societe->lire)) {
@ -194,7 +194,7 @@ if (!empty($conf->project->enabled)) {
if (isModEnabled("propal") && !empty($user->rights->propal->lire)) { if (isModEnabled("propal") && !empty($user->rights->propal->lire)) {
$elementList['propal_send'] = img_picto('', 'propal', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendProposal')); $elementList['propal_send'] = img_picto('', 'propal', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendProposal'));
} }
if (!empty($conf->commande->enabled) && !empty($user->rights->commande->lire)) { if (isModEnabled('commande') && !empty($user->rights->commande->lire)) {
$elementList['order_send'] = img_picto('', 'order', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendOrder')); $elementList['order_send'] = img_picto('', 'order', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendOrder'));
} }
if (isModEnabled('facture') && !empty($user->rights->facture->lire)) { if (isModEnabled('facture') && !empty($user->rights->facture->lire)) {
@ -209,7 +209,7 @@ if (isModEnabled("reception")) {
if (!empty($conf->ficheinter->enabled)) { if (!empty($conf->ficheinter->enabled)) {
$elementList['fichinter_send'] = img_picto('', 'intervention', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendIntervention')); $elementList['fichinter_send'] = img_picto('', 'intervention', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendIntervention'));
} }
if (!empty($conf->supplier_proposal->enabled)) { if (isModEnabled('supplier_proposal')) {
$elementList['supplier_proposal_send'] = img_picto('', 'propal', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierRequestForQuotation')); $elementList['supplier_proposal_send'] = img_picto('', 'propal', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierRequestForQuotation'));
} }
if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->commande->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && !empty($user->rights->supplier_order->lire))) { if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->commande->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && !empty($user->rights->supplier_order->lire))) {
@ -218,19 +218,19 @@ if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->commande-
if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_invoice") && !empty($user->rights->supplier_invoice->lire))) { if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_invoice") && !empty($user->rights->supplier_invoice->lire))) {
$elementList['invoice_supplier_send'] = img_picto('', 'bill', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierInvoice')); $elementList['invoice_supplier_send'] = img_picto('', 'bill', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierInvoice'));
} }
if (!empty($conf->contrat->enabled) && !empty($user->rights->contrat->lire)) { if (isModEnabled('contrat') && !empty($user->rights->contrat->lire)) {
$elementList['contract'] = img_picto('', 'contract', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendContract')); $elementList['contract'] = img_picto('', 'contract', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendContract'));
} }
if (!empty($conf->ticket->enabled) && !empty($user->rights->ticket->read)) { if (!empty($conf->ticket->enabled) && !empty($user->rights->ticket->read)) {
$elementList['ticket_send'] = img_picto('', 'ticket', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToTicket')); $elementList['ticket_send'] = img_picto('', 'ticket', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToTicket'));
} }
if (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire)) { if (isModEnabled('expensereport') && !empty($user->rights->expensereport->lire)) {
$elementList['expensereport_send'] = img_picto('', 'trip', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToExpenseReport')); $elementList['expensereport_send'] = img_picto('', 'trip', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToExpenseReport'));
} }
if (isModEnabled('agenda')) { if (isModEnabled('agenda')) {
$elementList['actioncomm_send'] = img_picto('', 'action', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendEventPush')); $elementList['actioncomm_send'] = img_picto('', 'action', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendEventPush'));
} }
if (!empty($conf->eventorganization->enabled) && !empty($user->rights->eventorganization->read)) { if (isModEnabled('eventorganization') && !empty($user->rights->eventorganization->read)) {
$elementList['conferenceorbooth'] = img_picto('', 'action', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization')); $elementList['conferenceorbooth'] = img_picto('', 'action', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization'));
} }
if (!empty($conf->partnership->enabled) && !empty($user->rights->partnership->read)) { if (!empty($conf->partnership->enabled) && !empty($user->rights->partnership->read)) {

View File

@ -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 = '';
}
}
/* /*

View File

@ -180,7 +180,7 @@ $formproduct = new FormProduct($db);
$disabled = ''; $disabled = '';
if (!empty($conf->productbatch->enabled)) { if (isModEnabled('productbatch')) {
$langs->load("productbatch"); $langs->load("productbatch");
$disabled = ' disabled'; $disabled = ' disabled';
print info_admin($langs->trans("WhenProductBatchModuleOnOptionAreForced")); print info_admin($langs->trans("WhenProductBatchModuleOnOptionAreForced"));
@ -226,7 +226,7 @@ $found++;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("DeStockOnValidateOrder").'</td>'; print '<td>'.$langs->trans("DeStockOnValidateOrder").'</td>';
print '<td class="right">'; print '<td class="right">';
if (!empty($conf->commande->enabled)) { if (isModEnabled('commande')) {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1); print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 0, 2, 1);
} else { } else {
@ -394,7 +394,7 @@ print "</td>\n";
print "</tr>\n"; print "</tr>\n";
// Option to force stock to be enough before adding a line into document // Option to force stock to be enough before adding a line into document
if (!empty($conf->invoice->enabled)) { if (isModEnabled('facture')) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockMustBeEnoughForInvoice").'</td>'; print '<td>'.$langs->trans("StockMustBeEnoughForInvoice").'</td>';
print '<td class="right">'; print '<td class="right">';
@ -408,7 +408,7 @@ if (!empty($conf->invoice->enabled)) {
print "</tr>\n"; print "</tr>\n";
} }
if (!empty($conf->order->enabled)) { if (isModEnabled('commande')) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockMustBeEnoughForOrder").'</td>'; print '<td>'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
print '<td class="right">'; print '<td class="right">';
@ -763,7 +763,7 @@ print "</td>\n";
print "</tr>\n"; print "</tr>\n";
/* Disabled. Would be better to be managed with a user cookie /* Disabled. Would be better to be managed with a user cookie
if (!empty($conf->productbatch->enabled)) { if (isModEnabled('productbatch')) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>' . $langs->trans("ShowAllBatchByDefault") . '</td>'; print '<td>' . $langs->trans("ShowAllBatchByDefault") . '</td>';
print '<td class="right">'; print '<td class="right">';

View File

@ -101,7 +101,7 @@ if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') {
} }
$text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'restricthtml'); $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); $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
} else { } else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity); $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 dol_get_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> : <a class="wordbreak" href="'.DOL_URL_ROOT.'/public/ticket/index.php?entity='.$conf->entity.'" target="_blank" rel="noopener noreferrer">'.dol_buildpath('/public/ticket/index.php?entity='.$conf->entity, 2).'</a>';
print dol_get_fiche_end();
$param = ''; $param = '';
print '<br>';
$enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' '; $enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' ';
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
// Button off, click to enable // Button off, click to enable
@ -256,9 +254,30 @@ if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
print $enabledisablehtml; print $enabledisablehtml;
print '<input type="hidden" id="TICKET_ENABLE_PUBLIC_INTERFACE" name="TICKET_ENABLE_PUBLIC_INTERFACE" value="'.(empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) ? 0 : 1).'">'; print '<input type="hidden" id="TICKET_ENABLE_PUBLIC_INTERFACE" name="TICKET_ENABLE_PUBLIC_INTERFACE" value="'.(empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) ? 0 : 1).'">';
print '<br><br>'; print dol_get_fiche_end();
if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
print '<br>';
// 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 '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> :<br>';
print '<div class="urllink">';
print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/ticket/index.php?entity='.$conf->entity.'">';
print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/ticket/index.php?entity='.$conf->entity.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
print '</div>';
print ajax_autoselect('publicurlmember');
print '<br><br>';
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >'; print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setvar">'; print '<input type="hidden" name="action" value="setvar">';
@ -371,8 +390,8 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help'); print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
print '</td></tr>'; print '</td></tr>';
// Texte d'accueil homepage // Text on home page
$public_text_home = $conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans('TicketPublicInterfaceTextHome'); $public_text_home = getDolGlobalString('TICKET_PUBLIC_TEXT_HOME', '<span class="opacitymedium">'.$langs->trans("TicketPublicDesc").'</span>');
print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHomeLabelAdmin").'</label>'; print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHomeLabelAdmin").'</label>';
print '</td><td>'; print '</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; 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 $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help');
print '</td></tr>'; print '</td></tr>';
// 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'); $public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe');
print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").'</label>'; print '<tr><td>'.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").'</label>';
print '</td><td>'; print '</td><td>';

View File

@ -56,21 +56,23 @@ if (!$user->admin) {
accessforbidden(); 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 = ''; $errormsg = '';
$utils = new Utils($db);
/* /*
* Actions * 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') { 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); $ret = dol_delete_file($file, 1);
if ($ret) { if ($ret) {
setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
@ -80,11 +82,6 @@ if ($action == 'delete') {
$action = ''; $action = '';
} }
/*
* View
*/
$_SESSION["commandbackuplastdone"] = ''; $_SESSION["commandbackuplastdone"] = '';
$_SESSION["commandbackuptorun"] = ''; $_SESSION["commandbackuptorun"] = '';
$_SESSION["commandbackupresult"] = ''; $_SESSION["commandbackupresult"] = '';
@ -103,13 +100,6 @@ if (!empty($MemoryLimit)) {
@ini_set('memory_limit', $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 // Start with empty buffer
$dump_buffer = ''; $dump_buffer = '';
$dump_buffer_len = 0; $dump_buffer_len = 0;
@ -122,9 +112,6 @@ $outputdir = $conf->admin->dir_output.'/backup';
$result = dol_mkdir($outputdir); $result = dol_mkdir($outputdir);
$utils = new Utils($db);
// MYSQL // MYSQL
if ($what == 'mysql') { if ($what == 'mysql') {
$cmddump = GETPOST("mysqldump", 'none'); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg $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(); $db->close();
// Redirect to backup page // Redirect to backup page
header("Location: dolibarr_export.php".(GETPOST('page_y', 'int') ? '?page_y='.GETPOST('page_y', 'int') : '')); header("Location: dolibarr_export.php".(GETPOST('page_y', 'int') ? '?page_y='.GETPOST('page_y', 'int') : ''));
exit();

View File

@ -205,7 +205,12 @@ if ($compression == 'zip') {
print $errormsg; print $errormsg;
} }
// Output export
if ($export_type != 'externalmodule' || empty($what)) { if ($export_type != 'externalmodule' || empty($what)) {
top_httphead();
if ($errormsg) { if ($errormsg) {
setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors'); setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
} else { } else {
@ -218,12 +223,15 @@ if ($export_type != 'externalmodule' || empty($what)) {
$returnto = 'dolibarr_export.php'; $returnto = 'dolibarr_export.php';
header("Location: ".$returnto); header("Location: ".$returnto);
exit(); exit();
} else { } else {
top_httphead('application/zip');
$zipname = $outputdir."/".$file; $zipname = $outputdir."/".$file;
// Then download the zipped file. // Then download the zipped file.
header('Content-Type: application/zip');
header('Content-disposition: attachment; filename='.basename($zipname)); header('Content-disposition: attachment; filename='.basename($zipname));
header('Content-Length: '.filesize($zipname)); header('Content-Length: '.filesize($zipname));
readfile($zipname); readfile($zipname);

View File

@ -62,13 +62,13 @@ $workflowcodes = array(
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array( 'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array(
'family'=>'create', 'family'=>'create',
'position'=>10, 'position'=>10,
'enabled'=>(isModEnabled("propal") && !empty($conf->commande->enabled)), 'enabled'=>(isModEnabled("propal") && isModEnabled('commande')),
'picto'=>'order' 'picto'=>'order'
), ),
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array( 'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array(
'family'=>'create', 'family'=>'create',
'position'=>20, 'position'=>20,
'enabled'=>(!empty($conf->commande->enabled) && isModEnabled('facture')), 'enabled'=>(isModEnabled('commande') && isModEnabled('facture')),
'picto'=>'bill' 'picto'=>'bill'
), ),
'WORKFLOW_TICKET_CREATE_INTERVENTION' => array ( 'WORKFLOW_TICKET_CREATE_INTERVENTION' => array (
@ -84,7 +84,7 @@ $workflowcodes = array(
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array( 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array(
'family'=>'classify_proposal', 'family'=>'classify_proposal',
'position'=>30, 'position'=>30,
'enabled'=>(isModEnabled("propal") && !empty($conf->commande->enabled)), 'enabled'=>(isModEnabled("propal") && isModEnabled('commande')),
'picto'=>'propal', 'picto'=>'propal',
'warning'=>'' 'warning'=>''
), ),
@ -100,19 +100,19 @@ $workflowcodes = array(
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array( // when shipping validated 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array( // when shipping validated
'family'=>'classify_order', 'family'=>'classify_order',
'position'=>40, 'position'=>40,
'enabled'=>(isModEnabled("expedition") && !empty($conf->commande->enabled)), 'enabled'=>(isModEnabled("expedition") && isModEnabled('commande')),
'picto'=>'order' 'picto'=>'order'
), ),
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED'=>array( // when shipping closed 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED'=>array( // when shipping closed
'family'=>'classify_order', 'family'=>'classify_order',
'position'=>41, 'position'=>41,
'enabled'=>(isModEnabled("expedition") && !empty($conf->commande->enabled)), 'enabled'=>(isModEnabled("expedition") && isModEnabled('commande')),
'picto'=>'order' 'picto'=>'order'
), ),
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array( 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array(
'family'=>'classify_order', 'family'=>'classify_order',
'position'=>42, 'position'=>42,
'enabled'=>(isModEnabled('facture') && !empty($conf->commande->enabled)), 'enabled'=>(isModEnabled('facture') && isModEnabled('commande')),
'picto'=>'order', 'picto'=>'order',
'warning'=>'' 'warning'=>''
), // For this option, if module invoice is disabled, it does not exists, so "Classify billed" for order must be done manually from order card. ), // For this option, if module invoice is disabled, it does not exists, so "Classify billed" for order must be done manually from order card.
@ -123,7 +123,7 @@ $workflowcodes = array(
'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array( 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array(
'family'=>'classify_supplier_proposal', 'family'=>'classify_supplier_proposal',
'position'=>60, 'position'=>60,
'enabled'=>(!empty($conf->supplier_proposal->enabled) && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), 'enabled'=>(isModEnabled('supplier_proposal') && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))),
'picto'=>'supplier_proposal', 'picto'=>'supplier_proposal',
'warning'=>'' 'warning'=>''
), ),

View File

@ -58,7 +58,7 @@ $permissiontoadd = $user->rights->asset->write; // Used by the include of action
if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) accessforbidden();
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); 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); $result = $assetaccountancycodes->fetchAccountancyCodes($object->id);
if ($result < 0) { if ($result < 0) {

View File

@ -86,7 +86,7 @@ $permissiontoadd = $user->rights->asset->write; // Used by the include of action
if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) accessforbidden();
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->asset->enabled)) accessforbidden(); if (!isModEnabled('asset')) accessforbidden();
/* /*

View File

@ -80,7 +80,7 @@ if ($user->socid > 0) accessforbidden();
if ($user->socid > 0) $socid = $user->socid; if ($user->socid > 0) $socid = $user->socid;
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); 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(); if (!$permissiontoread) accessforbidden();

View File

@ -56,7 +56,7 @@ if ($id > 0 || !empty($ref)) {
if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) accessforbidden();
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); 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(); if (!empty($object->not_depreciated)) accessforbidden();
$object->asset_depreciation_options = &$assetdepreciationoptions; $object->asset_depreciation_options = &$assetdepreciationoptions;

View File

@ -58,7 +58,7 @@ $permissiontoadd = $user->rights->asset->write; // Used by the include of action
if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) accessforbidden();
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); 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(); if (!empty($object->not_depreciated)) accessforbidden();
$object->asset_depreciation_options = &$assetdepreciationoptions; $object->asset_depreciation_options = &$assetdepreciationoptions;

View File

@ -57,7 +57,7 @@ $permissiontoadd = $user->rights->asset->write; // Used by the include of action
if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) accessforbidden();
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); 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(); if (!isset($object->disposal_date) || $object->disposal_date === "") accessforbidden();

View File

@ -78,7 +78,7 @@ $permissiontoadd = $user->rights->asset->asset->write; // Used by the include of
if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) accessforbidden();
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->asset->enabled)) accessforbidden(); if (!isModEnabled('asset')) accessforbidden();
/* /*

View File

@ -125,7 +125,7 @@ $permissiontoadd = $user->rights->asset->write;
$permissiontodelete = $user->rights->asset->delete; $permissiontodelete = $user->rights->asset->delete;
// Security check // Security check
if (empty($conf->asset->enabled)) { if (!isModEnabled('asset')) {
accessforbidden('Module not enabled'); accessforbidden('Module not enabled');
} }
@ -134,7 +134,7 @@ if ($user->socid > 0) accessforbidden();
$socid = 0; if ($user->socid > 0) $socid = $user->socid; $socid = 0; if ($user->socid > 0) $socid = $user->socid;
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); 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(); if (!$permissiontoread) accessforbidden();

View File

@ -59,7 +59,7 @@ $permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rig
if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) accessforbidden();
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); 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(); if (!$permissiontoread) accessforbidden();
$result = $assetaccountancycodes->fetchAccountancyCodes(0, $object->id); $result = $assetaccountancycodes->fetchAccountancyCodes(0, $object->id);

View File

@ -88,7 +88,7 @@ if ($user->socid > 0) accessforbidden();
if ($user->socid > 0) $socid = $user->socid; if ($user->socid > 0) $socid = $user->socid;
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); 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(); if (!$permissiontoread) accessforbidden();

View File

@ -80,7 +80,7 @@ if ($user->socid > 0) accessforbidden();
if ($user->socid > 0) $socid = $user->socid; if ($user->socid > 0) $socid = $user->socid;
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); 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(); if (!$permissiontoread) accessforbidden();

View File

@ -59,7 +59,7 @@ $permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rig
if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) accessforbidden();
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); 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(); if (!$permissiontoread) accessforbidden();
$object->asset_depreciation_options = &$assetdepreciationoptions; $object->asset_depreciation_options = &$assetdepreciationoptions;

View File

@ -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))); $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 // Security check
if (empty($conf->asset->enabled)) { if (!isModEnabled('asset')) {
accessforbidden('Module not enabled'); accessforbidden('Module not enabled');
} }
@ -140,7 +140,7 @@ if ($user->socid > 0) {
} }
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); 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(); if (!$permissiontoread) accessforbidden();
/* /*

View File

@ -57,7 +57,7 @@ $permissiontoadd = $user->rights->asset->write; // Used by the include of action
if ($user->socid > 0) accessforbidden(); if ($user->socid > 0) accessforbidden();
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
if (empty($conf->asset->enabled)) accessforbidden(); if (!isModEnabled('asset')) accessforbidden();
/* /*

View File

@ -22,21 +22,24 @@
* \brief Page setup for blockedlog module * \brief Page setup for blockedlog module
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin", "other", "blockedlog")); $langs->loadLangs(array('admin', 'blockedlog', 'other'));
// Access Control
if (!$user->admin || empty($conf->blockedlog->enabled)) { if (!$user->admin || empty($conf->blockedlog->enabled)) {
accessforbidden(); accessforbidden();
} }
// Get Parameters
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$withtab = GETPOST('withtab', 'int'); $withtab = GETPOST('withtab', 'int');

View File

@ -23,6 +23,8 @@
* \brief Page setup for blockedlog module * \brief Page setup for blockedlog module
*/ */
// Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
@ -31,12 +33,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin", "other", "blockedlog", "bills")); $langs->loadLangs(array('admin', 'bills', 'blockedlog', 'other'));
// Access Control
if ((!$user->admin && empty($user->rights->blockedlog->read)) || empty($conf->blockedlog->enabled)) { if ((!$user->admin && empty($user->rights->blockedlog->read)) || empty($conf->blockedlog->enabled)) {
accessforbidden(); accessforbidden();
} }
// Get Parameters
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'blockedloglist'; // To manage different context of search $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'blockedloglist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
@ -95,7 +99,7 @@ $block_static->loadTrackedEvents();
$result = restrictedArea($user, 'blockedlog', 0, ''); $result = restrictedArea($user, 'blockedlog', 0, '');
// Execution Time
$max_execution_time_for_importexport = (empty($conf->global->EXPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->EXPORT_MAX_EXECUTION_TIME); // 5mn if not defined $max_execution_time_for_importexport = (empty($conf->global->EXPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->EXPORT_MAX_EXECUTION_TIME); // 5mn if not defined
$max_time = @ini_get("max_execution_time"); $max_time = @ini_get("max_execution_time");
if ($max_time && $max_time < $max_execution_time_for_importexport) { if ($max_time && $max_time < $max_execution_time_for_importexport) {

View File

@ -140,6 +140,7 @@ class BlockedLog
$this->trackedevents = array(); $this->trackedevents = array();
// Customer Invoice/Facture / Payment
if (isModEnabled('facture')) { if (isModEnabled('facture')) {
$this->trackedevents['BILL_VALIDATE'] = 'logBILL_VALIDATE'; $this->trackedevents['BILL_VALIDATE'] = 'logBILL_VALIDATE';
$this->trackedevents['BILL_DELETE'] = 'logBILL_DELETE'; $this->trackedevents['BILL_DELETE'] = 'logBILL_DELETE';
@ -151,18 +152,19 @@ class BlockedLog
} }
/* Supplier /* Supplier
// Supplier Invoice / Payment
if (isModEnabled("fournisseur")) { if (isModEnabled("fournisseur")) {
$this->trackedevents['BILL_SUPPLIER_VALIDATE']='BlockedLogSupplierBillValidate'; $this->trackedevents['BILL_SUPPLIER_VALIDATE']='BlockedLogSupplierBillValidate';
$this->trackedevents['BILL_SUPPLIER_DELETE']='BlockedLogSupplierBillDelete'; $this->trackedevents['BILL_SUPPLIER_DELETE']='BlockedLogSupplierBillDelete';
$this->trackedevents['BILL_SUPPLIER_SENTBYMAIL']='BlockedLogSupplierBillSentByEmail'; // Trigger key does not exists, we want just into array to list it as done $this->trackedevents['BILL_SUPPLIER_SENTBYMAIL']='BlockedLogSupplierBillSentByEmail'; // Trigger key does not exists, we want just into array to list it as done
$this->trackedevents['SUPPLIER_DOC_DOWNLOAD']='BlockedLogSupplierBillDownload'; // Trigger key does not exists, we want just into array to list it as done $this->trackedevents['SUPPLIER_DOC_DOWNLOAD']='BlockedLogSupplierBillDownload'; // Trigger key does not exists, we want just into array to list it as done
$this->trackedevents['SUPPLIER_DOC_PREVIEW']='BlockedLogSupplierBillPreview'; // Trigger key does not exists, we want just into array to list it as done $this->trackedevents['SUPPLIER_DOC_PREVIEW']='BlockedLogSupplierBillPreview'; // Trigger key does not exists, we want just into array to list it as done
$this->trackedevents['PAYMENT_SUPPLIER_CREATE']='BlockedLogSupplierBillPaymentCreate'; $this->trackedevents['PAYMENT_SUPPLIER_CREATE']='BlockedLogSupplierBillPaymentCreate';
$this->trackedevents['PAYMENT_SUPPLIER_DELETE']='BlockedLogsupplierBillPaymentCreate'; $this->trackedevents['PAYMENT_SUPPLIER_DELETE']='BlockedLogsupplierBillPaymentCreate';
} }
*/ */
// Donation
if (!empty($conf->don->enabled)) { if (!empty($conf->don->enabled)) {
$this->trackedevents['DON_VALIDATE'] = 'logDON_VALIDATE'; $this->trackedevents['DON_VALIDATE'] = 'logDON_VALIDATE';
$this->trackedevents['DON_DELETE'] = 'logDON_DELETE'; $this->trackedevents['DON_DELETE'] = 'logDON_DELETE';
@ -172,6 +174,7 @@ class BlockedLog
} }
/* /*
// Salary
if (!empty($conf->salary->enabled)) { if (!empty($conf->salary->enabled)) {
$this->trackedevents['PAYMENT_SALARY_CREATE']='BlockedLogSalaryPaymentCreate'; $this->trackedevents['PAYMENT_SALARY_CREATE']='BlockedLogSalaryPaymentCreate';
$this->trackedevents['PAYMENT_SALARY_MODIFY']='BlockedLogSalaryPaymentCreate'; $this->trackedevents['PAYMENT_SALARY_MODIFY']='BlockedLogSalaryPaymentCreate';
@ -179,16 +182,21 @@ class BlockedLog
} }
*/ */
if (!empty($conf->adherent->enabled)) { // Members
if (isModEnabled('adherent')) {
$this->trackedevents['MEMBER_SUBSCRIPTION_CREATE'] = 'logMEMBER_SUBSCRIPTION_CREATE'; $this->trackedevents['MEMBER_SUBSCRIPTION_CREATE'] = 'logMEMBER_SUBSCRIPTION_CREATE';
$this->trackedevents['MEMBER_SUBSCRIPTION_MODIFY'] = 'logMEMBER_SUBSCRIPTION_MODIFY'; $this->trackedevents['MEMBER_SUBSCRIPTION_MODIFY'] = 'logMEMBER_SUBSCRIPTION_MODIFY';
$this->trackedevents['MEMBER_SUBSCRIPTION_DELETE'] = 'logMEMBER_SUBSCRIPTION_DELETE'; $this->trackedevents['MEMBER_SUBSCRIPTION_DELETE'] = 'logMEMBER_SUBSCRIPTION_DELETE';
} }
// Bank
if (isModEnabled("banque")) { if (isModEnabled("banque")) {
$this->trackedevents['PAYMENT_VARIOUS_CREATE'] = 'logPAYMENT_VARIOUS_CREATE'; $this->trackedevents['PAYMENT_VARIOUS_CREATE'] = 'logPAYMENT_VARIOUS_CREATE';
$this->trackedevents['PAYMENT_VARIOUS_MODIFY'] = 'logPAYMENT_VARIOUS_MODIFY'; $this->trackedevents['PAYMENT_VARIOUS_MODIFY'] = 'logPAYMENT_VARIOUS_MODIFY';
$this->trackedevents['PAYMENT_VARIOUS_DELETE'] = 'logPAYMENT_VARIOUS_DELETE'; $this->trackedevents['PAYMENT_VARIOUS_DELETE'] = 'logPAYMENT_VARIOUS_DELETE';
} }
// Cashdesk
// $conf->global->BANK_ENABLE_POS_CASHCONTROL must be set to 1 by all external POS modules // $conf->global->BANK_ENABLE_POS_CASHCONTROL must be set to 1 by all external POS modules
$moduleposenabled = (!empty($conf->cashdesk->enabled) || !empty($conf->takepos->enabled) || !empty($conf->global->BANK_ENABLE_POS_CASHCONTROL)); $moduleposenabled = (!empty($conf->cashdesk->enabled) || !empty($conf->takepos->enabled) || !empty($conf->global->BANK_ENABLE_POS_CASHCONTROL));
if ($moduleposenabled) { if ($moduleposenabled) {

View File

@ -17,9 +17,9 @@
*/ */
/** /**
* \file htdocs/modulebuilder/template/myobject_agenda.php * \file htdocs/bom/bom_agenda.php
* \ingroup bom * \ingroup bom
* \brief Page of MyObject events * \brief Page of BOM events
*/ */
// Load Dolibarr environment // Load Dolibarr environment

View File

@ -682,9 +682,6 @@ class Categories extends DolibarrApi
unset($object->total_ttc); unset($object->total_ttc);
unset($object->total_tva); unset($object->total_tva);
unset($object->lines); unset($object->lines);
unset($object->fk_incoterms);
unset($object->label_incoterms);
unset($object->location_incoterms);
unset($object->civility_id); unset($object->civility_id);
unset($object->name); unset($object->name);
unset($object->lastname); unset($object->lastname);

View File

@ -487,6 +487,7 @@ $typeid = $type;
// List of products or services (type is type of category) // List of products or services (type is type of category)
if ($type == Categorie::TYPE_PRODUCT) { if ($type == Categorie::TYPE_PRODUCT) {
if ($user->hasRight("product", "read")) {
$permission = ($user->rights->produit->creer || $user->rights->service->creer); $permission = ($user->rights->produit->creer || $user->rights->service->creer);
$prods = $object->getObjectsInCateg($type, 0, $limit, $offset); $prods = $object->getObjectsInCateg($type, 0, $limit, $offset);
@ -560,10 +561,15 @@ if ($type == Categorie::TYPE_PRODUCT) {
print '</form>'."\n"; print '</form>'."\n";
} }
} else {
print_barre_liste($langs->trans("ProductsAndServices"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'products');
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
} }
// List of customers // List of customers
if ($type == Categorie::TYPE_CUSTOMER) { if ($type == Categorie::TYPE_CUSTOMER) {
if ($user->hasRight("societe", "read")) {
$permission = $user->rights->societe->creer; $permission = $user->rights->societe->creer;
$socs = $object->getObjectsInCateg($type, 0, $limit, $offset); $socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
@ -635,10 +641,15 @@ if ($type == Categorie::TYPE_CUSTOMER) {
print '</form>'."\n"; print '</form>'."\n";
} }
} else {
print_barre_liste($langs->trans("Customers"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'companies');
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
} }
// List of suppliers // List of suppliers
if ($type == Categorie::TYPE_SUPPLIER) { if ($type == Categorie::TYPE_SUPPLIER) {
if ($user->hasRight("fournisseur", "read")) {
$permission = $user->rights->societe->creer; $permission = $user->rights->societe->creer;
$socs = $object->getObjectsInCateg($type, 0, $limit, $offset); $socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
@ -711,10 +722,15 @@ if ($type == Categorie::TYPE_SUPPLIER) {
print '</form>'."\n"; print '</form>'."\n";
} }
} else {
print_barre_liste($langs->trans("Suppliers"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'companies');
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
} }
// List of members // List of members
if ($type == Categorie::TYPE_MEMBER) { if ($type == Categorie::TYPE_MEMBER) {
if ($user->hasRight("adherent", "read")) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$permission = $user->rights->adherent->creer; $permission = $user->rights->adherent->creer;
@ -790,10 +806,15 @@ if ($type == Categorie::TYPE_MEMBER) {
print '</form>'."\n"; print '</form>'."\n";
} }
} else {
print_barre_liste($langs->trans("Member"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'members');
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
} }
// List of contacts // List of contacts
if ($type == Categorie::TYPE_CONTACT) { if ($type == Categorie::TYPE_CONTACT) {
if ($user->hasRight("societe", "read")) {
$permission = $user->rights->societe->creer; $permission = $user->rights->societe->creer;
$contacts = $object->getObjectsInCateg($type, 0, $limit, $offset); $contacts = $object->getObjectsInCateg($type, 0, $limit, $offset);
@ -872,10 +893,15 @@ if ($type == Categorie::TYPE_CONTACT) {
print '</form>'."\n"; print '</form>'."\n";
} }
} else {
print_barre_liste($langs->trans("Contact"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'contact');
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
} }
// List of bank accounts // List of bank accounts
if ($type == Categorie::TYPE_ACCOUNT) { if ($type == Categorie::TYPE_ACCOUNT) {
if ($user->hasRight("banque", "read")) {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$permission = $user->rights->banque->creer; $permission = $user->rights->banque->creer;
@ -949,10 +975,15 @@ if ($type == Categorie::TYPE_ACCOUNT) {
print '</form>'."\n"; print '</form>'."\n";
} }
} else {
print_barre_liste($langs->trans("Banque"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'bank');
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
} }
// List of Project // List of Project
if ($type == Categorie::TYPE_PROJECT) { if ($type == Categorie::TYPE_PROJECT) {
if ($user->hasRight("project", "read")) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$permission = $user->rights->projet->creer; $permission = $user->rights->projet->creer;
@ -1027,10 +1058,15 @@ if ($type == Categorie::TYPE_PROJECT) {
print '</form>'."\n"; print '</form>'."\n";
} }
} else {
print_barre_liste($langs->trans("Project"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'project');
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
} }
// List of users // List of users
if ($type == Categorie::TYPE_USER && $user->hasRight("user", "user", "read")) { if ($type == Categorie::TYPE_USER) {
if ($user->hasRight("user", "user", "read")) {
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
$users = $object->getObjectsInCateg($type); $users = $object->getObjectsInCateg($type);
@ -1103,10 +1139,12 @@ if ($type == Categorie::TYPE_USER && $user->hasRight("user", "user", "read")) {
print_barre_liste($langs->trans("Users"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'user'); print_barre_liste($langs->trans("Users"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'user');
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
} }
}
// List of warehouses // List of warehouses
if ($type == Categorie::TYPE_WAREHOUSE) { if ($type == Categorie::TYPE_WAREHOUSE) {
if ($user->hasRight("warehouse", "read")) {
$permission = $user->rights->stock->creer; $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';
@ -1161,10 +1199,15 @@ if ($type == Categorie::TYPE_WAREHOUSE) {
print '</form>'."\n"; print '</form>'."\n";
} }
} else {
print_barre_liste($langs->trans("Warehouse"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'stock');
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
} }
// List of tickets // List of tickets
if ($type == Categorie::TYPE_TICKET) { if ($type == Categorie::TYPE_TICKET) {
if ($user->hasRight("ticket", "read")) {
$permission = ($user->rights->categorie->creer || $user->rights->categorie->creer); $permission = ($user->rights->categorie->creer || $user->rights->categorie->creer);
$tickets = $object->getObjectsInCateg($type, 0, $limit, $offset); $tickets = $object->getObjectsInCateg($type, 0, $limit, $offset);
@ -1235,6 +1278,10 @@ if ($type == Categorie::TYPE_TICKET) {
print '</form>'."\n"; print '</form>'."\n";
} }
} else {
print_barre_liste($langs->trans("Ticket"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'ticket');
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
}
} }
// End of page // End of page

View File

@ -1362,7 +1362,7 @@ if ($action == 'create') {
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200'); $formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
print '</td></tr>'; print '</td></tr>';
if (!empty($conf->categorie->enabled)) { if (isModEnabled('categorie')) {
// Categories // Categories
print '<tr><td>'.$langs->trans("Categories").'</td><td>'; print '<tr><td>'.$langs->trans("Categories").'</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1);
@ -1496,7 +1496,7 @@ if ($action == 'create') {
// Description // Description
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; 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(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
@ -1870,7 +1870,7 @@ if ($id > 0) {
print '</td></tr>'; print '</td></tr>';
// Tags-Categories // Tags-Categories
if (!empty($conf->categorie->enabled)) { if (isModEnabled('categorie')) {
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1);
$c = new Categorie($db); $c = new Categorie($db);
@ -2285,7 +2285,7 @@ if ($id > 0) {
} }
// Categories // Categories
if (!empty($conf->categorie->enabled)) { if (isModEnabled('categorie')) {
print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>'; print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($object->id, Categorie::TYPE_ACTIONCOMM, 1); print $form->showCategories($object->id, Categorie::TYPE_ACTIONCOMM, 1);
print "</td></tr>"; print "</td></tr>";

View File

@ -124,7 +124,7 @@ class AgendaEvents extends DolibarrApi
if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) { if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) {
$search_sale = DolibarrApiAccess::$user->id; $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 $search_sale = 0; // If module thirdparty not enabled, sale representative is something that does not exists
} }

View File

@ -201,7 +201,7 @@ class CActionComm
if ($obj->module == 'invoice' && isModEnabled('facture') && !empty($user->rights->facture->lire)) { if ($obj->module == 'invoice' && isModEnabled('facture') && !empty($user->rights->facture->lire)) {
$qualified = 1; $qualified = 1;
} }
if ($obj->module == 'order' && !empty($conf->commande->enabled) && empty($user->rights->commande->lire)) { if ($obj->module == 'order' && isModEnabled('commande') && empty($user->rights->commande->lire)) {
$qualified = 1; $qualified = 1;
} }
if ($obj->module == 'propal' && isModEnabled("propal") && !empty($user->rights->propale->lire)) { if ($obj->module == 'propal' && isModEnabled("propal") && !empty($user->rights->propale->lire)) {
@ -218,7 +218,7 @@ class CActionComm
} }
// For case module = 'myobject@eventorganization' // For case module = 'myobject@eventorganization'
$tmparray = preg_split("/@/", $obj->module, -1); $tmparray = preg_split("/@/", $obj->module, -1);
if (count($tmparray) > 1 && $tmparray[1] == 'eventorganization' && !empty($conf->eventorganization->enabled)) { if (count($tmparray) > 1 && $tmparray[1] == 'eventorganization' && isModEnabled('eventorganization')) {
$qualified = 1; $qualified = 1;
} }
// For the generic case with type = 'module...' and module = 'myobject@mymodule' // For the generic case with type = 'module...' and module = 'myobject@mymodule'

View File

@ -47,16 +47,16 @@ if (isModEnabled('facture')) {
if (isModEnabled("propal")) { if (isModEnabled("propal")) {
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
} }
if (!empty($conf->commande->enabled)) { if (isModEnabled('commande')) {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
} }
if (isModEnabled("expedition")) { if (isModEnabled("expedition")) {
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
} }
if (!empty($conf->contrat->enabled)) { if (isModEnabled('contrat')) {
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
} }
if (!empty($conf->adherent->enabled)) { if (isModEnabled('adherent')) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
} }
if (!empty($conf->ficheinter->enabled)) { if (!empty($conf->ficheinter->enabled)) {
@ -66,10 +66,10 @@ if (!empty($conf->ficheinter->enabled)) {
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('companies', 'banks')); $langs->loadLangs(array('companies', 'banks'));
if (!empty($conf->contrat->enabled)) { if (isModEnabled('contrat')) {
$langs->load("contracts"); $langs->load("contracts");
} }
if (!empty($conf->commande->enabled)) { if (isModEnabled('commande')) {
$langs->load("orders"); $langs->load("orders");
} }
if (isModEnabled("expedition")) { if (isModEnabled("expedition")) {
@ -510,7 +510,7 @@ if ($object->id > 0) {
} }
if ($object->client) { if ($object->client) {
if (!empty($conf->commande->enabled) && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT)) { if (isModEnabled('commande') && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT)) {
print '<!-- Minimim amount for orders -->'."\n"; print '<!-- Minimim amount for orders -->'."\n";
print '<tr class="nowrap">'; print '<tr class="nowrap">';
print '<td>'; print '<td>';
@ -584,7 +584,7 @@ if ($object->id > 0) {
print '</tr>'; print '</tr>';
} }
if (!empty($conf->intracommreport->enabled)) { if (isModEnabled('intracommreport')) {
// Transport mode by default // Transport mode by default
print '<tr><td class="nowrap">'; print '<tr><td class="nowrap">';
print '<table class="centpercent nobordernopadding"><tr><td class="nowrap">'; print '<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
@ -605,7 +605,7 @@ if ($object->id > 0) {
} }
// Categories // Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
$langs->load("categories"); $langs->load("categories");
print '<tr><td>'.$langs->trans("CustomersCategoriesShort").'</td>'; print '<tr><td>'.$langs->trans("CustomersCategoriesShort").'</td>';
print '<td>'; print '<td>';
@ -621,7 +621,7 @@ if ($object->id > 0) {
include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
// Module Adherent // Module Adherent
if (!empty($conf->adherent->enabled)) { if (isModEnabled('adherent')) {
$langs->load("members"); $langs->load("members");
$langs->load("users"); $langs->load("users");
@ -718,7 +718,7 @@ if ($object->id > 0) {
} }
} }
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { if (isModEnabled('commande') && $user->rights->commande->lire) {
// Box commandes // Box commandes
$tmp = $object->getOutstandingOrders(); $tmp = $object->getOutstandingOrders();
$outstandingOpened = $tmp['opened']; $outstandingOpened = $tmp['opened'];
@ -913,7 +913,7 @@ if ($object->id > 0) {
/* /*
* Latest orders * Latest orders
*/ */
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { if (isModEnabled('commande') && $user->rights->commande->lire) {
$param =""; $param ="";
$sql = "SELECT s.nom, s.rowid"; $sql = "SELECT s.nom, s.rowid";
@ -1122,7 +1122,7 @@ if ($object->id > 0) {
/* /*
* Latest contracts * Latest contracts
*/ */
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) { if (isModEnabled('contrat') && $user->rights->contrat->lire) {
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup, c.entity,"; $sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup, c.entity,";
$sql .= " c.last_main_doc, c.model_pdf"; $sql .= " c.last_main_doc, c.model_pdf";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
@ -1553,7 +1553,7 @@ if ($object->id > 0) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddProp").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddProp").'</a></div>';
} }
if (!empty($conf->commande->enabled) && $user->rights->commande->creer && $object->status == 1) { if (isModEnabled('commande') && $user->rights->commande->creer && $object->status == 1) {
$langs->load("orders"); $langs->load("orders");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddOrder").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddOrder").'</a></div>';
} }
@ -1570,7 +1570,7 @@ if ($object->id > 0) {
// Add invoice // Add invoice
if ($user->socid == 0) { if ($user->socid == 0) {
if (!empty($conf->deplacement->enabled) && $object->status == 1) { if (isModEnabled('deplacement') && $object->status == 1) {
$langs->load("trips"); $langs->load("trips");
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddTrip").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddTrip").'</a></div>';
} }
@ -1581,7 +1581,7 @@ if ($object->id > 0) {
} else { } else {
$langs->loadLangs(array("orders", "bills")); $langs->loadLangs(array("orders", "bills"));
if (!empty($conf->commande->enabled)) { if (isModEnabled('commande')) {
if ($object->client != 0 && $object->client != 2) { if ($object->client != 0 && $object->client != 2) {
if (!empty($orders2invoice) && $orders2invoice > 0) { if (!empty($orders2invoice) && $orders2invoice > 0) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'&search_billed=0&autoselectall=1">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'&search_billed=0&autoselectall=1">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';

View File

@ -93,10 +93,10 @@ $companystatic = new Societe($db);
if (isModEnabled("propal")) { if (isModEnabled("propal")) {
$propalstatic = new Propal($db); $propalstatic = new Propal($db);
} }
if (!empty($conf->supplier_proposal->enabled)) { if (isModEnabled('supplier_proposal')) {
$supplierproposalstatic = new SupplierProposal($db); $supplierproposalstatic = new SupplierProposal($db);
} }
if (!empty($conf->commande->enabled)) { if (isModEnabled('commande')) {
$orderstatic = new Commande($db); $orderstatic = new Commande($db);
} }
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) { if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) {
@ -194,7 +194,7 @@ if (isModEnabled("propal") && $user->rights->propal->lire) {
$companystatic->canvas = $obj->canvas; $companystatic->canvas = $obj->canvas;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap tdoverflowmax100">'.$propalstatic->getNomUrl(1).'</td>'; print '<td class="nowraponall tdoverflowmax100">'.$propalstatic->getNomUrl(1).'</td>';
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'customer').'</td>'; print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'customer').'</td>';
print '<td class="nowrap right tdamount amount">'.price((!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc)).'</td>'; print '<td class="nowrap right tdamount amount">'.price((!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc)).'</td>';
print '</tr>'; print '</tr>';
@ -226,7 +226,7 @@ if (isModEnabled("propal") && $user->rights->propal->lire) {
* Draft supplier proposals * Draft supplier proposals
*/ */
if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) { if (isModEnabled('supplier_proposal') && $user->rights->supplier_proposal->lire) {
$sql = "SELECT p.rowid, p.ref, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status"; $sql = "SELECT p.rowid, p.ref, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_client, s.code_compta, s.client";
@ -291,7 +291,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
$companystatic->canvas = $obj->canvas; $companystatic->canvas = $obj->canvas;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap tdoverflowmax100">'.$supplierproposalstatic->getNomUrl(1).'</td>'; print '<td class="nowraponall tdoverflowmax100">'.$supplierproposalstatic->getNomUrl(1).'</td>';
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'supplier').'</td>'; print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'supplier').'</td>';
print '<td class="nowrap right tdamount amount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>'; print '<td class="nowrap right tdamount amount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
print '</tr>'; print '</tr>';
@ -323,7 +323,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa
* Draft customer orders * Draft customer orders
*/ */
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { if (isModEnabled('commande') && $user->rights->commande->lire) {
$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.total_tva, c.total_ttc, c.fk_statut as status"; $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.total_tva, c.total_ttc, c.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_client, s.code_compta, s.client";
@ -389,7 +389,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$companystatic->canvas = $obj->canvas; $companystatic->canvas = $obj->canvas;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap tdoverflowmax100">'.$orderstatic->getNomUrl(1).'</td>'; print '<td class="nowraponall tdoverflowmax100">'.$orderstatic->getNomUrl(1).'</td>';
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'customer').'</td>'; print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'customer').'</td>';
print '<td class="nowrap right tdamount amount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>'; print '<td class="nowrap right tdamount amount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
print '</tr>'; print '</tr>';
@ -487,7 +487,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO
$companystatic->canvas = $obj->canvas; $companystatic->canvas = $obj->canvas;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap tdoverflowmax100">'.$supplierorderstatic->getNomUrl(1).'</td>'; print '<td class="nowraponall tdoverflowmax100">'.$supplierorderstatic->getNomUrl(1).'</td>';
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'supplier').'</td>'; print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'supplier').'</td>';
print '<td class="nowrap right tdamount amount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>'; print '<td class="nowrap right tdamount amount">'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).'</td>';
print '</tr>'; print '</tr>';
@ -573,8 +573,9 @@ if (!empty($conf->ficheinter->enabled)) {
$companystatic->email = $obj->email; $companystatic->email = $obj->email;
$companystatic->entity = $obj->entity; $companystatic->entity = $obj->entity;
$companystatic->canvas = $obj->canvas; $companystatic->canvas = $obj->canvas;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap tdoverflowmax100">'; print '<td class="nowraponall tdoverflowmax100">';
print $fichinterstatic->getNomUrl(1); print $fichinterstatic->getNomUrl(1);
print "</td>"; print "</td>";
print '<td class="nowrap tdoverflowmax100">'; print '<td class="nowrap tdoverflowmax100">';
@ -654,7 +655,7 @@ if (isModEnabled("societe") && $user->rights->societe->lire) {
$companystatic->canvas = $objp->canvas; $companystatic->canvas = $objp->canvas;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'customer').'</td>'; print '<td class="nowraponall tdoverflowmax100">'.$companystatic->getNomUrl(1, 'customer').'</td>';
print '<td class="nowrap">'; print '<td class="nowrap">';
//print $companystatic->getLibCustProspStatut(); //print $companystatic->getLibCustProspStatut();
@ -751,7 +752,7 @@ if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERM
$companystatic->canvas = $objp->canvas; $companystatic->canvas = $objp->canvas;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowrap tdoverflowmax100">'.$companystatic->getNomUrl(1, 'supplier').'</td>'; print '<td class="nowraponall tdoverflowmax100">'.$companystatic->getNomUrl(1, 'supplier').'</td>';
print '<td>'; print '<td>';
$obj = $companystatic; $obj = $companystatic;
@ -809,7 +810,7 @@ if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERM
/* /*
* Latest contracts * Latest contracts
*/ */
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) { // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT if (isModEnabled('contrat') && $user->rights->contrat->lire && 0) { // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT
$staticcontrat = new Contrat($db); $staticcontrat = new Contrat($db);
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
@ -865,8 +866,8 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) { // T
$staticcontrat->ref = $obj->ref; $staticcontrat->ref = $obj->ref;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$staticcontrat->getNomUrl(1).'</td>'; print '<td class="nowraponall">'.$staticcontrat->getNomUrl(1).'</td>';
print '<td>'.$companystatic->getNomUrl(1, 'customer', 44).'</td>'; print '<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1, 'customer', 44).'</td>';
print '<td class="right">'.$staticcontrat->LibStatut($obj->statut, 3).'</td>'; print '<td class="right">'.$staticcontrat->LibStatut($obj->statut, 3).'</td>';
print '</tr>'; print '</tr>';
@ -962,7 +963,7 @@ if (isModEnabled("propal") && $user->rights->propal->lire) {
print '<td class="nowrap" width="140">'; print '<td class="nowrap" width="140">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">'.$propalstatic->getNomUrl(1).'</td>'; print '<td class="nobordernopadding nowraponall">'.$propalstatic->getNomUrl(1).'</td>';
print '<td width="18" class="nobordernopadding nowrap">'.$warning.'</td>'; print '<td width="18" class="nobordernopadding nowrap">'.$warning.'</td>';
print '<td width="16" align="center" class="nobordernopadding">'.$formfile->getDocumentsLink($propalstatic->element, $filename, $filedir).'</td>'; print '<td width="16" align="center" class="nobordernopadding">'.$formfile->getDocumentsLink($propalstatic->element, $filename, $filedir).'</td>';
print '</tr>'; print '</tr>';
@ -1006,7 +1007,7 @@ if (isModEnabled("propal") && $user->rights->propal->lire) {
/* /*
* Opened (validated) order * Opened (validated) order
*/ */
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { if (isModEnabled('commande') && $user->rights->commande->lire) {
$sql = "SELECT c.rowid as commandeid, c.total_ttc, c.total_ht, c.total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed"; $sql = "SELECT c.rowid as commandeid, c.total_ttc, c.total_ht, c.total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_client, s.code_compta, s.client";
@ -1082,7 +1083,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
print '<td class="nowrap" width="140">'; print '<td class="nowrap" width="140">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">'; print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">'.$orderstatic->getNomUrl(1).'</td>'; print '<td class="nobordernopadding nowraponall">'.$orderstatic->getNomUrl(1).'</td>';
print '<td width="18" class="nobordernopadding nowrap"></td>'; print '<td width="18" class="nobordernopadding nowrap"></td>';
print '<td width="16" align="center" class="nobordernopadding">'.$formfile->getDocumentsLink($orderstatic->element, $filename, $filedir).'</td>'; print '<td width="16" align="center" class="nobordernopadding">'.$formfile->getDocumentsLink($orderstatic->element, $filename, $filedir).'</td>';
print '</tr>'; print '</tr>';

View File

@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('mails', 'companies')); $langs->loadLangs(array('mails', 'companies'));
if (!empty($conf->categorie->enabled)) { if (isModEnabled('categorie')) {
$langs->load("categories"); $langs->load("categories");
} }

View File

@ -980,7 +980,7 @@ if ($action == 'create') {
} }
if (($object->statut == 0 || $object->statut == 1 || $object->statut == 2) && $user->rights->mailing->creer) { if (($object->statut == 0 || $object->statut == 1 || $object->statut == 2) && $user->rights->mailing->creer) {
if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_MAILING)) { if (isModEnabled('fckeditor') && !empty($conf->global->FCKEDITOR_ENABLE_MAILING)) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("EditWithEditor").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("EditWithEditor").'</a>';
} else { } else {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("EditWithTextEditor").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("EditWithTextEditor").'</a>';

View File

@ -1792,7 +1792,7 @@ if ($action == 'create') {
// Delivery delay // Delivery delay
print '<tr class="field_availability_id"><td class="titlefieldcreate">'.$langs->trans('AvailabilityPeriod'); print '<tr class="field_availability_id"><td class="titlefieldcreate">'.$langs->trans('AvailabilityPeriod');
if (!empty($conf->commande->enabled)) { if (isModEnabled('commande')) {
print ' ('.$langs->trans('AfterOrder').')'; print ' ('.$langs->trans('AfterOrder').')';
} }
print '</td><td class="valuefieldcreate">'; print '</td><td class="valuefieldcreate">';
@ -2441,7 +2441,7 @@ if ($action == 'create') {
// Delivery delay // Delivery delay
print '<tr class="fielddeliverydelay"><td>'; print '<tr class="fielddeliverydelay"><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
if (!empty($conf->commande->enabled)) { if (isModEnabled('commande')) {
print $form->textwithpicto($langs->trans('AvailabilityPeriod'), $langs->trans('AvailabilityPeriod').' ('.$langs->trans('AfterOrder').')'); print $form->textwithpicto($langs->trans('AvailabilityPeriod'), $langs->trans('AvailabilityPeriod').' ('.$langs->trans('AfterOrder').')');
} else { } else {
print $langs->trans('AvailabilityPeriod'); print $langs->trans('AvailabilityPeriod');
@ -2826,7 +2826,7 @@ if ($action == 'create') {
} }
// Create a sale order // Create a sale order
if (!empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) { if (isModEnabled('commande') && $object->statut == Propal::STATUS_SIGNED) {
if ($usercancreateorder) { if ($usercancreateorder) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddOrder").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddOrder").'</a>';
} }
@ -2850,7 +2850,7 @@ if ($action == 'create') {
} }
// Create contract // Create contract
if (!empty($conf->contrat->enabled) && $object->statut == Propal::STATUS_SIGNED) { if (isModEnabled('contrat') && $object->statut == Propal::STATUS_SIGNED) {
$langs->load("contracts"); $langs->load("contracts");
if ($usercancreatecontract) { if ($usercancreatecontract) {

View File

@ -1057,7 +1057,7 @@ if ($resql) {
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
// If the user can view products // If the user can view products
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'; include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('IncludingProductWithTag'); $tmptitle = $langs->trans('IncludingProductWithTag');
@ -1065,7 +1065,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, (empty($conf->dol_optimize_smallscreen) ? 'maxwidth300 widthcentpercentminusx' : 'maxwidth250 widthcentpercentminusx'), 1); $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, (empty($conf->dol_optimize_smallscreen) ? 'maxwidth300 widthcentpercentminusx' : 'maxwidth250 widthcentpercentminusx'), 1);
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
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'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('CustomersProspectsCategoriesShort'); $tmptitle = $langs->trans('CustomersProspectsCategoriesShort');

View File

@ -71,7 +71,7 @@ if (!empty($conf->incoterm->enabled)) {
if (!empty($conf->margin->enabled)) { if (!empty($conf->margin->enabled)) {
$langs->load('margins'); $langs->load('margins');
} }
if (!empty($conf->productbatch->enabled)) { if (isModEnabled('productbatch')) {
$langs->load('productbatch'); $langs->load('productbatch');
} }
@ -2836,7 +2836,7 @@ if ($action == 'create' && $usercancreate) {
} }
// Create contract // Create contract
if (!empty($conf->contrat->enabled) && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS || $object->statut == Commande::STATUS_CLOSED)) { if (isModEnabled('contrat') && ($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS || $object->statut == Commande::STATUS_CLOSED)) {
$langs->load("contracts"); $langs->load("contracts");
if ($user->hasRight('contrat', 'creer')) { if ($user->hasRight('contrat', 'creer')) {

View File

@ -25,6 +25,8 @@
* \brief Home page of customer order module * \brief Home page of customer order module
*/ */
// Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.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.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.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) { if (!$user->rights->commande->lire) {
accessforbidden(); accessforbidden();
} }
@ -41,8 +48,6 @@ $hookmanager = new HookManager($db);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('ordersindex')); $hookmanager->initHooks(array('ordersindex'));
// Load translation files required by the page
$langs->loadLangs(array('orders', 'bills'));
// Security check // Security check
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
@ -87,7 +92,7 @@ if ($tmp) {
/* /*
* Draft orders * Draft orders
*/ */
if (!empty($conf->commande->enabled)) { if (isModEnabled('commande')) {
$sql = "SELECT c.rowid, c.ref, s.nom as name, s.rowid as socid"; $sql = "SELECT c.rowid, c.ref, s.nom as name, s.rowid as socid";
$sql .= ", s.client"; $sql .= ", s.client";
$sql .= ", s.code_client"; $sql .= ", s.code_client";
@ -239,7 +244,7 @@ $max = 10;
/* /*
* Orders to process * Orders to process
*/ */
if (!empty($conf->commande->enabled)) { if (isModEnabled('commande')) {
$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_commande as date, s.nom as name, s.rowid as socid"; $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_commande as date, s.nom as name, s.rowid as socid";
$sql .= ", s.client"; $sql .= ", s.client";
$sql .= ", s.code_client"; $sql .= ", s.code_client";
@ -328,7 +333,7 @@ if (!empty($conf->commande->enabled)) {
/* /*
* Orders that are in process * Orders that are in process
*/ */
if (!empty($conf->commande->enabled)) { if (isModEnabled('commande')) {
$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_commande as date, s.nom as name, s.rowid as socid"; $sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_commande as date, s.nom as name, s.rowid as socid";
$sql .= ", s.client"; $sql .= ", s.client";
$sql .= ", s.code_client"; $sql .= ", s.code_client";

View File

@ -33,6 +33,8 @@
* \brief Page to list orders * \brief Page to list orders
*/ */
// Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.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.'/core/lib/company.lib.php';
@ -51,6 +53,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('orders', 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks', 'products')); $langs->loadLangs(array('orders', 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks', 'products'));
// Get Parameters
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha'); $massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int'); $show_files = GETPOST('show_files', 'int');
@ -58,6 +61,7 @@ $confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array'); $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'orderlist'; $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'orderlist';
// Search Parameters
$search_datecloture_start = GETPOST('search_datecloture_start', 'int'); $search_datecloture_start = GETPOST('search_datecloture_start', 'int');
if (empty($search_datecloture_start)) { if (empty($search_datecloture_start)) {
$search_datecloture_start = dol_mktime(0, 0, 0, GETPOST('search_datecloture_startmonth', 'int'), GETPOST('search_datecloture_startday', 'int'), GETPOST('search_datecloture_startyear', 'int')); $search_datecloture_start = dol_mktime(0, 0, 0, GETPOST('search_datecloture_startmonth', 'int'), GETPOST('search_datecloture_startday', 'int'), GETPOST('search_datecloture_startyear', 'int'));
@ -209,6 +213,7 @@ $arrayfields = array(
'c.import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>999), 'c.import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>999),
'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000) 'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
); );
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -724,6 +729,7 @@ if ($action == 'shipped' && $permissiontoadd) {
} }
} }
} }
// Closed records // Closed records
if (!$error && $massaction === 'setbilled' && $permissiontoclose) { if (!$error && $massaction === 'setbilled' && $permissiontoclose) {
$db->begin(); $db->begin();
@ -760,10 +766,12 @@ if (!$error && $massaction === 'setbilled' && $permissiontoclose) {
} }
} }
/* /*
* View * View
*/ */
$now = dol_now(); $now = dol_now();
$form = new Form($db); $form = new Form($db);
@ -779,7 +787,6 @@ $projectstatic = new Project($db);
$title = $langs->trans("Orders"); $title = $langs->trans("Orders");
$help_url = "EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; $help_url = "EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
// llxHeader('',$title,$help_url);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0 || $search_user > 0) { if ($sall || $search_product_category > 0 || $search_user > 0) {
@ -800,12 +807,14 @@ $sql .= ' c.fk_input_reason, c.import_key';
if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
$sql .= ", cc.fk_categorie, cc.fk_soc"; $sql .= ", cc.fk_categorie, cc.fk_soc";
} }
// Add fields from extrafields // Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) { if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
} }
} }
// Add fields from hooks // Add fields from hooks
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@ -1222,7 +1231,7 @@ if ($resql) {
if ($permissiontocancel) { if ($permissiontocancel) {
$arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel");
} }
if (!empty($conf->invoice->enabled) && $user->rights->facture->creer) { if (isModEnabled('facture') && $user->rights->facture->creer) {
$arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer"); $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer");
} }
if ($permissiontoclose) { if ($permissiontoclose) {
@ -1328,7 +1337,7 @@ if ($resql) {
$moreforfilter = ''; $moreforfilter = '';
// If the user can view prospects other than his' // If the user can view prospects? sales other than his own
if ($user->rights->user->user->lire) { if ($user->rights->user->user->lire) {
$langs->load("commercial"); $langs->load("commercial");
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
@ -1343,8 +1352,9 @@ if ($resql) {
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx');
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
// If the user can view prospects other than his'
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) { // If the user can view other products/services than his own
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'; include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('IncludingProductWithTag'); $tmptitle = $langs->trans('IncludingProductWithTag');
@ -1352,13 +1362,15 @@ 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, 'maxwidth300 widthcentpercentminusx', 1); $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth300 widthcentpercentminusx', 1);
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { // If Categories are enabled & user has rights to see
if (isModEnabled('categorie') && $user->rights->categorie->lire) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('CustomersProspectsCategoriesShort'); $tmptitle = $langs->trans('CustomersProspectsCategoriesShort');
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle, 'maxwidth300 widthcentpercentminusx'); $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle, 'maxwidth300 widthcentpercentminusx');
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
// If Stock is enabled
if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
@ -1510,60 +1522,61 @@ if ($resql) {
$form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1, '', 1); $form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1, '', 1);
print '</td>'; print '</td>';
} }
// Amount HT / net
if (!empty($arrayfields['c.total_ht']['checked'])) { if (!empty($arrayfields['c.total_ht']['checked'])) {
// Amount
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).'">'; print '<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).'">';
print '</td>'; print '</td>';
} }
// Amount of VAT
if (!empty($arrayfields['c.total_vat']['checked'])) { if (!empty($arrayfields['c.total_vat']['checked'])) {
// Amount
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).'">'; print '<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).'">';
print '</td>'; print '</td>';
} }
// Total Amount (TTC / gross)
if (!empty($arrayfields['c.total_ttc']['checked'])) { if (!empty($arrayfields['c.total_ttc']['checked'])) {
// Amount
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.'">'; print '<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.'">';
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['c.multicurrency_code']['checked'])) {
// Currency // Currency
if (!empty($arrayfields['c.multicurrency_code']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print $form->selectMultiCurrency($search_multicurrency_code, 'search_multicurrency_code', 1); print $form->selectMultiCurrency($search_multicurrency_code, 'search_multicurrency_code', 1);
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['c.multicurrency_tx']['checked'])) {
// Currency rate // Currency rate
if (!empty($arrayfields['c.multicurrency_tx']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).'">'; print '<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).'">';
print '</td>'; print '</td>';
} }
// Amount HT/net in foreign currency
if (!empty($arrayfields['c.multicurrency_total_ht']['checked'])) { if (!empty($arrayfields['c.multicurrency_total_ht']['checked'])) {
// Amount
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).'">'; print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).'">';
print '</td>'; print '</td>';
} }
// VAT in foreign currency
if (!empty($arrayfields['c.multicurrency_total_vat']['checked'])) { if (!empty($arrayfields['c.multicurrency_total_vat']['checked'])) {
// Amount VAT
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).'">'; print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).'">';
print '</td>'; print '</td>';
} }
// Amount/Total (TTC / gross) in foreign currency
if (!empty($arrayfields['c.multicurrency_total_ttc']['checked'])) { if (!empty($arrayfields['c.multicurrency_total_ttc']['checked'])) {
// Amount
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).'">'; print '<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).'">';
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['u.login']['checked'])) {
// Author // Author
if (!empty($arrayfields['u.login']['checked'])) {
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print '<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">'; print '<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">';
print '</td>'; print '</td>';
} }
// Sales Representative
if (!empty($arrayfields['sale_representative']['checked'])) { if (!empty($arrayfields['sale_representative']['checked'])) {
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
} }
@ -1583,12 +1596,15 @@ if ($resql) {
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
print '</td>'; print '</td>';
} }
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook // Fields from hook
$parameters = array('arrayfields'=>$arrayfields); $parameters = array('arrayfields'=>$arrayfields);
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Date creation // Date creation
if (!empty($arrayfields['c.datec']['checked'])) { if (!empty($arrayfields['c.datec']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
@ -1776,8 +1792,10 @@ if ($resql) {
), ),
'pos' => array(), 'pos' => array(),
); );
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields // Hook fields
$parameters = array( $parameters = array(
'arrayfields' => $arrayfields, 'arrayfields' => $arrayfields,
@ -1977,6 +1995,7 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Alias name // Alias name
if (!empty($arrayfields['s.name_alias']['checked'])) { if (!empty($arrayfields['s.name_alias']['checked'])) {
print '<td class="nocellnopadd">'; print '<td class="nocellnopadd">';
@ -1986,6 +2005,7 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Town // Town
if (!empty($arrayfields['s.town']['checked'])) { if (!empty($arrayfields['s.town']['checked'])) {
print '<td class="nocellnopadd">'; print '<td class="nocellnopadd">';
@ -1995,6 +2015,7 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Zip // Zip
if (!empty($arrayfields['s.zip']['checked'])) { if (!empty($arrayfields['s.zip']['checked'])) {
print '<td class="nocellnopadd">'; print '<td class="nocellnopadd">';
@ -2004,6 +2025,7 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// State // State
if (!empty($arrayfields['state.nom']['checked'])) { if (!empty($arrayfields['state.nom']['checked'])) {
print "<td>".$obj->state_name."</td>\n"; print "<td>".$obj->state_name."</td>\n";
@ -2011,6 +2033,7 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Country // Country
if (!empty($arrayfields['country.code_iso']['checked'])) { if (!empty($arrayfields['country.code_iso']['checked'])) {
print '<td class="center">'; print '<td class="center">';
@ -2021,6 +2044,7 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Type ent // Type ent
if (!empty($arrayfields['typent.code']['checked'])) { if (!empty($arrayfields['typent.code']['checked'])) {
print '<td class="center">'; print '<td class="center">';
@ -2047,6 +2071,7 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Plannned date of delivery // Plannned date of delivery
if (!empty($arrayfields['c.date_delivery']['checked'])) { if (!empty($arrayfields['c.date_delivery']['checked'])) {
print '<td class="center">'; print '<td class="center">';
@ -2056,6 +2081,7 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Shipping Method // Shipping Method
if (!empty($arrayfields['c.fk_shipping_method']['checked'])) { if (!empty($arrayfields['c.fk_shipping_method']['checked'])) {
print '<td>'; print '<td>';
@ -2065,6 +2091,7 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Payment terms // Payment terms
if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) { if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) {
print '<td>'; print '<td>';
@ -2074,6 +2101,7 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Payment mode // Payment mode
if (!empty($arrayfields['c.fk_mode_reglement']['checked'])) { if (!empty($arrayfields['c.fk_mode_reglement']['checked'])) {
print '<td>'; print '<td>';
@ -2083,6 +2111,7 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Channel // Channel
if (!empty($arrayfields['c.fk_input_reason']['checked'])) { if (!empty($arrayfields['c.fk_input_reason']['checked'])) {
print '<td>'; print '<td>';
@ -2092,7 +2121,8 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Amount HT
// Amount HT/net
if (!empty($arrayfields['c.total_ht']['checked'])) { if (!empty($arrayfields['c.total_ht']['checked'])) {
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ht)."</span></td>\n"; print '<td class="nowrap right"><span class="amount">'.price($obj->total_ht)."</span></td>\n";
if (!$i) { if (!$i) {
@ -2107,6 +2137,7 @@ if ($resql) {
$totalarray['val']['c.total_ht'] = $obj->total_ht; $totalarray['val']['c.total_ht'] = $obj->total_ht;
} }
} }
// Amount VAT // Amount VAT
if (!empty($arrayfields['c.total_vat']['checked'])) { if (!empty($arrayfields['c.total_vat']['checked'])) {
print '<td class="nowrap right"><span class="amount">'.price($obj->total_tva)."</span></td>\n"; print '<td class="nowrap right"><span class="amount">'.price($obj->total_tva)."</span></td>\n";
@ -2118,7 +2149,8 @@ if ($resql) {
} }
$totalarray['val']['c.total_tva'] += $obj->total_tva; $totalarray['val']['c.total_tva'] += $obj->total_tva;
} }
// Amount TTC
// Amount TTC / gross
if (!empty($arrayfields['c.total_ttc']['checked'])) { if (!empty($arrayfields['c.total_ttc']['checked'])) {
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc)."</span></td>\n"; print '<td class="nowrap right"><span class="amount">'.price($obj->total_ttc)."</span></td>\n";
if (!$i) { if (!$i) {
@ -2147,21 +2179,22 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Amount HT
// Amount HT/net in foreign currency
if (!empty($arrayfields['c.multicurrency_total_ht']['checked'])) { if (!empty($arrayfields['c.multicurrency_total_ht']['checked'])) {
print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht)."</span></td>\n"; print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht)."</span></td>\n";
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Amount VAT // Amount VAT in foreign currency
if (!empty($arrayfields['c.multicurrency_total_vat']['checked'])) { if (!empty($arrayfields['c.multicurrency_total_vat']['checked'])) {
print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat)."</span></td>\n"; print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat)."</span></td>\n";
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Amount TTC // Amount TTC / gross in foreign currency
if (!empty($arrayfields['c.multicurrency_total_ttc']['checked'])) { if (!empty($arrayfields['c.multicurrency_total_ttc']['checked'])) {
print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc)."</span></td>\n"; print '<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc)."</span></td>\n";
if (!$i) { if (!$i) {
@ -2197,8 +2230,8 @@ if ($resql) {
} }
} }
if (!empty($arrayfields['sale_representative']['checked'])) {
// Sales representatives // Sales representatives
if (!empty($arrayfields['sale_representative']['checked'])) {
print '<td>'; print '<td>';
if ($obj->socid > 0) { if ($obj->socid > 0) {
$listsalesrepresentatives = $companystatic->getSalesRepresentatives($user); $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
@ -2251,6 +2284,7 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Total margin // Total margin
if (!empty($arrayfields['total_margin']['checked'])) { if (!empty($arrayfields['total_margin']['checked'])) {
print '<td class="right nowrap">'.price($marginInfo['total_margin']).'</td>'; print '<td class="right nowrap">'.price($marginInfo['total_margin']).'</td>';
@ -2262,6 +2296,7 @@ if ($resql) {
} }
$totalarray['val']['total_margin'] += $marginInfo['total_margin']; $totalarray['val']['total_margin'] += $marginInfo['total_margin'];
} }
// Total margin rate // Total margin rate
if (!empty($arrayfields['total_margin_rate']['checked'])) { if (!empty($arrayfields['total_margin_rate']['checked'])) {
print '<td class="right nowrap">'.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').'</td>'; print '<td class="right nowrap">'.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').'</td>';
@ -2269,6 +2304,7 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Total mark rate // Total mark rate
if (!empty($arrayfields['total_mark_rate']['checked'])) { if (!empty($arrayfields['total_mark_rate']['checked'])) {
print '<td class="right nowrap">'.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').'</td>'; print '<td class="right nowrap">'.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').'</td>';
@ -2390,7 +2426,7 @@ if ($resql) {
$stock_order = 0; $stock_order = 0;
$stock_order_supplier = 0; $stock_order_supplier = 0;
if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { // What about other options ? if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { // What about other options ?
if (!empty($conf->commande->enabled)) { if (isModEnabled('commande')) {
if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) { if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) {
$generic_product->load_stats_commande(0, '1,2'); $generic_product->load_stats_commande(0, '1,2');
$productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty']; $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty'];
@ -2457,6 +2493,7 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Import key // Import key
if (!empty($arrayfields['c.import_key']['checked'])) { if (!empty($arrayfields['c.import_key']['checked'])) {
print '<td class="nowrap center">'.$obj->import_key.'</td>'; print '<td class="nowrap center">'.$obj->import_key.'</td>';
@ -2464,6 +2501,7 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Status // Status
if (!empty($arrayfields['c.fk_statut']['checked'])) { if (!empty($arrayfields['c.fk_statut']['checked'])) {
print '<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).'</td>'; print '<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).'</td>';

View File

@ -108,7 +108,7 @@ $arrayfields = array(
); );
// Security check // Security check
if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled)) { if (!isModEnabled('comptabilite') && !isModEnabled('accounting')) {
accessforbidden(); accessforbidden();
} }
if ($user->socid > 0) { if ($user->socid > 0) {
@ -135,13 +135,13 @@ $error = 0;
$listofchoices = array( $listofchoices = array(
'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills', 'enabled' => isModEnabled('facture'), 'perms' => !empty($user->rights->facture->lire)), '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)), '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)), 'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips', 'enabled' => isModEnabled('expensereport'), 'perms' => !empty($user->rights->expensereport->lire)),
'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation', 'enabled' => !empty($conf->don->enabled), 'perms' => !empty($user->rights->don->lire)), 'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation', 'enabled' => isModEnabled('don'), 'perms' => !empty($user->rights->don->lire)),
'selectsocialcontributions'=>array('label'=>'SocialContributions', 'enabled' => !empty($conf->tax->enabled), 'perms' => !empty($user->rights->tax->charges->lire)), 'selectsocialcontributions'=>array('label'=>'SocialContributions', 'enabled' => isModEnabled('tax'), 'perms' => !empty($user->rights->tax->charges->lire)),
'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries', 'enabled' => !empty($conf->salaries->enabled), 'perms' => !empty($user->rights->salaries->read)), '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)), '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)), 'selectloanspayment'=>array('label'=>'PaymentLoan', 'enabled' => isModEnabled('don'), 'perms' => !empty($user->rights->loan->read)),
); );
@ -569,7 +569,7 @@ print '<form name="searchfiles" action="?action=searchfiles" method="POST">'."\n
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<span class="opacitymedium">'.$langs->trans("ExportAccountingSourceDocHelp"); print '<span class="opacitymedium">'.$langs->trans("ExportAccountingSourceDocHelp");
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
print ' '.$langs->trans("ExportAccountingSourceDocHelp2", $langs->transnoentitiesnoconv("Accounting"), $langs->transnoentitiesnoconv("Journals")); print ' '.$langs->trans("ExportAccountingSourceDocHelp2", $langs->transnoentitiesnoconv("Accounting"), $langs->transnoentitiesnoconv("Journals"));
} }
print '</span><br>'; print '</span><br>';
@ -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_liste_field_titre($arrayfields['ref']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'nowraponall ');
print '<td>'.$langs->trans("Document").'</td>'; print '<td>'.$langs->trans("Document").'</td>';
print '<td>'.$langs->trans("Paid").'</td>'; print '<td>'.$langs->trans("Paid").'</td>';
print '<td align="right">'.$langs->trans("TotalHT").($conf->multicurrency->enabled ? ' ('.$conf->currency.')' : '').'</td>'; print '<td align="right">'.$langs->trans("TotalHT").(isModEnabled('multicurrency') ? ' ('.$conf->currency.')' : '').'</td>';
print '<td align="right">'.$langs->trans("TotalTTC").($conf->multicurrency->enabled ? ' ('.$conf->currency.')' : '').'</td>'; print '<td align="right">'.$langs->trans("TotalTTC").(isModEnabled('multicurrency') ? ' ('.$conf->currency.')' : '').'</td>';
print '<td align="right">'.$langs->trans("TotalVAT").($conf->multicurrency->enabled ? ' ('.$conf->currency.')' : '').'</td>'; print '<td align="right">'.$langs->trans("TotalVAT").(isModEnabled('multicurrency') ? ' ('.$conf->currency.')' : '').'</td>';
print '<td>'.$langs->trans("ThirdParty").'</td>'; print '<td>'.$langs->trans("ThirdParty").'</td>';
print '<td class="center">'.$langs->trans("Code").'</td>'; print '<td class="center">'.$langs->trans("Code").'</td>';
print '<td class="center">'.$langs->trans("Country").'</td>'; print '<td class="center">'.$langs->trans("Country").'</td>';
print '<td class="center">'.$langs->trans("VATIntra").'</td>'; print '<td class="center">'.$langs->trans("VATIntra").'</td>';
if (isModEnabled('multicompany')) { if (isModEnabled('multicurrency')) {
print '<td class="center">'.$langs->trans("Currency").'</td>'; print '<td class="center">'.$langs->trans("Currency").'</td>';
} }
print '</tr>'; print '</tr>';
if (empty($TData)) { if (empty($TData)) {
print '<tr class="oddeven"><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td>'; print '<tr class="oddeven"><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td>';
if (isModEnabled('multicompany')) { if (isModEnabled('multicurrency')) {
print '<td></td>'; print '<td></td>';
} }
print '</tr>'; print '</tr>';
@ -833,7 +833,7 @@ if (!empty($date_start) && !empty($date_stop)) {
$totalVAT_debit -= $data['amount_vat']; $totalVAT_debit -= $data['amount_vat'];
} }
if (isModEnabled('multicompany')) { if (isModEnabled('multicurrency')) {
print '<td class="center">'.$data['currency']."</td>\n"; print '<td class="center">'.$data['currency']."</td>\n";
} }
@ -847,7 +847,7 @@ if (!empty($date_start) && !empty($date_stop)) {
print '<td align="right">'.price(price2num($totalIT_credit, 'MT')).'</td>'; print '<td align="right">'.price(price2num($totalIT_credit, 'MT')).'</td>';
print '<td align="right">'.price(price2num($totalVAT_credit, 'MT')).'</td>'; print '<td align="right">'.price(price2num($totalVAT_credit, 'MT')).'</td>';
print '<td colspan="4"></td>'; print '<td colspan="4"></td>';
if (isModEnabled('multicompany')) { if (isModEnabled('multicurrency')) {
print '<td></td>'; print '<td></td>';
} }
print "</tr>\n"; print "</tr>\n";
@ -858,7 +858,7 @@ if (!empty($date_start) && !empty($date_stop)) {
print '<td align="right">'.price(price2num($totalIT_debit, 'MT')).'</td>'; print '<td align="right">'.price(price2num($totalIT_debit, 'MT')).'</td>';
print '<td align="right">'.price(price2num($totalVAT_debit, 'MT')).'</td>'; print '<td align="right">'.price(price2num($totalVAT_debit, 'MT')).'</td>';
print '<td colspan="4"></td>'; print '<td colspan="4"></td>';
if (isModEnabled('multicompany')) { if (isModEnabled('multicurrency')) {
print '<td></td>'; print '<td></td>';
} }
print "</tr>\n"; print "</tr>\n";
@ -869,7 +869,7 @@ if (!empty($date_start) && !empty($date_stop)) {
print '<td align="right">'.price(price2num($totalIT_credit + $totalIT_debit, 'MT')).'</td>'; print '<td align="right">'.price(price2num($totalIT_credit + $totalIT_debit, 'MT')).'</td>';
print '<td align="right">'.price(price2num($totalVAT_credit + $totalVAT_debit, 'MT')).'</td>'; print '<td align="right">'.price(price2num($totalVAT_credit + $totalVAT_debit, 'MT')).'</td>';
print '<td colspan="4"></td>'; print '<td colspan="4"></td>';
if (isModEnabled('multicompany')) { if (isModEnabled('multicurrency')) {
print '<td></td>'; print '<td></td>';
} }
print "</tr>\n"; print "</tr>\n";

View File

@ -365,7 +365,7 @@ if (GETPOST('save') && !$cancel && !empty($user->rights->banque->modifier)) {
$error++; $error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankAccount")), null, 'errors'); 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'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors');
$error++; $error++;
@ -517,9 +517,15 @@ $morehtmlref = '';
if ($id > 0 || !empty($ref)) { if ($id > 0 || !empty($ref)) {
$title = $object->ref.' - '.$langs->trans("Transactions"); $title = $object->ref.' - '.$langs->trans("Transactions");
$helpurl = ""; } else {
llxHeader('', $title, $helpurl); $title = $langs->trans("BankTransactions");
}
$help_url = '';
llxHeader('', $title, $help_url, '', 0, 0, array(), array(), $param);
if ($id > 0 || !empty($ref)) {
// Load bank groups // Load bank groups
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
$bankcateg = new BankCateg($db); $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 = "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 .= " b.fk_account, b.fk_type, b.fk_bordereau,";
$sql .= " ba.rowid as bankid, ba.ref as bankref"; $sql .= " ba.rowid as bankid, ba.ref as bankref";
@ -879,7 +882,7 @@ if ($resql) {
print '<td class=right>'.$langs->trans("BankAccount").'</td>'; print '<td class=right>'.$langs->trans("BankAccount").'</td>';
print '<td class=right>'.$langs->trans("Debit").'</td>'; print '<td class=right>'.$langs->trans("Debit").'</td>';
print '<td class=right>'.$langs->trans("Credit").'</td>'; print '<td class=right>'.$langs->trans("Credit").'</td>';
/*if (! empty($conf->accounting->enabled)) /*if (isModEnabled('accounting'))
{ {
print '<td class="center">'; print '<td class="center">';
print $langs->trans("AccountAccounting"); print $langs->trans("AccountAccounting");
@ -914,7 +917,7 @@ if ($resql) {
//} //}
print '<td class="right"><input name="adddebit" class="flat" type="text" size="4" value="'.GETPOST("adddebit", "alpha").'"></td>'; print '<td class="right"><input name="adddebit" class="flat" type="text" size="4" value="'.GETPOST("adddebit", "alpha").'"></td>';
print '<td class="right"><input name="addcredit" class="flat" type="text" size="4" value="'.GETPOST("addcredit", "alpha").'"></td>'; print '<td class="right"><input name="addcredit" class="flat" type="text" size="4" value="'.GETPOST("addcredit", "alpha").'"></td>';
/*if (! empty($conf->accounting->enabled)) /*if (isModEnabled('accounting'))
{ {
print '<td class="center">'; print '<td class="center">';
print $formaccounting->select_account($search_accountancy_code, 'search_accountancy_code', 1, null, 1, 1, ''); print $formaccounting->select_account($search_accountancy_code, 'search_accountancy_code', 1, null, 1, 1, '');
@ -1023,9 +1026,9 @@ if ($resql) {
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
if (!empty($conf->categorie->enabled)) { if (isModEnabled('categorie')) {
// Categories // Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
$langs->load('categories'); $langs->load('categories');
// Bank line // Bank line

View File

@ -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.'/core/class/html.formbank.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.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'; 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'; 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'; 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'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
} }
@ -336,7 +336,7 @@ if (empty($reshook)) {
$form = new Form($db); $form = new Form($db);
$formbank = new FormBank($db); $formbank = new FormBank($db);
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
} }
@ -445,7 +445,7 @@ if ($action == 'create') {
print '</td></tr>'; print '</td></tr>';
// Tags-Categories // Tags-Categories
if (!empty($conf->categorie->enabled)) { if (isModEnabled('categorie')) {
print '<tr><td>'.$langs->trans("Categories").'</td><td>'; print '<tr><td>'.$langs->trans("Categories").'</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
@ -581,7 +581,7 @@ if ($action == 'create') {
$fieldrequired = 'fieldrequired '; $fieldrequired = 'fieldrequired ';
} }
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
print '<tr><td class="'.$fieldrequired.'titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>'; print '<tr><td class="'.$fieldrequired.'titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
print '<td>'; print '<td>';
print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1); print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1);
@ -592,7 +592,7 @@ if ($action == 'create') {
} }
// Accountancy journal // Accountancy journal
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>'; print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
print '<td>'; print '<td>';
print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0); print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0);
@ -671,7 +671,7 @@ if ($action == 'create') {
// Accountancy code // Accountancy code
print '<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>'; print '<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>';
print '<td>'; print '<td>';
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $object->account_number, 1); $accountingaccount->fetch('', $object->account_number, 1);
@ -682,7 +682,7 @@ if ($action == 'create') {
print '</td></tr>'; print '</td></tr>';
// Accountancy journal // Accountancy journal
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>'; print '<tr><td>'.$langs->trans("AccountancyJournal").'</td>';
print '<td>'; print '<td>';
@ -708,7 +708,7 @@ if ($action == 'create') {
print '<table class="border tableforfield centpercent">'; print '<table class="border tableforfield centpercent">';
// Categories // Categories
if (!empty($conf->categorie->enabled)) { if (isModEnabled('categorie')) {
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1); print $form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1);
print "</td></tr>"; print "</td></tr>";
@ -958,7 +958,7 @@ if ($action == 'create') {
print '</td></tr>'; print '</td></tr>';
// Tags-Categories // Tags-Categories
if (!empty($conf->categorie->enabled)) { if (isModEnabled('categorie')) {
print '<tr><td>'.$langs->trans("Categories").'</td><td>'; print '<tr><td>'.$langs->trans("Categories").'</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1);
$c = new Categorie($db); $c = new Categorie($db);
@ -1006,7 +1006,7 @@ if ($action == 'create') {
print '<tr><td'.$tdextra.'>'.$langs->trans("AccountancyCode").'</td>'; print '<tr><td'.$tdextra.'>'.$langs->trans("AccountancyCode").'</td>';
print '<td>'; print '<td>';
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1); print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1);
} else { } else {
print '<input type="text" name="account_number" value="'.(GETPOST("account_number") ? GETPOST("account_number") : $object->account_number).'">'; print '<input type="text" name="account_number" value="'.(GETPOST("account_number") ? GETPOST("account_number") : $object->account_number).'">';
@ -1014,7 +1014,7 @@ if ($action == 'create') {
print '</td></tr>'; print '</td></tr>';
// Accountancy journal // Accountancy journal
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
print '<tr><td class="fieldrequired">'.$langs->trans("AccountancyJournal").'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans("AccountancyJournal").'</td>';
print '<td>'; print '<td>';
print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0); print $formaccounting->select_journal($object->fk_accountancy_journal, 'fk_accountancy_journal', 4, 1, 0, 0);

View File

@ -1398,7 +1398,7 @@ class Account extends CommonObject
$option = 'nolink'; $option = 'nolink';
} }
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$langs->load("accountancy"); $langs->load("accountancy");
$label .= '<br><b>'.$langs->trans('AccountAccounting').':</b> '.length_accountg($this->account_number); $label .= '<br><b>'.$langs->trans('AccountAccounting').':</b> '.length_accountg($this->account_number);

View File

@ -37,16 +37,16 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('banks', 'categories', 'compta', 'bills', 'other')); $langs->loadLangs(array('banks', 'categories', 'compta', 'bills', 'other'));
if (!empty($conf->adherent->enabled)) { if (isModEnabled('adherent')) {
$langs->load("members"); $langs->load("members");
} }
if (!empty($conf->don->enabled)) { if (isModEnabled('don')) {
$langs->load("donations"); $langs->load("donations");
} }
if (!empty($conf->loan->enabled)) { if (isModEnabled('loan')) {
$langs->load("loan"); $langs->load("loan");
} }
if (!empty($conf->salaries->enabled)) { if (isModEnabled('salaries')) {
$langs->load("salaries"); $langs->load("salaries");
} }
@ -580,7 +580,7 @@ if ($result) {
print "</tr>"; print "</tr>";
// Categories // Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
$langs->load('categories'); $langs->load('categories');
// Bank line // Bank line

View File

@ -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/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.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'; 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'; 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'; 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' $search_status = GETPOST('search_status') ?GETPOST('search_status', 'alpha') : 'opened'; // 'all' or ''='opened'
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
if (!empty($conf->categorie->enabled)) { if (isModEnabled('categorie')) {
$search_category_list = GETPOST("search_category_".Categorie::TYPE_ACCOUNT."_list", "array"); $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), 'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1, 'position'=>12),
'accountype'=>array('label'=>$langs->trans("Type"), 'checked'=>1, 'position'=>14), 'accountype'=>array('label'=>$langs->trans("Type"), 'checked'=>1, 'position'=>14),
'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1, 'position'=>16), '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.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>(isModEnabled('accounting')), 'position'=>18),
'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>(!empty($conf->accounting->enabled) || !empty($conf->accounting->enabled)), 'position'=>20), 'b.fk_accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>(isModEnabled('accounting')), 'position'=>20),
'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1, 'position'=>50), 'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1, 'position'=>50),
'b.currency_code'=>array('label'=>$langs->trans("Currency"), 'checked'=>0, 'position'=>22), 'b.currency_code'=>array('label'=>$langs->trans("Currency"), 'checked'=>0, 'position'=>22),
'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), '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)"; $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"); $sql .= Categorie::getFilterJoinQuery(Categorie::TYPE_ACCOUNT, "b.rowid");
} }
@ -209,7 +209,7 @@ if ($search_status == 'closed') {
$sql .= " AND clos = 1"; $sql .= " AND clos = 1";
} }
if (!empty($conf->categorie->enabled)) { if (isModEnabled('categorie')) {
$sql .= Categorie::getFilterSelectQuery(Categorie::TYPE_ACCOUNT, "b.rowid", $search_category_list); $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 = ''; $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); $moreforfilter .= $form->getFilterBox(Categorie::TYPE_ACCOUNT, $search_category_list);
} }
@ -569,7 +569,7 @@ foreach ($accounts as $key => $type) {
// Account number // Account number
if (!empty($arrayfields['b.account_number']['checked'])) { if (!empty($arrayfields['b.account_number']['checked'])) {
print '<td class="tdoverflowmax250">'; print '<td class="tdoverflowmax250">';
if (!empty($conf->accounting->enabled) && !empty($objecttmp->account_number)) { if (isModEnabled('accounting') && !empty($objecttmp->account_number)) {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $objecttmp->account_number, 1); $accountingaccount->fetch('', $objecttmp->account_number, 1);
print '<span title="'.dol_escape_htmltag($accountingaccount->account_number.' - '.$accountingaccount->label).'">'; print '<span title="'.dol_escape_htmltag($accountingaccount->account_number.' - '.$accountingaccount->label).'">';
@ -587,7 +587,7 @@ foreach ($accounts as $key => $type) {
// Accountancy journal // Accountancy journal
if (!empty($arrayfields['b.fk_accountancy_journal']['checked'])) { if (!empty($arrayfields['b.fk_accountancy_journal']['checked'])) {
print '<td class="tdoverflowmax125">'; print '<td class="tdoverflowmax125">';
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
if (empty($objecttmp->fk_accountancy_journal)) { if (empty($objecttmp->fk_accountancy_journal)) {
print img_warning($langs->trans("Mandatory")); print img_warning($langs->trans("Mandatory"));
} else { } else {

View File

@ -223,6 +223,17 @@ if ($id > 0) {
$param .= '&id='.urlencode($id); $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)) { if (empty($numref)) {
$sortfield = 'numr'; $sortfield = 'numr';
@ -248,10 +259,6 @@ if (empty($numref)) {
$numrows = $db->num_rows($result); $numrows = $db->num_rows($result);
$i = 0; $i = 0;
$title = $object->ref.' - '.$langs->trans("AccountStatements");
$helpurl = "";
llxHeader('', $title, $helpurl);
// Onglets // Onglets
$head = bank_prepare_head($object); $head = bank_prepare_head($object);
print dol_get_fiche_head($head, 'statement', $langs->trans("FinancialAccount"), 0, 'account'); 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 * Show list of record into a bank statement
*/ */
$title = $langs->trans("FinancialAccount").' - '.$langs->trans("AccountStatements");
$helpurl = "";
llxHeader('', $title, $helpurl);
// Onglets // Onglets
$head = account_statement_prepare_head($object, $numref); $head = account_statement_prepare_head($object, $numref);
print dol_get_fiche_head($head, 'statement', $langs->trans("AccountStatement"), -1, 'account'); print dol_get_fiche_head($head, 'statement', $langs->trans("AccountStatement"), -1, 'account');

View File

@ -270,12 +270,12 @@ print '</tr>';
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print img_picto('', 'bank_account', 'class="paddingright"'); 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 "</td>"; print "</td>";
print "<td>\n"; print "<td>\n";
print img_picto('', 'bank_account', 'class="paddingright"'); 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 "</td>\n"; print "</td>\n";
print "<td>"; print "<td>";

View File

@ -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.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.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.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.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"); $paymenttype = GETPOST("paymenttype", "aZ09");
$accountancy_code = GETPOST("accountancy_code", "alpha"); $accountancy_code = GETPOST("accountancy_code", "alpha");
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); $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") : ''; $subledger_account = GETPOST("subledger_account", "alpha") > 0 ? GETPOST("subledger_account", "alpha") : '';
} else { } else {
$subledger_account = GETPOST("subledger_account", "alpha"); $subledger_account = GETPOST("subledger_account", "alpha");
@ -149,7 +149,7 @@ if (empty($reshook)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors');
$error++; $error++;
} }
if (!empty($conf->accounting->enabled) && !$object->accountancy_code) { if (isModEnabled('accounting') && !$object->accountancy_code) {
$langs->load('errors'); $langs->load('errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountAccounting")), null, 'errors');
$error++; $error++;
@ -305,10 +305,10 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->banque->m
* View * View
*/ */
$form = new Form($db); $form = new Form($db);
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
} }
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$formproject = new FormProjets($db); $formproject = new FormProjets($db);
} }
@ -448,7 +448,7 @@ if ($action == 'create') {
} }
// Accountancy account // 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 // TODO Remove the fieldrequired and allow instead to edit a various payment to enter accounting code
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("AccountAccounting").'</td>'; print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("AccountAccounting").'</td>';
print '<td>'; print '<td>';
@ -461,7 +461,7 @@ if ($action == 'create') {
} }
// Subledger account // Subledger account
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
print '<tr><td>'.$langs->trans("SubledgerAccount").'</td>'; print '<tr><td>'.$langs->trans("SubledgerAccount").'</td>';
print '<td>'; print '<td>';
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
@ -485,7 +485,7 @@ if ($action == 'create') {
print '</td></tr>'; print '</td></tr>';
// Project // Project
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$formproject = new FormProjets($db); $formproject = new FormProjets($db);
// Associated project // Associated project
@ -557,7 +557,7 @@ if ($id) {
$morehtmlref = '<div class="refidno">'; $morehtmlref = '<div class="refidno">';
// Project // Project
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= $langs->trans('Project').' '; $morehtmlref .= $langs->trans('Project').' ';
if ($user->rights->banque->modifier) { if ($user->rights->banque->modifier) {
@ -625,7 +625,7 @@ if ($id) {
print '<tr><td class="nowrap">'; print '<tr><td class="nowrap">';
print $langs->trans("AccountAccounting"); print $langs->trans("AccountAccounting");
print '</td><td>'; print '</td><td>';
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('', $object->accountancy_code, 1); $accountingaccount->fetch('', $object->accountancy_code, 1);

View File

@ -97,7 +97,7 @@ if ($object->id) {
$morehtmlref = '<div class="refidno">'; $morehtmlref = '<div class="refidno">';
// Project // Project
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= $langs->trans('Project').' : '; $morehtmlref .= $langs->trans('Project').' : ';
if ($user->rights->banque->modifier && 0) { if ($user->rights->banque->modifier && 0) {

View File

@ -57,7 +57,7 @@ print dol_get_fiche_head($head, 'info', $langs->trans("VariousPayment"), -1, $ob
$morehtmlref = '<div class="refidno">'; $morehtmlref = '<div class="refidno">';
// Project // Project
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= $langs->trans('Project').' : '; $morehtmlref .= $langs->trans('Project').' : ';
if ($user->rights->banque->modifier && 0) { if ($user->rights->banque->modifier && 0) {

View File

@ -154,8 +154,8 @@ $arrayfields = array(
'project' =>array('label'=>"Project", 'checked'=>1, 'position'=>200, "enabled"=>!empty($conf->project->enabled)), 'project' =>array('label'=>"Project", 'checked'=>1, 'position'=>200, "enabled"=>!empty($conf->project->enabled)),
'bank' =>array('label'=>"BankAccount", 'checked'=>1, 'position'=>300, "enabled"=>isModEnabled("banque")), 'bank' =>array('label'=>"BankAccount", 'checked'=>1, 'position'=>300, "enabled"=>isModEnabled("banque")),
'entry' =>array('label'=>"BankTransactionLine", 'checked'=>1, 'position'=>310, "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)), 'account' =>array('label'=>"AccountAccountingShort", 'checked'=>1, 'position'=>400, "enabled"=>isModEnabled('accounting')),
'subledger' =>array('label'=>"SubledgerAccount", 'checked'=>1, 'position'=>410, "enabled"=>!empty($conf->accounting->enabled)), 'subledger' =>array('label'=>"SubledgerAccount", 'checked'=>1, 'position'=>410, "enabled"=>isModEnabled('accounting')),
'debit' =>array('label'=>"Debit", 'checked'=>1, 'position'=>500), 'debit' =>array('label'=>"Debit", 'checked'=>1, 'position'=>500),
'credit' =>array('label'=>"Credit", 'checked'=>1, 'position'=>510), 'credit' =>array('label'=>"Credit", 'checked'=>1, 'position'=>510),
); );
@ -190,7 +190,7 @@ $form = new Form($db);
if ($arrayfields['account']['checked'] || $arrayfields['subledger']['checked']) { if ($arrayfields['account']['checked'] || $arrayfields['subledger']['checked']) {
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
} }
if ($arrayfields['bank']['checked'] && !empty($conf->accounting->enabled)) { if ($arrayfields['bank']['checked'] && isModEnabled('accounting')) {
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
} }
if ($arrayfields['ref']['checked']) { if ($arrayfields['ref']['checked']) {
@ -621,7 +621,7 @@ if ($resql) {
$accountstatic->ref = $obj->bref; $accountstatic->ref = $obj->bref;
$accountstatic->number = $obj->bnumber; $accountstatic->number = $obj->bnumber;
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$accountstatic->account_number = $obj->bank_account_number; $accountstatic->account_number = $obj->bank_account_number;
$accountingjournal->fetch($obj->accountancy_journal); $accountingjournal->fetch($obj->accountancy_journal);
$accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1); $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0, 1, 1, '', 1);

View File

@ -70,10 +70,10 @@ if ($contextpage == 'takepos') {
$arrayofpaymentmode = array('cash'=>'Cash', 'cheque'=>'Cheque', 'card'=>'CreditCard'); $arrayofpaymentmode = array('cash'=>'Cash', 'cheque'=>'Cheque', 'card'=>'CreditCard');
$arrayofposavailable = array(); $arrayofposavailable = array();
if (!empty($conf->cashdesk->enabled)) { if (isModEnabled('cashdesk')) {
$arrayofposavailable['cashdesk'] = $langs->trans('CashDesk').' (cashdesk)'; $arrayofposavailable['cashdesk'] = $langs->trans('CashDesk').' (cashdesk)';
} }
if (!empty($conf->takepos->enabled)) { if (isModEnabled('takepos')) {
$arrayofposavailable['takepos'] = $langs->trans('TakePOS').' (takepos)'; $arrayofposavailable['takepos'] = $langs->trans('TakePOS').' (takepos)';
} }
// TODO Add hook here to allow other POS to add themself // TODO Add hook here to allow other POS to add themself
@ -265,6 +265,10 @@ $initialbalanceforterminal = array();
$theoricalamountforterminal = array(); $theoricalamountforterminal = array();
$theoricalnbofinvoiceforterminal = array(); $theoricalnbofinvoiceforterminal = array();
llxHeader('', $langs->trans("CashControl"));
if ($action == "create" || $action == "start" || $action == 'close') { if ($action == "create" || $action == "start" || $action == 'close') {
if ($action == 'close') { if ($action == 'close') {
$posmodule = $object->posmodule; $posmodule = $object->posmodule;
@ -376,8 +380,6 @@ if ($action == "create" || $action == "start" || $action == 'close') {
//var_dump($theoricalamountforterminal); var_dump($theoricalnbofinvoiceforterminal); //var_dump($theoricalamountforterminal); var_dump($theoricalnbofinvoiceforterminal);
if ($action != 'close') { if ($action != 'close') {
llxHeader('', $langs->trans("NewCashFence"));
print load_fiche_titre($langs->trans("CashControl")." - ".$langs->trans("New"), '', 'cash-register'); print load_fiche_titre($langs->trans("CashControl")." - ".$langs->trans("New"), '', 'cash-register');
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -597,8 +599,6 @@ if ($action == "create" || $action == "start" || $action == 'close') {
if (empty($action) || $action == "view" || $action == "close") { if (empty($action) || $action == "view" || $action == "close") {
$result = $object->fetch($id); $result = $object->fetch($id);
llxHeader('', $langs->trans("CashControl"));
if ($result <= 0) { if ($result <= 0) {
print $langs->trans("ErrorRecordNotFound"); print $langs->trans("ErrorRecordNotFound");
} else { } else {

View File

@ -133,7 +133,7 @@ if ($year) {
print '<span class="opacitymedium">'.$langs->trans("DescTaxAndDividendsArea").'</span><br>'; print '<span class="opacitymedium">'.$langs->trans("DescTaxAndDividendsArea").'</span><br>';
print "<br>"; print "<br>";
if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) { if (isModEnabled('tax') && $user->rights->tax->charges->lire) {
// Social contributions only // Social contributions only
print load_fiche_titre($langs->trans("SocialContributions").($year ? ' ('.$langs->trans("Year").' '.$year.')' : ''), '', ''); 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 // VAT
if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) { if (isModEnabled('tax') && $user->rights->tax->charges->lire) {
print "<br>"; print "<br>";
$tva = new Tva($db); $tva = new Tva($db);

View File

@ -29,7 +29,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/trip.lib.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.'/compta/deplacement/class/deplacement.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.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.'/projet/class/project.class.php';
} }
@ -422,7 +422,7 @@ if ($action == 'create') {
print '</td></tr>'; print '</td></tr>';
// Project // Project
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$langs->load('projects'); $langs->load('projects');
print '<tr>'; print '<tr>';
print '<td>'; print '<td>';

View File

@ -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.'/compta/facture/class/facture-rec.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.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.'/projet/class/project.class.php';
//include_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.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); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$formproject = new FormProjets($db); $formproject = new FormProjets($db);
} }
$companystatic = new Societe($db); $companystatic = new Societe($db);
@ -954,7 +954,7 @@ if ($action == 'create') {
print dol_get_fiche_head(null, '', '', 0); print dol_get_fiche_head(null, '', '', 0);
$rowspan = 4; $rowspan = 4;
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$rowspan++; $rowspan++;
} }
if ($object->fk_account > 0) { if ($object->fk_account > 0) {
@ -1047,7 +1047,7 @@ if ($action == 'create') {
} }
// Project // 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; $projectid = GETPOST('projectid') ?GETPOST('projectid') : $object->fk_project;
$langs->load('projects'); $langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td>'; print '<tr><td>'.$langs->trans('Project').'</td><td>';
@ -1117,9 +1117,9 @@ if ($action == 'create') {
$title = $langs->trans("ProductsAndServices"); $title = $langs->trans("ProductsAndServices");
if (empty($conf->service->enabled)) { if (!isModEnabled('service')) {
$title = $langs->trans("Products"); $title = $langs->trans("Products");
} elseif (empty($conf->product->enabled)) { } elseif (!isModEnabled('product')) {
$title = $langs->trans("Services"); $title = $langs->trans("Services");
} }
@ -1203,7 +1203,7 @@ if ($action == 'create') {
// Thirdparty // Thirdparty
$morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
// Project // Project
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' '; $morehtmlref .= '<br>'.$langs->trans('Project').' ';
if ($user->rights->facture->creer) { if ($user->rights->facture->creer) {
@ -1310,7 +1310,7 @@ if ($action == 'create') {
print '</td></tr>'; print '</td></tr>';
// Multicurrency // Multicurrency
if (!empty($conf->multicurrency->enabled)) { if (isModEnabled('multicurrency')) {
// Multicurrency code // Multicurrency code
print '<tr>'; print '<tr>';
print '<td>'; print '<td>';
@ -1573,7 +1573,7 @@ if ($action == 'create') {
if ($object->frequency > 0) { if ($object->frequency > 0) {
print '<br>'; print '<br>';
if (empty($conf->cron->enabled)) { if (!isModEnabled('cron')) {
print info_admin($langs->trans("EnableAndSetupModuleCron", $langs->transnoentitiesnoconv("Module2300Name"))); print info_admin($langs->trans("EnableAndSetupModuleCron", $langs->transnoentitiesnoconv("Module2300Name")));
} }

View File

@ -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/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.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'; 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.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
} }
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.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'; 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'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
} }
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('bills', 'companies', 'compta', 'products', 'banks', 'main', 'withdrawals')); $langs->loadLangs(array('bills', 'companies', 'compta', 'products', 'banks', 'main', 'withdrawals'));
if (isModEnabled('incoterm')) {
if (!empty($conf->incoterm->enabled)) {
$langs->load('incoterm'); $langs->load('incoterm');
} }
if (isModEnabled('margin')) {
if (!empty($conf->margin->enabled)) {
$langs->load('margins'); $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')); $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
} elseif ($action == 'setbankaccount' && $usercancreate) { // bank account } elseif ($action == 'setbankaccount' && $usercancreate) { // bank account
$result = $object->setBankAccount(GETPOST('fk_account', 'int')); $result = $object->setBankAccount(GETPOST('fk_account', 'int'));
@ -2105,7 +2103,7 @@ if (empty($reshook)) {
$error++; $error++;
} }
if (!$error && !empty($conf->variants->enabled) && $prod_entry_mode != 'free') { if (!$error && isModEnabled('variants') && $prod_entry_mode != 'free') {
if ($combinations = GETPOST('combinations', 'array')) { if ($combinations = GETPOST('combinations', 'array')) {
//Check if there is a product with the given combination //Check if there is a product with the given combination
$prodcomb = new ProductCombination($db); $prodcomb = new ProductCombination($db);
@ -2323,7 +2321,7 @@ if (empty($reshook)) {
if (!$error) { if (!$error) {
// Add batchinfo if the detail_batch array is defined // Add batchinfo if the detail_batch array is defined
if (!empty($conf->productbatch->enabled) && !empty($lines[$i]->detail_batch) && is_array($lines[$i]->detail_batch) && !empty($conf->global->INVOICE_INCUDE_DETAILS_OF_LOTS_SERIALS)) { if (isModEnabled('productbatch') && !empty($lines[$i]->detail_batch) && is_array($lines[$i]->detail_batch) && !empty($conf->global->INVOICE_INCUDE_DETAILS_OF_LOTS_SERIALS)) {
$langs->load('productbatch'); $langs->load('productbatch');
foreach ($lines[$i]->detail_batch as $batchline) { foreach ($lines[$i]->detail_batch as $batchline) {
$desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty', $batchline->qty).' '; $desc .= ' '.$langs->trans('Batch').' '.$batchline->batch.' '.$langs->trans('printQty', $batchline->qty).' ';
@ -2952,7 +2950,7 @@ $formmargin = new FormMargin($db);
$soc = new Societe($db); $soc = new Societe($db);
$paymentstatic = new Paiement($db); $paymentstatic = new Paiement($db);
$bankaccountstatic = new Account($db); $bankaccountstatic = new Account($db);
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$formproject = new FormProjets($db); $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_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)); $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)) { if (!empty($objectsrc->multicurrency_code)) {
$currency_code = $objectsrc->multicurrency_code; $currency_code = $objectsrc->multicurrency_code;
} }
@ -3096,7 +3094,7 @@ if ($action == 'create') {
$remise_absolue = 0; $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) $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; $currency_code = $soc->multicurrency_code;
} }
} }
@ -3738,7 +3736,7 @@ if ($action == 'create') {
} }
// Project // Project
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$langs->load('projects'); $langs->load('projects');
print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('Project').'</td><td colspan="2">';
print img_picto('', 'project').$formproject->select_projects(($socid > 0 ? $socid : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); 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 // Incoterms
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
print '<tr>'; print '<tr>';
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), !empty($objectsrc->label_incoterms) ? $objectsrc->label_incoterms : '', 1).'</label></td>'; print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), !empty($objectsrc->label_incoterms) ? $objectsrc->label_incoterms : '', 1).'</label></td>';
print '<td colspan="2" class="maxwidthonsmartphone">'; print '<td colspan="2" class="maxwidthonsmartphone">';
@ -3795,7 +3793,7 @@ if ($action == 'create') {
print "</td></tr>"; print "</td></tr>";
// Multicurrency // Multicurrency
if (!empty($conf->multicurrency->enabled)) { if (isModEnabled('multicurrency')) {
print '<tr>'; print '<tr>';
print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>'; print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
print '<td colspan="2" class="maxwidthonsmartphone">'; print '<td colspan="2" class="maxwidthonsmartphone">';
@ -3916,7 +3914,7 @@ if ($action == 'create') {
} }
print '<tr><td>'.$langs->trans('AmountTTC').'</td><td colspan="2">'.price($objectsrc->total_ttc)."</td></tr>"; print '<tr><td>'.$langs->trans('AmountTTC').'</td><td colspan="2">'.price($objectsrc->total_ttc)."</td></tr>";
if (!empty($conf->multicurrency->enabled)) { if (isModEnabled('multicurrency')) {
print '<tr><td>'.$langs->trans('MulticurrencyAmountHT').'</td><td colspan="2">'.price($objectsrc->multicurrency_total_ht).'</td></tr>'; print '<tr><td>'.$langs->trans('MulticurrencyAmountHT').'</td><td colspan="2">'.price($objectsrc->multicurrency_total_ht).'</td></tr>';
print '<tr><td>'.$langs->trans('MulticurrencyAmountVAT').'</td><td colspan="2">'.price($objectsrc->multicurrency_total_tva)."</td></tr>"; print '<tr><td>'.$langs->trans('MulticurrencyAmountVAT').'</td><td colspan="2">'.price($objectsrc->multicurrency_total_tva)."</td></tr>";
print '<tr><td>'.$langs->trans('MulticurrencyAmountTTC').'</td><td colspan="2">'.price($objectsrc->multicurrency_total_ttc)."</td></tr>"; print '<tr><td>'.$langs->trans('MulticurrencyAmountTTC').'</td><td colspan="2">'.price($objectsrc->multicurrency_total_ttc)."</td></tr>";
@ -3992,7 +3990,7 @@ if ($action == 'create') {
$resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT'); $resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
// Multicurrency // Multicurrency
if (!empty($conf->multicurrency->enabled)) { if (isModEnabled('multicurrency')) {
$multicurrency_totalpaid = $object->getSommePaiement(1); $multicurrency_totalpaid = $object->getSommePaiement(1);
$multicurrency_totalcreditnotes = $object->getSumCreditNotesUsed(1); $multicurrency_totalcreditnotes = $object->getSumCreditNotesUsed(1);
$multicurrency_totaldeposits = $object->getSumDepositsUsed(1); $multicurrency_totaldeposits = $object->getSumDepositsUsed(1);
@ -4364,7 +4362,7 @@ if ($action == 'create') {
$morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)'; $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)';
} }
// Project // Project
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' '; $morehtmlref .= '<br>'.$langs->trans('Project').' ';
if ($usercancreate) { if ($usercancreate) {
@ -4584,7 +4582,7 @@ if ($action == 'create') {
print '</td></tr>'; print '</td></tr>';
// Multicurrency // Multicurrency
if (!empty($conf->multicurrency->enabled)) { if (isModEnabled('multicurrency')) {
// Multicurrency code // Multicurrency code
print '<tr>'; print '<tr>';
print '<td>'; print '<td>';
@ -4650,7 +4648,7 @@ if ($action == 'create') {
} }
// Incoterms // Incoterms
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>'; print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('IncotermLabel'); print $langs->trans('IncotermLabel');
@ -4788,7 +4786,7 @@ if ($action == 'create') {
$sign = -1; // We invert sign for output $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 // Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>'; print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
print '<td class="nowrap right amountcard">'.price($sign * $object->multicurrency_total_ht, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>'; print '<td class="nowrap right amountcard">'.price($sign * $object->multicurrency_total_ht, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
@ -4883,7 +4881,7 @@ if ($action == 'create') {
$nbrows = 8; $nbrows = 8;
$nbcols = 3; $nbcols = 3;
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$nbrows++; $nbrows++;
} }
if (isModEnabled("banque")) { if (isModEnabled("banque")) {
@ -4899,10 +4897,10 @@ if ($action == 'create') {
if ($selleruserevenustamp) { if ($selleruserevenustamp) {
$nbrows++; $nbrows++;
} }
if (!empty($conf->multicurrency->enabled)) { if (isModEnabled('multicurrency')) {
$nbrows += 5; $nbrows += 5;
} }
if (!empty($conf->incoterm->enabled)) { if (isModEnabled('incoterm')) {
$nbrows += 1; $nbrows += 1;
} }
@ -4997,7 +4995,7 @@ if ($action == 'create') {
print '<td>' . $langs->trans('ListOfNextSituationInvoices') . '</td>'; print '<td>' . $langs->trans('ListOfNextSituationInvoices') . '</td>';
print '<td></td>'; print '<td></td>';
print '<td></td>'; print '<td></td>';
if (! empty($conf->banque->enabled)) print '<td class="right"></td>'; if (isModEnabled('banque')) print '<td class="right"></td>';
print '<td class="right">' . $langs->trans('AmountHT') . '</td>'; print '<td class="right">' . $langs->trans('AmountHT') . '</td>';
print '<td class="right">' . $langs->trans('AmountTTC') . '</td>'; print '<td class="right">' . $langs->trans('AmountTTC') . '</td>';
print '<td width="18">&nbsp;</td>'; print '<td width="18">&nbsp;</td>';
@ -5111,7 +5109,7 @@ if ($action == 'create') {
$bankaccountstatic->number = $objp->banumber; $bankaccountstatic->number = $objp->banumber;
$bankaccountstatic->currency_code = $objp->bacurrency_code; $bankaccountstatic->currency_code = $objp->bacurrency_code;
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$bankaccountstatic->account_number = $objp->account_number; $bankaccountstatic->account_number = $objp->account_number;
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
@ -5339,7 +5337,7 @@ if ($action == 'create') {
print '</div>'; print '</div>';
// Margin Infos // Margin Infos
if (!empty($conf->margin->enabled)) { if (isModEnabled('margin')) {
$formmargin->displayMarginInfos($object); $formmargin->displayMarginInfos($object);
} }
@ -5513,7 +5511,7 @@ if ($action == 'create') {
// Create contract // Create contract
if (!empty($conf->global->CONTRACT_CREATE_FROM_INVOICE)) { if (!empty($conf->global->CONTRACT_CREATE_FROM_INVOICE)) {
if (!empty($conf->contrat->enabled) && $object->statut == Facture::STATUS_VALIDATED) { if (isModEnabled('contrat') && $object->statut == Facture::STATUS_VALIDATED) {
$langs->load("contracts"); $langs->load("contracts");
if ($usercancreatecontract) { if ($usercancreatecontract) {
@ -5562,7 +5560,7 @@ if ($action == 'create') {
} }
// POS Ticket // POS Ticket
if (!empty($conf->takepos->enabled) && $object->module_source == 'takepos') { if (isModEnabled('takepos') && $object->module_source == 'takepos') {
$langs->load("cashdesk"); $langs->load("cashdesk");
$receipt_url = DOL_URL_ROOT."/takepos/receipt.php"; $receipt_url = DOL_URL_ROOT."/takepos/receipt.php";
print '<a target="_blank" rel="noopener noreferrer" class="butAction" href="'.$receipt_url.'?facid='.((int) $object->id).'">'.$langs->trans('POSTicket').'</a>'; print '<a target="_blank" rel="noopener noreferrer" class="butAction" href="'.$receipt_url.'?facid='.((int) $object->id).'">'.$langs->trans('POSTicket').'</a>';

View File

@ -25,7 +25,7 @@
/** /**
* \file htdocs/compta/facture/class/facture-rec.class.php * \file htdocs/compta/facture/class/facture-rec.class.php
* \ingroup facture * \ingroup facture
* \brief Fichier de la classe des factures recurentes * \brief File of class to manage recurring invoices
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php';
@ -462,7 +462,7 @@ class FactureRec extends CommonInvoice
/** /**
* Update a line to invoice_rec. * Update a line invoice_rec.
* *
* @param User $user User * @param User $user User
* @param int $notrigger No trigger * @param int $notrigger No trigger
@ -470,8 +470,6 @@ class FactureRec extends CommonInvoice
*/ */
public function update(User $user, $notrigger = 0) public function update(User $user, $notrigger = 0)
{ {
global $conf;
$error = 0; $error = 0;
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET";
@ -480,8 +478,8 @@ class FactureRec extends CommonInvoice
$sql .= " suspended = ".((int) $this->suspended).","; $sql .= " suspended = ".((int) $this->suspended).",";
$sql .= " fk_soc = ".((int) $this->socid).","; $sql .= " fk_soc = ".((int) $this->socid).",";
$sql .= " total_tva = ".((float) $this->total_tva).","; $sql .= " total_tva = ".((float) $this->total_tva).",";
$sql .= " localtax1 = ".((float) $this->localtax1).","; $sql .= " localtax1 = ".((float) $this->total_localtax1).",";
$sql .= " localtax2 = ".((float) $this->localtax2).","; $sql .= " localtax2 = ".((float) $this->total_localtax2).",";
$sql .= " total_ht = ".((float) $this->total_ht).","; $sql .= " total_ht = ".((float) $this->total_ht).",";
$sql .= " total_ttc = ".((float) $this->total_ttc).","; $sql .= " total_ttc = ".((float) $this->total_ttc).",";
$sql .= " remise_percent = ".((float) $this->remise_percent); $sql .= " remise_percent = ".((float) $this->remise_percent);

View File

@ -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.'/margin/lib/margins.lib.php';
require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.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'; 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'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
} }

View File

@ -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/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.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'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
} }
@ -137,7 +137,7 @@ if ($id > 0 || !empty($ref)) {
// Thirdparty // Thirdparty
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer');
// Project // Project
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' '; $morehtmlref .= '<br>'.$langs->trans('Project').' ';
if ($user->rights->facture->creer) { if ($user->rights->facture->creer) {

View File

@ -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/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.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.'/projet/class/project.class.php';
} }
@ -92,20 +92,24 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
* View * View
*/ */
if (empty($object->id)) { $form = new Form($db);
llxHeader();
$langs->load('errors');
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
llxFooter();
exit;
}
if (empty($object->id)) {
$title = $langs->trans('Documents');
} else {
$title = $object->ref." - ".$langs->trans('Documents'); $title = $object->ref." - ".$langs->trans('Documents');
}
$help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; $help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
$form = new Form($db); if (empty($object->id)) {
$langs->load('errors');
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
llxFooter();
exit;
}
if ($id > 0 || !empty($ref)) { if ($id > 0 || !empty($ref)) {
if ($object->fetch($id, $ref) > 0) { if ($object->fetch($id, $ref) > 0) {
@ -137,7 +141,7 @@ if ($id > 0 || !empty($ref)) {
// Thirdparty // Thirdparty
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer');
// Project // Project
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' '; $morehtmlref .= '<br>'.$langs->trans('Project').' ';
if ($user->rights->facture->creer) { if ($user->rights->facture->creer) {

View File

@ -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/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.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'; include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
} }
@ -97,7 +97,7 @@ $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_cl
// Thirdparty // Thirdparty
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer');
// Project // Project
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' '; $morehtmlref .= '<br>'.$langs->trans('Project').' ';
if ($user->rights->facture->creer) { if ($user->rights->facture->creer) {

View File

@ -257,7 +257,7 @@ llxHeader('', $langs->trans("RepeatableInvoices"), 'ch-facture.html#s-fac-factur
$form = new Form($db); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$formproject = new FormProjets($db); $formproject = new FormProjets($db);
} }
$companystatic = new Societe($db); $companystatic = new Societe($db);

View File

@ -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.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.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/class/html.formmargin.class.php';
} }
require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.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/date.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.'/projet/class/project.class.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'; 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 'rtp'=>array('label'=>"Rest", 'checked'=>0, 'position'=>150), // Not enabled by default because slow
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>165), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>165),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>166), '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_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 0 : 1), 'position'=>280),
'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>285), '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'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>290), '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'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>291), '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'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>292), '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'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>295), 'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(!isModEnabled('multicurrency') ? 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 '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_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' => 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)), '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); $formother = new FormOther($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$formmargin = null; $formmargin = null;
if (!empty($conf->margin->enabled)) { if (isModEnabled('margin')) {
$formmargin = new FormMargin($db); $formmargin = new FormMargin($db);
} }
$bankaccountstatic = new Account($db); $bankaccountstatic = new Account($db);
@ -1200,7 +1200,7 @@ if ($resql) {
$moreforfilter .= '</div>'; $moreforfilter .= '</div>';
} }
// Filter on product tags // 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'; include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('IncludingProductWithTag'); $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 .= 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 .= '</div>'; $moreforfilter .= '</div>';
} }
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'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '<div class="divsearchfield">'; $moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('CustomersProspectsCategoriesShort'); $tmptitle = $langs->trans('CustomersProspectsCategoriesShort');
@ -1721,7 +1721,7 @@ if ($resql) {
$totalarray['val']['f.total_ttc'] = 0; $totalarray['val']['f.total_ttc'] = 0;
$with_margin_info = false; $with_margin_info = false;
if (!empty($conf->margin->enabled) && ( if (isModEnabled('margin') && (
!empty($arrayfields['total_pa']['checked']) !empty($arrayfields['total_pa']['checked'])
|| !empty($arrayfields['total_margin']['checked']) || !empty($arrayfields['total_margin']['checked'])
|| !empty($arrayfields['total_margin_rate']['checked']) || !empty($arrayfields['total_margin_rate']['checked'])

View File

@ -29,7 +29,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.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/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.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'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
} }
@ -77,19 +77,24 @@ if (empty($reshook)) {
* View * 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)) { if (empty($object->id)) {
llxHeader();
$langs->load('errors'); $langs->load('errors');
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>'; echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
llxFooter(); llxFooter();
exit; 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)) { if ($id > 0 || !empty($ref)) {
$object = new Facture($db); $object = new Facture($db);
@ -114,7 +119,7 @@ if ($id > 0 || !empty($ref)) {
// Thirdparty // Thirdparty
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer');
// Project // Project
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' '; $morehtmlref .= '<br>'.$langs->trans('Project').' ';
if ($user->rights->facture->creer) { if ($user->rights->facture->creer) {

View File

@ -349,7 +349,7 @@ if ($object->id > 0) {
} }
} }
// Project // Project
if (!empty($conf->project->enabled)) { if (isModEnabled('project')) {
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' '; $morehtmlref .= '<br>'.$langs->trans('Project').' ';
if ($usercancreate) { if ($usercancreate) {
@ -616,7 +616,7 @@ if ($object->id > 0) {
print '<table class="border centpercent tableforfield">'; print '<table class="border centpercent tableforfield">';
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { if (isModEnabled('multicurrency') && ($object->multicurrency_code != $conf->currency)) {
// Multicurrency Amount HT // Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>'; print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
print '<td class="nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>'; print '<td class="nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';

View File

@ -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.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.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'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
} }
@ -72,7 +72,7 @@ $endyear = $year;
/* /*
* View * View
*/ */
if (!empty($conf->category->enabled)) { if (isModEnabled('categorie')) {
$langs->load('categories'); $langs->load('categories');
} }
$form = new Form($db); $form = new Form($db);
@ -299,7 +299,7 @@ if ($user->admin) {
print '</td></tr>'; print '</td></tr>';
// Category // Category
if (!empty($conf->category->enabled)) { if (isModEnabled('categorie')) {
if ($mode == 'customer') { if ($mode == 'customer') {
$cat_type = Categorie::TYPE_CUSTOMER; $cat_type = Categorie::TYPE_CUSTOMER;
$cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Customer")); $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Customer"));

View File

@ -50,7 +50,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('compta', 'bills')); $langs->loadLangs(array('compta', 'bills'));
if (!empty($conf->commande->enabled)) { if (isModEnabled('commande')) {
$langs->load("orders"); $langs->load("orders");
} }

View File

@ -48,10 +48,10 @@ $date_endyear = GETPOST('date_endyear');
if ($user->socid > 0) { if ($user->socid > 0) {
$socid = $user->socid; $socid = $user->socid;
} }
if (!empty($conf->comptabilite->enabled)) { if (isModEnabled('comptabilite')) {
$result = restrictedArea($user, 'compta', '', '', 'resultat'); $result = restrictedArea($user, 'compta', '', '', 'resultat');
} }
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
} }

View File

@ -50,10 +50,10 @@ $date_endyear = GETPOST('date_endyear');
if ($user->socid > 0) { if ($user->socid > 0) {
$socid = $user->socid; $socid = $user->socid;
} }
if (!empty($conf->comptabilite->enabled)) { if (isModEnabled('comptabilite')) {
$result = restrictedArea($user, 'compta', '', '', 'resultat'); $result = restrictedArea($user, 'compta', '', '', 'resultat');
} }
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
} }

View File

@ -597,7 +597,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<td>'.$arraytitle.'</td>'; print '<td>'.$arraytitle.'</td>';
print '<td class="center">'.$langs->trans('Date').'</td>'; print '<td class="center">'.$langs->trans('Date').'</td>';
print '<td class="center">'.$langs->trans('DateMaxPayment').'</td>'; print '<td class="center">'.$langs->trans('DateMaxPayment').'</td>';
if (!empty($conf->multicurrency->enabled)) { if (isModEnabled('multicurrency')) {
print '<td>'.$langs->trans('Currency').'</td>'; print '<td>'.$langs->trans('Currency').'</td>';
print '<td class="right">'.$langs->trans('MulticurrencyAmountTTC').'</td>'; print '<td class="right">'.$langs->trans('MulticurrencyAmountTTC').'</td>';
print '<td class="right">'.$multicurrencyalreadypayedlabel.'</td>'; print '<td class="right">'.$multicurrencyalreadypayedlabel.'</td>';
@ -640,7 +640,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT'); $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT');
// Multicurrency Price // Multicurrency Price
if (!empty($conf->multicurrency->enabled)) { if (isModEnabled('multicurrency')) {
$multicurrency_payment = $invoice->getSommePaiement(1); $multicurrency_payment = $invoice->getSommePaiement(1);
$multicurrency_creditnotes = $invoice->getSumCreditNotesUsed(1); $multicurrency_creditnotes = $invoice->getSumCreditNotesUsed(1);
$multicurrency_deposits = $invoice->getSumDepositsUsed(1); $multicurrency_deposits = $invoice->getSumDepositsUsed(1);
@ -676,12 +676,12 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
} }
// Currency // Currency
if (!empty($conf->multicurrency->enabled)) { if (isModEnabled('multicurrency')) {
print '<td class="center">'.$objp->multicurrency_code."</td>\n"; print '<td class="center">'.$objp->multicurrency_code."</td>\n";
} }
// Multicurrency Price // Multicurrency Price
if (!empty($conf->multicurrency->enabled)) { if (isModEnabled('multicurrency')) {
print '<td class="right">'; print '<td class="right">';
if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) { if ($objp->multicurrency_code && $objp->multicurrency_code != $conf->currency) {
print price($sign * $objp->multicurrency_total_ttc); print price($sign * $objp->multicurrency_total_ttc);
@ -814,7 +814,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Print total // Print total
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td colspan="3" class="left">'.$langs->trans('TotalTTC').'</td>'; print '<td colspan="3" class="left">'.$langs->trans('TotalTTC').'</td>';
if (!empty($conf->multicurrency->enabled)) { if (isModEnabled('multicurrency')) {
print '<td></td>'; print '<td></td>';
print '<td></td>'; print '<td></td>';
print '<td></td>'; print '<td></td>';

View File

@ -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 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 = $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 $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; global $conf;
$way = 'dolibarr'; $way = 'dolibarr';
if (!empty($conf->multicurrency->enabled)) { if (isModEnabled('multicurrency')) {
foreach ($this->multicurrency_amounts as $value) { foreach ($this->multicurrency_amounts as $value) {
if (!empty($value)) { // one value found then payment is in invoice currency if (!empty($value)) { // one value found then payment is in invoice currency
$way = 'customer'; $way = 'customer';

View File

@ -132,7 +132,7 @@ $nbofyear = ($year_end - $year_start) + 1;
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING') // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING')
$modecompta = $conf->global->ACCOUNTING_MODE; $modecompta = $conf->global->ACCOUNTING_MODE;
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$modecompta = 'BOOKKEEPING'; $modecompta = 'BOOKKEEPING';
} }
if (GETPOST("modecompta", 'alpha')) { if (GETPOST("modecompta", 'alpha')) {
@ -146,10 +146,10 @@ $socid = GETPOST('socid', 'int');
if ($user->socid > 0) { if ($user->socid > 0) {
$socid = $user->socid; $socid = $user->socid;
} }
if (!empty($conf->comptabilite->enabled)) { if (isModEnabled('comptabilite')) {
$result = restrictedArea($user, 'compta', '', '', 'resultat'); $result = restrictedArea($user, 'compta', '', '', 'resultat');
} }
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
} }
@ -174,7 +174,7 @@ if ($modecompta == "CREANCES-DETTES") {
$calcmode = $langs->trans("CalcModeDebt"); $calcmode = $langs->trans("CalcModeDebt");
$calcmode .= '<br>('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')'; $calcmode .= '<br>('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=RECETTES-DEPENSES">', '</a>'), $calcmode); $calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=RECETTES-DEPENSES">', '</a>'), $calcmode);
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')'; $calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=BOOKKEEPING">', '</a>'), $calcmode); $calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=BOOKKEEPING">', '</a>'), $calcmode);
} }
@ -193,7 +193,7 @@ if ($modecompta == "CREANCES-DETTES") {
$calcmode = $langs->trans("CalcModeEngagement"); $calcmode = $langs->trans("CalcModeEngagement");
$calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')'; $calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=CREANCES-DETTES">', '</a>'), $calcmode); $calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=CREANCES-DETTES">', '</a>'), $calcmode);
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')'; $calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=BOOKKEEPING">', '</a>'), $calcmode); $calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=BOOKKEEPING">', '</a>'), $calcmode);
} }
@ -223,7 +223,7 @@ $hselected = 'report';
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'showaccountdetail'=>$showaccountdetail), $calcmode); 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); print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
} }
@ -537,7 +537,7 @@ if ($modecompta == 'BOOKKEEPING') {
* Donations * Donations
*/ */
if (!empty($conf->don->enabled)) { if (isModEnabled('don')) {
print '<tr class="trforbreak"><td colspan="4">'.$langs->trans("Donations").'</td></tr>'; print '<tr class="trforbreak"><td colspan="4">'.$langs->trans("Donations").'</td></tr>';
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') { if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') {
@ -932,7 +932,7 @@ if ($modecompta == 'BOOKKEEPING') {
* Salaries * Salaries
*/ */
if (!empty($conf->salaries->enabled)) { if (isModEnabled('salaries')) {
print '<tr class="trforbreak"><td colspan="4">'.$langs->trans("Salaries").'</td></tr>'; print '<tr class="trforbreak"><td colspan="4">'.$langs->trans("Salaries").'</td></tr>';
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') { if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') {
@ -1035,7 +1035,7 @@ if ($modecompta == 'BOOKKEEPING') {
* Expense report * Expense report
*/ */
if (!empty($conf->expensereport->enabled)) { if (isModEnabled('expensereport')) {
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') { if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') {
$langs->load('trips'); $langs->load('trips');
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
@ -1206,7 +1206,7 @@ if ($modecompta == 'BOOKKEEPING') {
* Payment Loan * 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_ht = 0;
$subtotal_ttc = 0; $subtotal_ttc = 0;

View File

@ -110,7 +110,7 @@ $nbofyear = ($year_end - $year_start) + 1;
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING') // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING')
$modecompta = $conf->global->ACCOUNTING_MODE; $modecompta = $conf->global->ACCOUNTING_MODE;
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$modecompta = 'BOOKKEEPING'; $modecompta = 'BOOKKEEPING';
} }
if (GETPOST("modecompta", 'alpha')) { if (GETPOST("modecompta", 'alpha')) {
@ -122,10 +122,10 @@ $socid = GETPOST('socid', 'int');
if ($user->socid > 0) { if ($user->socid > 0) {
$socid = $user->socid; $socid = $user->socid;
} }
if (!empty($conf->comptabilite->enabled)) { if (isModEnabled('comptabilite')) {
$result = restrictedArea($user, 'compta', '', '', 'resultat'); $result = restrictedArea($user, 'compta', '', '', 'resultat');
} }
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
} }
@ -151,7 +151,7 @@ if ($modecompta == 'CREANCES-DETTES') {
$calcmode = $langs->trans("CalcModeDebt"); $calcmode = $langs->trans("CalcModeDebt");
$calcmode .= '<br>('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')'; $calcmode .= '<br>('.$langs->trans("SeeReportInInputOutputMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">', '</a>'), $calcmode); $calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">', '</a>'), $calcmode);
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')'; $calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">', '</a>'), $calcmode); $calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">', '</a>'), $calcmode);
} }
@ -171,7 +171,7 @@ if ($modecompta == 'CREANCES-DETTES') {
$calcmode = $langs->trans("CalcModeEngagement"); $calcmode = $langs->trans("CalcModeEngagement");
$calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')'; $calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">', '</a>'), $calcmode); $calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">', '</a>'), $calcmode);
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')'; $calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{s1}', '{s2}').')';
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">', '</a>'), $calcmode); $calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">', '</a>'), $calcmode);
} }
@ -200,7 +200,7 @@ $hselected = 'report';
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta), $calcmode); 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); print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
} }
@ -391,7 +391,7 @@ if (isModEnabled('facture') && ($modecompta == 'CREANCES-DETTES' || $modecompta
$subtotal_ht = 0; $subtotal_ht = 0;
$subtotal_ttc = 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') { if ($modecompta == 'CREANCES-DETTES') {
// TVA collected to pay // TVA collected to pay
$sql = "SELECT sum(f.total_tva) as amount, date_format(f.datef,'%Y-%m') as dm"; $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_ht = 0;
$subtotal_ttc = 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') { 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 = "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"; $sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
@ -613,7 +613,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
* Salaries * 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') { if ($modecompta == 'CREANCES-DETTES') {
$column = 's.dateep'; // we use the date of end of period of salary $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 * 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'); $langs->load('trips');
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
@ -737,7 +737,7 @@ if (!empty($conf->expensereport->enabled) && ($modecompta == 'CREANCES-DETTES' |
* Donation get dunning payments * 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_ht = 0;
$subtotal_ttc = 0; $subtotal_ttc = 0;
@ -867,7 +867,7 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY) && isModEnabled("ba
* Payement Loan * 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 = "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 .= " FROM ".MAIN_DB_PREFIX."payment_loan AS p, ".MAIN_DB_PREFIX."loan as l";
$sql .= " WHERE l.entity IN (".getEntity('variouspayment').")"; $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 * Request in mode BOOKKEEPING
*/ */
if (!empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING')) { if (isModEnabled('accounting') && ($modecompta == 'BOOKKEEPING')) {
$predefinedgroupwhere = "("; $predefinedgroupwhere = "(";
$predefinedgroupwhere .= " (aa.pcg_type = 'EXPENSE')"; $predefinedgroupwhere .= " (aa.pcg_type = 'EXPENSE')";
$predefinedgroupwhere .= " OR "; $predefinedgroupwhere .= " OR ";

View File

@ -137,7 +137,7 @@ if ($cat_id == 0) {
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING') // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING')
$modecompta = $conf->global->ACCOUNTING_MODE; $modecompta = $conf->global->ACCOUNTING_MODE;
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$modecompta = 'BOOKKEEPING'; $modecompta = 'BOOKKEEPING';
} }
if (GETPOST("modecompta")) { if (GETPOST("modecompta")) {
@ -151,10 +151,10 @@ $socid = GETPOST('socid', 'int');
if ($user->socid > 0) { if ($user->socid > 0) {
$socid = $user->socid; $socid = $user->socid;
} }
if (!empty($conf->comptabilite->enabled)) { if (isModEnabled('comptabilite')) {
$result = restrictedArea($user, 'compta', '', '', 'resultat'); $result = restrictedArea($user, 'compta', '', '', 'resultat');
} }
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); $result = restrictedArea($user, 'accounting', '', '', 'comptarapport');
} }
@ -193,7 +193,7 @@ if ($modecompta == "CREANCES-DETTES") {
$name = $langs->trans("AnnualByAccountDueDebtMode"); $name = $langs->trans("AnnualByAccountDueDebtMode");
$calcmode = $langs->trans("CalcModeDebt"); $calcmode = $langs->trans("CalcModeDebt");
$calcmode .= '<br>('.$langs->trans("SeeReportInInputOutputMode", '<a href="'.$_SERVER["PHP_SELF"].'?year='.$start_year.(GETPOST("month") > 0 ? '&month='.GETPOST("month") : '').'&modecompta=RECETTES-DEPENSES">', '</a>').')'; $calcmode .= '<br>('.$langs->trans("SeeReportInInputOutputMode", '<a href="'.$_SERVER["PHP_SELF"].'?year='.$start_year.(GETPOST("month") > 0 ? '&month='.GETPOST("month") : '').'&modecompta=RECETTES-DEPENSES">', '</a>').')';
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '<a href="'.$_SERVER["PHP_SELF"].'?year='.$start_year.'&modecompta=BOOKKEEPING">', '</a>').')'; $calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '<a href="'.$_SERVER["PHP_SELF"].'?year='.$start_year.'&modecompta=BOOKKEEPING">', '</a>').')';
} }
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $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"); $name = $langs->trans("AnnualByAccountInputOutputMode");
$calcmode = $langs->trans("CalcModeEngagement"); $calcmode = $langs->trans("CalcModeEngagement");
$calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month") > 0 ? '&month='.GETPOST("month") : '').'&modecompta=CREANCES-DETTES">', '</a>').')'; $calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month") > 0 ? '&month='.GETPOST("month") : '').'&modecompta=CREANCES-DETTES">', '</a>').')';
if (!empty($conf->accounting->enabled)) { if (isModEnabled('accounting')) {
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=BOOKKEEPING">', '</a>').')'; $calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=BOOKKEEPING">', '</a>').')';
} }
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $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); 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); print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
} }

Some files were not shown because too many files have changed in this diff Show More