';
print $form->textwithpicto($langs->trans("FreeLegalTextOnExpenseReports"), $langs->trans("AddCRIfTooLong").'
'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').' ';
$variablename = 'EXPENSEREPORT_FREE_TEXT';
-if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
-{
+if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
print '';
} else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php
index 9b56ac5901b..050c2b9455c 100644
--- a/htdocs/admin/expensereport_rules.php
+++ b/htdocs/admin/expensereport_rules.php
@@ -20,7 +20,7 @@
/**
- * \file htdocs/admin/expensereport_ik.php
+ * \file htdocs/admin/expensereport_rules.php
* \ingroup expensereport
* \brief Page to display expense tax ik
*/
@@ -34,7 +34,9 @@ require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.ph
// Load translation files required by the page
$langs->loadLangs(array("admin", "other", "trips", "errors", "dict"));
-if (!$user->admin) accessforbidden();
+if (!$user->admin) {
+ accessforbidden();
+}
//Init error
$error = false;
@@ -55,15 +57,15 @@ $amount = GETPOST('amount');
$restrictive = GETPOST('restrictive');
$object = new ExpenseReportRule($db);
-if (!empty($id))
-{
+if (!empty($id)) {
$result = $object->fetch($id);
- if ($result < 0) dol_print_error('', $object->error, $object->errors);
+ if ($result < 0) {
+ dol_print_error('', $object->error, $object->errors);
+ }
}
// TODO do action
-if ($action == 'save')
-{
+if ($action == 'save') {
$error = 0;
// check parameters
@@ -92,8 +94,7 @@ if ($action == 'save')
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportLimitAmount")), null, 'errors');
}
- if (empty($error))
- {
+ if (empty($error)) {
$object->setValues($_POST);
if ($apply_to == 'U') {
@@ -116,18 +117,22 @@ if ($action == 'save')
$object->entity = $conf->entity;
$res = $object->create($user);
- if ($res > 0) setEventMessages($langs->trans('ExpenseReportRuleSave'), null);
- else dol_print_error($object->db);
+ if ($res > 0) {
+ setEventMessages($langs->trans('ExpenseReportRuleSave'), null);
+ } else {
+ dol_print_error($object->db);
+ }
header('Location: '.$_SERVER['PHP_SELF']);
exit;
}
-} elseif ($action == 'delete')
-{
+} elseif ($action == 'delete') {
// TODO add confirm
$res = $object->delete($user);
- if ($res < 0) dol_print_error($object->db);
+ if ($res < 0) {
+ dol_print_error($object->db);
+ }
header('Location: '.$_SERVER['PHP_SELF']);
exit;
@@ -135,8 +140,17 @@ if ($action == 'save')
$rules = ExpenseReportRule::getAllRule();
-$tab_apply = array('A' => $langs->trans('All'), 'G' => $langs->trans('Group'), 'U' => $langs->trans('User'));
-$tab_rules_type = array('EX_DAY' => $langs->trans('Day'), 'EX_MON' => $langs->trans('Month'), 'EX_YEA' => $langs->trans('Year'), 'EX_EXP' => $langs->trans('OnExpense'));
+$tab_apply = array(
+ 'A' => $langs->trans('All'),
+ 'G' => $langs->trans('Group'),
+ 'U' => $langs->trans('User')
+);
+$tab_rules_type = array(
+ 'EX_DAY' => $langs->trans('Day'),
+ 'EX_MON' => $langs->trans('Month'),
+ 'EX_YEA' => $langs->trans('Year'),
+ 'EX_EXP' => $langs->trans('OnExpense')
+);
/*
@@ -156,8 +170,7 @@ print dol_get_fiche_head($head, 'expenserules', $langs->trans("ExpenseReportsRul
echo ''.$langs->trans('ExpenseReportRulesDesc').'';
print '
';
-if ($action != 'edit')
-{
+if ($action != 'edit') {
echo ' |
';
-foreach ($rules as $rule)
-{
+foreach ($rules as $rule) {
echo '';
echo '| ';
- if ($action == 'edit' && $object->id == $rule->id)
- {
+ if ($action == 'edit' && $object->id == $rule->id) {
$selected = ($object->is_for_all > 0) ? 'A' : ($object->fk_usergroup > 0 ? 'G' : 'U');
echo ' '.$form->selectarray('apply_to', $tab_apply, $selected, 0).' ';
echo ''.$form->select_dolusers($object->fk_user, 'fk_user').' ';
echo ''.$form->select_dolgroups($object->fk_usergroup, 'fk_usergroup').' ';
} else {
- if ($rule->is_for_all > 0) echo $tab_apply['A'];
- elseif ($rule->fk_usergroup > 0) echo $tab_apply['G'].' ('.$rule->getGroupLabel().')';
- elseif ($rule->fk_user > 0) echo $tab_apply['U'].' ('.$rule->getUserName().')';
- }
- echo ' | ';
-
-
- echo '';
- if ($action == 'edit' && $object->id == $rule->id)
- {
- echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1);
- } else {
- if ($rule->fk_c_type_fees == -1) echo $langs->trans('AllExpenseReport');
- else {
- $key = getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
- if ($key != $langs->trans($key)) echo $langs->trans($key);
- else echo $langs->trans(getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id')); // TODO check to return trans of 'code'
+ if ($rule->is_for_all > 0) {
+ echo $tab_apply['A'];
+ } elseif ($rule->fk_usergroup > 0) {
+ echo $tab_apply['G'].' ('.$rule->getGroupLabel().')';
+ } elseif ($rule->fk_user > 0) {
+ echo $tab_apply['U'].' ('.$rule->getUserName().')';
}
}
echo ' | ';
echo '';
- if ($action == 'edit' && $object->id == $rule->id)
- {
+ if ($action == 'edit' && $object->id == $rule->id) {
+ echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1);
+ } else {
+ if ($rule->fk_c_type_fees == -1) {
+ echo $langs->trans('AllExpenseReport');
+ } else {
+ $key = getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
+ if ($key != $langs->trans($key)) {
+ echo $langs->trans($key);
+ } else {
+ echo $langs->trans(getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id')); // TODO check to return trans of 'code'
+ }
+ }
+ }
+ echo ' | ';
+
+
+ echo '';
+ if ($action == 'edit' && $object->id == $rule->id) {
echo $form->selectarray('code_expense_rules_type', $tab_rules_type, $object->code_expense_rules_type, 0);
} else {
echo $tab_rules_type[$rule->code_expense_rules_type];
@@ -263,8 +279,7 @@ foreach ($rules as $rule)
echo ' | ';
- if ($action == 'edit' && $object->id == $rule->id)
- {
+ if ($action == 'edit' && $object->id == $rule->id) {
print $form->selectDate(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0);
} else {
echo dol_print_date($rule->dates, 'day');
@@ -273,8 +288,7 @@ foreach ($rules as $rule)
echo ' | ';
- if ($action == 'edit' && $object->id == $rule->id)
- {
+ if ($action == 'edit' && $object->id == $rule->id) {
print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0);
} else {
echo dol_print_date($rule->datee, 'day');
@@ -283,8 +297,7 @@ foreach ($rules as $rule)
echo ' | ';
- if ($action == 'edit' && $object->id == $rule->id)
- {
+ if ($action == 'edit' && $object->id == $rule->id) {
echo ''.$conf->currency;
} else {
echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency);
@@ -293,8 +306,7 @@ foreach ($rules as $rule)
echo ' | ';
- if ($action == 'edit' && $object->id == $rule->id)
- {
+ if ($action == 'edit' && $object->id == $rule->id) {
echo $form->selectyesno('restrictive', $object->restrictive, 1);
} else {
echo yn($rule->restrictive, 1, 1);
@@ -303,8 +315,7 @@ foreach ($rules as $rule)
echo ' | ';
- if ($object->id != $rule->id)
- {
+ if ($object->id != $rule->id) {
echo ''.img_edit().' ';
echo ''.img_delete().'';
} else {
diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php
index d04379210a6..de19f674659 100644
--- a/htdocs/core/js/lib_foot.js.php
+++ b/htdocs/core/js/lib_foot.js.php
@@ -21,13 +21,27 @@
* \brief File that include javascript functions (included if option use_javascript activated)
*/
-if (!defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
-if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
-if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
-if (!defined('NOLOGIN')) define('NOLOGIN', 1);
-if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1);
-if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
-if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
+if (!defined('NOREQUIRESOC')) {
+ define('NOREQUIRESOC', '1');
+}
+if (!defined('NOCSRFCHECK')) {
+ define('NOCSRFCHECK', 1);
+}
+if (!defined('NOTOKENRENEWAL')) {
+ define('NOTOKENRENEWAL', 1);
+}
+if (!defined('NOLOGIN')) {
+ define('NOLOGIN', 1);
+}
+if (!defined('NOREQUIREMENU')) {
+ define('NOREQUIREMENU', 1);
+}
+if (!defined('NOREQUIREHTML')) {
+ define('NOREQUIREHTML', 1);
+}
+if (!defined('NOREQUIREAJAX')) {
+ define('NOREQUIREAJAX', '1');
+}
session_cache_limiter('public');
@@ -36,8 +50,11 @@ require_once '../../main.inc.php';
// Define javascript type
top_httphead('text/javascript; charset=UTF-8');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
-if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate');
-else header('Cache-Control: no-cache');
+if (empty($dolibarr_nocache)) {
+ header('Cache-Control: max-age=10800, public, must-revalidate');
+} else {
+ header('Cache-Control: no-cache');
+}
//var_dump($conf);
@@ -46,15 +63,14 @@ else header('Cache-Control: no-cache');
print "\n/* JS CODE TO ENABLE Tooltips on all object with class classfortooltip */\n";
print "jQuery(document).ready(function () {\n";
-if (empty($conf->dol_no_mouse_hover))
-{
+if (empty($conf->dol_no_mouse_hover)) {
print 'jQuery(".classfortooltip").tooltip({
- show: { collision: "flipfit", effect:\'toggle\', delay:50 },
- hide: { delay: 250 },
+ show: { collision: "flipfit", effect:"toggle", delay:75, duration:150 },
+ hide: { delay: 250, duration: 20 },
tooltipClass: "mytooltip",
content: function () {
console.log("Return title for popup");
- return $(this).prop(\'title\'); /* To force to get title as is */
+ return $(this).prop("title"); /* To force to get title as is */
}
});'."\n";
}
@@ -79,8 +95,7 @@ print "});\n";
// Wrapper to manage dropdown
-if (!defined('JS_JQUERY_DISABLE_DROPDOWN'))
-{
+if (!defined('JS_JQUERY_DISABLE_DROPDOWN')) {
print "\n/* JS CODE TO ENABLE dropdown (hamburger, linkto, ...) */\n";
print '
jQuery(document).ready(function () {
@@ -149,8 +164,7 @@ if (!defined('JS_JQUERY_DISABLE_DROPDOWN'))
}
// Wrapper to manage document_preview
-if ($conf->browser->layout != 'phone')
-{
+if ($conf->browser->layout != 'phone') {
print "\n/* JS CODE TO ENABLE document_preview */\n"; // Function document_preview is into header
print '
jQuery(document).ready(function () {
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index 08bab0b4c76..eef93849c8b 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -11,7 +11,7 @@
* Copyright (C) 2015-2016 Ferran Marcet
* Copyright (C) 2017 Josep Lluís Amador
* Copyright (C) 2018 Charlene Benke
- * Copyright (C) 2018-2019 Frédéric France
+ * Copyright (C) 2018-2020 Frédéric France
*
* 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
@@ -60,8 +60,7 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'sup
$socid = GETPOST('socid', 'int');
// Security check
-if ($user->socid > 0)
-{
+if ($user->socid > 0) {
$action = '';
$_GET["action"] = '';
$socid = $user->socid;
@@ -363,13 +362,10 @@ if ($massaction == 'transfer_request')
{
$langs->load("withdrawals");
- if (!$user->rights->paymentbybanktransfer->create)
- {
+ if (!$user->rights->paymentbybanktransfer->create) {
$error++;
setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors');
- }
- else
- {
+ } else {
//Checking error
$error = 0;
@@ -421,34 +417,27 @@ if ($massaction == 'transfer_request')
elseif (!empty($objecttmp->mode_reglement_code) && $objecttmp->mode_reglement_code != 'VIR') {
$error++;
setEventMessages($objecttmp->ref.' '.$langs->trans("BadPaymentMethod"), $objecttmp->errors, 'errors');
- }
- else {
+ } else {
$listofbills[] = $objecttmp; // $listofbills will only contains invoices with good payment method and no request already done
}
}
}
//Massive withdraw request for request with no errors
- if (!empty($listofbills))
- {
+ if (!empty($listofbills)) {
$nbwithdrawrequestok = 0;
- foreach ($listofbills as $aBill)
- {
+ foreach ($listofbills as $aBill) {
$db->begin();
$result = $aBill->demande_prelevement($user, $aBill->resteapayer, 'bank-transfer', 'supplier_invoice');
- if ($result > 0)
- {
+ if ($result > 0) {
$db->commit();
$nbwithdrawrequestok++;
- }
- else
- {
+ } else {
$db->rollback();
setEventMessages($aBill->error, $aBill->errors, 'errors');
}
}
- if ($nbwithdrawrequestok > 0)
- {
+ if ($nbwithdrawrequestok > 0) {
setEventMessages($langs->trans("BankTransferRequestsDone", $nbwithdrawrequestok), null, 'mesgs');
}
}
diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php
index 8a7e0cc8054..f88e6dfd834 100644
--- a/htdocs/fourn/facture/paiement.php
+++ b/htdocs/fourn/facture/paiement.php
@@ -9,7 +9,7 @@
* Copyright (C) 2015 Marcos García
* Copyright (C) 2015 Juanjo Menent
* Copyright (C) 2017 Alexandre Spangaro
- * Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2018-2020 Frédéric France
*
* 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
@@ -42,15 +42,15 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('companies', 'bills', 'banks', 'compta'));
-$action = GETPOST('action', 'alpha');
-$confirm = GETPOST('confirm', 'alpha');
+$action = GETPOST('action', 'alpha');
+$confirm = GETPOST('confirm', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
-$facid = GETPOST('facid', 'int');
-$socid = GETPOST('socid', 'int');
+$facid = GETPOST('facid', 'int');
+$socid = GETPOST('socid', 'int');
$accountid = GETPOST('accountid', 'int');
$day = GETPOST('day', 'int');
-$month = GETPOST('month', 'int');
+$month = GETPOST('month', 'int');
$year = GETPOST('year', 'int');
$search_ref = GETPOST("search_ref", "alpha");
@@ -562,15 +562,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '| '.$langs->trans('RefSupplier').' | ';
print ''.$langs->trans('Date').' | ';
print ''.$langs->trans('DateMaxPayment').' | ';
- if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('Currency').' | ';
- if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyAmountTTC').' | ';
- if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyAlreadyPaid').' | ';
- if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyRemainderToPay').' | ';
+ if (!empty($conf->multicurrency->enabled)) {
+ print ''.$langs->trans('Currency').' | ';
+ print ''.$langs->trans('MulticurrencyAmountTTC').' | ';
+ print ''.$langs->trans('MulticurrencyAlreadyPaid').' | ';
+ print ''.$langs->trans('MulticurrencyRemainderToPay').' | ';
+ }
print ''.$langs->trans('AmountTTC').' | ';
print ''.$langs->trans('AlreadyPaid').' | ';
print ''.$langs->trans('RemainderToPay').' | ';
print ''.$langs->trans('PaymentAmount').' | ';
- if (!empty($conf->multicurrency->enabled)) print ''.$langs->trans('MulticurrencyPaymentAmount').' | ';
+ if (!empty($conf->multicurrency->enabled)) {
+ print ''.$langs->trans('MulticurrencyPaymentAmount').' | ';
+ }
print ' |
';
$total = 0;
@@ -596,8 +600,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT');
// Multicurrency Price
- if (!empty($conf->multicurrency->enabled))
- {
+ if (!empty($conf->multicurrency->enabled)) {
$multicurrency_payment = $invoice->getSommePaiement(1);
$multicurrency_creditnotes = $invoice->getSumCreditNotesUsed(1);
$multicurrency_deposits = $invoice->getSumDepositsUsed(1);
@@ -616,8 +619,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '';
+ print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
+ print '
';
+ print '';
+ print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
+ print '
';
+ }
print '';
}
}
diff --git a/scripts/user/migrate_picture_path.php b/scripts/user/migrate_picture_path.php
index 795d03b710d..dd395dc0629 100755
--- a/scripts/user/migrate_picture_path.php
+++ b/scripts/user/migrate_picture_path.php
@@ -19,12 +19,14 @@
*/
/**
- * \file scripts/product/migrate_picture_path.php
+ * \file scripts/user/migrate_picture_path.php
* \ingroup scripts
* \brief Migrate pictures from old system prior to 3.7 to new path for 3.7+
*/
-if (!defined('NOSESSION')) define('NOSESSION', '1');
+if (!defined('NOSESSION')) {
+ define('NOSESSION', '1');
+}
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
diff --git a/scripts/user/sync_users_ldap2dolibarr.php b/scripts/user/sync_users_ldap2dolibarr.php
index 375cb2f43ba..a040599bfc2 100755
--- a/scripts/user/sync_users_ldap2dolibarr.php
+++ b/scripts/user/sync_users_ldap2dolibarr.php
@@ -24,7 +24,9 @@
* \brief Script to update users into Dolibarr from LDAP
*/
-if (!defined('NOSESSION')) define('NOSESSION', '1');
+if (!defined('NOSESSION')) {
+ define('NOSESSION', '1');
+}
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
@@ -59,12 +61,27 @@ print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',', $argv));
// List of fields to get from LDAP
-$required_fields = array($conf->global->LDAP_KEY_USERS, $conf->global->LDAP_FIELD_FULLNAME, $conf->global->LDAP_FIELD_NAME, $conf->global->LDAP_FIELD_FIRSTNAME, $conf->global->LDAP_FIELD_LOGIN, $conf->global->LDAP_FIELD_LOGIN_SAMBA, $conf->global->LDAP_FIELD_PASSWORD, $conf->global->LDAP_FIELD_PASSWORD_CRYPTED, $conf->global->LDAP_FIELD_PHONE, $conf->global->LDAP_FIELD_FAX, $conf->global->LDAP_FIELD_MOBILE,
+$required_fields = array(
+ $conf->global->LDAP_KEY_USERS,
+ $conf->global->LDAP_FIELD_FULLNAME,
+ $conf->global->LDAP_FIELD_NAME,
+ $conf->global->LDAP_FIELD_FIRSTNAME,
+ $conf->global->LDAP_FIELD_LOGIN,
+ $conf->global->LDAP_FIELD_LOGIN_SAMBA,
+ $conf->global->LDAP_FIELD_PASSWORD,
+ $conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
+ $conf->global->LDAP_FIELD_PHONE,
+ $conf->global->LDAP_FIELD_FAX,
+ $conf->global->LDAP_FIELD_MOBILE,
// $conf->global->LDAP_FIELD_ADDRESS,
// $conf->global->LDAP_FIELD_ZIP,
// $conf->global->LDAP_FIELD_TOWN,
// $conf->global->LDAP_FIELD_COUNTRY,
- $conf->global->LDAP_FIELD_MAIL, $conf->global->LDAP_FIELD_TITLE, $conf->global->LDAP_FIELD_DESCRIPTION, $conf->global->LDAP_FIELD_SID);
+ $conf->global->LDAP_FIELD_MAIL,
+ $conf->global->LDAP_FIELD_TITLE,
+ $conf->global->LDAP_FIELD_DESCRIPTION,
+ $conf->global->LDAP_FIELD_SID
+);
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated
$required_fields = array_unique(array_values(array_filter($required_fields, "dolValidElement")));
@@ -75,14 +92,18 @@ if (!isset($argv[1])) {
}
foreach ($argv as $key => $val) {
- if ($val == 'commitiferror')
+ if ($val == 'commitiferror') {
$forcecommit = 1;
- if (preg_match('/--server=([^\s]+)$/', $val, $reg))
+ }
+ if (preg_match('/--server=([^\s]+)$/', $val, $reg)) {
$conf->global->LDAP_SERVER_HOST = $reg[1];
- if (preg_match('/--excludeuser=([^\s]+)$/', $val, $reg))
+ }
+ if (preg_match('/--excludeuser=([^\s]+)$/', $val, $reg)) {
$excludeuser = explode(',', $reg[1]);
- if (preg_match('/-y$/', $val, $reg))
+ }
+ if (preg_match('/-y$/', $val, $reg)) {
$confirmed = 1;
+ }
}
print "Mails sending disabled (useless in batch mode)\n";
@@ -94,9 +115,11 @@ print "port=".$conf->global->LDAP_SERVER_PORT."\n";
print "login=".$conf->global->LDAP_ADMIN_DN."\n";
print "pass=".preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)."\n";
print "DN to extract=".$conf->global->LDAP_USER_DN."\n";
-if (!empty($conf->global->LDAP_FILTER_CONNECTION))
+if (!empty($conf->global->LDAP_FILTER_CONNECTION)) {
print 'Filter=('.$conf->global->LDAP_FILTER_CONNECTION.')'."\n"; // Note: filter is defined into function getRecords
-else print 'Filter=('.$conf->global->LDAP_KEY_USERS.'=*)'."\n";
+} else {
+ print 'Filter=('.$conf->global->LDAP_KEY_USERS.'=*)'."\n";
+}
print "----- To Dolibarr database:\n";
print "type=".$conf->db->type."\n";
print "host=".$conf->db->host."\n";
@@ -200,7 +223,7 @@ if ($result >= 0) {
$fuser->job = $ldapuser[$conf->global->LDAP_FIELD_TITLE];
$fuser->note = $ldapuser[$conf->global->LDAP_FIELD_DESCRIPTION];
$fuser->admin = 0;
- $fuser->societe_id = 0;
+ $fuser->socid = 0;
$fuser->contact_id = 0;
$fuser->fk_member = 0;
@@ -254,9 +277,11 @@ if ($result >= 0) {
}
if (!$error || $forcecommit) {
- if (!$error)
+ if (!$error) {
print $langs->transnoentities("NoErrorCommitIsDone")."\n";
- else print $langs->transnoentities("ErrorButCommitIsDone")."\n";
+ } else {
+ print $langs->transnoentities("ErrorButCommitIsDone")."\n";
+ }
$db->commit();
} else {
print $langs->transnoentities("ErrorSomeErrorWereFoundRollbackIsDone", $error)."\n";