@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | {
|
| 15 | 15 | parent::__construct(); |
| 16 | 16 | |
| 17 | - $this->searchDir[] = BASE_PATH . '/plugins'; |
|
| 17 | + $this->searchDir[] = BASE_PATH.'/plugins'; |
|
| 18 | 18 | $this->nameSpaces[] = 'Alixar'; |
| 19 | 19 | $this->path = null; |
| 20 | 20 | } |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | define('SITE_URL', APP_PROTOCOL . '://' . SERVER_NAME);
|
| 41 | 41 | define('BASE_URI', SITE_URL . APP_URI);
|
| 42 | 42 | */ |
| 43 | - define('DOL_BASE_PATH', BASE_PATH . '/dolibarr/htdocs');
|
|
| 44 | - define('DOL_BASE_URI', BASE_URI . '/dolibarr/htdocs');
|
|
| 43 | + define('DOL_BASE_PATH', BASE_PATH.'/dolibarr/htdocs');
|
|
| 44 | + define('DOL_BASE_URI', BASE_URI.'/dolibarr/htdocs');
|
|
| 45 | 45 | //define('DOL_DOCUMENT_ROOT', DOL_BASE_PATH);
|
| 46 | 46 | |
| 47 | 47 | define('CORE_FOLDER', '/core');
|
@@ -55,15 +55,15 @@ discard block |
||
| 55 | 55 | define('CACHE_FOLDER', '/../cache');
|
| 56 | 56 | //define('VENDOR_FOLDER', BASE_URI . '/vendor');
|
| 57 | 57 | |
| 58 | - define('CORE_PATH', BASE_PATH . CORE_FOLDER);
|
|
| 59 | - define('CONFIG_PATH', BASE_PATH . CONFIG_FOLDER);
|
|
| 60 | - define('CONTROLLERS_PATH', BASE_PATH . CONTROLLERS_FOLDER);
|
|
| 61 | - define('HELPERS_PATH', BASE_PATH . HELPERS_FOLDER);
|
|
| 62 | - define('MODELS_PATH', BASE_PATH . MODELS_FOLDER);
|
|
| 63 | - define('SKINS_PATH', BASE_PATH . SKINS_FOLDER);
|
|
| 64 | - define('TEMPLATES_PATH', BASE_PATH . TEMPLATES_FOLDER);
|
|
| 65 | - define('PLUGINS_PATH', BASE_PATH . PLUGINS_FOLDER);
|
|
| 66 | - define('CACHE_PATH', BASE_PATH . CACHE_FOLDER);
|
|
| 58 | + define('CORE_PATH', BASE_PATH.CORE_FOLDER);
|
|
| 59 | + define('CONFIG_PATH', BASE_PATH.CONFIG_FOLDER);
|
|
| 60 | + define('CONTROLLERS_PATH', BASE_PATH.CONTROLLERS_FOLDER);
|
|
| 61 | + define('HELPERS_PATH', BASE_PATH.HELPERS_FOLDER);
|
|
| 62 | + define('MODELS_PATH', BASE_PATH.MODELS_FOLDER);
|
|
| 63 | + define('SKINS_PATH', BASE_PATH.SKINS_FOLDER);
|
|
| 64 | + define('TEMPLATES_PATH', BASE_PATH.TEMPLATES_FOLDER);
|
|
| 65 | + define('PLUGINS_PATH', BASE_PATH.PLUGINS_FOLDER);
|
|
| 66 | + define('CACHE_PATH', BASE_PATH.CACHE_FOLDER);
|
|
| 67 | 67 | //define('VENDOR_PATH', BASE_PATH . VENDOR_FOLDER);
|
| 68 | 68 | |
| 69 | 69 | /** |
@@ -30,13 +30,13 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
| 32 | 32 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder');
|
| 33 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 33 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 34 | 34 | |
| 35 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; |
|
| 36 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 37 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/geturl.lib.php'; |
|
| 38 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
|
| 39 | -require_once DOL_DOCUMENT_ROOT . '/admin/dolistore/class/dolistore.class.php'; |
|
| 35 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; |
|
| 36 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 37 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; |
|
| 38 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
| 39 | +require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php'; |
|
| 40 | 40 | |
| 41 | 41 | // Load translation files required by the page |
| 42 | 42 | $langs->loadLangs(array("errors", "admin", "modulebuilder"));
|
@@ -87,16 +87,16 @@ discard block |
||
| 87 | 87 | $param = ''; |
| 88 | 88 | if (!GETPOST('buttonreset', 'alpha')) {
|
| 89 | 89 | if ($search_keyword) |
| 90 | - $param .= '&search_keyword=' . urlencode($search_keyword); |
|
| 90 | + $param .= '&search_keyword='.urlencode($search_keyword); |
|
| 91 | 91 | if ($search_status && $search_status != '-1') |
| 92 | - $param .= '&search_status=' . urlencode($search_status); |
|
| 92 | + $param .= '&search_status='.urlencode($search_status); |
|
| 93 | 93 | if ($search_nature && $search_nature != '-1') |
| 94 | - $param .= '&search_nature=' . urlencode($search_nature); |
|
| 94 | + $param .= '&search_nature='.urlencode($search_nature); |
|
| 95 | 95 | if ($search_version && $search_version != '-1') |
| 96 | - $param .= '&search_version=' . urlencode($search_version); |
|
| 96 | + $param .= '&search_version='.urlencode($search_version); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | -$dirins = DOL_DOCUMENT_ROOT . '/custom'; |
|
| 99 | +$dirins = DOL_DOCUMENT_ROOT.'/custom'; |
|
| 100 | 100 | $urldolibarrmodules = 'https://www.dolistore.com/'; |
| 101 | 101 | |
| 102 | 102 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $formconfirm = ''; |
| 111 | 111 | |
| 112 | 112 | $parameters = array(); |
| 113 | -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
|
| 113 | +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
|
| 114 | 114 | if ($reshook < 0) |
| 115 | 115 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 116 | 116 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | // $original_file should match format module_modulename-x.y[.z].zip |
| 128 | 128 | $original_file = basename($_FILES["fileinstall"]["name"]); |
| 129 | - $newfile = $conf->admin->dir_temp . '/' . $original_file . '/' . $original_file; |
|
| 129 | + $newfile = $conf->admin->dir_temp.'/'.$original_file.'/'.$original_file; |
|
| 130 | 130 | |
| 131 | 131 | if (!$original_file) {
|
| 132 | 132 | $langs->load("Error");
|
@@ -147,19 +147,19 @@ discard block |
||
| 147 | 147 | |
| 148 | 148 | if (!$error) {
|
| 149 | 149 | if ($original_file) {
|
| 150 | - @dol_delete_dir_recursive($conf->admin->dir_temp . '/' . $original_file); |
|
| 151 | - dol_mkdir($conf->admin->dir_temp . '/' . $original_file); |
|
| 150 | + @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file); |
|
| 151 | + dol_mkdir($conf->admin->dir_temp.'/'.$original_file); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - $tmpdir = preg_replace('/\.zip$/', '', $original_file) . '.dir';
|
|
| 154 | + $tmpdir = preg_replace('/\.zip$/', '', $original_file).'.dir';
|
|
| 155 | 155 | if ($tmpdir) {
|
| 156 | - @dol_delete_dir_recursive($conf->admin->dir_temp . '/' . $tmpdir); |
|
| 157 | - dol_mkdir($conf->admin->dir_temp . '/' . $tmpdir); |
|
| 156 | + @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$tmpdir); |
|
| 157 | + dol_mkdir($conf->admin->dir_temp.'/'.$tmpdir); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | $result = dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'], $newfile, 1, 0, $_FILES['fileinstall']['error']); |
| 161 | 161 | if ($result > 0) {
|
| 162 | - $result = dol_uncompress($newfile, $conf->admin->dir_temp . '/' . $tmpdir); |
|
| 162 | + $result = dol_uncompress($newfile, $conf->admin->dir_temp.'/'.$tmpdir); |
|
| 163 | 163 | |
| 164 | 164 | if (!empty($result['error'])) {
|
| 165 | 165 | $langs->load("errors");
|
@@ -170,26 +170,26 @@ discard block |
||
| 170 | 170 | $modulename = preg_replace('/module_/', '', $original_file);
|
| 171 | 171 | $modulename = preg_replace('/\-[\d]+\.[\d]+.*$/', '', $modulename);
|
| 172 | 172 | // Search dir $modulename |
| 173 | - $modulenamedir = $conf->admin->dir_temp . '/' . $tmpdir . '/' . $modulename; |
|
| 173 | + $modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; |
|
| 174 | 174 | //var_dump($modulenamedir); |
| 175 | 175 | if (!dol_is_dir($modulenamedir)) {
|
| 176 | - $modulenamedir = $conf->admin->dir_temp . '/' . $tmpdir . '/htdocs/' . $modulename; |
|
| 176 | + $modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; |
|
| 177 | 177 | //var_dump($modulenamedir); |
| 178 | 178 | if (!dol_is_dir($modulenamedir)) {
|
| 179 | - setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat") . '<br>Dir not found: ' . $conf->admin->dir_temp . '/' . $tmpdir . '/' . $modulename . '<br>' . $conf->admin->dir_temp . '/' . $tmpdir . '/htdocs/' . $modulename, null, 'errors');
|
|
| 179 | + setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").'<br>Dir not found: '.$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename.'<br>'.$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename, null, 'errors');
|
|
| 180 | 180 | $error++; |
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | if (!$error) {
|
| 185 | 185 | //var_dump($dirins); |
| 186 | - @dol_delete_dir_recursive($dirins . '/' . $modulename); |
|
| 187 | - dol_syslog("Uncompress of module file is a success. We copy it from " . $modulenamedir . " into target dir " . $dirins . '/' . $modulename);
|
|
| 188 | - $result = dolCopyDir($modulenamedir, $dirins . '/' . $modulename, '0444', 1); |
|
| 186 | + @dol_delete_dir_recursive($dirins.'/'.$modulename); |
|
| 187 | + dol_syslog("Uncompress of module file is a success. We copy it from ".$modulenamedir." into target dir ".$dirins.'/'.$modulename);
|
|
| 188 | + $result = dolCopyDir($modulenamedir, $dirins.'/'.$modulename, '0444', 1); |
|
| 189 | 189 | if ($result <= 0) {
|
| 190 | - dol_syslog('Failed to call dolCopyDir result=' . $result . " with param " . $modulenamedir . " and " . $dirins . '/' . $modulename, LOG_WARNING);
|
|
| 190 | + dol_syslog('Failed to call dolCopyDir result='.$result." with param ".$modulenamedir." and ".$dirins.'/'.$modulename, LOG_WARNING);
|
|
| 191 | 191 | $langs->load("errors");
|
| 192 | - setEventMessages($langs->trans("ErrorFailToCopyDir", $modulenamedir, $dirins . '/' . $modulename), null, 'errors');
|
|
| 192 | + setEventMessages($langs->trans("ErrorFailToCopyDir", $modulenamedir, $dirins.'/'.$modulename), null, 'errors');
|
|
| 193 | 193 | $error++; |
| 194 | 194 | } |
| 195 | 195 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | if (!$error) {
|
| 203 | - setEventMessages($langs->trans("SetupIsReadyForUse", DOL_URL_ROOT . '/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home") . ' - ' . $langs->transnoentitiesnoconv("Setup") . ' - ' . $langs->transnoentitiesnoconv("Modules")), null, 'warnings');
|
|
| 203 | + setEventMessages($langs->trans("SetupIsReadyForUse", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")), null, 'warnings');
|
|
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | else {
|
| 212 | 212 | //var_dump($resarray);exit; |
| 213 | 213 | if ($resarray['nbperms'] > 0) {
|
| 214 | - $tmpsql = "SELECT COUNT(rowid) as nb FROM " . MAIN_DB_PREFIX . "user WHERE admin <> 1"; |
|
| 214 | + $tmpsql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1"; |
|
| 215 | 215 | $resqltmp = $db->query($tmpsql); |
| 216 | 216 | if ($resqltmp) {
|
| 217 | 217 | $obj = $db->fetch_object($resqltmp); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | //header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
|
| 228 | - header("Location: ?controller=admin&method=modules&mode=" . $mode . $param . ($page_y ? '&page_y=' . $page_y : ''));
|
|
| 228 | + header("Location: ?controller=admin&method=modules&mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
|
|
| 229 | 229 | exit; |
| 230 | 230 | } |
| 231 | 231 | else if ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes') {
|
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | setEventMessages($result, null, 'errors'); |
| 235 | 235 | } |
| 236 | 236 | //header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
|
| 237 | - header("Location: ?controller=admin&method=modules&mode=" . $mode . $param . ($page_y ? '&page_y=' . $page_y : ''));
|
|
| 237 | + header("Location: ?controller=admin&method=modules&mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
|
|
| 238 | 238 | exit; |
| 239 | 239 | } |
| 240 | 240 | |
@@ -262,9 +262,9 @@ discard block |
||
| 262 | 262 | // Search modules dirs |
| 263 | 263 | $modulesdir = dolGetModulesDirs(); |
| 264 | 264 | |
| 265 | -$arrayofnatures = array('core' => $langs->transnoentitiesnoconv("Core"), 'external' => $langs->transnoentitiesnoconv("External") . ' - [' . $langs->trans("AllPublishers") . ']');
|
|
| 266 | -$arrayofwarnings = array(); // Array of warning each module want to show when activated |
|
| 267 | -$arrayofwarningsext = array(); // Array of warning each module want to show when we activate an external module |
|
| 265 | +$arrayofnatures = array('core' => $langs->transnoentitiesnoconv("Core"), 'external' => $langs->transnoentitiesnoconv("External").' - ['.$langs->trans("AllPublishers").']');
|
|
| 266 | +$arrayofwarnings = array(); // Array of warning each module want to show when activated |
|
| 267 | +$arrayofwarningsext = array(); // Array of warning each module want to show when we activate an external module |
|
| 268 | 268 | $filename = array(); |
| 269 | 269 | $modules = array(); |
| 270 | 270 | $orders = array(); |
@@ -277,37 +277,37 @@ discard block |
||
| 277 | 277 | foreach ($modulesdir as $dir) {
|
| 278 | 278 | // Load modules attributes in arrays (name, numero, orders) from dir directory |
| 279 | 279 | //print $dir."\n<br>"; |
| 280 | - dol_syslog("Scan directory " . $dir . " for module descriptor files (modXXX.class.php)");
|
|
| 280 | + dol_syslog("Scan directory ".$dir." for module descriptor files (modXXX.class.php)");
|
|
| 281 | 281 | $handle = @opendir($dir); |
| 282 | 282 | if (is_resource($handle)) {
|
| 283 | 283 | while (($file = readdir($handle)) !== false) {
|
| 284 | 284 | //print "$i ".$file."\n<br>"; |
| 285 | - if (is_readable($dir . $file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
|
|
| 285 | + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
|
|
| 286 | 286 | $modName = substr($file, 0, dol_strlen($file) - 10); |
| 287 | 287 | |
| 288 | 288 | if ($modName) {
|
| 289 | 289 | if (!empty($modNameLoaded[$modName])) { // In cache of already loaded modules ?
|
| 290 | - $mesg = "Error: Module " . $modName . " was found twice: Into " . $modNameLoaded[$modName] . " and " . $dir . ". You probably have an old file on your disk.<br>"; |
|
| 290 | + $mesg = "Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.<br>"; |
|
| 291 | 291 | setEventMessages($mesg, null, 'warnings'); |
| 292 | 292 | dol_syslog($mesg, LOG_ERR); |
| 293 | 293 | continue; |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | try {
|
| 297 | - $res = include_once $dir . $file; // A class already exists in a different file will send a non catchable fatal error. |
|
| 297 | + $res = include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error. |
|
| 298 | 298 | if (class_exists($modName)) {
|
| 299 | 299 | try {
|
| 300 | 300 | $objMod = new $modName($db); |
| 301 | 301 | $modNameLoaded[$modName] = $dir; |
| 302 | 302 | if (!$objMod->numero > 0 && $modName != 'modUser') {
|
| 303 | - dol_syslog('The module descriptor ' . $modName . ' must have a numero property', LOG_ERR);
|
|
| 303 | + dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
|
|
| 304 | 304 | } |
| 305 | 305 | $j = $objMod->numero; |
| 306 | 306 | |
| 307 | 307 | $modulequalified = 1; |
| 308 | 308 | |
| 309 | 309 | // We discard modules according to features level (PS: if module is activated we always show it) |
| 310 | - $const_name = 'MAIN_MODULE_' . strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
|
|
| 310 | + $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
|
|
| 311 | 311 | if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) |
| 312 | 312 | $modulequalified = 0; |
| 313 | 313 | if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) |
@@ -324,9 +324,9 @@ discard block |
||
| 324 | 324 | $external = ($objMod->isCoreOrExternalModule() == 'external'); |
| 325 | 325 | if ($external) {
|
| 326 | 326 | if ($publisher) {
|
| 327 | - $arrayofnatures['external_' . $publisher] = $langs->trans("External") . ' - ' . $publisher;
|
|
| 327 | + $arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher;
|
|
| 328 | 328 | } else {
|
| 329 | - $arrayofnatures['external_'] = $langs->trans("External") . ' - ' . $langs->trans("UnknownPublishers");
|
|
| 329 | + $arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers");
|
|
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | ksort($arrayofnatures); |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | |
| 348 | 348 | $moduleposition = ($objMod->module_position ? $objMod->module_position : '50'); |
| 349 | 349 | if ($moduleposition == '50' && ($objMod->isCoreOrExternalModule() == 'external')) {
|
| 350 | - $moduleposition = '80'; // External modules at end by default |
|
| 350 | + $moduleposition = '80'; // External modules at end by default |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | // Add list of warnings to show into arrayofwarnings and arrayofwarningsext |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext; |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - $orders[$i] = $familyinfo[$familykey]['position'] . "_" . $familykey . "_" . $moduleposition . "_" . $j; // Sort by family, then by module position then number |
|
| 361 | + $orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number |
|
| 362 | 362 | $dirmod[$i] = $dir; |
| 363 | 363 | //print $i.'-'.$dirmod[$i].'<br>'; |
| 364 | 364 | // Set categ[$i] |
@@ -366,28 +366,28 @@ discard block |
||
| 366 | 366 | if ($objMod->version == 'development' || $objMod->version == 'experimental') |
| 367 | 367 | $specialstring = 'expdev'; |
| 368 | 368 | if (isset($categ[$specialstring])) |
| 369 | - $categ[$specialstring] ++; // Array of all different modules categories |
|
| 369 | + $categ[$specialstring]++; // Array of all different modules categories |
|
| 370 | 370 | else |
| 371 | 371 | $categ[$specialstring] = 1; |
| 372 | 372 | $j++; |
| 373 | 373 | $i++; |
| 374 | 374 | } else |
| 375 | - dol_syslog("Module " . get_class($objMod) . " not qualified");
|
|
| 375 | + dol_syslog("Module ".get_class($objMod)." not qualified");
|
|
| 376 | 376 | } catch (Exception $e) {
|
| 377 | - dol_syslog("Failed to load " . $dir . $file . " " . $e->getMessage(), LOG_ERR);
|
|
| 377 | + dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
|
|
| 378 | 378 | } |
| 379 | 379 | } else {
|
| 380 | - print "Warning bad descriptor file : " . $dir . $file . " (Class " . $modName . " not found into file)<br>"; |
|
| 380 | + print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>"; |
|
| 381 | 381 | } |
| 382 | 382 | } catch (Exception $e) {
|
| 383 | - dol_syslog("Failed to load " . $dir . $file . " " . $e->getMessage(), LOG_ERR);
|
|
| 383 | + dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
|
|
| 384 | 384 | } |
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | } |
| 388 | 388 | closedir($handle); |
| 389 | 389 | } else {
|
| 390 | - dol_syslog("htdocs/admin/modules.php: Failed to open directory " . $dir . ". See permission and open_basedir option.", LOG_WARNING);
|
|
| 390 | + dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING);
|
|
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | $langs->loadLangs($objMod->langfiles); |
| 400 | 400 | |
| 401 | 401 | $form = new Form($db); |
| 402 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?value=' . $value . '&mode=' . $mode . $param, $langs->trans('ConfirmUnactivation'), $langs->trans(GETPOST('confirm_message_code')), 'reset', '', 'no', 1);
|
|
| 402 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?value='.$value.'&mode='.$mode.$param, $langs->trans('ConfirmUnactivation'), $langs->trans(GETPOST('confirm_message_code')), 'reset', '', 'no', 1);
|
|
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | |
@@ -413,18 +413,18 @@ discard block |
||
| 413 | 413 | $nbofactivatedmodules = count($conf->modules); |
| 414 | 414 | $moreinfo = $langs->trans("TotalNumberOfActivatedModules", ($nbofactivatedmodules - 1), count($modules));
|
| 415 | 415 | if ($nbofactivatedmodules <= 1) |
| 416 | - $moreinfo .= ' ' . img_warning($langs->trans("YouMustEnableOneModule"));
|
|
| 416 | + $moreinfo .= ' '.img_warning($langs->trans("YouMustEnableOneModule"));
|
|
| 417 | 417 | print load_fiche_titre($langs->trans("ModulesSetup"), $moreinfo, 'title_setup');
|
| 418 | 418 | |
| 419 | 419 | // Start to show page |
| 420 | 420 | if ($mode == 'common') |
| 421 | - print '<span class="opacitymedium">' . $langs->trans("ModulesDesc") . "</span><br>\n";
|
|
| 421 | + print '<span class="opacitymedium">'.$langs->trans("ModulesDesc")."</span><br>\n";
|
|
| 422 | 422 | if ($mode == 'marketplace') |
| 423 | - print '<span class="opacitymedium">' . $langs->trans("ModulesMarketPlaceDesc") . "</span><br>\n";
|
|
| 423 | + print '<span class="opacitymedium">'.$langs->trans("ModulesMarketPlaceDesc")."</span><br>\n";
|
|
| 424 | 424 | if ($mode == 'deploy') |
| 425 | - print '<span class="opacitymedium">' . $langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules")) . "</span><br>\n";
|
|
| 425 | + print '<span class="opacitymedium">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."</span><br>\n";
|
|
| 426 | 426 | if ($mode == 'develop') |
| 427 | - print '<span class="opacitymedium">' . $langs->trans("ModulesDevelopDesc") . "</span><br>\n";
|
|
| 427 | + print '<span class="opacitymedium">'.$langs->trans("ModulesDevelopDesc")."</span><br>\n";
|
|
| 428 | 428 | |
| 429 | 429 | $head = modules_prepare_head(); |
| 430 | 430 | |
@@ -435,22 +435,22 @@ discard block |
||
| 435 | 435 | if ($mode == 'common') {
|
| 436 | 436 | dol_set_focus('#search_keyword');
|
| 437 | 437 | |
| 438 | - print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">'; |
|
| 438 | + print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; |
|
| 439 | 439 | if ($optioncss != '') |
| 440 | - print '<input type="hidden" name="optioncss" value="' . $optioncss . '">'; |
|
| 441 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
| 442 | - print '<input type="hidden" name="sortfield" value="' . $sortfield . '">'; |
|
| 443 | - print '<input type="hidden" name="sortorder" value="' . $sortorder . '">'; |
|
| 444 | - print '<input type="hidden" name="page" value="' . $page . '">'; |
|
| 440 | + print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; |
|
| 441 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 442 | + print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; |
|
| 443 | + print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; |
|
| 444 | + print '<input type="hidden" name="page" value="'.$page.'">'; |
|
| 445 | 445 | |
| 446 | 446 | dol_fiche_head($head, $mode, '', -1); |
| 447 | 447 | |
| 448 | 448 | $moreforfilter = ''; |
| 449 | 449 | $moreforfilter .= '<div class="divsearchfield">'; |
| 450 | - $moreforfilter .= $langs->trans('Keyword') . ': <input type="text" id="search_keyword" name="search_keyword" value="' . dol_escape_htmltag($search_keyword) . '">';
|
|
| 450 | + $moreforfilter .= $langs->trans('Keyword').': <input type="text" id="search_keyword" name="search_keyword" value="'.dol_escape_htmltag($search_keyword).'">';
|
|
| 451 | 451 | $moreforfilter .= '</div>'; |
| 452 | 452 | $moreforfilter .= '<div class="divsearchfield">'; |
| 453 | - $moreforfilter .= $langs->trans('Origin') . ': ' . $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1);
|
|
| 453 | + $moreforfilter .= $langs->trans('Origin').': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1);
|
|
| 454 | 454 | $moreforfilter .= '</div>'; |
| 455 | 455 | if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
|
| 456 | 456 | $array_version = array('stable' => $langs->transnoentitiesnoconv("Stable"));
|
@@ -461,23 +461,23 @@ discard block |
||
| 461 | 461 | if ($conf->global->MAIN_FEATURES_LEVEL > 1) |
| 462 | 462 | $array_version['development'] = $langs->trans("Development");
|
| 463 | 463 | $moreforfilter .= '<div class="divsearchfield">'; |
| 464 | - $moreforfilter .= $langs->trans('Version') . ': ' . $form->selectarray('search_version', $array_version, $search_version, 1);
|
|
| 464 | + $moreforfilter .= $langs->trans('Version').': '.$form->selectarray('search_version', $array_version, $search_version, 1);
|
|
| 465 | 465 | $moreforfilter .= '</div>'; |
| 466 | 466 | } |
| 467 | 467 | $moreforfilter .= '<div class="divsearchfield">'; |
| 468 | - $moreforfilter .= $langs->trans('Status') . ': ' . $form->selectarray('search_status', array('active' => $langs->transnoentitiesnoconv("Enabled"), 'disabled' => $langs->transnoentitiesnoconv("Disabled")), $search_status, 1);
|
|
| 468 | + $moreforfilter .= $langs->trans('Status').': '.$form->selectarray('search_status', array('active' => $langs->transnoentitiesnoconv("Enabled"), 'disabled' => $langs->transnoentitiesnoconv("Disabled")), $search_status, 1);
|
|
| 469 | 469 | $moreforfilter .= '</div>'; |
| 470 | 470 | $moreforfilter .= ' '; |
| 471 | 471 | $moreforfilter .= '<div class="divsearchfield">'; |
| 472 | - $moreforfilter .= '<input type="submit" name="buttonsubmit" class="button" value="' . dol_escape_htmltag($langs->trans("Refresh")) . '">';
|
|
| 472 | + $moreforfilter .= '<input type="submit" name="buttonsubmit" class="button" value="'.dol_escape_htmltag($langs->trans("Refresh")).'">';
|
|
| 473 | 473 | $moreforfilter .= ' '; |
| 474 | - $moreforfilter .= '<input type="submit" name="buttonreset" class="button" value="' . dol_escape_htmltag($langs->trans("Reset")) . '">';
|
|
| 474 | + $moreforfilter .= '<input type="submit" name="buttonreset" class="button" value="'.dol_escape_htmltag($langs->trans("Reset")).'">';
|
|
| 475 | 475 | $moreforfilter .= '</div>'; |
| 476 | 476 | |
| 477 | 477 | if (!empty($moreforfilter)) {
|
| 478 | 478 | print $moreforfilter; |
| 479 | 479 | $parameters = array(); |
| 480 | - $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
|
| 480 | + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
|
| 481 | 481 | print $hookmanager->resPrint; |
| 482 | 482 | } |
| 483 | 483 | |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | print '<div class="clearboth"></div><br>'; |
| 487 | 487 | |
| 488 | 488 | $parameters = array(); |
| 489 | - $reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
|
| 489 | + $reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
|
| 490 | 490 | if ($reshook < 0) |
| 491 | 491 | setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
| 492 | 492 | |
@@ -508,14 +508,14 @@ discard block |
||
| 508 | 508 | //print $objMod->name." - ".$key." - ".$objMod->version."<br>"; |
| 509 | 509 | //if (($mode != (isset($specialtostring[$special])?$specialtostring[$special]:'unknown') && $mode != 'expdev') |
| 510 | 510 | if ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental') |
| 511 | - continue; // Discard if not for current tab |
|
| 511 | + continue; // Discard if not for current tab |
|
| 512 | 512 | |
| 513 | 513 | if (!$objMod->getName()) {
|
| 514 | - dol_syslog("Error for module " . $key . " - Property name of module looks empty", LOG_WARNING);
|
|
| 514 | + dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING);
|
|
| 515 | 515 | continue; |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | - $const_name = 'MAIN_MODULE_' . strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
|
|
| 518 | + $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
|
|
| 519 | 519 | |
| 520 | 520 | // Check filters |
| 521 | 521 | $modulename = $objMod->getName(); |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | // We discard showing according to filters |
| 528 | 528 | if ($search_keyword) {
|
| 529 | 529 | $qualified = 0; |
| 530 | - if (preg_match('/' . preg_quote($search_keyword) . '/i', $modulename) || preg_match('/' . preg_quote($search_keyword) . '/i', $moduletechnicalname) || preg_match('/' . preg_quote($search_keyword) . '/i', $moduledesc) || preg_match('/' . preg_quote($search_keyword) . '/i', $moduledesclong) || preg_match('/' . preg_quote($search_keyword) . '/i', $moduleauthor)
|
|
| 530 | + if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename) || preg_match('/'.preg_quote($search_keyword).'/i', $moduletechnicalname) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong) || preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor)
|
|
| 531 | 531 | ) |
| 532 | 532 | $qualified = 1; |
| 533 | 533 | if (!$qualified) |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | print load_fiche_titre($familytext, '', ''); |
| 582 | 582 | |
| 583 | 583 | print '<div class="div-table-responsive">'; |
| 584 | - print '<table class="tagtable liste" summary="list_of_modules">' . "\n"; |
|
| 584 | + print '<table class="tagtable liste" summary="list_of_modules">'."\n"; |
|
| 585 | 585 | |
| 586 | 586 | $atleastoneforfamily = 0; |
| 587 | 587 | } |
@@ -613,9 +613,9 @@ discard block |
||
| 613 | 613 | $imginfo = "info_black"; |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | - print '<tr class="oddeven">' . "\n"; |
|
| 616 | + print '<tr class="oddeven">'."\n"; |
|
| 617 | 617 | if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) |
| 618 | - print '<td width="20px">' . ++$linenum . '</td>'; |
|
| 618 | + print '<td width="20px">'.++$linenum.'</td>'; |
|
| 619 | 619 | |
| 620 | 620 | // Picto + Name of module |
| 621 | 621 | print ' <td width="200px">'; |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | else {
|
| 632 | 632 | print img_object($alttext, 'generic', 'class="valignmiddle"'); |
| 633 | 633 | } |
| 634 | - print ' <span class="valignmiddle">' . $objMod->getName() . '</span>'; |
|
| 634 | + print ' <span class="valignmiddle">'.$objMod->getName().'</span>'; |
|
| 635 | 635 | print "</td>\n"; |
| 636 | 636 | |
| 637 | 637 | // Desc |
@@ -642,19 +642,19 @@ discard block |
||
| 642 | 642 | // Help |
| 643 | 643 | print '<td class="center nowrap" style="width: 82px;">'; |
| 644 | 644 | //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1);
|
| 645 | - print '<a href="javascript:document_preview(\'' . DOL_URL_ROOT . '/admin/modulehelp.php?id=' . $objMod->numero . '\',\'text/html\',\'' . dol_escape_js($langs->trans("Module")) . '\')">' . img_picto($langs->trans("ClickToShowDescription"), $imginfo) . '</a>';
|
|
| 645 | + print '<a href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.$objMod->numero.'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto($langs->trans("ClickToShowDescription"), $imginfo).'</a>';
|
|
| 646 | 646 | print '</td>'; |
| 647 | 647 | |
| 648 | 648 | // Version |
| 649 | 649 | print '<td class="center nowrap" width="120px">'; |
| 650 | 650 | print $versiontrans; |
| 651 | 651 | if (!empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)) {
|
| 652 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/geturl.lib.php'; |
|
| 652 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; |
|
| 653 | 653 | if (!empty($objMod->url_last_version)) {
|
| 654 | 654 | $newversion = getURLContent($objMod->url_last_version); |
| 655 | 655 | if (isset($newversion['content'])) {
|
| 656 | 656 | if (version_compare($newversion['content'], $versiontrans) > 0) {
|
| 657 | - print " <span class='butAction' title='" . $langs->trans('LastStableVersion') . "'>" . $newversion['content'] . "</span>";
|
|
| 657 | + print " <span class='butAction' title='".$langs->trans('LastStableVersion')."'>".$newversion['content']."</span>";
|
|
| 658 | 658 | } |
| 659 | 659 | } |
| 660 | 660 | } |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | // Link enable/disabme |
| 669 | 669 | print '<td class="center valignmiddle" width="60px">'; |
| 670 | 670 | if (!empty($arrayofwarnings[$modName])) {
|
| 671 | - print '<!-- This module has a warning to show when we activate it (note: your country is ' . $mysoc->country_code . ') -->' . "\n"; |
|
| 671 | + print '<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n"; |
|
| 672 | 672 | } |
| 673 | 673 | if (!empty($objMod->disabled)) {
|
| 674 | 674 | print $langs->trans("Disabled");
|
@@ -685,30 +685,30 @@ discard block |
||
| 685 | 685 | else {
|
| 686 | 686 | if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
|
| 687 | 687 | //print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&module_position='.$module_position.'&action=reset_confirm&confirm_message_code='.$objMod->warnings_unactivation[$mysoc->country_code].'&value=' . $modName . '&mode=' . $mode . $param . '">'; |
| 688 | - print '<a class="reposition" href="?controller=admin&method=modules&id=' . $objMod->numero . '&module_position=' . $module_position . '&action=reset_confirm&confirm_message_code=' . $objMod->warnings_unactivation[$mysoc->country_code] . '&value=' . $modName . '&mode=' . $mode . $param . '">'; |
|
| 688 | + print '<a class="reposition" href="?controller=admin&method=modules&id='.$objMod->numero.'&module_position='.$module_position.'&action=reset_confirm&confirm_message_code='.$objMod->warnings_unactivation[$mysoc->country_code].'&value='.$modName.'&mode='.$mode.$param.'">'; |
|
| 689 | 689 | print img_picto($langs->trans("Activated"), 'switch_on');
|
| 690 | 690 | print '</a>'; |
| 691 | 691 | } else {
|
| 692 | 692 | //print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&module_position='.$module_position.'&action=reset&value=' . $modName . '&mode=' . $mode .'&confirm=yes' . $param . '">'; |
| 693 | - print '<a class="reposition" href="?controller=admin&method=modules&id=' . $objMod->numero . '&module_position=' . $module_position . '&action=reset&value=' . $modName . '&mode=' . $mode . '&confirm=yes' . $param . '">'; |
|
| 693 | + print '<a class="reposition" href="?controller=admin&method=modules&id='.$objMod->numero.'&module_position='.$module_position.'&action=reset&value='.$modName.'&mode='.$mode.'&confirm=yes'.$param.'">'; |
|
| 694 | 694 | print img_picto($langs->trans("Activated"), 'switch_on');
|
| 695 | 695 | print '</a>'; |
| 696 | 696 | } |
| 697 | 697 | } |
| 698 | - print '</td>' . "\n"; |
|
| 698 | + print '</td>'."\n"; |
|
| 699 | 699 | |
| 700 | 700 | // Link config |
| 701 | 701 | if (!empty($objMod->config_page_url) && !$disableSetup) {
|
| 702 | 702 | $backtourlparam = ''; |
| 703 | 703 | if ($search_keyword != '') |
| 704 | - $backtourlparam .= ($backtourlparam ? '&' : '?') . 'search_keyword=' . $search_keyword; // No urlencode here, done later |
|
| 704 | + $backtourlparam .= ($backtourlparam ? '&' : '?').'search_keyword='.$search_keyword; // No urlencode here, done later |
|
| 705 | 705 | if ($search_nature > -1) |
| 706 | - $backtourlparam .= ($backtourlparam ? '&' : '?') . 'search_nature=' . $search_nature; |
|
| 706 | + $backtourlparam .= ($backtourlparam ? '&' : '?').'search_nature='.$search_nature; |
|
| 707 | 707 | if ($search_version > -1) |
| 708 | - $backtourlparam .= ($backtourlparam ? '&' : '?') . 'search_version=' . $search_version; |
|
| 708 | + $backtourlparam .= ($backtourlparam ? '&' : '?').'search_version='.$search_version; |
|
| 709 | 709 | if ($search_status > -1) |
| 710 | - $backtourlparam .= ($backtourlparam ? '&' : '?') . 'search_status=' . $search_status; |
|
| 711 | - $backtourl = $_SERVER["PHP_SELF"] . $backtourlparam; |
|
| 710 | + $backtourlparam .= ($backtourlparam ? '&' : '?').'search_status='.$search_status; |
|
| 711 | + $backtourl = $_SERVER["PHP_SELF"].$backtourlparam; |
|
| 712 | 712 | |
| 713 | 713 | if (is_array($objMod->config_page_url)) {
|
| 714 | 714 | print '<td class="tdsetuppicto right" width="60px">'; |
@@ -716,30 +716,30 @@ discard block |
||
| 716 | 716 | foreach ($objMod->config_page_url as $page) {
|
| 717 | 717 | $urlpage = str_replace('.php', '', $page);
|
| 718 | 718 | if ($i++) {
|
| 719 | - print '<a href="' . $urlpage . '" title="' . $langs->trans($page) . '">' . img_picto(ucfirst($page), "setup") . '</a>'; |
|
| 719 | + print '<a href="'.$urlpage.'" title="'.$langs->trans($page).'">'.img_picto(ucfirst($page), "setup").'</a>'; |
|
| 720 | 720 | // print '<a href="'.$page.'">'.ucfirst($page).'</a> '; |
| 721 | 721 | } else {
|
| 722 | 722 | if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
|
| 723 | 723 | //$urltouse=dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1);
|
| 724 | - $urltouse = '?controller=' . $regs[2] . '/admin&method=' . $regs[1]; |
|
| 725 | - print '<a href="' . $urltouse . (preg_match('/\?/', $urltouse) ? '&' : '?') . 'save_lastsearch_values=1&backtopage=' . urlencode($backtourl) . '" title="' . $langs->trans("Setup") . '">' . img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"') . '</a>';
|
|
| 724 | + $urltouse = '?controller='.$regs[2].'/admin&method='.$regs[1]; |
|
| 725 | + print '<a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a>';
|
|
| 726 | 726 | } else {
|
| 727 | 727 | //$urltouse=$urlpage; |
| 728 | - $urltouse = '?controller=' . $urlpage . '&method=admin'; |
|
| 729 | - print '<a href="' . $urltouse . (preg_match('/\?/', $urltouse) ? '&' : '?') . 'save_lastsearch_values=1&backtopage=' . urlencode($backtourl) . '" title="' . $langs->trans("Setup") . '">' . img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"') . '</a>';
|
|
| 728 | + $urltouse = '?controller='.$urlpage.'&method=admin'; |
|
| 729 | + print '<a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a>';
|
|
| 730 | 730 | } |
| 731 | 731 | } |
| 732 | 732 | } |
| 733 | 733 | print "</td>\n"; |
| 734 | 734 | } else if (preg_match('/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) {
|
| 735 | 735 | //print '<td class="tdsetuppicto right valignmiddle" width="60px"><a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a></td>';
|
| 736 | - print '<td class="tdsetuppicto right valignmiddle" width="60px"><a href="?controller=' . $regs[2] . '/admin&method=' . $regs[1] . '&save_lastsearch_values=1&backtopage=' . urlencode($backtourl) . '" title="' . $langs->trans("Setup") . '">' . img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"') . '</a></td>';
|
|
| 736 | + print '<td class="tdsetuppicto right valignmiddle" width="60px"><a href="?controller='.$regs[2].'/admin&method='.$regs[1].'&save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a></td>';
|
|
| 737 | 737 | } else {
|
| 738 | 738 | //print '<td class="tdsetuppicto right valignmiddle" width="60px"><a href="'.$objMod->config_page_url.'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a></td>';
|
| 739 | - print '<td class="tdsetuppicto right valignmiddle" width="60px"><a href="?controller=' . $objMod->config_page_url . '&method=admin&save_lastsearch_values=1&backtopage=' . urlencode($backtourl) . '" title="' . $langs->trans("Setup") . '">' . img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"') . '</a></td>';
|
|
| 739 | + print '<td class="tdsetuppicto right valignmiddle" width="60px"><a href="?controller='.$objMod->config_page_url.'&method=admin&save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a></td>';
|
|
| 740 | 740 | } |
| 741 | 741 | } else {
|
| 742 | - print '<td class="tdsetuppicto right valignmiddle" width="60px">' . img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"') . '</td>';
|
|
| 742 | + print '<td class="tdsetuppicto right valignmiddle" width="60px">'.img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"').'</td>';
|
|
| 743 | 743 | } |
| 744 | 744 | } else { // Module not yet activated
|
| 745 | 745 | // Link enable/disable |
@@ -752,34 +752,34 @@ discard block |
||
| 752 | 752 | // Module qualified for activation |
| 753 | 753 | $warningmessage = ''; |
| 754 | 754 | if (!empty($arrayofwarnings[$modName])) {
|
| 755 | - print '<!-- This module has a warning to show when we activate it (note: your country is ' . $mysoc->country_code . ') -->' . "\n"; |
|
| 755 | + print '<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n"; |
|
| 756 | 756 | foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) {
|
| 757 | - $warningmessage .= ($warningmessage ? "\n" : "") . $langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code); |
|
| 757 | + $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code); |
|
| 758 | 758 | } |
| 759 | 759 | } |
| 760 | 760 | if ($objMod->isCoreOrExternalModule() == 'external' && !empty($arrayofwarningsext)) {
|
| 761 | - print '<!-- This module is an external module and it may have a warning to show (note: your country is ' . $mysoc->country_code . ') -->' . "\n"; |
|
| 761 | + print '<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.') -->'."\n"; |
|
| 762 | 762 | foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) {
|
| 763 | 763 | $keymodulelowercase = strtolower(preg_replace('/^mod/', '', $keymodule));
|
| 764 | 764 | if (in_array($keymodulelowercase, $conf->modules)) { // If module that request warning is on
|
| 765 | 765 | foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) {
|
| 766 | - if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^' . $mysoc->country_code . '/', $keycountry))) {
|
|
| 767 | - $warningmessage .= ($warningmessage ? "\n" : "") . $langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName()); |
|
| 768 | - $warningmessage .= ($warningmessage ? "\n" : "") . ($warningmessage ? "\n" : "") . $langs->trans("Module") . ' : ' . $objMod->getName();
|
|
| 766 | + if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) {
|
|
| 767 | + $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName()); |
|
| 768 | + $warningmessage .= ($warningmessage ? "\n" : "").($warningmessage ? "\n" : "").$langs->trans("Module").' : '.$objMod->getName();
|
|
| 769 | 769 | if (!empty($objMod->editor_name)) |
| 770 | - $warningmessage .= ($warningmessage ? "\n" : "") . $langs->trans("Publisher") . ' : ' . $objMod->editor_name;
|
|
| 770 | + $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("Publisher").' : '.$objMod->editor_name;
|
|
| 771 | 771 | if (!empty($objMod->editor_name)) |
| 772 | - $warningmessage .= ($warningmessage ? "\n" : "") . $langs->trans("ModuleTriggeringThisWarning") . ' : ' . $modules[$keymodule]->getName();
|
|
| 772 | + $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("ModuleTriggeringThisWarning").' : '.$modules[$keymodule]->getName();
|
|
| 773 | 773 | } |
| 774 | 774 | } |
| 775 | 775 | } |
| 776 | 776 | } |
| 777 | 777 | } |
| 778 | - print '<!-- Message to show: ' . $warningmessage . ' -->' . "\n"; |
|
| 778 | + print '<!-- Message to show: '.$warningmessage.' -->'."\n"; |
|
| 779 | 779 | //print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&module_position='.$module_position.'&action=set&value=' . $modName . '&mode=' . $mode . $param . '"'; |
| 780 | - print '<a class="reposition" href="?controller=admin&method=modules&id=' . $objMod->numero . '&module_position=' . $module_position . '&action=set&value=' . $modName . '&mode=' . $mode . $param . '"'; |
|
| 780 | + print '<a class="reposition" href="?controller=admin&method=modules&id='.$objMod->numero.'&module_position='.$module_position.'&action=set&value='.$modName.'&mode='.$mode.$param.'"'; |
|
| 781 | 781 | if ($warningmessage) |
| 782 | - print ' onclick="return confirm(\'' . dol_escape_js($warningmessage) . '\');"'; |
|
| 782 | + print ' onclick="return confirm(\''.dol_escape_js($warningmessage).'\');"'; |
|
| 783 | 783 | print '>'; |
| 784 | 784 | print img_picto($langs->trans("Disabled"), 'switch_off');
|
| 785 | 785 | print "</a>\n"; |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | print "</td>\n"; |
| 788 | 788 | |
| 789 | 789 | // Link config |
| 790 | - print '<td class="tdsetuppicto right valignmiddle" width="60px">' . img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"') . '</td>';
|
|
| 790 | + print '<td class="tdsetuppicto right valignmiddle" width="60px">'.img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"').'</td>';
|
|
| 791 | 791 | } |
| 792 | 792 | |
| 793 | 793 | print "</tr>\n"; |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | print '<br>'; |
| 804 | 804 | |
| 805 | 805 | // Show warning about external users |
| 806 | - print info_admin(showModulesExludedForExternal($modules)) . "\n"; |
|
| 806 | + print info_admin(showModulesExludedForExternal($modules))."\n"; |
|
| 807 | 807 | |
| 808 | 808 | print '</form>'; |
| 809 | 809 | } |
@@ -815,16 +815,16 @@ discard block |
||
| 815 | 815 | print "<table summary=\"list_of_modules\" class=\"noborder\" width=\"100%\">\n"; |
| 816 | 816 | print "<tr class=\"liste_titre\">\n"; |
| 817 | 817 | //print '<td>'.$langs->trans("Logo").'</td>';
|
| 818 | - print '<td colspan="2">' . $langs->trans("WebSiteDesc") . '</td>';
|
|
| 819 | - print '<td>' . $langs->trans("URL") . '</td>';
|
|
| 818 | + print '<td colspan="2">'.$langs->trans("WebSiteDesc").'</td>';
|
|
| 819 | + print '<td>'.$langs->trans("URL").'</td>';
|
|
| 820 | 820 | print '</tr>'; |
| 821 | 821 | |
| 822 | 822 | print "<tr class=\"oddeven\">\n"; |
| 823 | 823 | $url = 'https://www.dolistore.com'; |
| 824 | 824 | // print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolistore_logo.png"></a></td>'; |
| 825 | - print '<td align="left"><a href="' . $url . '" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="' . DOL_BASE_URI . '/theme/dolistore_logo.png"></a></td>'; |
|
| 826 | - print '<td>' . $langs->trans("DoliStoreDesc") . '</td>';
|
|
| 827 | - print '<td><a href="' . $url . '" target="_blank" rel="external">' . $url . '</a></td>'; |
|
| 825 | + print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_BASE_URI.'/theme/dolistore_logo.png"></a></td>'; |
|
| 826 | + print '<td>'.$langs->trans("DoliStoreDesc").'</td>';
|
|
| 827 | + print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>'; |
|
| 828 | 828 | print '</tr>'; |
| 829 | 829 | |
| 830 | 830 | print "</table>\n"; |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | //var_dump($options); |
| 839 | 839 | $dolistore->getRemoteData($options); |
| 840 | 840 | |
| 841 | - print '<span class="opacitymedium">' . $langs->trans('DOLISTOREdescriptionLong') . '</span><br><br>';
|
|
| 841 | + print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
|
|
| 842 | 842 | |
| 843 | 843 | $previouslink = $dolistore->get_previous_link(); |
| 844 | 844 | $nextlink = $dolistore->get_next_link(); |
@@ -898,14 +898,14 @@ discard block |
||
| 898 | 898 | $dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT);
|
| 899 | 899 | $allowonlineinstall = true; |
| 900 | 900 | $allowfromweb = 1; |
| 901 | - if (dol_is_file($dolibarrdataroot . '/installmodules.lock')) |
|
| 901 | + if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) |
|
| 902 | 902 | $allowonlineinstall = false; |
| 903 | 903 | |
| 904 | - $fullurl = '<a href="' . $urldolibarrmodules . '" target="_blank">' . $urldolibarrmodules . '</a>'; |
|
| 904 | + $fullurl = '<a href="'.$urldolibarrmodules.'" target="_blank">'.$urldolibarrmodules.'</a>'; |
|
| 905 | 905 | $message = ''; |
| 906 | 906 | if (!empty($allowonlineinstall)) {
|
| 907 | 907 | if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) {
|
| 908 | - $message = info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT . '/custom', DOL_DOCUMENT_ROOT));
|
|
| 908 | + $message = info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
|
|
| 909 | 909 | $allowfromweb = -1; |
| 910 | 910 | } else {
|
| 911 | 911 | if ($dirins_ok) {
|
@@ -915,12 +915,12 @@ discard block |
||
| 915 | 915 | $allowfromweb = 0; |
| 916 | 916 | } |
| 917 | 917 | } else {
|
| 918 | - $message = info_admin($langs->trans("NotExistsDirect", $dirins) . $langs->trans("InfDirAlt") . $langs->trans("InfDirExample"));
|
|
| 918 | + $message = info_admin($langs->trans("NotExistsDirect", $dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
|
|
| 919 | 919 | $allowfromweb = 0; |
| 920 | 920 | } |
| 921 | 921 | } |
| 922 | 922 | } else {
|
| 923 | - $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot . '/installmodules.lock'));
|
|
| 923 | + $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.'/installmodules.lock'));
|
|
| 924 | 924 | $allowfromweb = 0; |
| 925 | 925 | } |
| 926 | 926 | |
@@ -937,26 +937,26 @@ discard block |
||
| 937 | 937 | if ($allowfromweb == 1) {
|
| 938 | 938 | //print $langs->trans("ThisIsProcessToFollow").'<br>';
|
| 939 | 939 | } else {
|
| 940 | - print $langs->trans("ThisIsAlternativeProcessToFollow") . '<br>';
|
|
| 941 | - print '<b>' . $langs->trans("StepNb", 1) . '</b>: ';
|
|
| 942 | - print $langs->trans("FindPackageFromWebSite", $fullurl) . '<br>';
|
|
| 943 | - print '<b>' . $langs->trans("StepNb", 2) . '</b>: ';
|
|
| 944 | - print $langs->trans("DownloadPackageFromWebSite", $fullurl) . '<br>';
|
|
| 945 | - print '<b>' . $langs->trans("StepNb", 3) . '</b>: ';
|
|
| 940 | + print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
|
|
| 941 | + print '<b>'.$langs->trans("StepNb", 1).'</b>: ';
|
|
| 942 | + print $langs->trans("FindPackageFromWebSite", $fullurl).'<br>';
|
|
| 943 | + print '<b>'.$langs->trans("StepNb", 2).'</b>: ';
|
|
| 944 | + print $langs->trans("DownloadPackageFromWebSite", $fullurl).'<br>';
|
|
| 945 | + print '<b>'.$langs->trans("StepNb", 3).'</b>: ';
|
|
| 946 | 946 | } |
| 947 | 947 | |
| 948 | 948 | if ($allowfromweb == 1) {
|
| 949 | - print $langs->trans("UnpackPackageInModulesRoot", $dirins) . '<br>';
|
|
| 949 | + print $langs->trans("UnpackPackageInModulesRoot", $dirins).'<br>';
|
|
| 950 | 950 | |
| 951 | 951 | print '<br>'; |
| 952 | 952 | |
| 953 | - print '<form enctype="multipart/form-data" method="POST" class="noborder" action="' . $_SERVER["PHP_SELF"] . '" name="forminstall">'; |
|
| 953 | + print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">'; |
|
| 954 | 954 | print '<input type="hidden" name="action" value="install">'; |
| 955 | 955 | print '<input type="hidden" name="mode" value="deploy">'; |
| 956 | 956 | |
| 957 | 957 | print $langs->trans("YouCanSubmitFile");
|
| 958 | 958 | |
| 959 | - $max = $conf->global->MAIN_UPLOAD_DOC; // En Kb |
|
| 959 | + $max = $conf->global->MAIN_UPLOAD_DOC; // En Kb |
|
| 960 | 960 | $maxphp = @ini_get('upload_max_filesize'); // En inconnu
|
| 961 | 961 | if (preg_match('/k$/i', $maxphp))
|
| 962 | 962 | $maxphp = $maxphp * 1; |
@@ -975,20 +975,20 @@ discard block |
||
| 975 | 975 | print '<script type="text/javascript"> |
| 976 | 976 | $(document).ready(function() {
|
| 977 | 977 | jQuery("#fileinstall").on("change", function() {
|
| 978 | - if(this.files[0].size > ' . ($maxmin * 1024) . '){
|
|
| 979 | - alert("' . dol_escape_js($langs->trans("ErrorFileSizeTooLarge")) . '");
|
|
| 978 | + if(this.files[0].size > ' . ($maxmin * 1024).'){
|
|
| 979 | + alert("' . dol_escape_js($langs->trans("ErrorFileSizeTooLarge")).'");
|
|
| 980 | 980 | this.value = ""; |
| 981 | 981 | }; |
| 982 | 982 | }); |
| 983 | 983 | }); |
| 984 | 984 | </script>' . "\n"; |
| 985 | 985 | // MAX_FILE_SIZE doit précéder le champ input de type file |
| 986 | - print '<input type="hidden" name="max_file_size" value="' . ($maxmin * 1024) . '">'; |
|
| 986 | + print '<input type="hidden" name="max_file_size" value="'.($maxmin * 1024).'">'; |
|
| 987 | 987 | } |
| 988 | 988 | |
| 989 | 989 | print '<input class="flat minwidth400" type="file" name="fileinstall" id="fileinstall"> '; |
| 990 | 990 | |
| 991 | - print '<input type="submit" name="send" value="' . dol_escape_htmltag($langs->trans("Send")) . '" class="button">';
|
|
| 991 | + print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
|
|
| 992 | 992 | |
| 993 | 993 | print '</form>'; |
| 994 | 994 | |
@@ -997,9 +997,9 @@ discard block |
||
| 997 | 997 | |
| 998 | 998 | print '<div class="center"><div class="logo_setup"></div></div>'; |
| 999 | 999 | } else {
|
| 1000 | - print $langs->trans("UnpackPackageInModulesRoot", $dirins) . '<br>';
|
|
| 1001 | - print '<b>' . $langs->trans("StepNb", 4) . '</b>: ';
|
|
| 1002 | - print $langs->trans("SetupIsReadyForUse") . '<br>';
|
|
| 1000 | + print $langs->trans("UnpackPackageInModulesRoot", $dirins).'<br>';
|
|
| 1001 | + print '<b>'.$langs->trans("StepNb", 4).'</b>: ';
|
|
| 1002 | + print $langs->trans("SetupIsReadyForUse").'<br>';
|
|
| 1003 | 1003 | } |
| 1004 | 1004 | } |
| 1005 | 1005 | |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | print '<br>'; |
| 1008 | 1008 | |
| 1009 | 1009 | foreach ($result['return'] as $value) {
|
| 1010 | - echo $value . '<br>'; |
|
| 1010 | + echo $value.'<br>'; |
|
| 1011 | 1011 | } |
| 1012 | 1012 | } |
| 1013 | 1013 | |
@@ -1021,28 +1021,28 @@ discard block |
||
| 1021 | 1021 | print "<table summary=\"list_of_modules\" class=\"noborder\" width=\"100%\">\n"; |
| 1022 | 1022 | print "<tr class=\"liste_titre\">\n"; |
| 1023 | 1023 | //print '<td>'.$langs->trans("Logo").'</td>';
|
| 1024 | - print '<td colspan="2">' . $langs->trans("DevelopYourModuleDesc") . '</td>';
|
|
| 1025 | - print '<td>' . $langs->trans("URL") . '</td>';
|
|
| 1024 | + print '<td colspan="2">'.$langs->trans("DevelopYourModuleDesc").'</td>';
|
|
| 1025 | + print '<td>'.$langs->trans("URL").'</td>';
|
|
| 1026 | 1026 | print '</tr>'; |
| 1027 | 1027 | |
| 1028 | - print '<tr class="oddeven" height="80">' . "\n"; |
|
| 1028 | + print '<tr class="oddeven" height="80">'."\n"; |
|
| 1029 | 1029 | print '<td align="left">'; |
| 1030 | 1030 | //span class="fa fa-bug"></span> |
| 1031 | 1031 | //print '<img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png">'; |
| 1032 | 1032 | print '<div class="imgmaxheight50 logo_setup"></div>'; |
| 1033 | 1033 | print '</td>'; |
| 1034 | - print '<td>' . $langs->trans("TryToUseTheModuleBuilder", $langs->transnoentitiesnoconv("ModuleBuilder")) . '</td>';
|
|
| 1035 | - print '<td>' . $langs->trans("SeeTopRightMenu") . '</td>';
|
|
| 1034 | + print '<td>'.$langs->trans("TryToUseTheModuleBuilder", $langs->transnoentitiesnoconv("ModuleBuilder")).'</td>';
|
|
| 1035 | + print '<td>'.$langs->trans("SeeTopRightMenu").'</td>';
|
|
| 1036 | 1036 | print '</tr>'; |
| 1037 | 1037 | |
| 1038 | - print '<tr class="oddeven" height="80">' . "\n"; |
|
| 1038 | + print '<tr class="oddeven" height="80">'."\n"; |
|
| 1039 | 1039 | $url = 'https://partners.dolibarr.org'; |
| 1040 | 1040 | print '<td align="left">'; |
| 1041 | 1041 | //print'<a href="' . $url . '" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="' . DOL_URL_ROOT . '/theme/dolibarr_preferred_partner_int.png"></a>'; |
| 1042 | - print'<a href="' . $url . '" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="' . DOL_BASE_URI . '/theme/dolibarr_preferred_partner_int.png"></a>'; |
|
| 1042 | + print'<a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_BASE_URI.'/theme/dolibarr_preferred_partner_int.png"></a>'; |
|
| 1043 | 1043 | print '</td>'; |
| 1044 | - print '<td>' . $langs->trans("DoliPartnersDesc") . '</td>';
|
|
| 1045 | - print '<td><a href="' . $url . '" target="_blank" rel="external">' . $url . '</a></td>'; |
|
| 1044 | + print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
|
|
| 1045 | + print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>'; |
|
| 1046 | 1046 | print '</tr>'; |
| 1047 | 1047 | |
| 1048 | 1048 | print "</table>\n"; |
@@ -42,8 +42,9 @@ discard block |
||
| 42 | 42 | $langs->loadLangs(array("errors", "admin", "modulebuilder"));
|
| 43 | 43 | |
| 44 | 44 | $mode = GETPOST('mode', 'alpha');
|
| 45 | -if (empty($mode)) |
|
| 46 | - $mode = 'common'; |
|
| 45 | +if (empty($mode)) { |
|
| 46 | + $mode = 'common'; |
|
| 47 | +} |
|
| 47 | 48 | $action = GETPOST('action', 'alpha');
|
| 48 | 49 | //var_dump($_POST);exit; |
| 49 | 50 | $value = GETPOST('value', 'alpha');
|
@@ -64,8 +65,9 @@ discard block |
||
| 64 | 65 | $dolistore = new Dolistore(false); |
| 65 | 66 | |
| 66 | 67 | |
| 67 | -if (!$user->admin) |
|
| 68 | - accessforbidden(); |
|
| 68 | +if (!$user->admin) { |
|
| 69 | + accessforbidden(); |
|
| 70 | +} |
|
| 69 | 71 | |
| 70 | 72 | $specialtostring = array(0 => 'common', 1 => 'interfaces', 2 => 'other', 3 => 'functional', 4 => 'marketplace'); |
| 71 | 73 | |
@@ -86,15 +88,19 @@ discard block |
||
| 86 | 88 | |
| 87 | 89 | $param = ''; |
| 88 | 90 | if (!GETPOST('buttonreset', 'alpha')) {
|
| 89 | - if ($search_keyword) |
|
| 90 | - $param .= '&search_keyword=' . urlencode($search_keyword); |
|
| 91 | - if ($search_status && $search_status != '-1') |
|
| 92 | - $param .= '&search_status=' . urlencode($search_status); |
|
| 93 | - if ($search_nature && $search_nature != '-1') |
|
| 94 | - $param .= '&search_nature=' . urlencode($search_nature); |
|
| 95 | - if ($search_version && $search_version != '-1') |
|
| 96 | - $param .= '&search_version=' . urlencode($search_version); |
|
| 97 | -} |
|
| 91 | + if ($search_keyword) { |
|
| 92 | + $param .= '&search_keyword=' . urlencode($search_keyword); |
|
| 93 | + } |
|
| 94 | + if ($search_status && $search_status != '-1') { |
|
| 95 | + $param .= '&search_status=' . urlencode($search_status); |
|
| 96 | + } |
|
| 97 | + if ($search_nature && $search_nature != '-1') { |
|
| 98 | + $param .= '&search_nature=' . urlencode($search_nature); |
|
| 99 | + } |
|
| 100 | + if ($search_version && $search_version != '-1') { |
|
| 101 | + $param .= '&search_version=' . urlencode($search_version); |
|
| 102 | + } |
|
| 103 | + } |
|
| 98 | 104 | |
| 99 | 105 | $dirins = DOL_DOCUMENT_ROOT . '/custom'; |
| 100 | 106 | $urldolibarrmodules = 'https://www.dolistore.com/'; |
@@ -111,8 +117,9 @@ discard block |
||
| 111 | 117 | |
| 112 | 118 | $parameters = array(); |
| 113 | 119 | $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
| 114 | -if ($reshook < 0) |
|
| 115 | - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 120 | +if ($reshook < 0) { |
|
| 121 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 122 | +} |
|
| 116 | 123 | |
| 117 | 124 | if (GETPOST('buttonreset', 'alpha')) {
|
| 118 | 125 | $search_keyword = ''; |
@@ -206,9 +213,9 @@ discard block |
||
| 206 | 213 | |
| 207 | 214 | if ($action == 'set' && $user->admin) {
|
| 208 | 215 | $resarray = activateModule($value); |
| 209 | - if (!empty($resarray['errors'])) |
|
| 210 | - setEventMessages('', $resarray['errors'], 'errors');
|
|
| 211 | - else {
|
|
| 216 | + if (!empty($resarray['errors'])) { |
|
| 217 | + setEventMessages('', $resarray['errors'], 'errors'); |
|
| 218 | + } else {
|
|
| 212 | 219 | //var_dump($resarray);exit; |
| 213 | 220 | if ($resarray['nbperms'] > 0) {
|
| 214 | 221 | $tmpsql = "SELECT COUNT(rowid) as nb FROM " . MAIN_DB_PREFIX . "user WHERE admin <> 1"; |
@@ -220,15 +227,15 @@ discard block |
||
| 220 | 227 | $msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
|
| 221 | 228 | setEventMessages($msg, null, 'warnings'); |
| 222 | 229 | } |
| 223 | - } else |
|
| 224 | - dol_print_error($db); |
|
| 230 | + } else { |
|
| 231 | + dol_print_error($db); |
|
| 232 | + } |
|
| 225 | 233 | } |
| 226 | 234 | } |
| 227 | 235 | //header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
|
| 228 | 236 | header("Location: ?controller=admin&method=modules&mode=" . $mode . $param . ($page_y ? '&page_y=' . $page_y : ''));
|
| 229 | 237 | exit; |
| 230 | -} |
|
| 231 | -else if ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes') {
|
|
| 238 | +} else if ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes') {
|
|
| 232 | 239 | $result = unActivateModule($value); |
| 233 | 240 | if ($result) {
|
| 234 | 241 | setEventMessages($result, null, 'errors'); |
@@ -308,16 +315,20 @@ discard block |
||
| 308 | 315 | |
| 309 | 316 | // We discard modules according to features level (PS: if module is activated we always show it) |
| 310 | 317 | $const_name = 'MAIN_MODULE_' . strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
|
| 311 | - if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) |
|
| 312 | - $modulequalified = 0; |
|
| 313 | - if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) |
|
| 314 | - $modulequalified = 0; |
|
| 315 | - if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0)))
|
|
| 316 | - $modulequalified = 0; |
|
| 318 | + if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) { |
|
| 319 | + $modulequalified = 0; |
|
| 320 | + } |
|
| 321 | + if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) { |
|
| 322 | + $modulequalified = 0; |
|
| 323 | + } |
|
| 324 | + if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) { |
|
| 325 | + $modulequalified = 0; |
|
| 326 | + } |
|
| 317 | 327 | |
| 318 | 328 | // We discard modules according to property ->hidden |
| 319 | - if (!empty($objMod->hidden)) |
|
| 320 | - $modulequalified = 0; |
|
| 329 | + if (!empty($objMod->hidden)) { |
|
| 330 | + $modulequalified = 0; |
|
| 331 | + } |
|
| 321 | 332 | |
| 322 | 333 | if ($modulequalified > 0) {
|
| 323 | 334 | $publisher = dol_escape_htmltag($objMod->getPublisher()); |
@@ -363,16 +374,21 @@ discard block |
||
| 363 | 374 | //print $i.'-'.$dirmod[$i].'<br>'; |
| 364 | 375 | // Set categ[$i] |
| 365 | 376 | $specialstring = 'unknown'; |
| 366 | - if ($objMod->version == 'development' || $objMod->version == 'experimental') |
|
| 367 | - $specialstring = 'expdev'; |
|
| 368 | - if (isset($categ[$specialstring])) |
|
| 369 | - $categ[$specialstring] ++; // Array of all different modules categories |
|
| 370 | - else |
|
| 371 | - $categ[$specialstring] = 1; |
|
| 377 | + if ($objMod->version == 'development' || $objMod->version == 'experimental') { |
|
| 378 | + $specialstring = 'expdev'; |
|
| 379 | + } |
|
| 380 | + if (isset($categ[$specialstring])) { |
|
| 381 | + $categ[$specialstring] ++; |
|
| 382 | + } |
|
| 383 | + // Array of all different modules categories |
|
| 384 | + else { |
|
| 385 | + $categ[$specialstring] = 1; |
|
| 386 | + } |
|
| 372 | 387 | $j++; |
| 373 | 388 | $i++; |
| 374 | - } else |
|
| 375 | - dol_syslog("Module " . get_class($objMod) . " not qualified");
|
|
| 389 | + } else { |
|
| 390 | + dol_syslog("Module " . get_class($objMod) . " not qualified"); |
|
| 391 | + } |
|
| 376 | 392 | } catch (Exception $e) {
|
| 377 | 393 | dol_syslog("Failed to load " . $dir . $file . " " . $e->getMessage(), LOG_ERR);
|
| 378 | 394 | } |
@@ -395,8 +411,9 @@ discard block |
||
| 395 | 411 | if (!empty($modules[$value])) {
|
| 396 | 412 | $objMod = $modules[$value]; |
| 397 | 413 | |
| 398 | - if (!empty($objMod->langfiles)) |
|
| 399 | - $langs->loadLangs($objMod->langfiles); |
|
| 414 | + if (!empty($objMod->langfiles)) { |
|
| 415 | + $langs->loadLangs($objMod->langfiles); |
|
| 416 | + } |
|
| 400 | 417 | |
| 401 | 418 | $form = new Form($db); |
| 402 | 419 | $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?value=' . $value . '&mode=' . $mode . $param, $langs->trans('ConfirmUnactivation'), $langs->trans(GETPOST('confirm_message_code')), 'reset', '', 'no', 1);
|
@@ -412,19 +429,24 @@ discard block |
||
| 412 | 429 | |
| 413 | 430 | $nbofactivatedmodules = count($conf->modules); |
| 414 | 431 | $moreinfo = $langs->trans("TotalNumberOfActivatedModules", ($nbofactivatedmodules - 1), count($modules));
|
| 415 | -if ($nbofactivatedmodules <= 1) |
|
| 416 | - $moreinfo .= ' ' . img_warning($langs->trans("YouMustEnableOneModule"));
|
|
| 432 | +if ($nbofactivatedmodules <= 1) { |
|
| 433 | + $moreinfo .= ' ' . img_warning($langs->trans("YouMustEnableOneModule")); |
|
| 434 | +} |
|
| 417 | 435 | print load_fiche_titre($langs->trans("ModulesSetup"), $moreinfo, 'title_setup');
|
| 418 | 436 | |
| 419 | 437 | // Start to show page |
| 420 | -if ($mode == 'common') |
|
| 421 | - print '<span class="opacitymedium">' . $langs->trans("ModulesDesc") . "</span><br>\n";
|
|
| 422 | -if ($mode == 'marketplace') |
|
| 423 | - print '<span class="opacitymedium">' . $langs->trans("ModulesMarketPlaceDesc") . "</span><br>\n";
|
|
| 424 | -if ($mode == 'deploy') |
|
| 425 | - print '<span class="opacitymedium">' . $langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules")) . "</span><br>\n";
|
|
| 426 | -if ($mode == 'develop') |
|
| 427 | - print '<span class="opacitymedium">' . $langs->trans("ModulesDevelopDesc") . "</span><br>\n";
|
|
| 438 | +if ($mode == 'common') { |
|
| 439 | + print '<span class="opacitymedium">' . $langs->trans("ModulesDesc") . "</span><br>\n"; |
|
| 440 | +} |
|
| 441 | +if ($mode == 'marketplace') { |
|
| 442 | + print '<span class="opacitymedium">' . $langs->trans("ModulesMarketPlaceDesc") . "</span><br>\n"; |
|
| 443 | +} |
|
| 444 | +if ($mode == 'deploy') { |
|
| 445 | + print '<span class="opacitymedium">' . $langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules")) . "</span><br>\n"; |
|
| 446 | +} |
|
| 447 | +if ($mode == 'develop') { |
|
| 448 | + print '<span class="opacitymedium">' . $langs->trans("ModulesDevelopDesc") . "</span><br>\n"; |
|
| 449 | +} |
|
| 428 | 450 | |
| 429 | 451 | $head = modules_prepare_head(); |
| 430 | 452 | |
@@ -436,8 +458,9 @@ discard block |
||
| 436 | 458 | dol_set_focus('#search_keyword');
|
| 437 | 459 | |
| 438 | 460 | print '<form method="POST" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">'; |
| 439 | - if ($optioncss != '') |
|
| 440 | - print '<input type="hidden" name="optioncss" value="' . $optioncss . '">'; |
|
| 461 | + if ($optioncss != '') { |
|
| 462 | + print '<input type="hidden" name="optioncss" value="' . $optioncss . '">'; |
|
| 463 | + } |
|
| 441 | 464 | print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
| 442 | 465 | print '<input type="hidden" name="sortfield" value="' . $sortfield . '">'; |
| 443 | 466 | print '<input type="hidden" name="sortorder" value="' . $sortorder . '">'; |
@@ -454,12 +477,15 @@ discard block |
||
| 454 | 477 | $moreforfilter .= '</div>'; |
| 455 | 478 | if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
|
| 456 | 479 | $array_version = array('stable' => $langs->transnoentitiesnoconv("Stable"));
|
| 457 | - if ($conf->global->MAIN_FEATURES_LEVEL < 0) |
|
| 458 | - $array_version['deprecated'] = $langs->trans("Deprecated");
|
|
| 459 | - if ($conf->global->MAIN_FEATURES_LEVEL > 0) |
|
| 460 | - $array_version['experimental'] = $langs->trans("Experimental");
|
|
| 461 | - if ($conf->global->MAIN_FEATURES_LEVEL > 1) |
|
| 462 | - $array_version['development'] = $langs->trans("Development");
|
|
| 480 | + if ($conf->global->MAIN_FEATURES_LEVEL < 0) { |
|
| 481 | + $array_version['deprecated'] = $langs->trans("Deprecated"); |
|
| 482 | + } |
|
| 483 | + if ($conf->global->MAIN_FEATURES_LEVEL > 0) { |
|
| 484 | + $array_version['experimental'] = $langs->trans("Experimental"); |
|
| 485 | + } |
|
| 486 | + if ($conf->global->MAIN_FEATURES_LEVEL > 1) { |
|
| 487 | + $array_version['development'] = $langs->trans("Development"); |
|
| 488 | + } |
|
| 463 | 489 | $moreforfilter .= '<div class="divsearchfield">'; |
| 464 | 490 | $moreforfilter .= $langs->trans('Version') . ': ' . $form->selectarray('search_version', $array_version, $search_version, 1);
|
| 465 | 491 | $moreforfilter .= '</div>'; |
@@ -487,8 +513,9 @@ discard block |
||
| 487 | 513 | |
| 488 | 514 | $parameters = array(); |
| 489 | 515 | $reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
| 490 | - if ($reshook < 0) |
|
| 491 | - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 516 | + if ($reshook < 0) { |
|
| 517 | + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); |
|
| 518 | + } |
|
| 492 | 519 | |
| 493 | 520 | // Show list of modules |
| 494 | 521 | |
@@ -507,8 +534,10 @@ discard block |
||
| 507 | 534 | |
| 508 | 535 | //print $objMod->name." - ".$key." - ".$objMod->version."<br>"; |
| 509 | 536 | //if (($mode != (isset($specialtostring[$special])?$specialtostring[$special]:'unknown') && $mode != 'expdev') |
| 510 | - if ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental') |
|
| 511 | - continue; // Discard if not for current tab |
|
| 537 | + if ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental') { |
|
| 538 | + continue; |
|
| 539 | + } |
|
| 540 | + // Discard if not for current tab |
|
| 512 | 541 | |
| 513 | 542 | if (!$objMod->getName()) {
|
| 514 | 543 | dol_syslog("Error for module " . $key . " - Property name of module looks empty", LOG_WARNING);
|
@@ -528,40 +557,52 @@ discard block |
||
| 528 | 557 | if ($search_keyword) {
|
| 529 | 558 | $qualified = 0; |
| 530 | 559 | if (preg_match('/' . preg_quote($search_keyword) . '/i', $modulename) || preg_match('/' . preg_quote($search_keyword) . '/i', $moduletechnicalname) || preg_match('/' . preg_quote($search_keyword) . '/i', $moduledesc) || preg_match('/' . preg_quote($search_keyword) . '/i', $moduledesclong) || preg_match('/' . preg_quote($search_keyword) . '/i', $moduleauthor)
|
| 531 | - ) |
|
| 532 | - $qualified = 1; |
|
| 533 | - if (!$qualified) |
|
| 534 | - continue; |
|
| 560 | + ) { |
|
| 561 | + $qualified = 1; |
|
| 562 | + } |
|
| 563 | + if (!$qualified) { |
|
| 564 | + continue; |
|
| 565 | + } |
|
| 535 | 566 | } |
| 536 | 567 | if ($search_status) {
|
| 537 | - if ($search_status == 'active' && empty($conf->global->$const_name)) |
|
| 538 | - continue; |
|
| 539 | - if ($search_status == 'disabled' && !empty($conf->global->$const_name)) |
|
| 540 | - continue; |
|
| 568 | + if ($search_status == 'active' && empty($conf->global->$const_name)) { |
|
| 569 | + continue; |
|
| 570 | + } |
|
| 571 | + if ($search_status == 'disabled' && !empty($conf->global->$const_name)) { |
|
| 572 | + continue; |
|
| 573 | + } |
|
| 541 | 574 | } |
| 542 | 575 | if ($search_nature) {
|
| 543 | - if (preg_match('/^external/', $search_nature) && $objMod->isCoreOrExternalModule() != 'external')
|
|
| 544 | - continue; |
|
| 576 | + if (preg_match('/^external/', $search_nature) && $objMod->isCoreOrExternalModule() != 'external') { |
|
| 577 | + continue; |
|
| 578 | + } |
|
| 545 | 579 | if (preg_match('/^external_(.*)$/', $search_nature, $reg)) {
|
| 546 | 580 | //print $reg[1].'-'.dol_escape_htmltag($objMod->getPublisher()); |
| 547 | 581 | $publisher = dol_escape_htmltag($objMod->getPublisher()); |
| 548 | - if ($reg[1] && dol_escape_htmltag($reg[1]) != $publisher) |
|
| 549 | - continue; |
|
| 550 | - if (!$reg[1] && !empty($publisher)) |
|
| 551 | - continue; |
|
| 582 | + if ($reg[1] && dol_escape_htmltag($reg[1]) != $publisher) { |
|
| 583 | + continue; |
|
| 584 | + } |
|
| 585 | + if (!$reg[1] && !empty($publisher)) { |
|
| 586 | + continue; |
|
| 587 | + } |
|
| 552 | 588 | } |
| 553 | - if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') |
|
| 554 | - continue; |
|
| 589 | + if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') { |
|
| 590 | + continue; |
|
| 591 | + } |
|
| 555 | 592 | } |
| 556 | 593 | if ($search_version) {
|
| 557 | - if (($objMod->version == 'development' || $objMod->version == 'experimental' || preg_match('/deprecated/', $objMod->version)) && $search_version == 'stable')
|
|
| 558 | - continue; |
|
| 559 | - if ($objMod->version != 'development' && ($search_version == 'development')) |
|
| 560 | - continue; |
|
| 561 | - if ($objMod->version != 'experimental' && ($search_version == 'experimental')) |
|
| 562 | - continue; |
|
| 563 | - if (!preg_match('/deprecated/', $objMod->version) && ($search_version == 'deprecated'))
|
|
| 564 | - continue; |
|
| 594 | + if (($objMod->version == 'development' || $objMod->version == 'experimental' || preg_match('/deprecated/', $objMod->version)) && $search_version == 'stable') { |
|
| 595 | + continue; |
|
| 596 | + } |
|
| 597 | + if ($objMod->version != 'development' && ($search_version == 'development')) { |
|
| 598 | + continue; |
|
| 599 | + } |
|
| 600 | + if ($objMod->version != 'experimental' && ($search_version == 'experimental')) { |
|
| 601 | + continue; |
|
| 602 | + } |
|
| 603 | + if (!preg_match('/deprecated/', $objMod->version) && ($search_version == 'deprecated')) { |
|
| 604 | + continue; |
|
| 605 | + } |
|
| 565 | 606 | } |
| 566 | 607 | |
| 567 | 608 | // Load all lang files of module |
@@ -599,12 +640,15 @@ discard block |
||
| 599 | 640 | // Version (with picto warning or not) |
| 600 | 641 | $version = $objMod->getVersion(0); |
| 601 | 642 | $versiontrans = ''; |
| 602 | - if (preg_match('/development/i', $version))
|
|
| 603 | - $versiontrans .= img_warning($langs->trans("Development"), 'style="float: left"');
|
|
| 604 | - if (preg_match('/experimental/i', $version))
|
|
| 605 | - $versiontrans .= img_warning($langs->trans("Experimental"), 'style="float: left"');
|
|
| 606 | - if (preg_match('/deprecated/i', $version))
|
|
| 607 | - $versiontrans .= img_warning($langs->trans("Deprecated"), 'style="float: left"');
|
|
| 643 | + if (preg_match('/development/i', $version)) { |
|
| 644 | + $versiontrans .= img_warning($langs->trans("Development"), 'style="float: left"'); |
|
| 645 | + } |
|
| 646 | + if (preg_match('/experimental/i', $version)) { |
|
| 647 | + $versiontrans .= img_warning($langs->trans("Experimental"), 'style="float: left"'); |
|
| 648 | + } |
|
| 649 | + if (preg_match('/deprecated/i', $version)) { |
|
| 650 | + $versiontrans .= img_warning($langs->trans("Deprecated"), 'style="float: left"'); |
|
| 651 | + } |
|
| 608 | 652 | $versiontrans .= $objMod->getVersion(1); |
| 609 | 653 | |
| 610 | 654 | // Define imginfo |
@@ -614,8 +658,9 @@ discard block |
||
| 614 | 658 | } |
| 615 | 659 | |
| 616 | 660 | print '<tr class="oddeven">' . "\n"; |
| 617 | - if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) |
|
| 618 | - print '<td width="20px">' . ++$linenum . '</td>'; |
|
| 661 | + if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) { |
|
| 662 | + print '<td width="20px">' . ++$linenum . '</td>'; |
|
| 663 | + } |
|
| 619 | 664 | |
| 620 | 665 | // Picto + Name of module |
| 621 | 666 | print ' <td width="200px">'; |
@@ -623,12 +668,12 @@ discard block |
||
| 623 | 668 | //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
|
| 624 | 669 | //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
|
| 625 | 670 | if (!empty($objMod->picto)) {
|
| 626 | - if (preg_match('/^\//i', $objMod->picto))
|
|
| 627 | - print img_picto($alttext, $objMod->picto, ' width="14px"', 1); |
|
| 628 | - else |
|
| 629 | - print img_object($alttext, $objMod->picto, 'class="valignmiddle" width="14px"'); |
|
| 630 | - } |
|
| 631 | - else {
|
|
| 671 | + if (preg_match('/^\//i', $objMod->picto)) { |
|
| 672 | + print img_picto($alttext, $objMod->picto, ' width="14px"', 1); |
|
| 673 | + } else { |
|
| 674 | + print img_object($alttext, $objMod->picto, 'class="valignmiddle" width="14px"'); |
|
| 675 | + } |
|
| 676 | + } else {
|
|
| 632 | 677 | print img_object($alttext, 'generic', 'class="valignmiddle"'); |
| 633 | 678 | } |
| 634 | 679 | print ' <span class="valignmiddle">' . $objMod->getName() . '</span>'; |
@@ -673,16 +718,16 @@ discard block |
||
| 673 | 718 | if (!empty($objMod->disabled)) {
|
| 674 | 719 | print $langs->trans("Disabled");
|
| 675 | 720 | } else if (!empty($objMod->always_enabled) || ((!empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
|
| 676 | - if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) |
|
| 677 | - print $langs->trans("Used");
|
|
| 678 | - else {
|
|
| 721 | + if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) { |
|
| 722 | + print $langs->trans("Used"); |
|
| 723 | + } else {
|
|
| 679 | 724 | print img_picto($langs->trans("Required"), 'switch_on');
|
| 680 | 725 | print $langs->trans("Required");
|
| 681 | 726 | } |
| 682 | - if (!empty($conf->multicompany->enabled) && $user->entity) |
|
| 683 | - $disableSetup++; |
|
| 684 | - } |
|
| 685 | - else {
|
|
| 727 | + if (!empty($conf->multicompany->enabled) && $user->entity) { |
|
| 728 | + $disableSetup++; |
|
| 729 | + } |
|
| 730 | + } else {
|
|
| 686 | 731 | if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
|
| 687 | 732 | //print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&module_position='.$module_position.'&action=reset_confirm&confirm_message_code='.$objMod->warnings_unactivation[$mysoc->country_code].'&value=' . $modName . '&mode=' . $mode . $param . '">'; |
| 688 | 733 | print '<a class="reposition" href="?controller=admin&method=modules&id=' . $objMod->numero . '&module_position=' . $module_position . '&action=reset_confirm&confirm_message_code=' . $objMod->warnings_unactivation[$mysoc->country_code] . '&value=' . $modName . '&mode=' . $mode . $param . '">'; |
@@ -700,14 +745,19 @@ discard block |
||
| 700 | 745 | // Link config |
| 701 | 746 | if (!empty($objMod->config_page_url) && !$disableSetup) {
|
| 702 | 747 | $backtourlparam = ''; |
| 703 | - if ($search_keyword != '') |
|
| 704 | - $backtourlparam .= ($backtourlparam ? '&' : '?') . 'search_keyword=' . $search_keyword; // No urlencode here, done later |
|
| 705 | - if ($search_nature > -1) |
|
| 706 | - $backtourlparam .= ($backtourlparam ? '&' : '?') . 'search_nature=' . $search_nature; |
|
| 707 | - if ($search_version > -1) |
|
| 708 | - $backtourlparam .= ($backtourlparam ? '&' : '?') . 'search_version=' . $search_version; |
|
| 709 | - if ($search_status > -1) |
|
| 710 | - $backtourlparam .= ($backtourlparam ? '&' : '?') . 'search_status=' . $search_status; |
|
| 748 | + if ($search_keyword != '') { |
|
| 749 | + $backtourlparam .= ($backtourlparam ? '&' : '?') . 'search_keyword=' . $search_keyword; |
|
| 750 | + } |
|
| 751 | + // No urlencode here, done later |
|
| 752 | + if ($search_nature > -1) { |
|
| 753 | + $backtourlparam .= ($backtourlparam ? '&' : '?') . 'search_nature=' . $search_nature; |
|
| 754 | + } |
|
| 755 | + if ($search_version > -1) { |
|
| 756 | + $backtourlparam .= ($backtourlparam ? '&' : '?') . 'search_version=' . $search_version; |
|
| 757 | + } |
|
| 758 | + if ($search_status > -1) { |
|
| 759 | + $backtourlparam .= ($backtourlparam ? '&' : '?') . 'search_status=' . $search_status; |
|
| 760 | + } |
|
| 711 | 761 | $backtourl = $_SERVER["PHP_SELF"] . $backtourlparam; |
| 712 | 762 | |
| 713 | 763 | if (is_array($objMod->config_page_url)) {
|
@@ -766,10 +816,12 @@ discard block |
||
| 766 | 816 | if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^' . $mysoc->country_code . '/', $keycountry))) {
|
| 767 | 817 | $warningmessage .= ($warningmessage ? "\n" : "") . $langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName()); |
| 768 | 818 | $warningmessage .= ($warningmessage ? "\n" : "") . ($warningmessage ? "\n" : "") . $langs->trans("Module") . ' : ' . $objMod->getName();
|
| 769 | - if (!empty($objMod->editor_name)) |
|
| 770 | - $warningmessage .= ($warningmessage ? "\n" : "") . $langs->trans("Publisher") . ' : ' . $objMod->editor_name;
|
|
| 771 | - if (!empty($objMod->editor_name)) |
|
| 772 | - $warningmessage .= ($warningmessage ? "\n" : "") . $langs->trans("ModuleTriggeringThisWarning") . ' : ' . $modules[$keymodule]->getName();
|
|
| 819 | + if (!empty($objMod->editor_name)) { |
|
| 820 | + $warningmessage .= ($warningmessage ? "\n" : "") . $langs->trans("Publisher") . ' : ' . $objMod->editor_name; |
|
| 821 | + } |
|
| 822 | + if (!empty($objMod->editor_name)) { |
|
| 823 | + $warningmessage .= ($warningmessage ? "\n" : "") . $langs->trans("ModuleTriggeringThisWarning") . ' : ' . $modules[$keymodule]->getName(); |
|
| 824 | + } |
|
| 773 | 825 | } |
| 774 | 826 | } |
| 775 | 827 | } |
@@ -778,8 +830,9 @@ discard block |
||
| 778 | 830 | print '<!-- Message to show: ' . $warningmessage . ' -->' . "\n"; |
| 779 | 831 | //print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&module_position='.$module_position.'&action=set&value=' . $modName . '&mode=' . $mode . $param . '"'; |
| 780 | 832 | print '<a class="reposition" href="?controller=admin&method=modules&id=' . $objMod->numero . '&module_position=' . $module_position . '&action=set&value=' . $modName . '&mode=' . $mode . $param . '"'; |
| 781 | - if ($warningmessage) |
|
| 782 | - print ' onclick="return confirm(\'' . dol_escape_js($warningmessage) . '\');"'; |
|
| 833 | + if ($warningmessage) { |
|
| 834 | + print ' onclick="return confirm(\'' . dol_escape_js($warningmessage) . '\');"'; |
|
| 835 | + } |
|
| 783 | 836 | print '>'; |
| 784 | 837 | print img_picto($langs->trans("Disabled"), 'switch_off');
|
| 785 | 838 | print "</a>\n"; |
@@ -898,8 +951,9 @@ discard block |
||
| 898 | 951 | $dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT);
|
| 899 | 952 | $allowonlineinstall = true; |
| 900 | 953 | $allowfromweb = 1; |
| 901 | - if (dol_is_file($dolibarrdataroot . '/installmodules.lock')) |
|
| 902 | - $allowonlineinstall = false; |
|
| 954 | + if (dol_is_file($dolibarrdataroot . '/installmodules.lock')) { |
|
| 955 | + $allowonlineinstall = false; |
|
| 956 | + } |
|
| 903 | 957 | |
| 904 | 958 | $fullurl = '<a href="' . $urldolibarrmodules . '" target="_blank">' . $urldolibarrmodules . '</a>'; |
| 905 | 959 | $message = ''; |
@@ -958,18 +1012,23 @@ discard block |
||
| 958 | 1012 | |
| 959 | 1013 | $max = $conf->global->MAIN_UPLOAD_DOC; // En Kb |
| 960 | 1014 | $maxphp = @ini_get('upload_max_filesize'); // En inconnu
|
| 961 | - if (preg_match('/k$/i', $maxphp))
|
|
| 962 | - $maxphp = $maxphp * 1; |
|
| 963 | - if (preg_match('/m$/i', $maxphp))
|
|
| 964 | - $maxphp = $maxphp * 1024; |
|
| 965 | - if (preg_match('/g$/i', $maxphp))
|
|
| 966 | - $maxphp = $maxphp * 1024 * 1024; |
|
| 967 | - if (preg_match('/t$/i', $maxphp))
|
|
| 968 | - $maxphp = $maxphp * 1024 * 1024 * 1024; |
|
| 1015 | + if (preg_match('/k$/i', $maxphp)) { |
|
| 1016 | + $maxphp = $maxphp * 1; |
|
| 1017 | + } |
|
| 1018 | + if (preg_match('/m$/i', $maxphp)) { |
|
| 1019 | + $maxphp = $maxphp * 1024; |
|
| 1020 | + } |
|
| 1021 | + if (preg_match('/g$/i', $maxphp)) { |
|
| 1022 | + $maxphp = $maxphp * 1024 * 1024; |
|
| 1023 | + } |
|
| 1024 | + if (preg_match('/t$/i', $maxphp)) { |
|
| 1025 | + $maxphp = $maxphp * 1024 * 1024 * 1024; |
|
| 1026 | + } |
|
| 969 | 1027 | // Now $max and $maxphp are in Kb |
| 970 | 1028 | $maxmin = $max; |
| 971 | - if ($maxphp > 0) |
|
| 972 | - $maxmin = min($max, $maxphp); |
|
| 1029 | + if ($maxphp > 0) { |
|
| 1030 | + $maxmin = min($max, $maxphp); |
|
| 1031 | + } |
|
| 973 | 1032 | |
| 974 | 1033 | if ($maxmin > 0) {
|
| 975 | 1034 | print '<script type="text/javascript"> |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | define('NOREQUIREMENU', 1);
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | -require_once DOL_BASE_PATH . '/main.inc.php'; |
|
| 42 | +require_once DOL_BASE_PATH.'/main.inc.php'; |
|
| 43 | 43 | |
| 44 | 44 | if (GETPOST('lang', 'aZ09')) {
|
| 45 | 45 | $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
|
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | $title = $langs->trans("Info");
|
| 58 | 58 | |
| 59 | 59 | // URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests |
| 60 | -$head = '<!-- Quick access -->' . "\n"; |
|
| 60 | +$head = '<!-- Quick access -->'."\n"; |
|
| 61 | 61 | $arrayofjs = array(); |
| 62 | 62 | $arrayofcss = array(); |
| 63 | 63 | top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss); |
| 64 | 64 | |
| 65 | -print '<body>' . "\n"; |
|
| 65 | +print '<body>'."\n"; |
|
| 66 | 66 | print '<div style="padding: 20px;">'; |
| 67 | 67 | //print '<br>'; |
| 68 | 68 | |
@@ -73,38 +73,38 @@ discard block |
||
| 73 | 73 | if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
| 74 | 74 | $appli = $conf->global->MAIN_APPLICATION_TITLE; |
| 75 | 75 | if (preg_match('/\d\.\d/', $appli)) {
|
| 76 | - if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) {
|
|
| 77 | - $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
|
|
| 76 | + if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
|
|
| 77 | + $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
|
|
| 78 | 78 | } |
| 79 | 79 | } else {
|
| 80 | - $appli .= " " . DOL_VERSION; |
|
| 80 | + $appli .= " ".DOL_VERSION; |
|
| 81 | 81 | } |
| 82 | 82 | } else {
|
| 83 | - $appli .= " " . DOL_VERSION; |
|
| 83 | + $appli .= " ".DOL_VERSION; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
|
| 87 | - $appli .= "<br>" . $langs->trans("LevelOfFeature") . ': ' . $conf->global->MAIN_FEATURES_LEVEL;
|
|
| 87 | + $appli .= "<br>".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL;
|
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $logouttext = ''; |
| 91 | 91 | if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
| 92 | 92 | //$logouthtmltext=$appli.'<br>'; |
| 93 | 93 | if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') {
|
| 94 | - $logouthtmltext .= $langs->trans("Logout") . '<br>';
|
|
| 94 | + $logouthtmltext .= $langs->trans("Logout").'<br>';
|
|
| 95 | 95 | |
| 96 | 96 | // $logouttext .= '<a href="' . DOL_URL_ROOT . '/user/logout.php">'; |
| 97 | - $logouttext .= '<a href="' . BASE_URI . '?controller=user&method=logout">'; |
|
| 97 | + $logouttext .= '<a href="'.BASE_URI.'?controller=user&method=logout">'; |
|
| 98 | 98 | //$logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
|
| 99 | 99 | $logouttext .= '<span class="fa fa-sign-out atoplogin"></span>'; |
| 100 | 100 | $logouttext .= '</a>'; |
| 101 | 101 | } else {
|
| 102 | 102 | $logouthtmltext .= $langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]);
|
| 103 | - $logouttext .= img_picto($langs->trans('Logout') . ":" . $langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
|
|
| 103 | + $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
|
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | -print '<div class="login_block_getinfo">' . "\n"; |
|
| 107 | +print '<div class="login_block_getinfo">'."\n"; |
|
| 108 | 108 | |
| 109 | 109 | // Add login user link |
| 110 | 110 | $toprightmenu .= '<div class="login_block_user">'; |
@@ -115,13 +115,13 @@ discard block |
||
| 115 | 115 | $toprightmenu .= $user->getNomUrl($mode, '', -1, 0, 11, 0, ($user->firstname ? 'firstname' : -1), 'atoplogin'); |
| 116 | 116 | $toprightmenu .= '</div></div>'; |
| 117 | 117 | |
| 118 | -$toprightmenu .= '</div>' . "\n"; |
|
| 118 | +$toprightmenu .= '</div>'."\n"; |
|
| 119 | 119 | |
| 120 | 120 | $toprightmenu .= '<div class="login_block_other">'; |
| 121 | 121 | |
| 122 | 122 | // Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>') |
| 123 | 123 | $parameters = array(); |
| 124 | -$result = $hookmanager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks
|
|
| 124 | +$result = $hookmanager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks
|
|
| 125 | 125 | if (is_numeric($result)) {
|
| 126 | 126 | if (empty($result)) {
|
| 127 | 127 | $toprightmenu .= $hookmanager->resPrint; // add |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | // Link to module builder |
| 138 | 138 | if (!empty($conf->modulebuilder->enabled)) {
|
| 139 | 139 | // $text = '<a href="' . DOL_URL_ROOT . '/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="_modulebuilder">'; |
| 140 | - $text = '<a href="' . BASE_URI . '?controller=modulebuilder&method=index&mainmenu=home&leftmenu=admintools" target="_modulebuilder">'; |
|
| 140 | + $text = '<a href="'.BASE_URI.'?controller=modulebuilder&method=index&mainmenu=home&leftmenu=admintools" target="_modulebuilder">'; |
|
| 141 | 141 | //$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"');
|
| 142 | 142 | $text .= '<span class="fa fa-bug atoplogin"></span>'; |
| 143 | 143 | $text .= '</a>'; |
@@ -153,9 +153,9 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | print $toprightmenu; |
| 155 | 155 | |
| 156 | -print "</div>\n"; // end div class="login_block" |
|
| 156 | +print "</div>\n"; // end div class="login_block" |
|
| 157 | 157 | |
| 158 | 158 | print '</div>'; |
| 159 | -print '</body></html>' . "\n"; |
|
| 159 | +print '</body></html>'."\n"; |
|
| 160 | 160 | |
| 161 | 161 | $db->close(); |
@@ -128,8 +128,10 @@ |
||
| 128 | 128 | } else {
|
| 129 | 129 | $toprightmenu = $hookmanager->resPrint; // replace |
| 130 | 130 | } |
| 131 | -} else |
|
| 132 | - $toprightmenu .= $result; // For backward compatibility |
|
| 131 | +} else { |
|
| 132 | + $toprightmenu .= $result; |
|
| 133 | +} |
|
| 134 | +// For backward compatibility |
|
| 133 | 135 | |
| 134 | 136 | |
| 135 | 137 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * \brief File of class to manage users |
| 35 | 35 | * \ingroup core |
| 36 | 36 | */ |
| 37 | -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; |
|
| 37 | +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Class to manage Dolibarr users |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | public $skype; |
| 74 | 74 | public $twitter; |
| 75 | 75 | public $facebook; |
| 76 | - public $job; // job position |
|
| 76 | + public $job; // job position |
|
| 77 | 77 | public $signature; |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | public $address; |
| 83 | 83 | public $zip; |
| 84 | 84 | public $town; |
| 85 | - public $state_id; // The state/department |
|
| 85 | + public $state_id; // The state/department |
|
| 86 | 86 | public $state_code; |
| 87 | 87 | public $state; |
| 88 | 88 | public $office_phone; |
@@ -136,26 +136,26 @@ discard block |
||
| 136 | 136 | public $datepreviouslogin; |
| 137 | 137 | public $photo; |
| 138 | 138 | public $lang; |
| 139 | - public $rights; // Array of permissions user->rights->permx |
|
| 140 | - public $all_permissions_are_loaded; // All permission are loaded |
|
| 141 | - public $nb_rights; // Number of rights granted to the user |
|
| 142 | - private $_tab_loaded = array(); // Cache array of already loaded permissions |
|
| 143 | - public $conf; // To store personal config |
|
| 144 | - public $default_values; // To store default values for user |
|
| 145 | - public $lastsearch_values_tmp; // To store current search criterias for user |
|
| 146 | - public $lastsearch_values; // To store last saved search criterias for user |
|
| 147 | - public $users = array(); // To store all tree of users hierarchy |
|
| 148 | - public $parentof; // To store an array of all parents for all ids. |
|
| 139 | + public $rights; // Array of permissions user->rights->permx |
|
| 140 | + public $all_permissions_are_loaded; // All permission are loaded |
|
| 141 | + public $nb_rights; // Number of rights granted to the user |
|
| 142 | + private $_tab_loaded = array(); // Cache array of already loaded permissions |
|
| 143 | + public $conf; // To store personal config |
|
| 144 | + public $default_values; // To store default values for user |
|
| 145 | + public $lastsearch_values_tmp; // To store current search criterias for user |
|
| 146 | + public $lastsearch_values; // To store last saved search criterias for user |
|
| 147 | + public $users = array(); // To store all tree of users hierarchy |
|
| 148 | + public $parentof; // To store an array of all parents for all ids. |
|
| 149 | 149 | private $cache_childids; |
| 150 | - public $accountancy_code; // Accountancy code in prevision of the complete accountancy module |
|
| 151 | - public $thm; // Average cost of employee - Used for valuation of time spent |
|
| 152 | - public $tjm; // Average cost of employee |
|
| 153 | - public $salary; // Monthly salary - Denormalized value from llx_user_employment |
|
| 154 | - public $salaryextra; // Monthly salary extra - Denormalized value from llx_user_employment |
|
| 155 | - public $weeklyhours; // Weekly hours - Denormalized value from llx_user_employment |
|
| 156 | - public $color; // Define background color for user in agenda |
|
| 157 | - public $dateemployment; // Define date of employment by company |
|
| 158 | - public $dateemploymentend; // Define date of employment end by company |
|
| 150 | + public $accountancy_code; // Accountancy code in prevision of the complete accountancy module |
|
| 151 | + public $thm; // Average cost of employee - Used for valuation of time spent |
|
| 152 | + public $tjm; // Average cost of employee |
|
| 153 | + public $salary; // Monthly salary - Denormalized value from llx_user_employment |
|
| 154 | + public $salaryextra; // Monthly salary extra - Denormalized value from llx_user_employment |
|
| 155 | + public $weeklyhours; // Weekly hours - Denormalized value from llx_user_employment |
|
| 156 | + public $color; // Define background color for user in agenda |
|
| 157 | + public $dateemployment; // Define date of employment by company |
|
| 158 | + public $dateemploymentend; // Define date of employment end by company |
|
| 159 | 159 | public $default_c_exp_tax_cat; |
| 160 | 160 | public $default_range; |
| 161 | 161 | public $fields = array( |
@@ -233,34 +233,34 @@ discard block |
||
| 233 | 233 | $sql .= " u.color,"; |
| 234 | 234 | $sql .= " u.dateemployment, u.dateemploymentend,"; |
| 235 | 235 | $sql .= " u.ref_int, u.ref_ext,"; |
| 236 | - $sql .= " u.default_range, u.default_c_exp_tax_cat,"; // Expense report default mode |
|
| 236 | + $sql .= " u.default_range, u.default_c_exp_tax_cat,"; // Expense report default mode |
|
| 237 | 237 | $sql .= " c.code as country_code, c.label as country,"; |
| 238 | 238 | $sql .= " d.code_departement as state_code, d.nom as state"; |
| 239 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user as u"; |
|
| 240 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON u.fk_country = c.rowid"; |
|
| 241 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_departements as d ON u.fk_state = d.rowid"; |
|
| 239 | + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; |
|
| 240 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid"; |
|
| 241 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON u.fk_state = d.rowid"; |
|
| 242 | 242 | |
| 243 | 243 | if ($entity < 0) {
|
| 244 | 244 | if ((empty($conf->multicompany->enabled) || empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) && (!empty($user->entity))) {
|
| 245 | - $sql .= " WHERE u.entity IN (0," . $conf->entity . ")"; |
|
| 245 | + $sql .= " WHERE u.entity IN (0,".$conf->entity.")"; |
|
| 246 | 246 | } else {
|
| 247 | - $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database |
|
| 247 | + $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database |
|
| 248 | 248 | } |
| 249 | 249 | } else { // The fetch was forced on an entity
|
| 250 | 250 | if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) |
| 251 | - $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database |
|
| 251 | + $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database |
|
| 252 | 252 | else |
| 253 | - $sql .= " WHERE u.entity IN (0, " . (($entity != '' && $entity >= 0) ? $entity : $conf->entity) . ")"; // search in entity provided in parameter |
|
| 253 | + $sql .= " WHERE u.entity IN (0, ".(($entity != '' && $entity >= 0) ? $entity : $conf->entity).")"; // search in entity provided in parameter |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | if ($sid) { // permet une recherche du user par son SID ActiveDirectory ou Samba
|
| 257 | - $sql .= " AND (u.ldap_sid = '" . $this->db->escape($sid) . "' OR u.login = '" . $this->db->escape($login) . "') LIMIT 1"; |
|
| 257 | + $sql .= " AND (u.ldap_sid = '".$this->db->escape($sid)."' OR u.login = '".$this->db->escape($login)."') LIMIT 1"; |
|
| 258 | 258 | } else if ($login) {
|
| 259 | - $sql .= " AND u.login = '" . $this->db->escape($login) . "'"; |
|
| 259 | + $sql .= " AND u.login = '".$this->db->escape($login)."'"; |
|
| 260 | 260 | } else {
|
| 261 | - $sql .= " AND u.rowid = " . $id; |
|
| 261 | + $sql .= " AND u.rowid = ".$id; |
|
| 262 | 262 | } |
| 263 | - $sql .= " ORDER BY u.entity ASC"; // Avoid random result when there is 2 login in 2 different entities |
|
| 263 | + $sql .= " ORDER BY u.entity ASC"; // Avoid random result when there is 2 login in 2 different entities |
|
| 264 | 264 | |
| 265 | 265 | $result = $this->db->query($sql); |
| 266 | 266 | if ($result) {
|
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | $this->datelastlogin = $this->db->jdate($obj->datel); |
| 331 | 331 | $this->datepreviouslogin = $this->db->jdate($obj->datep); |
| 332 | 332 | |
| 333 | - $this->societe_id = $obj->fk_soc; // deprecated |
|
| 333 | + $this->societe_id = $obj->fk_soc; // deprecated |
|
| 334 | 334 | $this->contact_id = $obj->fk_socpeople; // deprecated |
| 335 | 335 | $this->socid = $obj->fk_soc; |
| 336 | 336 | $this->contactid = $obj->fk_socpeople; |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | else {
|
| 355 | 355 | $this->error = "USERNOTFOUND"; |
| 356 | - dol_syslog(get_class($this) . "::fetch user not found", LOG_DEBUG); |
|
| 356 | + dol_syslog(get_class($this)."::fetch user not found", LOG_DEBUG); |
|
| 357 | 357 | |
| 358 | 358 | $this->db->free($result); |
| 359 | 359 | return 0; |
@@ -366,9 +366,9 @@ discard block |
||
| 366 | 366 | // To get back the global configuration unique to the user |
| 367 | 367 | if ($loadpersonalconf) {
|
| 368 | 368 | // Load user->conf for user |
| 369 | - $sql = "SELECT param, value FROM " . MAIN_DB_PREFIX . "user_param"; |
|
| 370 | - $sql .= " WHERE fk_user = " . $this->id; |
|
| 371 | - $sql .= " AND entity = " . $conf->entity; |
|
| 369 | + $sql = "SELECT param, value FROM ".MAIN_DB_PREFIX."user_param"; |
|
| 370 | + $sql .= " WHERE fk_user = ".$this->id; |
|
| 371 | + $sql .= " AND entity = ".$conf->entity; |
|
| 372 | 372 | //dol_syslog(get_class($this).'::fetch load personalized conf', LOG_DEBUG); |
| 373 | 373 | $resql = $this->db->query($sql); |
| 374 | 374 | if ($resql) {
|
@@ -410,9 +410,9 @@ discard block |
||
| 410 | 410 | |
| 411 | 411 | // Load user->default_values for user. TODO Save this in memcached ? |
| 412 | 412 | $sql = "SELECT rowid, entity, type, page, param, value"; |
| 413 | - $sql .= " FROM " . MAIN_DB_PREFIX . "default_values"; |
|
| 414 | - $sql .= " WHERE entity IN (" . ($this->entity > 0 ? $this->entity . ", " : "") . $conf->entity . ")"; // Entity of user (if defined) + current entity
|
|
| 415 | - $sql .= " AND user_id IN (0" . ($this->id > 0 ? ", " . $this->id : "") . ")"; // User 0 (all) + me (if defined) |
|
| 413 | + $sql .= " FROM ".MAIN_DB_PREFIX."default_values"; |
|
| 414 | + $sql .= " WHERE entity IN (".($this->entity > 0 ? $this->entity.", " : "").$conf->entity.")"; // Entity of user (if defined) + current entity
|
|
| 415 | + $sql .= " AND user_id IN (0".($this->id > 0 ? ", ".$this->id : "").")"; // User 0 (all) + me (if defined) |
|
| 416 | 416 | $resql = $this->db->query($sql); |
| 417 | 417 | if ($resql) {
|
| 418 | 418 | while ($obj = $this->db->fetch_object($resql)) {
|
@@ -464,7 +464,7 @@ discard block |
||
| 464 | 464 | |
| 465 | 465 | $entity = (!empty($entity) ? $entity : $conf->entity); |
| 466 | 466 | |
| 467 | - dol_syslog(get_class($this) . "::addrights $rid, $allmodule, $allperms, $entity"); |
|
| 467 | + dol_syslog(get_class($this)."::addrights $rid, $allmodule, $allperms, $entity"); |
|
| 468 | 468 | $error = 0; |
| 469 | 469 | $whereforadd = ''; |
| 470 | 470 | |
@@ -474,9 +474,9 @@ discard block |
||
| 474 | 474 | // Si on a demande ajout d'un droit en particulier, on recupere |
| 475 | 475 | // les caracteristiques (module, perms et subperms) de ce droit. |
| 476 | 476 | $sql = "SELECT module, perms, subperms"; |
| 477 | - $sql .= " FROM " . MAIN_DB_PREFIX . "rights_def"; |
|
| 478 | - $sql .= " WHERE id = '" . $this->db->escape($rid) . "'"; |
|
| 479 | - $sql .= " AND entity = " . $entity; |
|
| 477 | + $sql .= " FROM ".MAIN_DB_PREFIX."rights_def"; |
|
| 478 | + $sql .= " WHERE id = '".$this->db->escape($rid)."'"; |
|
| 479 | + $sql .= " AND entity = ".$entity; |
|
| 480 | 480 | |
| 481 | 481 | $result = $this->db->query($sql); |
| 482 | 482 | if ($result) {
|
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | // Where pour la liste des droits a ajouter |
| 493 | - $whereforadd = "id=" . $this->db->escape($rid); |
|
| 493 | + $whereforadd = "id=".$this->db->escape($rid); |
|
| 494 | 494 | // Ajout des droits induits |
| 495 | 495 | if (!empty($subperms)) |
| 496 | 496 | $whereforadd .= " OR (module='$module' AND perms='$perms' AND (subperms='lire' OR subperms='read'))"; |
@@ -505,9 +505,9 @@ discard block |
||
| 505 | 505 | if ($allmodule == 'allmodules') {
|
| 506 | 506 | $whereforadd = 'allmodules'; |
| 507 | 507 | } else {
|
| 508 | - $whereforadd = "module='" . $this->db->escape($allmodule) . "'"; |
|
| 508 | + $whereforadd = "module='".$this->db->escape($allmodule)."'"; |
|
| 509 | 509 | if (!empty($allperms)) |
| 510 | - $whereforadd .= " AND perms='" . $this->db->escape($allperms) . "'"; |
|
| 510 | + $whereforadd .= " AND perms='".$this->db->escape($allperms)."'"; |
|
| 511 | 511 | } |
| 512 | 512 | } |
| 513 | 513 | } |
@@ -516,10 +516,10 @@ discard block |
||
| 516 | 516 | if (!empty($whereforadd)) {
|
| 517 | 517 | //print "$module-$perms-$subperms"; |
| 518 | 518 | $sql = "SELECT id"; |
| 519 | - $sql .= " FROM " . MAIN_DB_PREFIX . "rights_def"; |
|
| 520 | - $sql .= " WHERE entity = " . $entity; |
|
| 519 | + $sql .= " FROM ".MAIN_DB_PREFIX."rights_def"; |
|
| 520 | + $sql .= " WHERE entity = ".$entity; |
|
| 521 | 521 | if (!empty($whereforadd) && $whereforadd != 'allmodules') {
|
| 522 | - $sql .= " AND " . $whereforadd; |
|
| 522 | + $sql .= " AND ".$whereforadd; |
|
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | $result = $this->db->query($sql); |
@@ -530,10 +530,10 @@ discard block |
||
| 530 | 530 | $obj = $this->db->fetch_object($result); |
| 531 | 531 | $nid = $obj->id; |
| 532 | 532 | |
| 533 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_rights WHERE fk_user = " . $this->id . " AND fk_id=" . $nid . " AND entity = " . $entity; |
|
| 533 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user = ".$this->id." AND fk_id=".$nid." AND entity = ".$entity; |
|
| 534 | 534 | if (!$this->db->query($sql)) |
| 535 | 535 | $error++; |
| 536 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user_rights (entity, fk_user, fk_id) VALUES (" . $entity . ", " . $this->id . ", " . $nid . ")";
|
|
| 536 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_rights (entity, fk_user, fk_id) VALUES (".$entity.", ".$this->id.", ".$nid.")";
|
|
| 537 | 537 | if (!$this->db->query($sql)) |
| 538 | 538 | $error++; |
| 539 | 539 | |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | |
| 549 | 549 | if (!$error && !$notrigger) {
|
| 550 | 550 | $langs->load("other");
|
| 551 | - $this->context = array('audit' => $langs->trans("PermissionsAdd") . ($rid ? ' (id=' . $rid . ')' : ''));
|
|
| 551 | + $this->context = array('audit' => $langs->trans("PermissionsAdd").($rid ? ' (id='.$rid.')' : ''));
|
|
| 552 | 552 | |
| 553 | 553 | // Call trigger |
| 554 | 554 | $result = $this->call_trigger('USER_MODIFY', $user);
|
@@ -592,9 +592,9 @@ discard block |
||
| 592 | 592 | // Si on a demande supression d'un droit en particulier, on recupere |
| 593 | 593 | // les caracteristiques module, perms et subperms de ce droit. |
| 594 | 594 | $sql = "SELECT module, perms, subperms"; |
| 595 | - $sql .= " FROM " . MAIN_DB_PREFIX . "rights_def"; |
|
| 596 | - $sql .= " WHERE id = '" . $this->db->escape($rid) . "'"; |
|
| 597 | - $sql .= " AND entity = " . $entity; |
|
| 595 | + $sql .= " FROM ".MAIN_DB_PREFIX."rights_def"; |
|
| 596 | + $sql .= " WHERE id = '".$this->db->escape($rid)."'"; |
|
| 597 | + $sql .= " AND entity = ".$entity; |
|
| 598 | 598 | |
| 599 | 599 | $result = $this->db->query($sql); |
| 600 | 600 | if ($result) {
|
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | // Where pour la liste des droits a supprimer |
| 611 | - $wherefordel = "id=" . $this->db->escape($rid); |
|
| 611 | + $wherefordel = "id=".$this->db->escape($rid); |
|
| 612 | 612 | // Suppression des droits induits |
| 613 | 613 | if ($subperms == 'lire' || $subperms == 'read') |
| 614 | 614 | $wherefordel .= " OR (module='$module' AND perms='$perms' AND subperms IS NOT NULL)"; |
@@ -622,9 +622,9 @@ discard block |
||
| 622 | 622 | if ($allmodule == 'allmodules') {
|
| 623 | 623 | $wherefordel = 'allmodules'; |
| 624 | 624 | } else {
|
| 625 | - $wherefordel = "module='" . $this->db->escape($allmodule) . "'"; |
|
| 625 | + $wherefordel = "module='".$this->db->escape($allmodule)."'"; |
|
| 626 | 626 | if (!empty($allperms)) |
| 627 | - $whereforadd .= " AND perms='" . $this->db->escape($allperms) . "'"; |
|
| 627 | + $whereforadd .= " AND perms='".$this->db->escape($allperms)."'"; |
|
| 628 | 628 | } |
| 629 | 629 | } |
| 630 | 630 | } |
@@ -633,10 +633,10 @@ discard block |
||
| 633 | 633 | if (!empty($wherefordel)) {
|
| 634 | 634 | //print "$module-$perms-$subperms"; |
| 635 | 635 | $sql = "SELECT id"; |
| 636 | - $sql .= " FROM " . MAIN_DB_PREFIX . "rights_def"; |
|
| 637 | - $sql .= " WHERE entity = " . $entity; |
|
| 636 | + $sql .= " FROM ".MAIN_DB_PREFIX."rights_def"; |
|
| 637 | + $sql .= " WHERE entity = ".$entity; |
|
| 638 | 638 | if (!empty($wherefordel) && $wherefordel != 'allmodules') {
|
| 639 | - $sql .= " AND " . $wherefordel; |
|
| 639 | + $sql .= " AND ".$wherefordel; |
|
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | $result = $this->db->query($sql); |
@@ -647,9 +647,9 @@ discard block |
||
| 647 | 647 | $obj = $this->db->fetch_object($result); |
| 648 | 648 | $nid = $obj->id; |
| 649 | 649 | |
| 650 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_rights"; |
|
| 651 | - $sql .= " WHERE fk_user = " . $this->id . " AND fk_id=" . $nid; |
|
| 652 | - $sql .= " AND entity = " . $entity; |
|
| 650 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights"; |
|
| 651 | + $sql .= " WHERE fk_user = ".$this->id." AND fk_id=".$nid; |
|
| 652 | + $sql .= " AND entity = ".$entity; |
|
| 653 | 653 | if (!$this->db->query($sql)) |
| 654 | 654 | $error++; |
| 655 | 655 | |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | |
| 665 | 665 | if (!$error && !$notrigger) {
|
| 666 | 666 | $langs->load("other");
|
| 667 | - $this->context = array('audit' => $langs->trans("PermissionsDelete") . ($rid ? ' (id=' . $rid . ')' : ''));
|
|
| 667 | + $this->context = array('audit' => $langs->trans("PermissionsDelete").($rid ? ' (id='.$rid.')' : ''));
|
|
| 668 | 668 | |
| 669 | 669 | // Call trigger |
| 670 | 670 | $result = $this->call_trigger('USER_MODIFY', $user);
|
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | */ |
| 692 | 692 | function clearrights() |
| 693 | 693 | {
|
| 694 | - dol_syslog(get_class($this) . "::clearrights reset user->rights"); |
|
| 694 | + dol_syslog(get_class($this)."::clearrights reset user->rights"); |
|
| 695 | 695 | $this->rights = ''; |
| 696 | 696 | $this->all_permissions_are_loaded = false; |
| 697 | 697 | $this->_tab_loaded = array(); |
@@ -724,18 +724,18 @@ discard block |
||
| 724 | 724 | // Recuperation des droits utilisateurs + recuperation des droits groupes |
| 725 | 725 | // D'abord les droits utilisateurs |
| 726 | 726 | $sql = "SELECT DISTINCT r.module, r.perms, r.subperms"; |
| 727 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user_rights as ur"; |
|
| 728 | - $sql .= ", " . MAIN_DB_PREFIX . "rights_def as r"; |
|
| 727 | + $sql .= " FROM ".MAIN_DB_PREFIX."user_rights as ur"; |
|
| 728 | + $sql .= ", ".MAIN_DB_PREFIX."rights_def as r"; |
|
| 729 | 729 | $sql .= " WHERE r.id = ur.fk_id"; |
| 730 | 730 | if (!empty($conf->global->MULTICOMPANY_BACKWARD_COMPATIBILITY)) {
|
| 731 | - $sql .= " AND r.entity IN (0," . (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) ? "1," : "") . $conf->entity . ")"; |
|
| 731 | + $sql .= " AND r.entity IN (0,".(!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) ? "1," : "").$conf->entity.")"; |
|
| 732 | 732 | } else {
|
| 733 | - $sql .= " AND ur.entity = " . $conf->entity; |
|
| 733 | + $sql .= " AND ur.entity = ".$conf->entity; |
|
| 734 | 734 | } |
| 735 | - $sql .= " AND ur.fk_user= " . $this->id; |
|
| 735 | + $sql .= " AND ur.fk_user= ".$this->id; |
|
| 736 | 736 | $sql .= " AND r.perms IS NOT NULL"; |
| 737 | 737 | if ($moduletag) |
| 738 | - $sql .= " AND r.module = '" . $this->db->escape($moduletag) . "'"; |
|
| 738 | + $sql .= " AND r.module = '".$this->db->escape($moduletag)."'"; |
|
| 739 | 739 | |
| 740 | 740 | $resql = $this->db->query($sql); |
| 741 | 741 | if ($resql) {
|
@@ -775,25 +775,25 @@ discard block |
||
| 775 | 775 | |
| 776 | 776 | // Maintenant les droits groupes |
| 777 | 777 | $sql = "SELECT DISTINCT r.module, r.perms, r.subperms"; |
| 778 | - $sql .= " FROM " . MAIN_DB_PREFIX . "usergroup_rights as gr,"; |
|
| 779 | - $sql .= " " . MAIN_DB_PREFIX . "usergroup_user as gu,"; |
|
| 780 | - $sql .= " " . MAIN_DB_PREFIX . "rights_def as r"; |
|
| 778 | + $sql .= " FROM ".MAIN_DB_PREFIX."usergroup_rights as gr,"; |
|
| 779 | + $sql .= " ".MAIN_DB_PREFIX."usergroup_user as gu,"; |
|
| 780 | + $sql .= " ".MAIN_DB_PREFIX."rights_def as r"; |
|
| 781 | 781 | $sql .= " WHERE r.id = gr.fk_id"; |
| 782 | 782 | if (!empty($conf->global->MULTICOMPANY_BACKWARD_COMPATIBILITY)) {
|
| 783 | 783 | if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
| 784 | - $sql .= " AND gu.entity IN (0," . $conf->entity . ")"; |
|
| 784 | + $sql .= " AND gu.entity IN (0,".$conf->entity.")"; |
|
| 785 | 785 | } else {
|
| 786 | - $sql .= " AND r.entity = " . $conf->entity; |
|
| 786 | + $sql .= " AND r.entity = ".$conf->entity; |
|
| 787 | 787 | } |
| 788 | 788 | } else {
|
| 789 | - $sql .= " AND gr.entity = " . $conf->entity; |
|
| 790 | - $sql .= " AND r.entity = " . $conf->entity; |
|
| 789 | + $sql .= " AND gr.entity = ".$conf->entity; |
|
| 790 | + $sql .= " AND r.entity = ".$conf->entity; |
|
| 791 | 791 | } |
| 792 | 792 | $sql .= " AND gr.fk_usergroup = gu.fk_usergroup"; |
| 793 | - $sql .= " AND gu.fk_user = " . $this->id; |
|
| 793 | + $sql .= " AND gu.fk_user = ".$this->id; |
|
| 794 | 794 | $sql .= " AND r.perms IS NOT NULL"; |
| 795 | 795 | if ($moduletag) |
| 796 | - $sql .= " AND r.module = '" . $this->db->escape($moduletag) . "'"; |
|
| 796 | + $sql .= " AND r.module = '".$this->db->escape($moduletag)."'"; |
|
| 797 | 797 | |
| 798 | 798 | $resql = $this->db->query($sql); |
| 799 | 799 | if ($resql) {
|
@@ -868,12 +868,12 @@ discard block |
||
| 868 | 868 | $this->db->begin(); |
| 869 | 869 | |
| 870 | 870 | // Deactivate user |
| 871 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
|
| 872 | - $sql .= " SET statut = " . $this->statut; |
|
| 873 | - $sql .= " WHERE rowid = " . $this->id; |
|
| 871 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; |
|
| 872 | + $sql .= " SET statut = ".$this->statut; |
|
| 873 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 874 | 874 | $result = $this->db->query($sql); |
| 875 | 875 | |
| 876 | - dol_syslog(get_class($this) . "::setstatus", LOG_DEBUG); |
|
| 876 | + dol_syslog(get_class($this)."::setstatus", LOG_DEBUG); |
|
| 877 | 877 | if ($result) {
|
| 878 | 878 | // Call trigger |
| 879 | 879 | $result = $this->call_trigger('USER_ENABLEDISABLE', $user);
|
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | } |
| 911 | 911 | |
| 912 | 912 | // Get current categories |
| 913 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 913 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 914 | 914 | $c = new Categorie($this->db); |
| 915 | 915 | $existing = $c->containing($this->id, Categorie::TYPE_USER, 'id'); |
| 916 | 916 | |
@@ -953,10 +953,10 @@ discard block |
||
| 953 | 953 | |
| 954 | 954 | $this->fetch($this->id); |
| 955 | 955 | |
| 956 | - dol_syslog(get_class($this) . "::delete", LOG_DEBUG); |
|
| 956 | + dol_syslog(get_class($this)."::delete", LOG_DEBUG); |
|
| 957 | 957 | |
| 958 | 958 | // Remove rights |
| 959 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_rights WHERE fk_user = " . $this->id; |
|
| 959 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user = ".$this->id; |
|
| 960 | 960 | |
| 961 | 961 | if (!$error && !$this->db->query($sql)) {
|
| 962 | 962 | $error++; |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | } |
| 965 | 965 | |
| 966 | 966 | // Remove group |
| 967 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "usergroup_user WHERE fk_user = " . $this->id; |
|
| 967 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_user WHERE fk_user = ".$this->id; |
|
| 968 | 968 | if (!$error && !$this->db->query($sql)) {
|
| 969 | 969 | $error++; |
| 970 | 970 | $this->error = $this->db->lasterror(); |
@@ -972,7 +972,7 @@ discard block |
||
| 972 | 972 | |
| 973 | 973 | // If contact, remove link |
| 974 | 974 | if ($this->contact_id) {
|
| 975 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "socpeople SET fk_user_creat = null WHERE rowid = " . $this->contact_id; |
|
| 975 | + $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET fk_user_creat = null WHERE rowid = ".$this->contact_id; |
|
| 976 | 976 | if (!$error && !$this->db->query($sql)) {
|
| 977 | 977 | $error++; |
| 978 | 978 | $this->error = $this->db->lasterror(); |
@@ -984,14 +984,14 @@ discard block |
||
| 984 | 984 | $result = $this->deleteExtraFields(); |
| 985 | 985 | if ($result < 0) {
|
| 986 | 986 | $error++; |
| 987 | - dol_syslog(get_class($this) . "::delete error -4 " . $this->error, LOG_ERR); |
|
| 987 | + dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); |
|
| 988 | 988 | } |
| 989 | 989 | } |
| 990 | 990 | |
| 991 | 991 | // Remove user |
| 992 | 992 | if (!$error) {
|
| 993 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user WHERE rowid = " . $this->id; |
|
| 994 | - dol_syslog(get_class($this) . "::delete", LOG_DEBUG); |
|
| 993 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".$this->id; |
|
| 994 | + dol_syslog(get_class($this)."::delete", LOG_DEBUG); |
|
| 995 | 995 | if (!$this->db->query($sql)) {
|
| 996 | 996 | $error++; |
| 997 | 997 | $this->error = $this->db->lasterror(); |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | if (!isset($this->entity)) |
| 1034 | 1034 | $this->entity = $conf->entity; // If not defined, we use default value |
| 1035 | 1035 | |
| 1036 | - dol_syslog(get_class($this) . "::create login=" . $this->login . ", user=" . (is_object($user) ? $user->id : ''), LOG_DEBUG); |
|
| 1036 | + dol_syslog(get_class($this)."::create login=".$this->login.", user=".(is_object($user) ? $user->id : ''), LOG_DEBUG); |
|
| 1037 | 1037 | |
| 1038 | 1038 | // Check parameters |
| 1039 | 1039 | if (!empty($conf->global->USER_MAIL_REQUIRED) && !isValidEMail($this->email)) {
|
@@ -1052,11 +1052,11 @@ discard block |
||
| 1052 | 1052 | $error = 0; |
| 1053 | 1053 | $this->db->begin(); |
| 1054 | 1054 | |
| 1055 | - $sql = "SELECT login FROM " . MAIN_DB_PREFIX . "user"; |
|
| 1056 | - $sql .= " WHERE login ='" . $this->db->escape($this->login) . "'"; |
|
| 1057 | - $sql .= " AND entity IN (0," . $this->db->escape($conf->entity) . ")"; |
|
| 1055 | + $sql = "SELECT login FROM ".MAIN_DB_PREFIX."user"; |
|
| 1056 | + $sql .= " WHERE login ='".$this->db->escape($this->login)."'"; |
|
| 1057 | + $sql .= " AND entity IN (0,".$this->db->escape($conf->entity).")"; |
|
| 1058 | 1058 | |
| 1059 | - dol_syslog(get_class($this) . "::create", LOG_DEBUG); |
|
| 1059 | + dol_syslog(get_class($this)."::create", LOG_DEBUG); |
|
| 1060 | 1060 | $resql = $this->db->query($sql); |
| 1061 | 1061 | if ($resql) {
|
| 1062 | 1062 | $num = $this->db->num_rows($resql); |
@@ -1064,17 +1064,17 @@ discard block |
||
| 1064 | 1064 | |
| 1065 | 1065 | if ($num) {
|
| 1066 | 1066 | $this->error = 'ErrorLoginAlreadyExists'; |
| 1067 | - dol_syslog(get_class($this) . "::create " . $this->error, LOG_WARNING); |
|
| 1067 | + dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING); |
|
| 1068 | 1068 | $this->db->rollback(); |
| 1069 | 1069 | return -6; |
| 1070 | 1070 | } else {
|
| 1071 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user (datec,login,ldap_sid,entity)"; |
|
| 1072 | - $sql .= " VALUES('" . $this->db->idate($this->datec) . "','" . $this->db->escape($this->login) . "','" . $this->db->escape($this->ldap_sid) . "'," . $this->db->escape($this->entity) . ")";
|
|
| 1071 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."user (datec,login,ldap_sid,entity)"; |
|
| 1072 | + $sql .= " VALUES('".$this->db->idate($this->datec)."','".$this->db->escape($this->login)."','".$this->db->escape($this->ldap_sid)."',".$this->db->escape($this->entity).")";
|
|
| 1073 | 1073 | $result = $this->db->query($sql); |
| 1074 | 1074 | |
| 1075 | - dol_syslog(get_class($this) . "::create", LOG_DEBUG); |
|
| 1075 | + dol_syslog(get_class($this)."::create", LOG_DEBUG); |
|
| 1076 | 1076 | if ($result) {
|
| 1077 | - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "user"); |
|
| 1077 | + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."user"); |
|
| 1078 | 1078 | |
| 1079 | 1079 | // Set default rights |
| 1080 | 1080 | if ($this->set_default_rights() < 0) {
|
@@ -1091,7 +1091,7 @@ discard block |
||
| 1091 | 1091 | } |
| 1092 | 1092 | |
| 1093 | 1093 | if (!empty($conf->global->STOCK_USERSTOCK_AUTOCREATE)) {
|
| 1094 | - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; |
|
| 1094 | + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
|
| 1095 | 1095 | $langs->load("stocks");
|
| 1096 | 1096 | $entrepot = new Entrepot($this->db); |
| 1097 | 1097 | $entrepot->libelle = $langs->trans("PersonalStock", $this->getFullName($langs));
|
@@ -1115,7 +1115,7 @@ discard block |
||
| 1115 | 1115 | return $this->id; |
| 1116 | 1116 | } else {
|
| 1117 | 1117 | //$this->error=$interface->error; |
| 1118 | - dol_syslog(get_class($this) . "::create " . $this->error, LOG_ERR); |
|
| 1118 | + dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); |
|
| 1119 | 1119 | $this->db->rollback(); |
| 1120 | 1120 | return -3; |
| 1121 | 1121 | } |
@@ -1168,7 +1168,7 @@ discard block |
||
| 1168 | 1168 | $this->employee = 0; |
| 1169 | 1169 | |
| 1170 | 1170 | if (empty($login)) |
| 1171 | - $login = strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4)); |
|
| 1171 | + $login = strtolower(substr($contact->firstname, 0, 4)).strtolower(substr($contact->lastname, 0, 4)); |
|
| 1172 | 1172 | $this->login = $login; |
| 1173 | 1173 | |
| 1174 | 1174 | $this->db->begin(); |
@@ -1176,14 +1176,14 @@ discard block |
||
| 1176 | 1176 | // Cree et positionne $this->id |
| 1177 | 1177 | $result = $this->create($user); |
| 1178 | 1178 | if ($result > 0) {
|
| 1179 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
|
| 1180 | - $sql .= " SET fk_socpeople=" . $contact->id; |
|
| 1179 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; |
|
| 1180 | + $sql .= " SET fk_socpeople=".$contact->id; |
|
| 1181 | 1181 | if ($contact->socid) |
| 1182 | - $sql .= ", fk_soc=" . $contact->socid; |
|
| 1183 | - $sql .= " WHERE rowid=" . $this->id; |
|
| 1182 | + $sql .= ", fk_soc=".$contact->socid; |
|
| 1183 | + $sql .= " WHERE rowid=".$this->id; |
|
| 1184 | 1184 | $resql = $this->db->query($sql); |
| 1185 | 1185 | |
| 1186 | - dol_syslog(get_class($this) . "::create_from_contact", LOG_DEBUG); |
|
| 1186 | + dol_syslog(get_class($this)."::create_from_contact", LOG_DEBUG); |
|
| 1187 | 1187 | if ($resql) {
|
| 1188 | 1188 | $this->context['createfromcontact'] = 'createfromcontact'; |
| 1189 | 1189 | |
@@ -1206,7 +1206,7 @@ discard block |
||
| 1206 | 1206 | } |
| 1207 | 1207 | } else {
|
| 1208 | 1208 | // $this->error deja positionne |
| 1209 | - dol_syslog(get_class($this) . "::create_from_contact - 0"); |
|
| 1209 | + dol_syslog(get_class($this)."::create_from_contact - 0"); |
|
| 1210 | 1210 | |
| 1211 | 1211 | $this->db->rollback(); |
| 1212 | 1212 | return $result; |
@@ -1241,7 +1241,7 @@ discard block |
||
| 1241 | 1241 | $this->country_id = $member->country_id; |
| 1242 | 1242 | |
| 1243 | 1243 | if (empty($login)) |
| 1244 | - $login = strtolower(substr($member->firstname, 0, 4)) . strtolower(substr($member->lastname, 0, 4)); |
|
| 1244 | + $login = strtolower(substr($member->firstname, 0, 4)).strtolower(substr($member->lastname, 0, 4)); |
|
| 1245 | 1245 | $this->login = $login; |
| 1246 | 1246 | |
| 1247 | 1247 | $this->db->begin(); |
@@ -1254,11 +1254,11 @@ discard block |
||
| 1254 | 1254 | $result = -2; |
| 1255 | 1255 | |
| 1256 | 1256 | if ($result > 0 && $member->fk_soc) { // If member is linked to a thirdparty
|
| 1257 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
|
| 1258 | - $sql .= " SET fk_soc=" . $member->fk_soc; |
|
| 1259 | - $sql .= " WHERE rowid=" . $this->id; |
|
| 1257 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; |
|
| 1258 | + $sql .= " SET fk_soc=".$member->fk_soc; |
|
| 1259 | + $sql .= " WHERE rowid=".$this->id; |
|
| 1260 | 1260 | |
| 1261 | - dol_syslog(get_class($this) . "::create_from_member", LOG_DEBUG); |
|
| 1261 | + dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG); |
|
| 1262 | 1262 | $resql = $this->db->query($sql); |
| 1263 | 1263 | if ($resql) {
|
| 1264 | 1264 | $this->db->commit(); |
@@ -1293,9 +1293,9 @@ discard block |
||
| 1293 | 1293 | // phpcs:enable |
| 1294 | 1294 | global $conf; |
| 1295 | 1295 | |
| 1296 | - $sql = "SELECT id FROM " . MAIN_DB_PREFIX . "rights_def"; |
|
| 1296 | + $sql = "SELECT id FROM ".MAIN_DB_PREFIX."rights_def"; |
|
| 1297 | 1297 | $sql .= " WHERE bydefault = 1"; |
| 1298 | - $sql .= " AND entity = " . $conf->entity; |
|
| 1298 | + $sql .= " AND entity = ".$conf->entity; |
|
| 1299 | 1299 | |
| 1300 | 1300 | $resql = $this->db->query($sql); |
| 1301 | 1301 | if ($resql) {
|
@@ -1312,10 +1312,10 @@ discard block |
||
| 1312 | 1312 | $i = 0; |
| 1313 | 1313 | while ($i < $num) {
|
| 1314 | 1314 | |
| 1315 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_rights WHERE fk_user = $this->id AND fk_id=$rd[$i]"; |
|
| 1315 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user = $this->id AND fk_id=$rd[$i]"; |
|
| 1316 | 1316 | $result = $this->db->query($sql); |
| 1317 | 1317 | |
| 1318 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user_rights (fk_user, fk_id) VALUES ($this->id, $rd[$i])"; |
|
| 1318 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_rights (fk_user, fk_id) VALUES ($this->id, $rd[$i])"; |
|
| 1319 | 1319 | $result = $this->db->query($sql); |
| 1320 | 1320 | if (!$result) |
| 1321 | 1321 | return -1; |
@@ -1342,7 +1342,7 @@ discard block |
||
| 1342 | 1342 | $nbrowsaffected = 0; |
| 1343 | 1343 | $error = 0; |
| 1344 | 1344 | |
| 1345 | - dol_syslog(get_class($this) . "::update notrigger=" . $notrigger . ", nosyncmember=" . $nosyncmember . ", nosyncmemberpass=" . $nosyncmemberpass); |
|
| 1345 | + dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncmember=".$nosyncmember.", nosyncmemberpass=".$nosyncmemberpass); |
|
| 1346 | 1346 | |
| 1347 | 1347 | // Clean parameters |
| 1348 | 1348 | $this->lastname = trim($this->lastname); |
@@ -1370,7 +1370,7 @@ discard block |
||
| 1370 | 1370 | $this->job = trim($this->job); |
| 1371 | 1371 | $this->signature = trim($this->signature); |
| 1372 | 1372 | $this->note = trim($this->note); |
| 1373 | - $this->openid = trim(empty($this->openid) ? '' : $this->openid); // Avoid warning |
|
| 1373 | + $this->openid = trim(empty($this->openid) ? '' : $this->openid); // Avoid warning |
|
| 1374 | 1374 | $this->admin = $this->admin ? $this->admin : 0; |
| 1375 | 1375 | $this->address = empty($this->address) ? '' : $this->address; |
| 1376 | 1376 | $this->zip = empty($this->zip) ? '' : $this->zip; |
@@ -1395,54 +1395,54 @@ discard block |
||
| 1395 | 1395 | $this->db->begin(); |
| 1396 | 1396 | |
| 1397 | 1397 | // Update datas |
| 1398 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user SET"; |
|
| 1399 | - $sql .= " lastname = '" . $this->db->escape($this->lastname) . "'"; |
|
| 1400 | - $sql .= ", firstname = '" . $this->db->escape($this->firstname) . "'"; |
|
| 1401 | - $sql .= ", employee = " . $this->employee; |
|
| 1402 | - $sql .= ", login = '" . $this->db->escape($this->login) . "'"; |
|
| 1403 | - $sql .= ", api_key = " . ($this->api_key ? "'" . $this->db->escape($this->api_key) . "'" : "null"); |
|
| 1404 | - $sql .= ", gender = " . ($this->gender != -1 ? "'" . $this->db->escape($this->gender) . "'" : "null"); // 'man' or 'woman' |
|
| 1405 | - $sql .= ", birth=" . (strval($this->birth) != '' ? "'" . $this->db->idate($this->birth) . "'" : 'null'); |
|
| 1398 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user SET"; |
|
| 1399 | + $sql .= " lastname = '".$this->db->escape($this->lastname)."'"; |
|
| 1400 | + $sql .= ", firstname = '".$this->db->escape($this->firstname)."'"; |
|
| 1401 | + $sql .= ", employee = ".$this->employee; |
|
| 1402 | + $sql .= ", login = '".$this->db->escape($this->login)."'"; |
|
| 1403 | + $sql .= ", api_key = ".($this->api_key ? "'".$this->db->escape($this->api_key)."'" : "null"); |
|
| 1404 | + $sql .= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman' |
|
| 1405 | + $sql .= ", birth=".(strval($this->birth) != '' ? "'".$this->db->idate($this->birth)."'" : 'null'); |
|
| 1406 | 1406 | if (!empty($user->admin)) |
| 1407 | - $sql .= ", admin = " . $this->admin; // admin flag can be set/unset only by an admin user |
|
| 1408 | - $sql .= ", address = '" . $this->db->escape($this->address) . "'"; |
|
| 1409 | - $sql .= ", zip = '" . $this->db->escape($this->zip) . "'"; |
|
| 1410 | - $sql .= ", town = '" . $this->db->escape($this->town) . "'"; |
|
| 1411 | - $sql .= ", fk_state = " . ((!empty($this->state_id) && $this->state_id > 0) ? "'" . $this->db->escape($this->state_id) . "'" : "null"); |
|
| 1412 | - $sql .= ", fk_country = " . ((!empty($this->country_id) && $this->country_id > 0) ? "'" . $this->db->escape($this->country_id) . "'" : "null"); |
|
| 1413 | - $sql .= ", office_phone = '" . $this->db->escape($this->office_phone) . "'"; |
|
| 1414 | - $sql .= ", office_fax = '" . $this->db->escape($this->office_fax) . "'"; |
|
| 1415 | - $sql .= ", user_mobile = '" . $this->db->escape($this->user_mobile) . "'"; |
|
| 1416 | - $sql .= ", email = '" . $this->db->escape($this->email) . "'"; |
|
| 1417 | - $sql .= ", skype = '" . $this->db->escape($this->skype) . "'"; |
|
| 1418 | - $sql .= ", twitter = '" . $this->db->escape($this->twitter) . "'"; |
|
| 1419 | - $sql .= ", facebook = '" . $this->db->escape($this->facebook) . "'"; |
|
| 1420 | - $sql .= ", job = '" . $this->db->escape($this->job) . "'"; |
|
| 1421 | - $sql .= ", signature = '" . $this->db->escape($this->signature) . "'"; |
|
| 1422 | - $sql .= ", accountancy_code = '" . $this->db->escape($this->accountancy_code) . "'"; |
|
| 1423 | - $sql .= ", color = '" . $this->db->escape($this->color) . "'"; |
|
| 1424 | - $sql .= ", dateemployment=" . (strval($this->dateemployment) != '' ? "'" . $this->db->idate($this->dateemployment) . "'" : 'null'); |
|
| 1425 | - $sql .= ", dateemploymentend=" . (strval($this->dateemploymentend) != '' ? "'" . $this->db->idate($this->dateemploymentend) . "'" : 'null'); |
|
| 1426 | - $sql .= ", note = '" . $this->db->escape($this->note) . "'"; |
|
| 1427 | - $sql .= ", photo = " . ($this->photo ? "'" . $this->db->escape($this->photo) . "'" : "null"); |
|
| 1428 | - $sql .= ", openid = " . ($this->openid ? "'" . $this->db->escape($this->openid) . "'" : "null"); |
|
| 1429 | - $sql .= ", fk_user = " . ($this->fk_user > 0 ? "'" . $this->db->escape($this->fk_user) . "'" : "null"); |
|
| 1407 | + $sql .= ", admin = ".$this->admin; // admin flag can be set/unset only by an admin user |
|
| 1408 | + $sql .= ", address = '".$this->db->escape($this->address)."'"; |
|
| 1409 | + $sql .= ", zip = '".$this->db->escape($this->zip)."'"; |
|
| 1410 | + $sql .= ", town = '".$this->db->escape($this->town)."'"; |
|
| 1411 | + $sql .= ", fk_state = ".((!empty($this->state_id) && $this->state_id > 0) ? "'".$this->db->escape($this->state_id)."'" : "null"); |
|
| 1412 | + $sql .= ", fk_country = ".((!empty($this->country_id) && $this->country_id > 0) ? "'".$this->db->escape($this->country_id)."'" : "null"); |
|
| 1413 | + $sql .= ", office_phone = '".$this->db->escape($this->office_phone)."'"; |
|
| 1414 | + $sql .= ", office_fax = '".$this->db->escape($this->office_fax)."'"; |
|
| 1415 | + $sql .= ", user_mobile = '".$this->db->escape($this->user_mobile)."'"; |
|
| 1416 | + $sql .= ", email = '".$this->db->escape($this->email)."'"; |
|
| 1417 | + $sql .= ", skype = '".$this->db->escape($this->skype)."'"; |
|
| 1418 | + $sql .= ", twitter = '".$this->db->escape($this->twitter)."'"; |
|
| 1419 | + $sql .= ", facebook = '".$this->db->escape($this->facebook)."'"; |
|
| 1420 | + $sql .= ", job = '".$this->db->escape($this->job)."'"; |
|
| 1421 | + $sql .= ", signature = '".$this->db->escape($this->signature)."'"; |
|
| 1422 | + $sql .= ", accountancy_code = '".$this->db->escape($this->accountancy_code)."'"; |
|
| 1423 | + $sql .= ", color = '".$this->db->escape($this->color)."'"; |
|
| 1424 | + $sql .= ", dateemployment=".(strval($this->dateemployment) != '' ? "'".$this->db->idate($this->dateemployment)."'" : 'null'); |
|
| 1425 | + $sql .= ", dateemploymentend=".(strval($this->dateemploymentend) != '' ? "'".$this->db->idate($this->dateemploymentend)."'" : 'null'); |
|
| 1426 | + $sql .= ", note = '".$this->db->escape($this->note)."'"; |
|
| 1427 | + $sql .= ", photo = ".($this->photo ? "'".$this->db->escape($this->photo)."'" : "null"); |
|
| 1428 | + $sql .= ", openid = ".($this->openid ? "'".$this->db->escape($this->openid)."'" : "null"); |
|
| 1429 | + $sql .= ", fk_user = ".($this->fk_user > 0 ? "'".$this->db->escape($this->fk_user)."'" : "null"); |
|
| 1430 | 1430 | if (isset($this->thm) || $this->thm != '') |
| 1431 | - $sql .= ", thm= " . ($this->thm != '' ? "'" . $this->db->escape($this->thm) . "'" : "null"); |
|
| 1431 | + $sql .= ", thm= ".($this->thm != '' ? "'".$this->db->escape($this->thm)."'" : "null"); |
|
| 1432 | 1432 | if (isset($this->tjm) || $this->tjm != '') |
| 1433 | - $sql .= ", tjm= " . ($this->tjm != '' ? "'" . $this->db->escape($this->tjm) . "'" : "null"); |
|
| 1433 | + $sql .= ", tjm= ".($this->tjm != '' ? "'".$this->db->escape($this->tjm)."'" : "null"); |
|
| 1434 | 1434 | if (isset($this->salary) || $this->salary != '') |
| 1435 | - $sql .= ", salary= " . ($this->salary != '' ? "'" . $this->db->escape($this->salary) . "'" : "null"); |
|
| 1435 | + $sql .= ", salary= ".($this->salary != '' ? "'".$this->db->escape($this->salary)."'" : "null"); |
|
| 1436 | 1436 | if (isset($this->salaryextra) || $this->salaryextra != '') |
| 1437 | - $sql .= ", salaryextra= " . ($this->salaryextra != '' ? "'" . $this->db->escape($this->salaryextra) . "'" : "null"); |
|
| 1438 | - $sql .= ", weeklyhours= " . ($this->weeklyhours != '' ? "'" . $this->db->escape($this->weeklyhours) . "'" : "null"); |
|
| 1439 | - $sql .= ", entity = '" . $this->db->escape($this->entity) . "'"; |
|
| 1440 | - $sql .= ", default_range = " . ($this->default_range > 0 ? $this->default_range : 'null'); |
|
| 1441 | - $sql .= ", default_c_exp_tax_cat = " . ($this->default_c_exp_tax_cat > 0 ? $this->default_c_exp_tax_cat : 'null'); |
|
| 1437 | + $sql .= ", salaryextra= ".($this->salaryextra != '' ? "'".$this->db->escape($this->salaryextra)."'" : "null"); |
|
| 1438 | + $sql .= ", weeklyhours= ".($this->weeklyhours != '' ? "'".$this->db->escape($this->weeklyhours)."'" : "null"); |
|
| 1439 | + $sql .= ", entity = '".$this->db->escape($this->entity)."'"; |
|
| 1440 | + $sql .= ", default_range = ".($this->default_range > 0 ? $this->default_range : 'null'); |
|
| 1441 | + $sql .= ", default_c_exp_tax_cat = ".($this->default_c_exp_tax_cat > 0 ? $this->default_c_exp_tax_cat : 'null'); |
|
| 1442 | 1442 | |
| 1443 | - $sql .= " WHERE rowid = " . $this->id; |
|
| 1443 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 1444 | 1444 | |
| 1445 | - dol_syslog(get_class($this) . "::update", LOG_DEBUG); |
|
| 1445 | + dol_syslog(get_class($this)."::update", LOG_DEBUG); |
|
| 1446 | 1446 | $resql = $this->db->query($sql); |
| 1447 | 1447 | if ($resql) {
|
| 1448 | 1448 | $nbrowsaffected += $this->db->affected_rows($resql); |
@@ -1459,8 +1459,8 @@ discard block |
||
| 1459 | 1459 | |
| 1460 | 1460 | // If user is linked to a member, remove old link to this member |
| 1461 | 1461 | if ($this->fk_member > 0) {
|
| 1462 | - dol_syslog(get_class($this) . "::update remove link with member. We will recreate it later", LOG_DEBUG); |
|
| 1463 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user SET fk_member = NULL where fk_member = " . $this->fk_member; |
|
| 1462 | + dol_syslog(get_class($this)."::update remove link with member. We will recreate it later", LOG_DEBUG); |
|
| 1463 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL where fk_member = ".$this->fk_member; |
|
| 1464 | 1464 | $resql = $this->db->query($sql); |
| 1465 | 1465 | if (!$resql) {
|
| 1466 | 1466 | $this->error = $this->db->error(); |
@@ -1469,8 +1469,8 @@ discard block |
||
| 1469 | 1469 | } |
| 1470 | 1470 | } |
| 1471 | 1471 | // Set link to user |
| 1472 | - dol_syslog(get_class($this) . "::update set link with member", LOG_DEBUG); |
|
| 1473 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user SET fk_member =" . ($this->fk_member > 0 ? $this->fk_member : 'null') . " where rowid = " . $this->id; |
|
| 1472 | + dol_syslog(get_class($this)."::update set link with member", LOG_DEBUG); |
|
| 1473 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member =".($this->fk_member > 0 ? $this->fk_member : 'null')." where rowid = ".$this->id; |
|
| 1474 | 1474 | $resql = $this->db->query($sql); |
| 1475 | 1475 | if (!$resql) {
|
| 1476 | 1476 | $this->error = $this->db->error(); |
@@ -1480,9 +1480,9 @@ discard block |
||
| 1480 | 1480 | |
| 1481 | 1481 | if ($nbrowsaffected) { // If something has changed in data
|
| 1482 | 1482 | if ($this->fk_member > 0 && !$nosyncmember) {
|
| 1483 | - dol_syslog(get_class($this) . "::update user is linked with a member. We try to update member too.", LOG_DEBUG); |
|
| 1483 | + dol_syslog(get_class($this)."::update user is linked with a member. We try to update member too.", LOG_DEBUG); |
|
| 1484 | 1484 | |
| 1485 | - require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
| 1485 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
| 1486 | 1486 | |
| 1487 | 1487 | // This user is linked with a member, so we also update member information |
| 1488 | 1488 | // if this is an update. |
@@ -1522,7 +1522,7 @@ discard block |
||
| 1522 | 1522 | if ($result < 0) {
|
| 1523 | 1523 | $this->error = $adh->error; |
| 1524 | 1524 | $this->errors = $adh->errors; |
| 1525 | - dol_syslog(get_class($this) . "::update error after calling adh->update to sync it with user: " . $this->error, LOG_ERR); |
|
| 1525 | + dol_syslog(get_class($this)."::update error after calling adh->update to sync it with user: ".$this->error, LOG_ERR); |
|
| 1526 | 1526 | $error++; |
| 1527 | 1527 | } |
| 1528 | 1528 | } else {
|
@@ -1533,9 +1533,9 @@ discard block |
||
| 1533 | 1533 | } |
| 1534 | 1534 | |
| 1535 | 1535 | if ($this->contact_id > 0 && !$nosynccontact) {
|
| 1536 | - dol_syslog(get_class($this) . "::update user is linked with a contact. We try to update contact too.", LOG_DEBUG); |
|
| 1536 | + dol_syslog(get_class($this)."::update user is linked with a contact. We try to update contact too.", LOG_DEBUG); |
|
| 1537 | 1537 | |
| 1538 | - require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
| 1538 | + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
|
| 1539 | 1539 | |
| 1540 | 1540 | // This user is linked with a contact, so we also update contact information |
| 1541 | 1541 | // if this is an update. |
@@ -1575,7 +1575,7 @@ discard block |
||
| 1575 | 1575 | if ($result < 0) {
|
| 1576 | 1576 | $this->error = $tmpobj->error; |
| 1577 | 1577 | $this->errors = $tmpobj->errors; |
| 1578 | - dol_syslog(get_class($this) . "::update error after calling adh->update to sync it with user: " . $this->error, LOG_ERR); |
|
| 1578 | + dol_syslog(get_class($this)."::update error after calling adh->update to sync it with user: ".$this->error, LOG_ERR); |
|
| 1579 | 1579 | $error++; |
| 1580 | 1580 | } |
| 1581 | 1581 | } else {
|
@@ -1609,7 +1609,7 @@ discard block |
||
| 1609 | 1609 | $this->db->commit(); |
| 1610 | 1610 | return $nbrowsaffected; |
| 1611 | 1611 | } else {
|
| 1612 | - dol_syslog(get_class($this) . "::update error=" . $this->error, LOG_ERR); |
|
| 1612 | + dol_syslog(get_class($this)."::update error=".$this->error, LOG_ERR); |
|
| 1613 | 1613 | $this->db->rollback(); |
| 1614 | 1614 | return -1; |
| 1615 | 1615 | } |
@@ -1632,20 +1632,20 @@ discard block |
||
| 1632 | 1632 | // phpcs:enable |
| 1633 | 1633 | $now = dol_now(); |
| 1634 | 1634 | |
| 1635 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user SET"; |
|
| 1635 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user SET"; |
|
| 1636 | 1636 | $sql .= " datepreviouslogin = datelastlogin,"; |
| 1637 | - $sql .= " datelastlogin = '" . $this->db->idate($now) . "',"; |
|
| 1638 | - $sql .= " tms = tms"; // La date de derniere modif doit changer sauf pour la mise a jour de date de derniere connexion |
|
| 1639 | - $sql .= " WHERE rowid = " . $this->id; |
|
| 1637 | + $sql .= " datelastlogin = '".$this->db->idate($now)."',"; |
|
| 1638 | + $sql .= " tms = tms"; // La date de derniere modif doit changer sauf pour la mise a jour de date de derniere connexion |
|
| 1639 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 1640 | 1640 | |
| 1641 | - dol_syslog(get_class($this) . "::update_last_login_date user->id=" . $this->id . " " . $sql, LOG_DEBUG); |
|
| 1641 | + dol_syslog(get_class($this)."::update_last_login_date user->id=".$this->id." ".$sql, LOG_DEBUG); |
|
| 1642 | 1642 | $resql = $this->db->query($sql); |
| 1643 | 1643 | if ($resql) {
|
| 1644 | 1644 | $this->datepreviouslogin = $this->datelastlogin; |
| 1645 | 1645 | $this->datelastlogin = $now; |
| 1646 | 1646 | return 1; |
| 1647 | 1647 | } else {
|
| 1648 | - $this->error = $this->db->lasterror() . ' sql=' . $sql; |
|
| 1648 | + $this->error = $this->db->lasterror().' sql='.$sql; |
|
| 1649 | 1649 | return -1; |
| 1650 | 1650 | } |
| 1651 | 1651 | } |
@@ -1663,11 +1663,11 @@ discard block |
||
| 1663 | 1663 | function setPassword($user, $password = '', $changelater = 0, $notrigger = 0, $nosyncmember = 0) |
| 1664 | 1664 | {
|
| 1665 | 1665 | global $conf, $langs; |
| 1666 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php'; |
|
| 1666 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; |
|
| 1667 | 1667 | |
| 1668 | 1668 | $error = 0; |
| 1669 | 1669 | |
| 1670 | - dol_syslog(get_class($this) . "::setPassword user=" . $user->id . " password=" . preg_replace('/./i', '*', $password) . " changelater=" . $changelater . " notrigger=" . $notrigger . " nosyncmember=" . $nosyncmember, LOG_DEBUG);
|
|
| 1670 | + dol_syslog(get_class($this)."::setPassword user=".$user->id." password=".preg_replace('/./i', '*', $password)." changelater=".$changelater." notrigger=".$notrigger." nosyncmember=".$nosyncmember, LOG_DEBUG);
|
|
| 1671 | 1671 | |
| 1672 | 1672 | // If new password not provided, we generate one |
| 1673 | 1673 | if (!$password) {
|
@@ -1684,17 +1684,17 @@ discard block |
||
| 1684 | 1684 | |
| 1685 | 1685 | $this->db->begin(); |
| 1686 | 1686 | |
| 1687 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
|
| 1688 | - $sql .= " SET pass_crypted = '" . $this->db->escape($password_crypted) . "',"; |
|
| 1687 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; |
|
| 1688 | + $sql .= " SET pass_crypted = '".$this->db->escape($password_crypted)."',"; |
|
| 1689 | 1689 | $sql .= " pass_temp = null"; |
| 1690 | 1690 | if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) {
|
| 1691 | 1691 | $sql .= ", pass = null"; |
| 1692 | 1692 | } else {
|
| 1693 | - $sql .= ", pass = '" . $this->db->escape($password) . "'"; |
|
| 1693 | + $sql .= ", pass = '".$this->db->escape($password)."'"; |
|
| 1694 | 1694 | } |
| 1695 | - $sql .= " WHERE rowid = " . $this->id; |
|
| 1695 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 1696 | 1696 | |
| 1697 | - dol_syslog(get_class($this) . "::setPassword", LOG_DEBUG); |
|
| 1697 | + dol_syslog(get_class($this)."::setPassword", LOG_DEBUG); |
|
| 1698 | 1698 | $result = $this->db->query($sql); |
| 1699 | 1699 | if ($result) {
|
| 1700 | 1700 | if ($this->db->affected_rows($result)) {
|
@@ -1703,7 +1703,7 @@ discard block |
||
| 1703 | 1703 | $this->pass_indatabase_crypted = $password_crypted; |
| 1704 | 1704 | |
| 1705 | 1705 | if ($this->fk_member && !$nosyncmember) {
|
| 1706 | - require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
| 1706 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
| 1707 | 1707 | |
| 1708 | 1708 | // This user is linked with a member, so we also update members informations |
| 1709 | 1709 | // if this is an update. |
@@ -1714,7 +1714,7 @@ discard block |
||
| 1714 | 1714 | $result = $adh->setPassword($user, $this->pass, (empty($conf->global->DATABASE_PWD_ENCRYPTED) ? 0 : 1), 1); // Cryptage non gere dans module adherent |
| 1715 | 1715 | if ($result < 0) {
|
| 1716 | 1716 | $this->error = $adh->error; |
| 1717 | - dol_syslog(get_class($this) . "::setPassword " . $this->error, LOG_ERR); |
|
| 1717 | + dol_syslog(get_class($this)."::setPassword ".$this->error, LOG_ERR); |
|
| 1718 | 1718 | $error++; |
| 1719 | 1719 | } |
| 1720 | 1720 | } else {
|
@@ -1723,7 +1723,7 @@ discard block |
||
| 1723 | 1723 | } |
| 1724 | 1724 | } |
| 1725 | 1725 | |
| 1726 | - dol_syslog(get_class($this) . "::setPassword notrigger=" . $notrigger . " error=" . $error, LOG_DEBUG); |
|
| 1726 | + dol_syslog(get_class($this)."::setPassword notrigger=".$notrigger." error=".$error, LOG_DEBUG); |
|
| 1727 | 1727 | |
| 1728 | 1728 | if (!$error && !$notrigger) {
|
| 1729 | 1729 | // Call trigger |
@@ -1750,11 +1750,11 @@ discard block |
||
| 1750 | 1750 | } else {
|
| 1751 | 1751 | // We store clear password in password temporary field. |
| 1752 | 1752 | // After receiving confirmation link, we will crypt it and store it in pass_crypted |
| 1753 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
|
| 1754 | - $sql .= " SET pass_temp = '" . $this->db->escape($password) . "'"; |
|
| 1755 | - $sql .= " WHERE rowid = " . $this->id; |
|
| 1753 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; |
|
| 1754 | + $sql .= " SET pass_temp = '".$this->db->escape($password)."'"; |
|
| 1755 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 1756 | 1756 | |
| 1757 | - dol_syslog(get_class($this) . "::setPassword", LOG_DEBUG); // No log |
|
| 1757 | + dol_syslog(get_class($this)."::setPassword", LOG_DEBUG); // No log |
|
| 1758 | 1758 | $result = $this->db->query($sql); |
| 1759 | 1759 | if ($result) {
|
| 1760 | 1760 | return $password; |
@@ -1780,7 +1780,7 @@ discard block |
||
| 1780 | 1780 | global $conf, $langs; |
| 1781 | 1781 | global $dolibarr_main_url_root; |
| 1782 | 1782 | |
| 1783 | - require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; |
|
| 1783 | + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; |
|
| 1784 | 1784 | |
| 1785 | 1785 | $msgishtml = 0; |
| 1786 | 1786 | |
@@ -1804,36 +1804,36 @@ discard block |
||
| 1804 | 1804 | $subject = $outputlangs->transnoentitiesnoconv("SubjectNewPassword", $appli);
|
| 1805 | 1805 | |
| 1806 | 1806 | // Define $urlwithroot |
| 1807 | - $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', trim($dolibarr_main_url_root));
|
|
| 1808 | - $urlwithroot = $urlwithouturlroot . DOL_URL_ROOT; // This is to use external domain name found into config file |
|
| 1807 | + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
|
| 1808 | + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file |
|
| 1809 | 1809 | |
| 1810 | 1810 | if (!$changelater) {
|
| 1811 | - $url = $urlwithroot . '/'; |
|
| 1811 | + $url = $urlwithroot.'/'; |
|
| 1812 | 1812 | |
| 1813 | - $mesg .= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived") . ".\n";
|
|
| 1814 | - $mesg .= $outputlangs->transnoentitiesnoconv("NewKeyIs") . " :\n\n";
|
|
| 1815 | - $mesg .= $outputlangs->transnoentitiesnoconv("Login") . " = " . $this->login . "\n";
|
|
| 1816 | - $mesg .= $outputlangs->transnoentitiesnoconv("Password") . " = " . $password . "\n\n";
|
|
| 1813 | + $mesg .= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived").".\n";
|
|
| 1814 | + $mesg .= $outputlangs->transnoentitiesnoconv("NewKeyIs")." :\n\n";
|
|
| 1815 | + $mesg .= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n";
|
|
| 1816 | + $mesg .= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n";
|
|
| 1817 | 1817 | $mesg .= "\n"; |
| 1818 | 1818 | |
| 1819 | - $mesg .= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $appli) . ': ' . $url . "\n\n";
|
|
| 1819 | + $mesg .= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $appli).': '.$url."\n\n";
|
|
| 1820 | 1820 | $mesg .= "--\n"; |
| 1821 | 1821 | $mesg .= $user->getFullName($outputlangs); // Username that make then sending |
| 1822 | 1822 | |
| 1823 | - dol_syslog(get_class($this) . "::send_password changelater is off, url=" . $url); |
|
| 1823 | + dol_syslog(get_class($this)."::send_password changelater is off, url=".$url); |
|
| 1824 | 1824 | } else {
|
| 1825 | - $url = $urlwithroot . '/user/passwordforgotten.php?action=validatenewpassword&username=' . $this->login . "&passwordhash=" . dol_hash($password); |
|
| 1825 | + $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordhash=".dol_hash($password); |
|
| 1826 | 1826 | |
| 1827 | - $mesg .= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived") . "\n";
|
|
| 1828 | - $mesg .= $outputlangs->transnoentitiesnoconv("NewKeyWillBe") . " :\n\n";
|
|
| 1829 | - $mesg .= $outputlangs->transnoentitiesnoconv("Login") . " = " . $this->login . "\n";
|
|
| 1830 | - $mesg .= $outputlangs->transnoentitiesnoconv("Password") . " = " . $password . "\n\n";
|
|
| 1827 | + $mesg .= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived")."\n";
|
|
| 1828 | + $mesg .= $outputlangs->transnoentitiesnoconv("NewKeyWillBe")." :\n\n";
|
|
| 1829 | + $mesg .= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n";
|
|
| 1830 | + $mesg .= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n";
|
|
| 1831 | 1831 | $mesg .= "\n"; |
| 1832 | - $mesg .= $outputlangs->transnoentitiesnoconv("YouMustClickToChange") . " :\n";
|
|
| 1833 | - $mesg .= $url . "\n\n"; |
|
| 1834 | - $mesg .= $outputlangs->transnoentitiesnoconv("ForgetIfNothing") . "\n\n";
|
|
| 1832 | + $mesg .= $outputlangs->transnoentitiesnoconv("YouMustClickToChange")." :\n";
|
|
| 1833 | + $mesg .= $url."\n\n"; |
|
| 1834 | + $mesg .= $outputlangs->transnoentitiesnoconv("ForgetIfNothing")."\n\n";
|
|
| 1835 | 1835 | |
| 1836 | - dol_syslog(get_class($this) . "::send_password changelater is on, url=" . $url); |
|
| 1836 | + dol_syslog(get_class($this)."::send_password changelater is on, url=".$url); |
|
| 1837 | 1837 | } |
| 1838 | 1838 | |
| 1839 | 1839 | $mailfile = new CMailFile( |
@@ -1844,7 +1844,7 @@ discard block |
||
| 1844 | 1844 | return 1; |
| 1845 | 1845 | } else {
|
| 1846 | 1846 | $langs->trans("errors");
|
| 1847 | - $this->error = $langs->trans("ErrorFailedToSendPassword") . ' ' . $mailfile->error;
|
|
| 1847 | + $this->error = $langs->trans("ErrorFailedToSendPassword").' '.$mailfile->error;
|
|
| 1848 | 1848 | return -1; |
| 1849 | 1849 | } |
| 1850 | 1850 | } |
@@ -1869,8 +1869,8 @@ discard block |
||
| 1869 | 1869 | {
|
| 1870 | 1870 | // phpcs:enable |
| 1871 | 1871 | $sql = "SELECT url, login, pass, poste "; |
| 1872 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user_clicktodial as u"; |
|
| 1873 | - $sql .= " WHERE u.fk_user = " . $this->id; |
|
| 1872 | + $sql .= " FROM ".MAIN_DB_PREFIX."user_clicktodial as u"; |
|
| 1873 | + $sql .= " WHERE u.fk_user = ".$this->id; |
|
| 1874 | 1874 | |
| 1875 | 1875 | $resql = $this->db->query($sql); |
| 1876 | 1876 | if ($resql) {
|
@@ -1904,21 +1904,21 @@ discard block |
||
| 1904 | 1904 | // phpcs:enable |
| 1905 | 1905 | $this->db->begin(); |
| 1906 | 1906 | |
| 1907 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_clicktodial"; |
|
| 1908 | - $sql .= " WHERE fk_user = " . $this->id; |
|
| 1907 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_clicktodial"; |
|
| 1908 | + $sql .= " WHERE fk_user = ".$this->id; |
|
| 1909 | 1909 | |
| 1910 | - dol_syslog(get_class($this) . '::update_clicktodial', LOG_DEBUG); |
|
| 1910 | + dol_syslog(get_class($this).'::update_clicktodial', LOG_DEBUG); |
|
| 1911 | 1911 | $result = $this->db->query($sql); |
| 1912 | 1912 | |
| 1913 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user_clicktodial"; |
|
| 1913 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_clicktodial"; |
|
| 1914 | 1914 | $sql .= " (fk_user,url,login,pass,poste)"; |
| 1915 | - $sql .= " VALUES (" . $this->id;
|
|
| 1916 | - $sql .= ", '" . $this->db->escape($this->clicktodial_url) . "'"; |
|
| 1917 | - $sql .= ", '" . $this->db->escape($this->clicktodial_login) . "'"; |
|
| 1918 | - $sql .= ", '" . $this->db->escape($this->clicktodial_password) . "'"; |
|
| 1919 | - $sql .= ", '" . $this->db->escape($this->clicktodial_poste) . "')"; |
|
| 1915 | + $sql .= " VALUES (".$this->id;
|
|
| 1916 | + $sql .= ", '".$this->db->escape($this->clicktodial_url)."'"; |
|
| 1917 | + $sql .= ", '".$this->db->escape($this->clicktodial_login)."'"; |
|
| 1918 | + $sql .= ", '".$this->db->escape($this->clicktodial_password)."'"; |
|
| 1919 | + $sql .= ", '".$this->db->escape($this->clicktodial_poste)."')"; |
|
| 1920 | 1920 | |
| 1921 | - dol_syslog(get_class($this) . '::update_clicktodial', LOG_DEBUG); |
|
| 1921 | + dol_syslog(get_class($this).'::update_clicktodial', LOG_DEBUG); |
|
| 1922 | 1922 | $result = $this->db->query($sql); |
| 1923 | 1923 | if ($result) {
|
| 1924 | 1924 | $this->db->commit(); |
@@ -1948,20 +1948,20 @@ discard block |
||
| 1948 | 1948 | |
| 1949 | 1949 | $this->db->begin(); |
| 1950 | 1950 | |
| 1951 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "usergroup_user"; |
|
| 1952 | - $sql .= " WHERE fk_user = " . $this->id; |
|
| 1953 | - $sql .= " AND fk_usergroup = " . $group; |
|
| 1954 | - $sql .= " AND entity = " . $entity; |
|
| 1951 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_user"; |
|
| 1952 | + $sql .= " WHERE fk_user = ".$this->id; |
|
| 1953 | + $sql .= " AND fk_usergroup = ".$group; |
|
| 1954 | + $sql .= " AND entity = ".$entity; |
|
| 1955 | 1955 | |
| 1956 | 1956 | $result = $this->db->query($sql); |
| 1957 | 1957 | |
| 1958 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "usergroup_user (entity, fk_user, fk_usergroup)"; |
|
| 1959 | - $sql .= " VALUES (" . $entity . "," . $this->id . "," . $group . ")";
|
|
| 1958 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."usergroup_user (entity, fk_user, fk_usergroup)"; |
|
| 1959 | + $sql .= " VALUES (".$entity.",".$this->id.",".$group.")";
|
|
| 1960 | 1960 | |
| 1961 | 1961 | $result = $this->db->query($sql); |
| 1962 | 1962 | if ($result) {
|
| 1963 | 1963 | if (!$error && !$notrigger) {
|
| 1964 | - $this->newgroupid = $group; // deprecated. Remove this. |
|
| 1964 | + $this->newgroupid = $group; // deprecated. Remove this. |
|
| 1965 | 1965 | $this->context = array('audit' => $langs->trans("UserSetInGroup"), 'newgroupid' => $group);
|
| 1966 | 1966 | |
| 1967 | 1967 | // Call trigger |
@@ -1976,7 +1976,7 @@ discard block |
||
| 1976 | 1976 | $this->db->commit(); |
| 1977 | 1977 | return 1; |
| 1978 | 1978 | } else {
|
| 1979 | - dol_syslog(get_class($this) . "::SetInGroup " . $this->error, LOG_ERR); |
|
| 1979 | + dol_syslog(get_class($this)."::SetInGroup ".$this->error, LOG_ERR); |
|
| 1980 | 1980 | $this->db->rollback(); |
| 1981 | 1981 | return -2; |
| 1982 | 1982 | } |
@@ -2005,15 +2005,15 @@ discard block |
||
| 2005 | 2005 | |
| 2006 | 2006 | $this->db->begin(); |
| 2007 | 2007 | |
| 2008 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "usergroup_user"; |
|
| 2009 | - $sql .= " WHERE fk_user = " . $this->id; |
|
| 2010 | - $sql .= " AND fk_usergroup = " . $group; |
|
| 2011 | - $sql .= " AND entity = " . $entity; |
|
| 2008 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_user"; |
|
| 2009 | + $sql .= " WHERE fk_user = ".$this->id; |
|
| 2010 | + $sql .= " AND fk_usergroup = ".$group; |
|
| 2011 | + $sql .= " AND entity = ".$entity; |
|
| 2012 | 2012 | |
| 2013 | 2013 | $result = $this->db->query($sql); |
| 2014 | 2014 | if ($result) {
|
| 2015 | 2015 | if (!$error && !$notrigger) {
|
| 2016 | - $this->oldgroupid = $group; // deprecated. Remove this. |
|
| 2016 | + $this->oldgroupid = $group; // deprecated. Remove this. |
|
| 2017 | 2017 | $this->context = array('audit' => $langs->trans("UserRemovedFromGroup"), 'oldgroupid' => $group);
|
| 2018 | 2018 | |
| 2019 | 2019 | // Call trigger |
@@ -2029,7 +2029,7 @@ discard block |
||
| 2029 | 2029 | return 1; |
| 2030 | 2030 | } else {
|
| 2031 | 2031 | $this->error = $interface->error; |
| 2032 | - dol_syslog(get_class($this) . "::RemoveFromGroup " . $this->error, LOG_ERR); |
|
| 2032 | + dol_syslog(get_class($this)."::RemoveFromGroup ".$this->error, LOG_ERR); |
|
| 2033 | 2033 | $this->db->rollback(); |
| 2034 | 2034 | return -2; |
| 2035 | 2035 | } |
@@ -2052,7 +2052,7 @@ discard block |
||
| 2052 | 2052 | */ |
| 2053 | 2053 | function getPhotoUrl($width, $height, $cssclass = '', $imagesize = '') |
| 2054 | 2054 | {
|
| 2055 | - $result = '<a href="' . DOL_URL_ROOT . '/user/card.php?id=' . $this->id . '">'; |
|
| 2055 | + $result = '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">'; |
|
| 2056 | 2056 | $result .= Form::showphoto('userphoto', $this, $width, $height, 0, $cssclass, $imagesize);
|
| 2057 | 2057 | $result .= '</a>'; |
| 2058 | 2058 | |
@@ -2102,56 +2102,56 @@ discard block |
||
| 2102 | 2102 | |
| 2103 | 2103 | // Info Login |
| 2104 | 2104 | $label .= '<div class="centpercent">'; |
| 2105 | - $label .= '<u>' . $langs->trans("User") . '</u><br>';
|
|
| 2106 | - $label .= '<b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs, '');
|
|
| 2105 | + $label .= '<u>'.$langs->trans("User").'</u><br>';
|
|
| 2106 | + $label .= '<b>'.$langs->trans('Name').':</b> '.$this->getFullName($langs, '');
|
|
| 2107 | 2107 | if (!empty($this->login)) {
|
| 2108 | - $label .= '<br><b>' . $langs->trans('Login') . ':</b> ' . $this->login;
|
|
| 2108 | + $label .= '<br><b>'.$langs->trans('Login').':</b> '.$this->login;
|
|
| 2109 | 2109 | } |
| 2110 | - $label .= '<br><b>' . $langs->trans("EMail") . ':</b> ' . $this->email;
|
|
| 2110 | + $label .= '<br><b>'.$langs->trans("EMail").':</b> '.$this->email;
|
|
| 2111 | 2111 | if (!empty($this->admin)) {
|
| 2112 | - $label .= '<br><b>' . $langs->trans("Administrator") . '</b>: ' . yn($this->admin);
|
|
| 2112 | + $label .= '<br><b>'.$langs->trans("Administrator").'</b>: '.yn($this->admin);
|
|
| 2113 | 2113 | } |
| 2114 | 2114 | if (!empty($this->socid)) { // Add thirdparty for external users
|
| 2115 | 2115 | $thirdpartystatic = new Societe($db); |
| 2116 | 2116 | $thirdpartystatic->fetch($this->socid); |
| 2117 | 2117 | if (empty($hidethirdpartylogo)) {
|
| 2118 | - $companylink = ' ' . $thirdpartystatic->getNomUrl(2, (($option == 'nolink') ? 'nolink' : '')); // picto only of company |
|
| 2118 | + $companylink = ' '.$thirdpartystatic->getNomUrl(2, (($option == 'nolink') ? 'nolink' : '')); // picto only of company |
|
| 2119 | 2119 | } |
| 2120 | - $company = ' (' . $langs->trans("Company") . ': ' . $thirdpartystatic->name . ')';
|
|
| 2120 | + $company = ' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')';
|
|
| 2121 | 2121 | } |
| 2122 | - $type = ($this->socid ? $langs->trans("External") . $company : $langs->trans("Internal"));
|
|
| 2123 | - $label .= '<br><b>' . $langs->trans("Type") . ':</b> ' . $type;
|
|
| 2124 | - $label .= '<br><b>' . $langs->trans("Status") . '</b>: ' . $this->getLibStatut(0);
|
|
| 2122 | + $type = ($this->socid ? $langs->trans("External").$company : $langs->trans("Internal"));
|
|
| 2123 | + $label .= '<br><b>'.$langs->trans("Type").':</b> '.$type;
|
|
| 2124 | + $label .= '<br><b>'.$langs->trans("Status").'</b>: '.$this->getLibStatut(0);
|
|
| 2125 | 2125 | $label .= '</div>'; |
| 2126 | 2126 | if ($infologin > 0) {
|
| 2127 | 2127 | $label .= '<br>'; |
| 2128 | - $label .= '<br><u>' . $langs->trans("Connection") . '</u>';
|
|
| 2129 | - $label .= '<br><b>' . $langs->trans("IPAddress") . '</b>: ' . $_SERVER["REMOTE_ADDR"];
|
|
| 2128 | + $label .= '<br><u>'.$langs->trans("Connection").'</u>';
|
|
| 2129 | + $label .= '<br><b>'.$langs->trans("IPAddress").'</b>: '.$_SERVER["REMOTE_ADDR"];
|
|
| 2130 | 2130 | if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) |
| 2131 | - $label .= '<br><b>' . $langs->trans("ConnectedOnMultiCompany") . ':</b> ' . $conf->entity . ' (user entity ' . $this->entity . ')';
|
|
| 2132 | - $label .= '<br><b>' . $langs->trans("AuthenticationMode") . ':</b> ' . $_SESSION["dol_authmode"] . (empty($dolibarr_main_demo) ? '' : ' (demo)');
|
|
| 2133 | - $label .= '<br><b>' . $langs->trans("ConnectedSince") . ':</b> ' . dol_print_date($this->datelastlogin, "dayhour", 'tzuser');
|
|
| 2134 | - $label .= '<br><b>' . $langs->trans("PreviousConnexion") . ':</b> ' . dol_print_date($this->datepreviouslogin, "dayhour", 'tzuser');
|
|
| 2135 | - $label .= '<br><b>' . $langs->trans("CurrentTheme") . ':</b> ' . $conf->theme;
|
|
| 2136 | - $label .= '<br><b>' . $langs->trans("CurrentMenuManager") . ':</b> ' . $menumanager->name;
|
|
| 2131 | + $label .= '<br><b>'.$langs->trans("ConnectedOnMultiCompany").':</b> '.$conf->entity.' (user entity '.$this->entity.')';
|
|
| 2132 | + $label .= '<br><b>'.$langs->trans("AuthenticationMode").':</b> '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo) ? '' : ' (demo)');
|
|
| 2133 | + $label .= '<br><b>'.$langs->trans("ConnectedSince").':</b> '.dol_print_date($this->datelastlogin, "dayhour", 'tzuser');
|
|
| 2134 | + $label .= '<br><b>'.$langs->trans("PreviousConnexion").':</b> '.dol_print_date($this->datepreviouslogin, "dayhour", 'tzuser');
|
|
| 2135 | + $label .= '<br><b>'.$langs->trans("CurrentTheme").':</b> '.$conf->theme;
|
|
| 2136 | + $label .= '<br><b>'.$langs->trans("CurrentMenuManager").':</b> '.$menumanager->name;
|
|
| 2137 | 2137 | $s = picto_from_langcode($langs->getDefaultLang()); |
| 2138 | - $label .= '<br><b>' . $langs->trans("CurrentUserLanguage") . ':</b> ' . ($s ? $s . ' ' : '') . $langs->getDefaultLang();
|
|
| 2139 | - $label .= '<br><b>' . $langs->trans("Browser") . ':</b> ' . $conf->browser->name . ($conf->browser->version ? ' ' . $conf->browser->version : '') . ' (' . $_SERVER['HTTP_USER_AGENT'] . ')';
|
|
| 2140 | - $label .= '<br><b>' . $langs->trans("Layout") . ':</b> ' . $conf->browser->layout;
|
|
| 2141 | - $label .= '<br><b>' . $langs->trans("Screen") . ':</b> ' . $_SESSION['dol_screenwidth'] . ' x ' . $_SESSION['dol_screenheight'];
|
|
| 2138 | + $label .= '<br><b>'.$langs->trans("CurrentUserLanguage").':</b> '.($s ? $s.' ' : '').$langs->getDefaultLang();
|
|
| 2139 | + $label .= '<br><b>'.$langs->trans("Browser").':</b> '.$conf->browser->name.($conf->browser->version ? ' '.$conf->browser->version : '').' ('.$_SERVER['HTTP_USER_AGENT'].')';
|
|
| 2140 | + $label .= '<br><b>'.$langs->trans("Layout").':</b> '.$conf->browser->layout;
|
|
| 2141 | + $label .= '<br><b>'.$langs->trans("Screen").':</b> '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight'];
|
|
| 2142 | 2142 | if ($conf->browser->layout == 'phone') |
| 2143 | - $label .= '<br><b>' . $langs->trans("Phone") . ':</b> ' . $langs->trans("Yes");
|
|
| 2143 | + $label .= '<br><b>'.$langs->trans("Phone").':</b> '.$langs->trans("Yes");
|
|
| 2144 | 2144 | if (!empty($_SESSION["disablemodules"])) |
| 2145 | - $label .= '<br><b>' . $langs->trans("DisabledModules") . ':</b> <br>' . join(', ', explode(',', $_SESSION["disablemodules"]));
|
|
| 2145 | + $label .= '<br><b>'.$langs->trans("DisabledModules").':</b> <br>'.join(', ', explode(',', $_SESSION["disablemodules"]));
|
|
| 2146 | 2146 | } |
| 2147 | 2147 | if ($infologin < 0) |
| 2148 | 2148 | $label = ''; |
| 2149 | 2149 | |
| 2150 | 2150 | // $url = DOL_URL_ROOT . '/user/card.php?id=' . $this->id; |
| 2151 | - $url = BASE_URI . '?controller=user&method=card&id=' . $this->id; |
|
| 2151 | + $url = BASE_URI.'?controller=user&method=card&id='.$this->id; |
|
| 2152 | 2152 | if ($option == 'leave') {
|
| 2153 | 2153 | //$url = DOL_URL_ROOT . '/holiday/list.php?id=' . $this->id; |
| 2154 | - $url = BASE_URI . '?controller=holiday&method=list&id=' . $this->id; |
|
| 2154 | + $url = BASE_URI.'?controller=holiday&method=list&id='.$this->id; |
|
| 2155 | 2155 | } |
| 2156 | 2156 | if ($option != 'nolink') {
|
| 2157 | 2157 | // Add param to save lastsearch_values or not |
@@ -2162,16 +2162,16 @@ discard block |
||
| 2162 | 2162 | $url .= '&save_lastsearch_values=1'; |
| 2163 | 2163 | } |
| 2164 | 2164 | |
| 2165 | - $linkstart = '<a href="' . $url . '"'; |
|
| 2165 | + $linkstart = '<a href="'.$url.'"'; |
|
| 2166 | 2166 | $linkclose = ""; |
| 2167 | 2167 | if (empty($notooltip)) {
|
| 2168 | 2168 | if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
| 2169 | 2169 | $langs->load("users");
|
| 2170 | 2170 | $label = $langs->trans("ShowUser");
|
| 2171 | - $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"'; |
|
| 2171 | + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
|
| 2172 | 2172 | } |
| 2173 | - $linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"'; |
|
| 2174 | - $linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"'; |
|
| 2173 | + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
|
| 2174 | + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
|
| 2175 | 2175 | |
| 2176 | 2176 | /* |
| 2177 | 2177 | $hookmanager->initHooks(array('userdao'));
|
@@ -2181,7 +2181,7 @@ discard block |
||
| 2181 | 2181 | */ |
| 2182 | 2182 | } |
| 2183 | 2183 | |
| 2184 | - $linkstart .= $linkclose . '>'; |
|
| 2184 | + $linkstart .= $linkclose.'>'; |
|
| 2185 | 2185 | $linkend = '</a>'; |
| 2186 | 2186 | |
| 2187 | 2187 | //if ($withpictoimg == -1) $result.='<div class="nowrap">'; |
@@ -2192,15 +2192,15 @@ discard block |
||
| 2192 | 2192 | $paddafterimage = 'style="margin-right: 3px;"'; |
| 2193 | 2193 | // Only picto |
| 2194 | 2194 | if ($withpictoimg > 0) |
| 2195 | - $picto = '<!-- picto user --><div class="inline-block nopadding userimg' . ($morecss ? ' ' . $morecss : '') . '">' . img_object('', 'user', $paddafterimage . ' ' . ($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1) . '</div>';
|
|
| 2195 | + $picto = '<!-- picto user --><div class="inline-block nopadding userimg'.($morecss ? ' '.$morecss : '').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1).'</div>';
|
|
| 2196 | 2196 | // Picto must be a photo |
| 2197 | 2197 | else |
| 2198 | - $picto = '<!-- picto photo user --><div class="inline-block nopadding userimg' . ($morecss ? ' ' . $morecss : '') . '"' . ($paddafterimage ? ' ' . $paddafterimage : '') . '>' . Form::showphoto('userphoto', $this, 0, 0, 0, 'userphoto' . ($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1) . '</div>';
|
|
| 2198 | + $picto = '<!-- picto photo user --><div class="inline-block nopadding userimg'.($morecss ? ' '.$morecss : '').'"'.($paddafterimage ? ' '.$paddafterimage : '').'>'.Form::showphoto('userphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1).'</div>';
|
|
| 2199 | 2199 | $result .= $picto; |
| 2200 | 2200 | } |
| 2201 | 2201 | if ($withpictoimg > -2 && $withpictoimg != 2) {
|
| 2202 | 2202 | if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) |
| 2203 | - $result .= '<div class="inline-block nopadding valignmiddle usertext' . ((!isset($this->statut) || $this->statut) ? '' : ' strikefordisabled') . ($morecss ? ' ' . $morecss : '') . '">'; |
|
| 2203 | + $result .= '<div class="inline-block nopadding valignmiddle usertext'.((!isset($this->statut) || $this->statut) ? '' : ' strikefordisabled').($morecss ? ' '.$morecss : '').'">'; |
|
| 2204 | 2204 | if ($mode == 'login') |
| 2205 | 2205 | $result .= dol_trunc($this->login, $maxlen); |
| 2206 | 2206 | else |
@@ -2216,7 +2216,7 @@ discard block |
||
| 2216 | 2216 | global $action; |
| 2217 | 2217 | $hookmanager->initHooks(array('userdao'));
|
| 2218 | 2218 | $parameters = array('id' => $this->id, 'getnomurl' => $result);
|
| 2219 | - $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
|
| 2219 | + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
|
| 2220 | 2220 | if ($reshook > 0) {
|
| 2221 | 2221 | $result = $hookmanager->resPrint; |
| 2222 | 2222 | } else {
|
@@ -2240,7 +2240,7 @@ discard block |
||
| 2240 | 2240 | $result = ''; |
| 2241 | 2241 | |
| 2242 | 2242 | // $linkstart = '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">'; |
| 2243 | - $linkstart = '<a href="' . BASE_URI . '?controller=user&method=card&id=' . $this->id . '">'; |
|
| 2243 | + $linkstart = '<a href="'.BASE_URI.'?controller=user&method=card&id='.$this->id.'">'; |
|
| 2244 | 2244 | $linkend = '</a>'; |
| 2245 | 2245 | |
| 2246 | 2246 | //Check user's rights to see an other user |
@@ -2249,7 +2249,7 @@ discard block |
||
| 2249 | 2249 | |
| 2250 | 2250 | if ($option == 'xxx') {
|
| 2251 | 2251 | //$linkstart = '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">'; |
| 2252 | - $linkstart = '<a href="' . BASE_URI . '?controller=user&method=card.php&id=' . $this->id . '">'; |
|
| 2252 | + $linkstart = '<a href="'.BASE_URI.'?controller=user&method=card.php&id='.$this->id.'">'; |
|
| 2253 | 2253 | $linkend = '</a>'; |
| 2254 | 2254 | } |
| 2255 | 2255 | |
@@ -2305,9 +2305,9 @@ discard block |
||
| 2305 | 2305 | } |
| 2306 | 2306 | elseif ($mode == 2) {
|
| 2307 | 2307 | if ($statut == 1) |
| 2308 | - return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"') . ' ' . $langs->trans('Enabled');
|
|
| 2308 | + return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"').' '.$langs->trans('Enabled');
|
|
| 2309 | 2309 | elseif ($statut == 0) |
| 2310 | - return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"') . ' ' . $langs->trans('Disabled');
|
|
| 2310 | + return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"').' '.$langs->trans('Disabled');
|
|
| 2311 | 2311 | } |
| 2312 | 2312 | elseif ($mode == 3) {
|
| 2313 | 2313 | if ($statut == 1) |
@@ -2317,15 +2317,15 @@ discard block |
||
| 2317 | 2317 | } |
| 2318 | 2318 | elseif ($mode == 4) {
|
| 2319 | 2319 | if ($statut == 1) |
| 2320 | - return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"') . ' ' . $langs->trans('Enabled');
|
|
| 2320 | + return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"').' '.$langs->trans('Enabled');
|
|
| 2321 | 2321 | elseif ($statut == 0) |
| 2322 | - return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"') . ' ' . $langs->trans('Disabled');
|
|
| 2322 | + return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"').' '.$langs->trans('Disabled');
|
|
| 2323 | 2323 | } |
| 2324 | 2324 | elseif ($mode == 5) {
|
| 2325 | 2325 | if ($statut == 1) |
| 2326 | - return $langs->trans('Enabled') . ' ' . img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"');
|
|
| 2326 | + return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"');
|
|
| 2327 | 2327 | elseif ($statut == 0) |
| 2328 | - return $langs->trans('Disabled') . ' ' . img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"');
|
|
| 2328 | + return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"');
|
|
| 2329 | 2329 | } |
| 2330 | 2330 | } |
| 2331 | 2331 | |
@@ -2345,11 +2345,11 @@ discard block |
||
| 2345 | 2345 | global $conf; |
| 2346 | 2346 | $dn = ''; |
| 2347 | 2347 | if ($mode == 0) |
| 2348 | - $dn = $conf->global->LDAP_KEY_USERS . "=" . $info[$conf->global->LDAP_KEY_USERS] . "," . $conf->global->LDAP_USER_DN; |
|
| 2348 | + $dn = $conf->global->LDAP_KEY_USERS."=".$info[$conf->global->LDAP_KEY_USERS].",".$conf->global->LDAP_USER_DN; |
|
| 2349 | 2349 | elseif ($mode == 1) |
| 2350 | 2350 | $dn = $conf->global->LDAP_USER_DN; |
| 2351 | 2351 | elseif ($mode == 2) |
| 2352 | - $dn = $conf->global->LDAP_KEY_USERS . "=" . $info[$conf->global->LDAP_KEY_USERS]; |
|
| 2352 | + $dn = $conf->global->LDAP_KEY_USERS."=".$info[$conf->global->LDAP_KEY_USERS]; |
|
| 2353 | 2353 | return $dn; |
| 2354 | 2354 | } |
| 2355 | 2355 | |
@@ -2532,8 +2532,8 @@ discard block |
||
| 2532 | 2532 | {
|
| 2533 | 2533 | $sql = "SELECT u.rowid, u.login as ref, u.datec,"; |
| 2534 | 2534 | $sql .= " u.tms as date_modification, u.entity"; |
| 2535 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user as u"; |
|
| 2536 | - $sql .= " WHERE u.rowid = " . $id; |
|
| 2535 | + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; |
|
| 2536 | + $sql .= " WHERE u.rowid = ".$id; |
|
| 2537 | 2537 | |
| 2538 | 2538 | $result = $this->db->query($sql); |
| 2539 | 2539 | if ($result) {
|
@@ -2562,9 +2562,9 @@ discard block |
||
| 2562 | 2562 | function getNbOfEMailings() |
| 2563 | 2563 | {
|
| 2564 | 2564 | $sql = "SELECT count(mc.email) as nb"; |
| 2565 | - $sql .= " FROM " . MAIN_DB_PREFIX . "mailing_cibles as mc"; |
|
| 2566 | - $sql .= " WHERE mc.email = '" . $this->db->escape($this->email) . "'"; |
|
| 2567 | - $sql .= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes |
|
| 2565 | + $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; |
|
| 2566 | + $sql .= " WHERE mc.email = '".$this->db->escape($this->email)."'"; |
|
| 2567 | + $sql .= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes |
|
| 2568 | 2568 | |
| 2569 | 2569 | $resql = $this->db->query($sql); |
| 2570 | 2570 | if ($resql) {
|
@@ -2592,18 +2592,18 @@ discard block |
||
| 2592 | 2592 | global $conf; |
| 2593 | 2593 | |
| 2594 | 2594 | $sql = "SELECT count(rowid) as nb"; |
| 2595 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user"; |
|
| 2595 | + $sql .= " FROM ".MAIN_DB_PREFIX."user"; |
|
| 2596 | 2596 | if ($option == 'superadmin') {
|
| 2597 | 2597 | $sql .= " WHERE entity = 0"; |
| 2598 | 2598 | if ($admin >= 0) |
| 2599 | - $sql .= " AND admin = " . $admin; |
|
| 2599 | + $sql .= " AND admin = ".$admin; |
|
| 2600 | 2600 | } |
| 2601 | 2601 | else {
|
| 2602 | - $sql .= " WHERE entity IN (" . getEntity('user', 0) . ")";
|
|
| 2602 | + $sql .= " WHERE entity IN (".getEntity('user', 0).")";
|
|
| 2603 | 2603 | if ($limitTo == 'active') |
| 2604 | 2604 | $sql .= " AND statut = 1"; |
| 2605 | 2605 | if ($admin >= 0) |
| 2606 | - $sql .= " AND admin = " . $admin; |
|
| 2606 | + $sql .= " AND admin = ".$admin; |
|
| 2607 | 2607 | } |
| 2608 | 2608 | |
| 2609 | 2609 | $resql = $this->db->query($sql); |
@@ -2653,7 +2653,7 @@ discard block |
||
| 2653 | 2653 | |
| 2654 | 2654 | $result = $this->update($user); |
| 2655 | 2655 | |
| 2656 | - dol_syslog(get_class($this) . "::update_ldap2dolibarr result=" . $result, LOG_DEBUG); |
|
| 2656 | + dol_syslog(get_class($this)."::update_ldap2dolibarr result=".$result, LOG_DEBUG); |
|
| 2657 | 2657 | |
| 2658 | 2658 | return $result; |
| 2659 | 2659 | } |
@@ -2668,10 +2668,10 @@ discard block |
||
| 2668 | 2668 | function get_children() |
| 2669 | 2669 | {
|
| 2670 | 2670 | // phpcs:enable |
| 2671 | - $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "user"; |
|
| 2672 | - $sql .= " WHERE fk_user = " . $this->id; |
|
| 2671 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."user"; |
|
| 2672 | + $sql .= " WHERE fk_user = ".$this->id; |
|
| 2673 | 2673 | |
| 2674 | - dol_syslog(get_class($this) . "::get_children result=" . $result, LOG_DEBUG); |
|
| 2674 | + dol_syslog(get_class($this)."::get_children result=".$result, LOG_DEBUG); |
|
| 2675 | 2675 | $res = $this->db->query($sql); |
| 2676 | 2676 | if ($res) {
|
| 2677 | 2677 | $users = array(); |
@@ -2700,11 +2700,11 @@ discard block |
||
| 2700 | 2700 | |
| 2701 | 2701 | // Load array[child]=parent |
| 2702 | 2702 | $sql = "SELECT fk_user as id_parent, rowid as id_son"; |
| 2703 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user"; |
|
| 2703 | + $sql .= " FROM ".MAIN_DB_PREFIX."user"; |
|
| 2704 | 2704 | $sql .= " WHERE fk_user <> 0"; |
| 2705 | - $sql .= " AND entity IN (" . getEntity('user') . ")";
|
|
| 2705 | + $sql .= " AND entity IN (".getEntity('user').")";
|
|
| 2706 | 2706 | |
| 2707 | - dol_syslog(get_class($this) . "::loadParentOf", LOG_DEBUG); |
|
| 2707 | + dol_syslog(get_class($this)."::loadParentOf", LOG_DEBUG); |
|
| 2708 | 2708 | $resql = $this->db->query($sql); |
| 2709 | 2709 | if ($resql) {
|
| 2710 | 2710 | while ($obj = $this->db->fetch_object($resql)) {
|
@@ -2747,19 +2747,19 @@ discard block |
||
| 2747 | 2747 | |
| 2748 | 2748 | // Init $this->users array |
| 2749 | 2749 | $sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.fk_soc, u.login, u.email, u.gender, u.admin, u.statut, u.photo, u.entity"; // Distinct reduce pb with old tables with duplicates |
| 2750 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user as u"; |
|
| 2750 | + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; |
|
| 2751 | 2751 | // Add fields from hooks |
| 2752 | 2752 | $parameters = array(); |
| 2753 | - $reshook = $hookmanager->executeHooks('printUserListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
|
| 2753 | + $reshook = $hookmanager->executeHooks('printUserListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
|
| 2754 | 2754 | if ($reshook > 0) {
|
| 2755 | 2755 | $sql .= $hookmanager->resPrint; |
| 2756 | 2756 | } else {
|
| 2757 | - $sql .= " WHERE u.entity IN (" . getEntity('user') . ")";
|
|
| 2757 | + $sql .= " WHERE u.entity IN (".getEntity('user').")";
|
|
| 2758 | 2758 | } |
| 2759 | 2759 | if ($filter) |
| 2760 | - $sql .= " AND " . $filter; |
|
| 2760 | + $sql .= " AND ".$filter; |
|
| 2761 | 2761 | |
| 2762 | - dol_syslog(get_class($this) . "::get_full_tree get user list", LOG_DEBUG); |
|
| 2762 | + dol_syslog(get_class($this)."::get_full_tree get user list", LOG_DEBUG); |
|
| 2763 | 2763 | $resql = $this->db->query($sql); |
| 2764 | 2764 | if ($resql) {
|
| 2765 | 2765 | $i = 0; |
@@ -2785,7 +2785,7 @@ discard block |
||
| 2785 | 2785 | } |
| 2786 | 2786 | |
| 2787 | 2787 | // We add the fullpath property to each elements of first level (no parent exists) |
| 2788 | - dol_syslog(get_class($this) . "::get_full_tree call to build_path_from_id_user", LOG_DEBUG); |
|
| 2788 | + dol_syslog(get_class($this)."::get_full_tree call to build_path_from_id_user", LOG_DEBUG); |
|
| 2789 | 2789 | foreach ($this->users as $key => $val) {
|
| 2790 | 2790 | $result = $this->build_path_from_id_user($key, 0); // Process a branch from the root user key (this user has no parent) |
| 2791 | 2791 | if ($result < 0) {
|
@@ -2797,18 +2797,18 @@ discard block |
||
| 2797 | 2797 | // Exclude leaf including $deleteafterid from tree |
| 2798 | 2798 | if ($deleteafterid) {
|
| 2799 | 2799 | //print "Look to discard user ".$deleteafterid."\n"; |
| 2800 | - $keyfilter1 = '^' . $deleteafterid . '$'; |
|
| 2801 | - $keyfilter2 = '_' . $deleteafterid . '$'; |
|
| 2802 | - $keyfilter3 = '^' . $deleteafterid . '_'; |
|
| 2803 | - $keyfilter4 = '_' . $deleteafterid . '_'; |
|
| 2800 | + $keyfilter1 = '^'.$deleteafterid.'$'; |
|
| 2801 | + $keyfilter2 = '_'.$deleteafterid.'$'; |
|
| 2802 | + $keyfilter3 = '^'.$deleteafterid.'_'; |
|
| 2803 | + $keyfilter4 = '_'.$deleteafterid.'_'; |
|
| 2804 | 2804 | foreach ($this->users as $key => $val) {
|
| 2805 | - if (preg_match('/' . $keyfilter1 . '/', $val['fullpath']) || preg_match('/' . $keyfilter2 . '/', $val['fullpath']) || preg_match('/' . $keyfilter3 . '/', $val['fullpath']) || preg_match('/' . $keyfilter4 . '/', $val['fullpath'])) {
|
|
| 2805 | + if (preg_match('/'.$keyfilter1.'/', $val['fullpath']) || preg_match('/'.$keyfilter2.'/', $val['fullpath']) || preg_match('/'.$keyfilter3.'/', $val['fullpath']) || preg_match('/'.$keyfilter4.'/', $val['fullpath'])) {
|
|
| 2806 | 2806 | unset($this->users[$key]); |
| 2807 | 2807 | } |
| 2808 | 2808 | } |
| 2809 | 2809 | } |
| 2810 | 2810 | |
| 2811 | - dol_syslog(get_class($this) . "::get_full_tree dol_sort_array", LOG_DEBUG); |
|
| 2811 | + dol_syslog(get_class($this)."::get_full_tree dol_sort_array", LOG_DEBUG); |
|
| 2812 | 2812 | $this->users = dol_sort_array($this->users, 'fullname', 'asc', true, false); |
| 2813 | 2813 | |
| 2814 | 2814 | //var_dump($this->users); |
@@ -2836,10 +2836,10 @@ discard block |
||
| 2836 | 2836 | |
| 2837 | 2837 | $idtoscan = $this->id; |
| 2838 | 2838 | |
| 2839 | - dol_syslog("Build childid for id = " . $idtoscan);
|
|
| 2839 | + dol_syslog("Build childid for id = ".$idtoscan);
|
|
| 2840 | 2840 | foreach ($this->users as $id => $val) {
|
| 2841 | 2841 | //var_dump($val['fullpath']); |
| 2842 | - if (preg_match('/_' . $idtoscan . '_/', $val['fullpath']))
|
|
| 2842 | + if (preg_match('/_'.$idtoscan.'_/', $val['fullpath']))
|
|
| 2843 | 2843 | $childids[$val['id']] = $val['id']; |
| 2844 | 2844 | } |
| 2845 | 2845 | } |
@@ -2863,16 +2863,16 @@ discard block |
||
| 2863 | 2863 | function build_path_from_id_user($id_user, $protection = 0) |
| 2864 | 2864 | {
|
| 2865 | 2865 | // phpcs:enable |
| 2866 | - dol_syslog(get_class($this) . "::build_path_from_id_user id_user=" . $id_user . " protection=" . $protection, LOG_DEBUG); |
|
| 2866 | + dol_syslog(get_class($this)."::build_path_from_id_user id_user=".$id_user." protection=".$protection, LOG_DEBUG); |
|
| 2867 | 2867 | |
| 2868 | 2868 | if (!empty($this->users[$id_user]['fullpath'])) {
|
| 2869 | 2869 | // Already defined |
| 2870 | - dol_syslog(get_class($this) . "::build_path_from_id_user fullpath and fullname already defined", LOG_WARNING); |
|
| 2870 | + dol_syslog(get_class($this)."::build_path_from_id_user fullpath and fullname already defined", LOG_WARNING); |
|
| 2871 | 2871 | return 0; |
| 2872 | 2872 | } |
| 2873 | 2873 | |
| 2874 | 2874 | // Define fullpath and fullname |
| 2875 | - $this->users[$id_user]['fullpath'] = '_' . $id_user; |
|
| 2875 | + $this->users[$id_user]['fullpath'] = '_'.$id_user; |
|
| 2876 | 2876 | $this->users[$id_user]['fullname'] = $this->users[$id_user]['lastname']; |
| 2877 | 2877 | $i = 0; |
| 2878 | 2878 | $cursor_user = $id_user; |
@@ -2881,11 +2881,11 @@ discard block |
||
| 2881 | 2881 | while (!empty($this->parentof[$cursor_user])) {
|
| 2882 | 2882 | if (in_array($this->parentof[$cursor_user], $useridfound)) {
|
| 2883 | 2883 | dol_syslog("The hierarchy of user has a recursive loop", LOG_WARNING);
|
| 2884 | - return -1; // Should not happen. Protection against looping hierarchy |
|
| 2884 | + return -1; // Should not happen. Protection against looping hierarchy |
|
| 2885 | 2885 | } |
| 2886 | 2886 | $useridfound[] = $this->parentof[$cursor_user]; |
| 2887 | - $this->users[$id_user]['fullpath'] = '_' . $this->parentof[$cursor_user] . $this->users[$id_user]['fullpath']; |
|
| 2888 | - $this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['lastname'] . ' >> ' . $this->users[$id_user]['fullname']; |
|
| 2887 | + $this->users[$id_user]['fullpath'] = '_'.$this->parentof[$cursor_user].$this->users[$id_user]['fullpath']; |
|
| 2888 | + $this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['lastname'].' >> '.$this->users[$id_user]['fullname']; |
|
| 2889 | 2889 | $i++; |
| 2890 | 2890 | $cursor_user = $this->parentof[$cursor_user]; |
| 2891 | 2891 | } |
@@ -2927,10 +2927,10 @@ discard block |
||
| 2927 | 2927 | $this->nb = array(); |
| 2928 | 2928 | |
| 2929 | 2929 | $sql = "SELECT count(u.rowid) as nb"; |
| 2930 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user as u"; |
|
| 2930 | + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; |
|
| 2931 | 2931 | $sql .= " WHERE u.statut > 0"; |
| 2932 | 2932 | //$sql.= " AND employee != 0"; |
| 2933 | - $sql .= " AND u.entity IN (" . getEntity('user') . ")";
|
|
| 2933 | + $sql .= " AND u.entity IN (".getEntity('user').")";
|
|
| 2934 | 2934 | |
| 2935 | 2935 | $resql = $this->db->query($sql); |
| 2936 | 2936 | if ($resql) {
|
@@ -2994,8 +2994,8 @@ discard block |
||
| 2994 | 2994 | return ''; |
| 2995 | 2995 | |
| 2996 | 2996 | $sql = "SELECT rowid, email, user_mobile, civility, lastname, firstname"; |
| 2997 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user"; |
|
| 2998 | - $sql .= " WHERE rowid = '" . $rowid . "'"; |
|
| 2997 | + $sql .= " FROM ".MAIN_DB_PREFIX."user"; |
|
| 2998 | + $sql .= " WHERE rowid = '".$rowid."'"; |
|
| 2999 | 2999 | |
| 3000 | 3000 | $resql = $this->db->query($sql); |
| 3001 | 3001 | if ($resql) {
|
@@ -3005,7 +3005,7 @@ discard block |
||
| 3005 | 3005 | $obj = $this->db->fetch_object($resql); |
| 3006 | 3006 | |
| 3007 | 3007 | if ($mode == 'email') |
| 3008 | - $user_property = dolGetFirstLastname($obj->firstname, $obj->lastname) . " <" . $obj->email . ">"; |
|
| 3008 | + $user_property = dolGetFirstLastname($obj->firstname, $obj->lastname)." <".$obj->email.">"; |
|
| 3009 | 3009 | else if ($mode == 'mobile') |
| 3010 | 3010 | $user_property = $obj->user_mobile; |
| 3011 | 3011 | } |
@@ -3032,7 +3032,7 @@ discard block |
||
| 3032 | 3032 | global $conf; |
| 3033 | 3033 | |
| 3034 | 3034 | $sql = "SELECT t.rowid"; |
| 3035 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t '; |
|
| 3035 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t '; |
|
| 3036 | 3036 | $sql .= " WHERE 1"; |
| 3037 | 3037 | |
| 3038 | 3038 | // Manage filter |
@@ -3040,24 +3040,24 @@ discard block |
||
| 3040 | 3040 | if (!empty($filter)) {
|
| 3041 | 3041 | foreach ($filter as $key => $value) {
|
| 3042 | 3042 | if ($key == 't.rowid') {
|
| 3043 | - $sqlwhere[] = $key . '=' . $value; |
|
| 3043 | + $sqlwhere[] = $key.'='.$value; |
|
| 3044 | 3044 | } elseif (strpos($key, 'date') !== false) {
|
| 3045 | - $sqlwhere[] = $key . ' = \'' . $this->db->idate($value) . '\''; |
|
| 3045 | + $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; |
|
| 3046 | 3046 | } elseif ($key == 'customsql') {
|
| 3047 | 3047 | $sqlwhere[] = $value; |
| 3048 | 3048 | } else {
|
| 3049 | - $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; |
|
| 3049 | + $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; |
|
| 3050 | 3050 | } |
| 3051 | 3051 | } |
| 3052 | 3052 | } |
| 3053 | 3053 | if (count($sqlwhere) > 0) {
|
| 3054 | - $sql .= ' AND (' . implode(' ' . $filtermode . ' ', $sqlwhere) . ')';
|
|
| 3054 | + $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')';
|
|
| 3055 | 3055 | } |
| 3056 | 3056 | $sql .= $this->db->order($sortfield, $sortorder); |
| 3057 | 3057 | if ($limit) |
| 3058 | 3058 | $sql .= $this->db->plimit($limit + 1, $offset); |
| 3059 | 3059 | |
| 3060 | - dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); |
|
| 3060 | + dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); |
|
| 3061 | 3061 | |
| 3062 | 3062 | $resql = $this->db->query($sql); |
| 3063 | 3063 | if ($resql) {
|
@@ -247,10 +247,14 @@ discard block |
||
| 247 | 247 | $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database |
| 248 | 248 | } |
| 249 | 249 | } else { // The fetch was forced on an entity
|
| 250 | - if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) |
|
| 251 | - $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database |
|
| 252 | - else |
|
| 253 | - $sql .= " WHERE u.entity IN (0, " . (($entity != '' && $entity >= 0) ? $entity : $conf->entity) . ")"; // search in entity provided in parameter |
|
| 250 | + if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { |
|
| 251 | + $sql .= " WHERE u.entity IS NOT NULL"; |
|
| 252 | + } |
|
| 253 | + // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database |
|
| 254 | + else { |
|
| 255 | + $sql .= " WHERE u.entity IN (0, " . (($entity != '' && $entity >= 0) ? $entity : $conf->entity) . ")"; |
|
| 256 | + } |
|
| 257 | + // search in entity provided in parameter |
|
| 254 | 258 | } |
| 255 | 259 | |
| 256 | 260 | if ($sid) { // permet une recherche du user par son SID ActiveDirectory ou Samba
|
@@ -342,16 +346,16 @@ discard block |
||
| 342 | 346 | |
| 343 | 347 | // Protection when module multicompany was set, admin was set to first entity and then, the module was disabled, |
| 344 | 348 | // in such case, this admin user must be admin for ALL entities. |
| 345 | - if (empty($conf->multicompany->enabled) && $this->admin && $this->entity == 1) |
|
| 346 | - $this->entity = 0; |
|
| 349 | + if (empty($conf->multicompany->enabled) && $this->admin && $this->entity == 1) { |
|
| 350 | + $this->entity = 0; |
|
| 351 | + } |
|
| 347 | 352 | |
| 348 | 353 | // Retreive all extrafield |
| 349 | 354 | // fetch optionals attributes and labels |
| 350 | 355 | $this->fetch_optionals(); |
| 351 | 356 | |
| 352 | 357 | $this->db->free($result); |
| 353 | - } |
|
| 354 | - else {
|
|
| 358 | + } else {
|
|
| 355 | 359 | $this->error = "USERNOTFOUND"; |
| 356 | 360 | dol_syslog(get_class($this) . "::fetch user not found", LOG_DEBUG); |
| 357 | 361 | |
@@ -377,13 +381,13 @@ discard block |
||
| 377 | 381 | while ($i < $num) {
|
| 378 | 382 | $obj = $this->db->fetch_object($resql); |
| 379 | 383 | $p = (!empty($obj->param) ? $obj->param : ''); |
| 380 | - if (!empty($p)) |
|
| 381 | - $this->conf->$p = $obj->value; |
|
| 384 | + if (!empty($p)) { |
|
| 385 | + $this->conf->$p = $obj->value; |
|
| 386 | + } |
|
| 382 | 387 | $i++; |
| 383 | 388 | } |
| 384 | 389 | $this->db->free($resql); |
| 385 | - } |
|
| 386 | - else {
|
|
| 390 | + } else {
|
|
| 387 | 391 | $this->error = $this->db->lasterror(); |
| 388 | 392 | return -2; |
| 389 | 393 | } |
@@ -492,12 +496,12 @@ discard block |
||
| 492 | 496 | // Where pour la liste des droits a ajouter |
| 493 | 497 | $whereforadd = "id=" . $this->db->escape($rid); |
| 494 | 498 | // Ajout des droits induits |
| 495 | - if (!empty($subperms)) |
|
| 496 | - $whereforadd .= " OR (module='$module' AND perms='$perms' AND (subperms='lire' OR subperms='read'))"; |
|
| 497 | - else if (!empty($perms)) |
|
| 498 | - $whereforadd .= " OR (module='$module' AND (perms='lire' OR perms='read') AND subperms IS NULL)"; |
|
| 499 | - } |
|
| 500 | - else {
|
|
| 499 | + if (!empty($subperms)) { |
|
| 500 | + $whereforadd .= " OR (module='$module' AND perms='$perms' AND (subperms='lire' OR subperms='read'))"; |
|
| 501 | + } else if (!empty($perms)) { |
|
| 502 | + $whereforadd .= " OR (module='$module' AND (perms='lire' OR perms='read') AND subperms IS NULL)"; |
|
| 503 | + } |
|
| 504 | + } else {
|
|
| 501 | 505 | // On a pas demande un droit en particulier mais une liste de droits |
| 502 | 506 | // sur la base d'un nom de module de de perms |
| 503 | 507 | // Where pour la liste des droits a ajouter |
@@ -506,8 +510,9 @@ discard block |
||
| 506 | 510 | $whereforadd = 'allmodules'; |
| 507 | 511 | } else {
|
| 508 | 512 | $whereforadd = "module='" . $this->db->escape($allmodule) . "'"; |
| 509 | - if (!empty($allperms)) |
|
| 510 | - $whereforadd .= " AND perms='" . $this->db->escape($allperms) . "'"; |
|
| 513 | + if (!empty($allperms)) { |
|
| 514 | + $whereforadd .= " AND perms='" . $this->db->escape($allperms) . "'"; |
|
| 515 | + } |
|
| 511 | 516 | } |
| 512 | 517 | } |
| 513 | 518 | } |
@@ -531,16 +536,17 @@ discard block |
||
| 531 | 536 | $nid = $obj->id; |
| 532 | 537 | |
| 533 | 538 | $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_rights WHERE fk_user = " . $this->id . " AND fk_id=" . $nid . " AND entity = " . $entity; |
| 534 | - if (!$this->db->query($sql)) |
|
| 535 | - $error++; |
|
| 539 | + if (!$this->db->query($sql)) { |
|
| 540 | + $error++; |
|
| 541 | + } |
|
| 536 | 542 | $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user_rights (entity, fk_user, fk_id) VALUES (" . $entity . ", " . $this->id . ", " . $nid . ")";
|
| 537 | - if (!$this->db->query($sql)) |
|
| 538 | - $error++; |
|
| 543 | + if (!$this->db->query($sql)) { |
|
| 544 | + $error++; |
|
| 545 | + } |
|
| 539 | 546 | |
| 540 | 547 | $i++; |
| 541 | 548 | } |
| 542 | - } |
|
| 543 | - else {
|
|
| 549 | + } else {
|
|
| 544 | 550 | $error++; |
| 545 | 551 | dol_print_error($this->db); |
| 546 | 552 | } |
@@ -610,12 +616,13 @@ discard block |
||
| 610 | 616 | // Where pour la liste des droits a supprimer |
| 611 | 617 | $wherefordel = "id=" . $this->db->escape($rid); |
| 612 | 618 | // Suppression des droits induits |
| 613 | - if ($subperms == 'lire' || $subperms == 'read') |
|
| 614 | - $wherefordel .= " OR (module='$module' AND perms='$perms' AND subperms IS NOT NULL)"; |
|
| 615 | - if ($perms == 'lire' || $perms == 'read') |
|
| 616 | - $wherefordel .= " OR (module='$module')"; |
|
| 617 | - } |
|
| 618 | - else {
|
|
| 619 | + if ($subperms == 'lire' || $subperms == 'read') { |
|
| 620 | + $wherefordel .= " OR (module='$module' AND perms='$perms' AND subperms IS NOT NULL)"; |
|
| 621 | + } |
|
| 622 | + if ($perms == 'lire' || $perms == 'read') { |
|
| 623 | + $wherefordel .= " OR (module='$module')"; |
|
| 624 | + } |
|
| 625 | + } else {
|
|
| 619 | 626 | // On a demande suppression d'un droit sur la base d'un nom de module ou perms |
| 620 | 627 | // Where pour la liste des droits a supprimer |
| 621 | 628 | if (!empty($allmodule)) {
|
@@ -623,8 +630,9 @@ discard block |
||
| 623 | 630 | $wherefordel = 'allmodules'; |
| 624 | 631 | } else {
|
| 625 | 632 | $wherefordel = "module='" . $this->db->escape($allmodule) . "'"; |
| 626 | - if (!empty($allperms)) |
|
| 627 | - $whereforadd .= " AND perms='" . $this->db->escape($allperms) . "'"; |
|
| 633 | + if (!empty($allperms)) { |
|
| 634 | + $whereforadd .= " AND perms='" . $this->db->escape($allperms) . "'"; |
|
| 635 | + } |
|
| 628 | 636 | } |
| 629 | 637 | } |
| 630 | 638 | } |
@@ -650,13 +658,13 @@ discard block |
||
| 650 | 658 | $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_rights"; |
| 651 | 659 | $sql .= " WHERE fk_user = " . $this->id . " AND fk_id=" . $nid; |
| 652 | 660 | $sql .= " AND entity = " . $entity; |
| 653 | - if (!$this->db->query($sql)) |
|
| 654 | - $error++; |
|
| 661 | + if (!$this->db->query($sql)) { |
|
| 662 | + $error++; |
|
| 663 | + } |
|
| 655 | 664 | |
| 656 | 665 | $i++; |
| 657 | 666 | } |
| 658 | - } |
|
| 659 | - else {
|
|
| 667 | + } else {
|
|
| 660 | 668 | $error++; |
| 661 | 669 | dol_print_error($this->db); |
| 662 | 670 | } |
@@ -734,8 +742,9 @@ discard block |
||
| 734 | 742 | } |
| 735 | 743 | $sql .= " AND ur.fk_user= " . $this->id; |
| 736 | 744 | $sql .= " AND r.perms IS NOT NULL"; |
| 737 | - if ($moduletag) |
|
| 738 | - $sql .= " AND r.module = '" . $this->db->escape($moduletag) . "'"; |
|
| 745 | + if ($moduletag) { |
|
| 746 | + $sql .= " AND r.module = '" . $this->db->escape($moduletag) . "'"; |
|
| 747 | + } |
|
| 739 | 748 | |
| 740 | 749 | $resql = $this->db->query($sql); |
| 741 | 750 | if ($resql) {
|
@@ -749,21 +758,26 @@ discard block |
||
| 749 | 758 | $subperms = $obj->subperms; |
| 750 | 759 | |
| 751 | 760 | if ($perms) {
|
| 752 | - if (!isset($this->rights) || !is_object($this->rights)) |
|
| 753 | - $this->rights = new stdClass(); // For avoid error |
|
| 761 | + if (!isset($this->rights) || !is_object($this->rights)) { |
|
| 762 | + $this->rights = new stdClass(); |
|
| 763 | + } |
|
| 764 | + // For avoid error |
|
| 754 | 765 | if ($module) {
|
| 755 | - if (!isset($this->rights->$module) || !is_object($this->rights->$module)) |
|
| 756 | - $this->rights->$module = new stdClass(); |
|
| 766 | + if (!isset($this->rights->$module) || !is_object($this->rights->$module)) { |
|
| 767 | + $this->rights->$module = new stdClass(); |
|
| 768 | + } |
|
| 757 | 769 | if ($subperms) {
|
| 758 | - if (!isset($this->rights->$module->$perms) || !is_object($this->rights->$module->$perms)) |
|
| 759 | - $this->rights->$module->$perms = new stdClass(); |
|
| 760 | - if (empty($this->rights->$module->$perms->$subperms)) |
|
| 761 | - $this->nb_rights++; |
|
| 770 | + if (!isset($this->rights->$module->$perms) || !is_object($this->rights->$module->$perms)) { |
|
| 771 | + $this->rights->$module->$perms = new stdClass(); |
|
| 772 | + } |
|
| 773 | + if (empty($this->rights->$module->$perms->$subperms)) { |
|
| 774 | + $this->nb_rights++; |
|
| 775 | + } |
|
| 762 | 776 | $this->rights->$module->$perms->$subperms = 1; |
| 763 | - } |
|
| 764 | - else {
|
|
| 765 | - if (empty($this->rights->$module->$perms)) |
|
| 766 | - $this->nb_rights++; |
|
| 777 | + } else {
|
|
| 778 | + if (empty($this->rights->$module->$perms)) { |
|
| 779 | + $this->nb_rights++; |
|
| 780 | + } |
|
| 767 | 781 | $this->rights->$module->$perms = 1; |
| 768 | 782 | } |
| 769 | 783 | } |
@@ -792,8 +806,9 @@ discard block |
||
| 792 | 806 | $sql .= " AND gr.fk_usergroup = gu.fk_usergroup"; |
| 793 | 807 | $sql .= " AND gu.fk_user = " . $this->id; |
| 794 | 808 | $sql .= " AND r.perms IS NOT NULL"; |
| 795 | - if ($moduletag) |
|
| 796 | - $sql .= " AND r.module = '" . $this->db->escape($moduletag) . "'"; |
|
| 809 | + if ($moduletag) { |
|
| 810 | + $sql .= " AND r.module = '" . $this->db->escape($moduletag) . "'"; |
|
| 811 | + } |
|
| 797 | 812 | |
| 798 | 813 | $resql = $this->db->query($sql); |
| 799 | 814 | if ($resql) {
|
@@ -807,23 +822,29 @@ discard block |
||
| 807 | 822 | $subperms = $obj->subperms; |
| 808 | 823 | |
| 809 | 824 | if ($perms) {
|
| 810 | - if (!isset($this->rights) || !is_object($this->rights)) |
|
| 811 | - $this->rights = new stdClass(); // For avoid error |
|
| 812 | - if (!isset($this->rights->$module) || !is_object($this->rights->$module)) |
|
| 813 | - $this->rights->$module = new stdClass(); |
|
| 825 | + if (!isset($this->rights) || !is_object($this->rights)) { |
|
| 826 | + $this->rights = new stdClass(); |
|
| 827 | + } |
|
| 828 | + // For avoid error |
|
| 829 | + if (!isset($this->rights->$module) || !is_object($this->rights->$module)) { |
|
| 830 | + $this->rights->$module = new stdClass(); |
|
| 831 | + } |
|
| 814 | 832 | if ($subperms) {
|
| 815 | - if (!isset($this->rights->$module->$perms) || !is_object($this->rights->$module->$perms)) |
|
| 816 | - $this->rights->$module->$perms = new stdClass(); |
|
| 817 | - if (empty($this->rights->$module->$perms->$subperms)) |
|
| 818 | - $this->nb_rights++; |
|
| 833 | + if (!isset($this->rights->$module->$perms) || !is_object($this->rights->$module->$perms)) { |
|
| 834 | + $this->rights->$module->$perms = new stdClass(); |
|
| 835 | + } |
|
| 836 | + if (empty($this->rights->$module->$perms->$subperms)) { |
|
| 837 | + $this->nb_rights++; |
|
| 838 | + } |
|
| 819 | 839 | $this->rights->$module->$perms->$subperms = 1; |
| 820 | - } |
|
| 821 | - else {
|
|
| 822 | - if (empty($this->rights->$module->$perms)) |
|
| 823 | - $this->nb_rights++; |
|
| 840 | + } else {
|
|
| 841 | + if (empty($this->rights->$module->$perms)) { |
|
| 842 | + $this->nb_rights++; |
|
| 843 | + } |
|
| 824 | 844 | // if we have already define a subperm like this $this->rights->$module->level1->level2 with llx_user_rights, we don't want override level1 because the level2 can be not define on user group |
| 825 | - if (!is_object($this->rights->$module->$perms)) |
|
| 826 | - $this->rights->$module->$perms = 1; |
|
| 845 | + if (!is_object($this->rights->$module->$perms)) { |
|
| 846 | + $this->rights->$module->$perms = 1; |
|
| 847 | + } |
|
| 827 | 848 | } |
| 828 | 849 | } |
| 829 | 850 | $i++; |
@@ -832,10 +853,12 @@ discard block |
||
| 832 | 853 | } |
| 833 | 854 | |
| 834 | 855 | // For backward compatibility |
| 835 | - if (isset($this->rights->propale) && !isset($this->rights->propal)) |
|
| 836 | - $this->rights->propal = $this->rights->propale; |
|
| 837 | - if (isset($this->rights->propal) && !isset($this->rights->propale)) |
|
| 838 | - $this->rights->propale = $this->rights->propal; |
|
| 856 | + if (isset($this->rights->propale) && !isset($this->rights->propal)) { |
|
| 857 | + $this->rights->propal = $this->rights->propale; |
|
| 858 | + } |
|
| 859 | + if (isset($this->rights->propal) && !isset($this->rights->propale)) { |
|
| 860 | + $this->rights->propale = $this->rights->propal; |
|
| 861 | + } |
|
| 839 | 862 | |
| 840 | 863 | if (!$moduletag) {
|
| 841 | 864 | // Si module etait non defini, alors on a tout charge, on peut donc considerer |
@@ -860,10 +883,11 @@ discard block |
||
| 860 | 883 | $error = 0; |
| 861 | 884 | |
| 862 | 885 | // Check parameters |
| 863 | - if ($this->statut == $statut) |
|
| 864 | - return 0; |
|
| 865 | - else |
|
| 866 | - $this->statut = $statut; |
|
| 886 | + if ($this->statut == $statut) { |
|
| 887 | + return 0; |
|
| 888 | + } else { |
|
| 889 | + $this->statut = $statut; |
|
| 890 | + } |
|
| 867 | 891 | |
| 868 | 892 | $this->db->begin(); |
| 869 | 893 | |
@@ -1030,8 +1054,10 @@ discard block |
||
| 1030 | 1054 | |
| 1031 | 1055 | // Clean parameters |
| 1032 | 1056 | $this->login = trim($this->login); |
| 1033 | - if (!isset($this->entity)) |
|
| 1034 | - $this->entity = $conf->entity; // If not defined, we use default value |
|
| 1057 | + if (!isset($this->entity)) { |
|
| 1058 | + $this->entity = $conf->entity; |
|
| 1059 | + } |
|
| 1060 | + // If not defined, we use default value |
|
| 1035 | 1061 | |
| 1036 | 1062 | dol_syslog(get_class($this) . "::create login=" . $this->login . ", user=" . (is_object($user) ? $user->id : ''), LOG_DEBUG); |
| 1037 | 1063 | |
@@ -1167,8 +1193,9 @@ discard block |
||
| 1167 | 1193 | $this->country_id = $contact->country_id; |
| 1168 | 1194 | $this->employee = 0; |
| 1169 | 1195 | |
| 1170 | - if (empty($login)) |
|
| 1171 | - $login = strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4)); |
|
| 1196 | + if (empty($login)) { |
|
| 1197 | + $login = strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4)); |
|
| 1198 | + } |
|
| 1172 | 1199 | $this->login = $login; |
| 1173 | 1200 | |
| 1174 | 1201 | $this->db->begin(); |
@@ -1178,8 +1205,9 @@ discard block |
||
| 1178 | 1205 | if ($result > 0) {
|
| 1179 | 1206 | $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
| 1180 | 1207 | $sql .= " SET fk_socpeople=" . $contact->id; |
| 1181 | - if ($contact->socid) |
|
| 1182 | - $sql .= ", fk_soc=" . $contact->socid; |
|
| 1208 | + if ($contact->socid) { |
|
| 1209 | + $sql .= ", fk_soc=" . $contact->socid; |
|
| 1210 | + } |
|
| 1183 | 1211 | $sql .= " WHERE rowid=" . $this->id; |
| 1184 | 1212 | $resql = $this->db->query($sql); |
| 1185 | 1213 | |
@@ -1240,8 +1268,9 @@ discard block |
||
| 1240 | 1268 | $this->state_id = $member->state_id; |
| 1241 | 1269 | $this->country_id = $member->country_id; |
| 1242 | 1270 | |
| 1243 | - if (empty($login)) |
|
| 1244 | - $login = strtolower(substr($member->firstname, 0, 4)) . strtolower(substr($member->lastname, 0, 4)); |
|
| 1271 | + if (empty($login)) { |
|
| 1272 | + $login = strtolower(substr($member->firstname, 0, 4)) . strtolower(substr($member->lastname, 0, 4)); |
|
| 1273 | + } |
|
| 1245 | 1274 | $this->login = $login; |
| 1246 | 1275 | |
| 1247 | 1276 | $this->db->begin(); |
@@ -1250,8 +1279,9 @@ discard block |
||
| 1250 | 1279 | $result = $this->create($user); |
| 1251 | 1280 | if ($result > 0) {
|
| 1252 | 1281 | $newpass = $this->setPassword($user, $this->pass); |
| 1253 | - if (is_numeric($newpass) && $newpass < 0) |
|
| 1254 | - $result = -2; |
|
| 1282 | + if (is_numeric($newpass) && $newpass < 0) { |
|
| 1283 | + $result = -2; |
|
| 1284 | + } |
|
| 1255 | 1285 | |
| 1256 | 1286 | if ($result > 0 && $member->fk_soc) { // If member is linked to a thirdparty
|
| 1257 | 1287 | $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
@@ -1317,8 +1347,9 @@ discard block |
||
| 1317 | 1347 | |
| 1318 | 1348 | $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user_rights (fk_user, fk_id) VALUES ($this->id, $rd[$i])"; |
| 1319 | 1349 | $result = $this->db->query($sql); |
| 1320 | - if (!$result) |
|
| 1321 | - return -1; |
|
| 1350 | + if (!$result) { |
|
| 1351 | + return -1; |
|
| 1352 | + } |
|
| 1322 | 1353 | $i++; |
| 1323 | 1354 | } |
| 1324 | 1355 | |
@@ -1403,8 +1434,10 @@ discard block |
||
| 1403 | 1434 | $sql .= ", api_key = " . ($this->api_key ? "'" . $this->db->escape($this->api_key) . "'" : "null"); |
| 1404 | 1435 | $sql .= ", gender = " . ($this->gender != -1 ? "'" . $this->db->escape($this->gender) . "'" : "null"); // 'man' or 'woman' |
| 1405 | 1436 | $sql .= ", birth=" . (strval($this->birth) != '' ? "'" . $this->db->idate($this->birth) . "'" : 'null'); |
| 1406 | - if (!empty($user->admin)) |
|
| 1407 | - $sql .= ", admin = " . $this->admin; // admin flag can be set/unset only by an admin user |
|
| 1437 | + if (!empty($user->admin)) { |
|
| 1438 | + $sql .= ", admin = " . $this->admin; |
|
| 1439 | + } |
|
| 1440 | + // admin flag can be set/unset only by an admin user |
|
| 1408 | 1441 | $sql .= ", address = '" . $this->db->escape($this->address) . "'"; |
| 1409 | 1442 | $sql .= ", zip = '" . $this->db->escape($this->zip) . "'"; |
| 1410 | 1443 | $sql .= ", town = '" . $this->db->escape($this->town) . "'"; |
@@ -1427,14 +1460,18 @@ discard block |
||
| 1427 | 1460 | $sql .= ", photo = " . ($this->photo ? "'" . $this->db->escape($this->photo) . "'" : "null"); |
| 1428 | 1461 | $sql .= ", openid = " . ($this->openid ? "'" . $this->db->escape($this->openid) . "'" : "null"); |
| 1429 | 1462 | $sql .= ", fk_user = " . ($this->fk_user > 0 ? "'" . $this->db->escape($this->fk_user) . "'" : "null"); |
| 1430 | - if (isset($this->thm) || $this->thm != '') |
|
| 1431 | - $sql .= ", thm= " . ($this->thm != '' ? "'" . $this->db->escape($this->thm) . "'" : "null"); |
|
| 1432 | - if (isset($this->tjm) || $this->tjm != '') |
|
| 1433 | - $sql .= ", tjm= " . ($this->tjm != '' ? "'" . $this->db->escape($this->tjm) . "'" : "null"); |
|
| 1434 | - if (isset($this->salary) || $this->salary != '') |
|
| 1435 | - $sql .= ", salary= " . ($this->salary != '' ? "'" . $this->db->escape($this->salary) . "'" : "null"); |
|
| 1436 | - if (isset($this->salaryextra) || $this->salaryextra != '') |
|
| 1437 | - $sql .= ", salaryextra= " . ($this->salaryextra != '' ? "'" . $this->db->escape($this->salaryextra) . "'" : "null"); |
|
| 1463 | + if (isset($this->thm) || $this->thm != '') { |
|
| 1464 | + $sql .= ", thm= " . ($this->thm != '' ? "'" . $this->db->escape($this->thm) . "'" : "null"); |
|
| 1465 | + } |
|
| 1466 | + if (isset($this->tjm) || $this->tjm != '') { |
|
| 1467 | + $sql .= ", tjm= " . ($this->tjm != '' ? "'" . $this->db->escape($this->tjm) . "'" : "null"); |
|
| 1468 | + } |
|
| 1469 | + if (isset($this->salary) || $this->salary != '') { |
|
| 1470 | + $sql .= ", salary= " . ($this->salary != '' ? "'" . $this->db->escape($this->salary) . "'" : "null"); |
|
| 1471 | + } |
|
| 1472 | + if (isset($this->salaryextra) || $this->salaryextra != '') { |
|
| 1473 | + $sql .= ", salaryextra= " . ($this->salaryextra != '' ? "'" . $this->db->escape($this->salaryextra) . "'" : "null"); |
|
| 1474 | + } |
|
| 1438 | 1475 | $sql .= ", weeklyhours= " . ($this->weeklyhours != '' ? "'" . $this->db->escape($this->weeklyhours) . "'" : "null"); |
| 1439 | 1476 | $sql .= ", entity = '" . $this->db->escape($this->entity) . "'"; |
| 1440 | 1477 | $sql .= ", default_range = " . ($this->default_range > 0 ? $this->default_range : 'null'); |
@@ -1452,8 +1489,9 @@ discard block |
||
| 1452 | 1489 | if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) {
|
| 1453 | 1490 | // Si mot de passe saisi et different de celui en base |
| 1454 | 1491 | $result = $this->setPassword($user, $this->pass, 0, $notrigger, $nosyncmemberpass); |
| 1455 | - if (!$nbrowsaffected) |
|
| 1456 | - $nbrowsaffected++; |
|
| 1492 | + if (!$nbrowsaffected) { |
|
| 1493 | + $nbrowsaffected++; |
|
| 1494 | + } |
|
| 1457 | 1495 | } |
| 1458 | 1496 | } |
| 1459 | 1497 | |
@@ -1679,8 +1717,9 @@ discard block |
||
| 1679 | 1717 | |
| 1680 | 1718 | // Mise a jour |
| 1681 | 1719 | if (!$changelater) {
|
| 1682 | - if (!is_object($this->oldcopy)) |
|
| 1683 | - $this->oldcopy = clone $this; |
|
| 1720 | + if (!is_object($this->oldcopy)) { |
|
| 1721 | + $this->oldcopy = clone $this; |
|
| 1722 | + } |
|
| 1684 | 1723 | |
| 1685 | 1724 | $this->db->begin(); |
| 1686 | 1725 | |
@@ -1798,8 +1837,9 @@ discard block |
||
| 1798 | 1837 | $outputlangs->loadLangs(array("main", "errors", "users", "other"));
|
| 1799 | 1838 | |
| 1800 | 1839 | $appli = constant('DOL_APPLICATION_TITLE');
|
| 1801 | - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) |
|
| 1802 | - $appli = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 1840 | + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { |
|
| 1841 | + $appli = $conf->global->MAIN_APPLICATION_TITLE; |
|
| 1842 | + } |
|
| 1803 | 1843 | |
| 1804 | 1844 | $subject = $outputlangs->transnoentitiesnoconv("SubjectNewPassword", $appli);
|
| 1805 | 1845 | |
@@ -2127,8 +2167,9 @@ discard block |
||
| 2127 | 2167 | $label .= '<br>'; |
| 2128 | 2168 | $label .= '<br><u>' . $langs->trans("Connection") . '</u>';
|
| 2129 | 2169 | $label .= '<br><b>' . $langs->trans("IPAddress") . '</b>: ' . $_SERVER["REMOTE_ADDR"];
|
| 2130 | - if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) |
|
| 2131 | - $label .= '<br><b>' . $langs->trans("ConnectedOnMultiCompany") . ':</b> ' . $conf->entity . ' (user entity ' . $this->entity . ')';
|
|
| 2170 | + if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY)) { |
|
| 2171 | + $label .= '<br><b>' . $langs->trans("ConnectedOnMultiCompany") . ':</b> ' . $conf->entity . ' (user entity ' . $this->entity . ')'; |
|
| 2172 | + } |
|
| 2132 | 2173 | $label .= '<br><b>' . $langs->trans("AuthenticationMode") . ':</b> ' . $_SESSION["dol_authmode"] . (empty($dolibarr_main_demo) ? '' : ' (demo)');
|
| 2133 | 2174 | $label .= '<br><b>' . $langs->trans("ConnectedSince") . ':</b> ' . dol_print_date($this->datelastlogin, "dayhour", 'tzuser');
|
| 2134 | 2175 | $label .= '<br><b>' . $langs->trans("PreviousConnexion") . ':</b> ' . dol_print_date($this->datepreviouslogin, "dayhour", 'tzuser');
|
@@ -2139,13 +2180,16 @@ discard block |
||
| 2139 | 2180 | $label .= '<br><b>' . $langs->trans("Browser") . ':</b> ' . $conf->browser->name . ($conf->browser->version ? ' ' . $conf->browser->version : '') . ' (' . $_SERVER['HTTP_USER_AGENT'] . ')';
|
| 2140 | 2181 | $label .= '<br><b>' . $langs->trans("Layout") . ':</b> ' . $conf->browser->layout;
|
| 2141 | 2182 | $label .= '<br><b>' . $langs->trans("Screen") . ':</b> ' . $_SESSION['dol_screenwidth'] . ' x ' . $_SESSION['dol_screenheight'];
|
| 2142 | - if ($conf->browser->layout == 'phone') |
|
| 2143 | - $label .= '<br><b>' . $langs->trans("Phone") . ':</b> ' . $langs->trans("Yes");
|
|
| 2144 | - if (!empty($_SESSION["disablemodules"])) |
|
| 2145 | - $label .= '<br><b>' . $langs->trans("DisabledModules") . ':</b> <br>' . join(', ', explode(',', $_SESSION["disablemodules"]));
|
|
| 2183 | + if ($conf->browser->layout == 'phone') { |
|
| 2184 | + $label .= '<br><b>' . $langs->trans("Phone") . ':</b> ' . $langs->trans("Yes"); |
|
| 2185 | + } |
|
| 2186 | + if (!empty($_SESSION["disablemodules"])) { |
|
| 2187 | + $label .= '<br><b>' . $langs->trans("DisabledModules") . ':</b> <br>' . join(', ', explode(',', $_SESSION["disablemodules"])); |
|
| 2188 | + } |
|
| 2146 | 2189 | } |
| 2147 | - if ($infologin < 0) |
|
| 2148 | - $label = ''; |
|
| 2190 | + if ($infologin < 0) { |
|
| 2191 | + $label = ''; |
|
| 2192 | + } |
|
| 2149 | 2193 | |
| 2150 | 2194 | // $url = DOL_URL_ROOT . '/user/card.php?id=' . $this->id; |
| 2151 | 2195 | $url = BASE_URI . '?controller=user&method=card&id=' . $this->id; |
@@ -2156,10 +2200,12 @@ discard block |
||
| 2156 | 2200 | if ($option != 'nolink') {
|
| 2157 | 2201 | // Add param to save lastsearch_values or not |
| 2158 | 2202 | $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); |
| 2159 | - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"]))
|
|
| 2160 | - $add_save_lastsearch_values = 1; |
|
| 2161 | - if ($add_save_lastsearch_values) |
|
| 2162 | - $url .= '&save_lastsearch_values=1'; |
|
| 2203 | + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { |
|
| 2204 | + $add_save_lastsearch_values = 1; |
|
| 2205 | + } |
|
| 2206 | + if ($add_save_lastsearch_values) { |
|
| 2207 | + $url .= '&save_lastsearch_values=1'; |
|
| 2208 | + } |
|
| 2163 | 2209 | } |
| 2164 | 2210 | |
| 2165 | 2211 | $linkstart = '<a href="' . $url . '"'; |
@@ -2188,25 +2234,31 @@ discard block |
||
| 2188 | 2234 | $result .= (($option == 'nolink') ? '' : $linkstart); |
| 2189 | 2235 | if ($withpictoimg) {
|
| 2190 | 2236 | $paddafterimage = ''; |
| 2191 | - if (abs($withpictoimg) == 1) |
|
| 2192 | - $paddafterimage = 'style="margin-right: 3px;"'; |
|
| 2237 | + if (abs($withpictoimg) == 1) { |
|
| 2238 | + $paddafterimage = 'style="margin-right: 3px;"'; |
|
| 2239 | + } |
|
| 2193 | 2240 | // Only picto |
| 2194 | - if ($withpictoimg > 0) |
|
| 2195 | - $picto = '<!-- picto user --><div class="inline-block nopadding userimg' . ($morecss ? ' ' . $morecss : '') . '">' . img_object('', 'user', $paddafterimage . ' ' . ($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1) . '</div>';
|
|
| 2241 | + if ($withpictoimg > 0) { |
|
| 2242 | + $picto = '<!-- picto user --><div class="inline-block nopadding userimg' . ($morecss ? ' ' . $morecss : '') . '">' . img_object('', 'user', $paddafterimage . ' ' . ($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1) . '</div>'; |
|
| 2243 | + } |
|
| 2196 | 2244 | // Picto must be a photo |
| 2197 | - else |
|
| 2198 | - $picto = '<!-- picto photo user --><div class="inline-block nopadding userimg' . ($morecss ? ' ' . $morecss : '') . '"' . ($paddafterimage ? ' ' . $paddafterimage : '') . '>' . Form::showphoto('userphoto', $this, 0, 0, 0, 'userphoto' . ($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1) . '</div>';
|
|
| 2245 | + else { |
|
| 2246 | + $picto = '<!-- picto photo user --><div class="inline-block nopadding userimg' . ($morecss ? ' ' . $morecss : '') . '"' . ($paddafterimage ? ' ' . $paddafterimage : '') . '>' . Form::showphoto('userphoto', $this, 0, 0, 0, 'userphoto' . ($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1) . '</div>'; |
|
| 2247 | + } |
|
| 2199 | 2248 | $result .= $picto; |
| 2200 | 2249 | } |
| 2201 | 2250 | if ($withpictoimg > -2 && $withpictoimg != 2) {
|
| 2202 | - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) |
|
| 2203 | - $result .= '<div class="inline-block nopadding valignmiddle usertext' . ((!isset($this->statut) || $this->statut) ? '' : ' strikefordisabled') . ($morecss ? ' ' . $morecss : '') . '">'; |
|
| 2204 | - if ($mode == 'login') |
|
| 2205 | - $result .= dol_trunc($this->login, $maxlen); |
|
| 2206 | - else |
|
| 2207 | - $result .= $this->getFullName($langs, '', ($mode == 'firstname' ? 2 : -1), $maxlen); |
|
| 2208 | - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) |
|
| 2209 | - $result .= '</div>'; |
|
| 2251 | + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
|
| 2252 | + $result .= '<div class="inline-block nopadding valignmiddle usertext' . ((!isset($this->statut) || $this->statut) ? '' : ' strikefordisabled') . ($morecss ? ' ' . $morecss : '') . '">'; |
|
| 2253 | + } |
|
| 2254 | + if ($mode == 'login') { |
|
| 2255 | + $result .= dol_trunc($this->login, $maxlen); |
|
| 2256 | + } else { |
|
| 2257 | + $result .= $this->getFullName($langs, '', ($mode == 'firstname' ? 2 : -1), $maxlen); |
|
| 2258 | + } |
|
| 2259 | + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
|
| 2260 | + $result .= '</div>'; |
|
| 2261 | + } |
|
| 2210 | 2262 | } |
| 2211 | 2263 | $result .= (($option == 'nolink') ? '' : $linkend); |
| 2212 | 2264 | //if ($withpictoimg == -1) $result.='</div>'; |
@@ -2244,8 +2296,9 @@ discard block |
||
| 2244 | 2296 | $linkend = '</a>'; |
| 2245 | 2297 | |
| 2246 | 2298 | //Check user's rights to see an other user |
| 2247 | - if ((!$user->rights->user->user->lire && $this->id != $user->id)) |
|
| 2248 | - $option = 'nolink'; |
|
| 2299 | + if ((!$user->rights->user->user->lire && $this->id != $user->id)) { |
|
| 2300 | + $option = 'nolink'; |
|
| 2301 | + } |
|
| 2249 | 2302 | |
| 2250 | 2303 | if ($option == 'xxx') {
|
| 2251 | 2304 | //$linkstart = '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">'; |
@@ -2259,8 +2312,9 @@ discard block |
||
| 2259 | 2312 | } |
| 2260 | 2313 | |
| 2261 | 2314 | $result .= $linkstart; |
| 2262 | - if ($withpicto) |
|
| 2263 | - $result .= img_object($langs->trans("ShowUser"), 'user', 'class="paddingright"');
|
|
| 2315 | + if ($withpicto) { |
|
| 2316 | + $result .= img_object($langs->trans("ShowUser"), 'user', 'class="paddingright"'); |
|
| 2317 | + } |
|
| 2264 | 2318 | $result .= $this->login; |
| 2265 | 2319 | $result .= $linkend; |
| 2266 | 2320 | return $result; |
@@ -2292,40 +2346,41 @@ discard block |
||
| 2292 | 2346 | $langs->load('users');
|
| 2293 | 2347 | |
| 2294 | 2348 | if ($mode == 0) {
|
| 2295 | - if ($statut == 1) |
|
| 2296 | - return $langs->trans('Enabled');
|
|
| 2297 | - elseif ($statut == 0) |
|
| 2298 | - return $langs->trans('Disabled');
|
|
| 2299 | - } |
|
| 2300 | - elseif ($mode == 1) {
|
|
| 2301 | - if ($statut == 1) |
|
| 2302 | - return $langs->trans('Enabled');
|
|
| 2303 | - elseif ($statut == 0) |
|
| 2304 | - return $langs->trans('Disabled');
|
|
| 2305 | - } |
|
| 2306 | - elseif ($mode == 2) {
|
|
| 2307 | - if ($statut == 1) |
|
| 2308 | - return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"') . ' ' . $langs->trans('Enabled');
|
|
| 2309 | - elseif ($statut == 0) |
|
| 2310 | - return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"') . ' ' . $langs->trans('Disabled');
|
|
| 2311 | - } |
|
| 2312 | - elseif ($mode == 3) {
|
|
| 2313 | - if ($statut == 1) |
|
| 2314 | - return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"');
|
|
| 2315 | - elseif ($statut == 0) |
|
| 2316 | - return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"');
|
|
| 2317 | - } |
|
| 2318 | - elseif ($mode == 4) {
|
|
| 2319 | - if ($statut == 1) |
|
| 2320 | - return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"') . ' ' . $langs->trans('Enabled');
|
|
| 2321 | - elseif ($statut == 0) |
|
| 2322 | - return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"') . ' ' . $langs->trans('Disabled');
|
|
| 2323 | - } |
|
| 2324 | - elseif ($mode == 5) {
|
|
| 2325 | - if ($statut == 1) |
|
| 2326 | - return $langs->trans('Enabled') . ' ' . img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"');
|
|
| 2327 | - elseif ($statut == 0) |
|
| 2328 | - return $langs->trans('Disabled') . ' ' . img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"');
|
|
| 2349 | + if ($statut == 1) { |
|
| 2350 | + return $langs->trans('Enabled'); |
|
| 2351 | + } elseif ($statut == 0) { |
|
| 2352 | + return $langs->trans('Disabled'); |
|
| 2353 | + } |
|
| 2354 | + } elseif ($mode == 1) {
|
|
| 2355 | + if ($statut == 1) { |
|
| 2356 | + return $langs->trans('Enabled'); |
|
| 2357 | + } elseif ($statut == 0) { |
|
| 2358 | + return $langs->trans('Disabled'); |
|
| 2359 | + } |
|
| 2360 | + } elseif ($mode == 2) {
|
|
| 2361 | + if ($statut == 1) { |
|
| 2362 | + return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"') . ' ' . $langs->trans('Enabled'); |
|
| 2363 | + } elseif ($statut == 0) { |
|
| 2364 | + return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"') . ' ' . $langs->trans('Disabled'); |
|
| 2365 | + } |
|
| 2366 | + } elseif ($mode == 3) {
|
|
| 2367 | + if ($statut == 1) { |
|
| 2368 | + return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"'); |
|
| 2369 | + } elseif ($statut == 0) { |
|
| 2370 | + return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"'); |
|
| 2371 | + } |
|
| 2372 | + } elseif ($mode == 4) {
|
|
| 2373 | + if ($statut == 1) { |
|
| 2374 | + return img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"') . ' ' . $langs->trans('Enabled'); |
|
| 2375 | + } elseif ($statut == 0) { |
|
| 2376 | + return img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"') . ' ' . $langs->trans('Disabled'); |
|
| 2377 | + } |
|
| 2378 | + } elseif ($mode == 5) {
|
|
| 2379 | + if ($statut == 1) { |
|
| 2380 | + return $langs->trans('Enabled') . ' ' . img_picto($langs->trans('Enabled'), 'statut4', 'class="pictostatus"'); |
|
| 2381 | + } elseif ($statut == 0) { |
|
| 2382 | + return $langs->trans('Disabled') . ' ' . img_picto($langs->trans('Disabled'), 'statut5', 'class="pictostatus"'); |
|
| 2383 | + } |
|
| 2329 | 2384 | } |
| 2330 | 2385 | } |
| 2331 | 2386 | |
@@ -2344,12 +2399,13 @@ discard block |
||
| 2344 | 2399 | // phpcs:enable |
| 2345 | 2400 | global $conf; |
| 2346 | 2401 | $dn = ''; |
| 2347 | - if ($mode == 0) |
|
| 2348 | - $dn = $conf->global->LDAP_KEY_USERS . "=" . $info[$conf->global->LDAP_KEY_USERS] . "," . $conf->global->LDAP_USER_DN; |
|
| 2349 | - elseif ($mode == 1) |
|
| 2350 | - $dn = $conf->global->LDAP_USER_DN; |
|
| 2351 | - elseif ($mode == 2) |
|
| 2352 | - $dn = $conf->global->LDAP_KEY_USERS . "=" . $info[$conf->global->LDAP_KEY_USERS]; |
|
| 2402 | + if ($mode == 0) { |
|
| 2403 | + $dn = $conf->global->LDAP_KEY_USERS . "=" . $info[$conf->global->LDAP_KEY_USERS] . "," . $conf->global->LDAP_USER_DN; |
|
| 2404 | + } elseif ($mode == 1) { |
|
| 2405 | + $dn = $conf->global->LDAP_USER_DN; |
|
| 2406 | + } elseif ($mode == 2) { |
|
| 2407 | + $dn = $conf->global->LDAP_KEY_USERS . "=" . $info[$conf->global->LDAP_KEY_USERS]; |
|
| 2408 | + } |
|
| 2353 | 2409 | return $dn; |
| 2354 | 2410 | } |
| 2355 | 2411 | |
@@ -2396,38 +2452,51 @@ discard block |
||
| 2396 | 2452 | |
| 2397 | 2453 | // Check if it is the LDAP key and if its value has been changed |
| 2398 | 2454 | if (!empty($conf->global->LDAP_KEY_USERS) && $conf->global->LDAP_KEY_USERS == $conf->global->$constname) {
|
| 2399 | - if (!empty($this->oldcopy) && $this->$varname != $this->oldcopy->$varname) |
|
| 2400 | - $keymodified = true; // For check if LDAP key has been modified |
|
| 2455 | + if (!empty($this->oldcopy) && $this->$varname != $this->oldcopy->$varname) { |
|
| 2456 | + $keymodified = true; |
|
| 2457 | + } |
|
| 2458 | + // For check if LDAP key has been modified |
|
| 2401 | 2459 | } |
| 2402 | 2460 | } |
| 2403 | 2461 | } |
| 2404 | - if ($this->address && !empty($conf->global->LDAP_FIELD_ADDRESS)) |
|
| 2405 | - $info[$conf->global->LDAP_FIELD_ADDRESS] = $this->address; |
|
| 2406 | - if ($this->zip && !empty($conf->global->LDAP_FIELD_ZIP)) |
|
| 2407 | - $info[$conf->global->LDAP_FIELD_ZIP] = $this->zip; |
|
| 2408 | - if ($this->town && !empty($conf->global->LDAP_FIELD_TOWN)) |
|
| 2409 | - $info[$conf->global->LDAP_FIELD_TOWN] = $this->town; |
|
| 2410 | - if ($this->note_public && !empty($conf->global->LDAP_FIELD_DESCRIPTION)) |
|
| 2411 | - $info[$conf->global->LDAP_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note_public, 2); |
|
| 2462 | + if ($this->address && !empty($conf->global->LDAP_FIELD_ADDRESS)) { |
|
| 2463 | + $info[$conf->global->LDAP_FIELD_ADDRESS] = $this->address; |
|
| 2464 | + } |
|
| 2465 | + if ($this->zip && !empty($conf->global->LDAP_FIELD_ZIP)) { |
|
| 2466 | + $info[$conf->global->LDAP_FIELD_ZIP] = $this->zip; |
|
| 2467 | + } |
|
| 2468 | + if ($this->town && !empty($conf->global->LDAP_FIELD_TOWN)) { |
|
| 2469 | + $info[$conf->global->LDAP_FIELD_TOWN] = $this->town; |
|
| 2470 | + } |
|
| 2471 | + if ($this->note_public && !empty($conf->global->LDAP_FIELD_DESCRIPTION)) { |
|
| 2472 | + $info[$conf->global->LDAP_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note_public, 2); |
|
| 2473 | + } |
|
| 2412 | 2474 | if ($this->socid > 0) {
|
| 2413 | 2475 | $soc = new Societe($this->db); |
| 2414 | 2476 | $soc->fetch($this->socid); |
| 2415 | 2477 | |
| 2416 | 2478 | $info[$conf->global->LDAP_FIELD_COMPANY] = $soc->name; |
| 2417 | - if ($soc->client == 1) |
|
| 2418 | - $info["businessCategory"] = "Customers"; |
|
| 2419 | - if ($soc->client == 2) |
|
| 2420 | - $info["businessCategory"] = "Prospects"; |
|
| 2421 | - if ($soc->fournisseur == 1) |
|
| 2422 | - $info["businessCategory"] = "Suppliers"; |
|
| 2479 | + if ($soc->client == 1) { |
|
| 2480 | + $info["businessCategory"] = "Customers"; |
|
| 2481 | + } |
|
| 2482 | + if ($soc->client == 2) { |
|
| 2483 | + $info["businessCategory"] = "Prospects"; |
|
| 2484 | + } |
|
| 2485 | + if ($soc->fournisseur == 1) { |
|
| 2486 | + $info["businessCategory"] = "Suppliers"; |
|
| 2487 | + } |
|
| 2423 | 2488 | } |
| 2424 | 2489 | |
| 2425 | 2490 | // When password is modified |
| 2426 | 2491 | if (!empty($this->pass)) {
|
| 2427 | - if (!empty($conf->global->LDAP_FIELD_PASSWORD)) |
|
| 2428 | - $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte |
|
| 2429 | - if (!empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) |
|
| 2430 | - $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption) |
|
| 2492 | + if (!empty($conf->global->LDAP_FIELD_PASSWORD)) { |
|
| 2493 | + $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass; |
|
| 2494 | + } |
|
| 2495 | + // this->pass = mot de passe non crypte |
|
| 2496 | + if (!empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) { |
|
| 2497 | + $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); |
|
| 2498 | + } |
|
| 2499 | + // Create OpenLDAP MD5 password (TODO add type of encryption) |
|
| 2431 | 2500 | } |
| 2432 | 2501 | // Set LDAP password if possible |
| 2433 | 2502 | elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') { // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password
|
@@ -2441,10 +2510,14 @@ discard block |
||
| 2441 | 2510 | } |
| 2442 | 2511 | // Use $this->pass_indatabase value if exists |
| 2443 | 2512 | elseif (!empty($this->pass_indatabase)) {
|
| 2444 | - if (!empty($conf->global->LDAP_FIELD_PASSWORD)) |
|
| 2445 | - $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte |
|
| 2446 | - if (!empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) |
|
| 2447 | - $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); // md5 for OpenLdap TODO add type of encryption |
|
| 2513 | + if (!empty($conf->global->LDAP_FIELD_PASSWORD)) { |
|
| 2514 | + $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass_indatabase; |
|
| 2515 | + } |
|
| 2516 | + // $this->pass_indatabase = mot de passe non crypte |
|
| 2517 | + if (!empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) { |
|
| 2518 | + $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); |
|
| 2519 | + } |
|
| 2520 | + // md5 for OpenLdap TODO add type of encryption |
|
| 2448 | 2521 | } |
| 2449 | 2522 | } |
| 2450 | 2523 | |
@@ -2467,10 +2540,12 @@ discard block |
||
| 2467 | 2540 | |
| 2468 | 2541 | $info["phpgwContactOwner"] = $this->egroupware_id; |
| 2469 | 2542 | |
| 2470 | - if ($this->email) |
|
| 2471 | - $info["rfc822Mailbox"] = $this->email; |
|
| 2472 | - if ($this->phone_mobile) |
|
| 2473 | - $info["phpgwCellTelephoneNumber"] = $this->phone_mobile; |
|
| 2543 | + if ($this->email) { |
|
| 2544 | + $info["rfc822Mailbox"] = $this->email; |
|
| 2545 | + } |
|
| 2546 | + if ($this->phone_mobile) { |
|
| 2547 | + $info["phpgwCellTelephoneNumber"] = $this->phone_mobile; |
|
| 2548 | + } |
|
| 2474 | 2549 | } |
| 2475 | 2550 | |
| 2476 | 2551 | return $info; |
@@ -2595,15 +2670,17 @@ discard block |
||
| 2595 | 2670 | $sql .= " FROM " . MAIN_DB_PREFIX . "user"; |
| 2596 | 2671 | if ($option == 'superadmin') {
|
| 2597 | 2672 | $sql .= " WHERE entity = 0"; |
| 2598 | - if ($admin >= 0) |
|
| 2599 | - $sql .= " AND admin = " . $admin; |
|
| 2600 | - } |
|
| 2601 | - else {
|
|
| 2673 | + if ($admin >= 0) { |
|
| 2674 | + $sql .= " AND admin = " . $admin; |
|
| 2675 | + } |
|
| 2676 | + } else {
|
|
| 2602 | 2677 | $sql .= " WHERE entity IN (" . getEntity('user', 0) . ")";
|
| 2603 | - if ($limitTo == 'active') |
|
| 2604 | - $sql .= " AND statut = 1"; |
|
| 2605 | - if ($admin >= 0) |
|
| 2606 | - $sql .= " AND admin = " . $admin; |
|
| 2678 | + if ($limitTo == 'active') { |
|
| 2679 | + $sql .= " AND statut = 1"; |
|
| 2680 | + } |
|
| 2681 | + if ($admin >= 0) { |
|
| 2682 | + $sql .= " AND admin = " . $admin; |
|
| 2683 | + } |
|
| 2607 | 2684 | } |
| 2608 | 2685 | |
| 2609 | 2686 | $resql = $this->db->query($sql); |
@@ -2756,8 +2833,9 @@ discard block |
||
| 2756 | 2833 | } else {
|
| 2757 | 2834 | $sql .= " WHERE u.entity IN (" . getEntity('user') . ")";
|
| 2758 | 2835 | } |
| 2759 | - if ($filter) |
|
| 2760 | - $sql .= " AND " . $filter; |
|
| 2836 | + if ($filter) { |
|
| 2837 | + $sql .= " AND " . $filter; |
|
| 2838 | + } |
|
| 2761 | 2839 | |
| 2762 | 2840 | dol_syslog(get_class($this) . "::get_full_tree get user list", LOG_DEBUG); |
| 2763 | 2841 | $resql = $this->db->query($sql); |
@@ -2839,14 +2917,16 @@ discard block |
||
| 2839 | 2917 | dol_syslog("Build childid for id = " . $idtoscan);
|
| 2840 | 2918 | foreach ($this->users as $id => $val) {
|
| 2841 | 2919 | //var_dump($val['fullpath']); |
| 2842 | - if (preg_match('/_' . $idtoscan . '_/', $val['fullpath']))
|
|
| 2843 | - $childids[$val['id']] = $val['id']; |
|
| 2920 | + if (preg_match('/_' . $idtoscan . '_/', $val['fullpath'])) { |
|
| 2921 | + $childids[$val['id']] = $val['id']; |
|
| 2922 | + } |
|
| 2844 | 2923 | } |
| 2845 | 2924 | } |
| 2846 | 2925 | $this->cache_childids[$this->id] = $childids; |
| 2847 | 2926 | |
| 2848 | - if ($addcurrentuser) |
|
| 2849 | - $childids[$this->id] = $this->id; |
|
| 2927 | + if ($addcurrentuser) { |
|
| 2928 | + $childids[$this->id] = $this->id; |
|
| 2929 | + } |
|
| 2850 | 2930 | |
| 2851 | 2931 | return $childids; |
| 2852 | 2932 | } |
@@ -2990,8 +3070,9 @@ discard block |
||
| 2990 | 3070 | // phpcs:enable |
| 2991 | 3071 | $user_property = ''; |
| 2992 | 3072 | |
| 2993 | - if (empty($rowid)) |
|
| 2994 | - return ''; |
|
| 3073 | + if (empty($rowid)) { |
|
| 3074 | + return ''; |
|
| 3075 | + } |
|
| 2995 | 3076 | |
| 2996 | 3077 | $sql = "SELECT rowid, email, user_mobile, civility, lastname, firstname"; |
| 2997 | 3078 | $sql .= " FROM " . MAIN_DB_PREFIX . "user"; |
@@ -3004,14 +3085,14 @@ discard block |
||
| 3004 | 3085 | if ($nump) {
|
| 3005 | 3086 | $obj = $this->db->fetch_object($resql); |
| 3006 | 3087 | |
| 3007 | - if ($mode == 'email') |
|
| 3008 | - $user_property = dolGetFirstLastname($obj->firstname, $obj->lastname) . " <" . $obj->email . ">"; |
|
| 3009 | - else if ($mode == 'mobile') |
|
| 3010 | - $user_property = $obj->user_mobile; |
|
| 3088 | + if ($mode == 'email') { |
|
| 3089 | + $user_property = dolGetFirstLastname($obj->firstname, $obj->lastname) . " <" . $obj->email . ">"; |
|
| 3090 | + } else if ($mode == 'mobile') { |
|
| 3091 | + $user_property = $obj->user_mobile; |
|
| 3092 | + } |
|
| 3011 | 3093 | } |
| 3012 | 3094 | return $user_property; |
| 3013 | - } |
|
| 3014 | - else {
|
|
| 3095 | + } else {
|
|
| 3015 | 3096 | dol_print_error($this->db); |
| 3016 | 3097 | } |
| 3017 | 3098 | } |
@@ -3054,8 +3135,9 @@ discard block |
||
| 3054 | 3135 | $sql .= ' AND (' . implode(' ' . $filtermode . ' ', $sqlwhere) . ')';
|
| 3055 | 3136 | } |
| 3056 | 3137 | $sql .= $this->db->order($sortfield, $sortorder); |
| 3057 | - if ($limit) |
|
| 3058 | - $sql .= $this->db->plimit($limit + 1, $offset); |
|
| 3138 | + if ($limit) { |
|
| 3139 | + $sql .= $this->db->plimit($limit + 1, $offset); |
|
| 3140 | + } |
|
| 3059 | 3141 | |
| 3060 | 3142 | dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); |
| 3061 | 3143 | |
@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | * \ingroup Advanced accountancy |
| 23 | 23 | * \brief Home accounting module |
| 24 | 24 | */ |
| 25 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 25 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 26 | 26 | |
| 27 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; |
|
| 28 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; |
|
| 27 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
|
| 28 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; |
|
| 29 | 29 | |
| 30 | 30 | // Load translation files required by the page |
| 31 | 31 | $langs->loadLangs(array("compta", "bills", "other", "accountancy", "loans", "banks", "admin", "dict"));
|
@@ -52,23 +52,23 @@ discard block |
||
| 52 | 52 | $step = 0; |
| 53 | 53 | |
| 54 | 54 | if ($conf->accounting->enabled) {
|
| 55 | - print $langs->trans("AccountancyAreaDescIntro") . "<br>\n";
|
|
| 55 | + print $langs->trans("AccountancyAreaDescIntro")."<br>\n";
|
|
| 56 | 56 | print "<br>\n"; |
| 57 | 57 | print "<br>\n"; |
| 58 | 58 | |
| 59 | - print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> ' . $langs->trans("AccountancyAreaDescActionOnce"), '', '') . "<br>\n";
|
|
| 59 | + print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."<br>\n";
|
|
| 60 | 60 | print '<hr>'; |
| 61 | 61 | print "<br>\n"; |
| 62 | 62 | |
| 63 | 63 | // STEPS |
| 64 | 64 | $step++; |
| 65 | - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescJournalSetup", $step, '<a href="' . DOL_URL_ROOT . '/accountancy/admin/journals_list.php?id=35">' . '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("AccountingJournals") . '</strong>' . '</a>');
|
|
| 65 | + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").'</strong>'.'</a>');
|
|
| 66 | 66 | print "<br>\n"; |
| 67 | 67 | $step++; |
| 68 | - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescChartModel", $step, '<a href="' . DOL_URL_ROOT . '/accountancy/admin/accountmodel.php">' . '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("Pcg_version") . '</strong>' . '</a>');
|
|
| 68 | + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").'</strong>'.'</a>');
|
|
| 69 | 69 | print "<br>\n"; |
| 70 | 70 | $step++; |
| 71 | - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescChart", $step, '<a href="' . DOL_URL_ROOT . '/accountancy/admin/account.php">' . '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("Chartofaccounts") . '</strong>' . '</a>');
|
|
| 71 | + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>'.'</a>');
|
|
| 72 | 72 | print "<br>\n"; |
| 73 | 73 | |
| 74 | 74 | print "<br>\n"; |
@@ -77,21 +77,21 @@ discard block |
||
| 77 | 77 | print "<br>\n"; |
| 78 | 78 | |
| 79 | 79 | $step++; |
| 80 | - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescDefault", $step, '<a href="' . DOL_URL_ROOT . '/accountancy/admin/defaultaccounts.php">' . '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("MenuDefaultAccounts") . '</strong>' . '</a>');
|
|
| 80 | + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'.'</a>');
|
|
| 81 | 81 | print "<br>\n"; |
| 82 | 82 | |
| 83 | 83 | $step++; |
| 84 | - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBank", $step, '<a href="' . DOL_URL_ROOT . '/compta/bank/list.php">' . '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("MenuBankAccounts") . '</strong>' . '</a>') . "\n";
|
|
| 84 | + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong>'.'</a>')."\n";
|
|
| 85 | 85 | print "<br>\n"; |
| 86 | 86 | |
| 87 | 87 | $step++; |
| 88 | - $textlink = '<a href="' . DOL_URL_ROOT . '/admin/dict.php?id=10&from=accountancy">' . '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . '-' . $langs->transnoentitiesnoconv("MenuVatAccounts") . '</strong>' . '</a>';
|
|
| 89 | - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescVat", $step, $textlink);
|
|
| 88 | + $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>'.'</a>';
|
|
| 89 | + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
|
|
| 90 | 90 | print "<br>\n"; |
| 91 | 91 | if (!empty($conf->tax->enabled)) {
|
| 92 | - $textlink = '<a href="' . DOL_URL_ROOT . '/admin/dict.php?id=7&from=accountancy">' . '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . '-' . $langs->transnoentitiesnoconv("MenuTaxAccounts") . '</strong>' . '</a>';
|
|
| 92 | + $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>'.'</a>';
|
|
| 93 | 93 | $step++; |
| 94 | - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescContrib", $step, $textlink);
|
|
| 94 | + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
|
|
| 95 | 95 | print "<br>\n"; |
| 96 | 96 | } |
| 97 | 97 | /* if (! empty($conf->salaries->enabled)) |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | } */ |
| 105 | 105 | if (!empty($conf->expensereport->enabled)) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
|
| 106 | 106 | $step++; |
| 107 | - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescExpenseReport", $step, '<a href="' . DOL_URL_ROOT . '/admin/dict.php?id=17&from=accountancy">' . '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("MenuExpenseReportAccounts") . '</strong>' . '</a>');
|
|
| 107 | + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>'.'</a>');
|
|
| 108 | 108 | print "<br>\n"; |
| 109 | 109 | } |
| 110 | 110 | /* |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | } */ |
| 123 | 123 | |
| 124 | 124 | $step++; |
| 125 | - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescProd", $step, '<a href="' . DOL_URL_ROOT . '/accountancy/admin/productaccount.php">' . '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . '-' . $langs->transnoentitiesnoconv("Setup") . "-" . $langs->transnoentitiesnoconv("ProductsBinding") . '</strong>' . '</a>');
|
|
| 125 | + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>'.'</a>');
|
|
| 126 | 126 | print "<br>\n"; |
| 127 | 127 | |
| 128 | 128 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | |
| 132 | 132 | print "<br>\n"; |
| 133 | - print load_fiche_titre('<span class="fa fa-calendar"></span> ' . $langs->trans("AccountancyAreaDescActionFreq"), '', '');
|
|
| 133 | + print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', '');
|
|
| 134 | 134 | print '<hr>'; |
| 135 | 135 | print "<br>\n"; |
| 136 | 136 | $step = 0; |
@@ -138,28 +138,28 @@ discard block |
||
| 138 | 138 | $langs->loadLangs(array('bills', 'trips'));
|
| 139 | 139 | |
| 140 | 140 | $step++; |
| 141 | - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '<a href="' . DOL_URL_ROOT . '/accountancy/customer/index.php">' . '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . "-" . $langs->transnoentitiesnoconv("CustomersVentilation") . '</strong>' . '</a>') . "\n";
|
|
| 141 | + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '<a href="'.DOL_URL_ROOT.'/accountancy/customer/index.php">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>'.'</a>')."\n";
|
|
| 142 | 142 | print "<br>\n"; |
| 143 | 143 | |
| 144 | 144 | $step++; |
| 145 | - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<a href="' . DOL_URL_ROOT . '/accountancy/supplier/index.php">' . '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . "-" . $langs->transnoentitiesnoconv("SuppliersVentilation") . '</strong>' . '</a>') . "\n";
|
|
| 145 | + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/index.php">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>'.'</a>')."\n";
|
|
| 146 | 146 | print "<br>\n"; |
| 147 | 147 | |
| 148 | 148 | if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled)) {
|
| 149 | 149 | $step++; |
| 150 | - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '<a href="' . DOL_URL_ROOT . '/accountancy/expensereport/index.php">' . '<strong>' . $langs->transnoentitiesnoconv("MenuAccountancy") . "-" . $langs->transnoentitiesnoconv("ExpenseReportsVentilation") . '</strong>' . '</a>') . "\n";
|
|
| 150 | + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>'.'</a>')."\n";
|
|
| 151 | 151 | print "<br>\n"; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | $step++; |
| 155 | - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), $langs->transnoentitiesnoconv("Journalization"), $langs->transnoentitiesnoconv("WriteBookKeeping")) . "\n";
|
|
| 155 | + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), $langs->transnoentitiesnoconv("Journalization"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
|
|
| 156 | 156 | print "<br>\n"; |
| 157 | 157 | |
| 158 | 158 | $step++; |
| 159 | - print img_picto('', 'puce') . ' ' . $langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step)) . "<br>\n";
|
|
| 159 | + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."<br>\n";
|
|
| 160 | 160 | print "<br>\n"; |
| 161 | 161 | } else {
|
| 162 | - print $langs->trans("Module10Desc") . "<br>\n";
|
|
| 162 | + print $langs->trans("Module10Desc")."<br>\n";
|
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // End of page |
@@ -31,8 +31,9 @@ |
||
| 31 | 31 | $langs->loadLangs(array("compta", "bills", "other", "accountancy", "loans", "banks", "admin", "dict"));
|
| 32 | 32 | |
| 33 | 33 | // Security check |
| 34 | -if ($user->societe_id > 0) |
|
| 35 | - accessforbidden(); |
|
| 34 | +if ($user->societe_id > 0) { |
|
| 35 | + accessforbidden(); |
|
| 36 | +} |
|
| 36 | 37 | |
| 37 | 38 | /* |
| 38 | 39 | * Actions |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | define('NOCSRFCHECK', 1); // This is main home and login page. We must be able to go on it from another web site. |
| 31 | 31 | |
| 32 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
| 33 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; |
|
| 32 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
| 33 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; |
|
| 34 | 34 | |
| 35 | 35 | // If not defined, we select menu "home" |
| 36 | 36 | $_GET['mainmenu'] = GETPOST('mainmenu', 'aZ09') ? GETPOST('mainmenu', 'aZ09') : 'home'; |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | // Check if company name is defined (first install) |
| 46 | 46 | if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_NOM)) { |
| 47 | 47 | //header("Location: " . DOL_URL_ROOT . "/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete"); |
| 48 | - header('Location: ' . BASE_URI . '?controller=admin&method=index&mainmenu=home&leftmenu=setup&mesg=setupnotcomplete'); |
|
| 48 | + header('Location: '.BASE_URI.'?controller=admin&method=index&mainmenu=home&leftmenu=setup&mesg=setupnotcomplete'); |
|
| 49 | 49 | exit; |
| 50 | 50 | } |
| 51 | 51 | /* |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | */ |
| 61 | 61 | if (GETPOST('addbox')) { // Add box (when submit is done from a form when ajax disabled) |
| 62 | - require_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php'; |
|
| 62 | + require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php'; |
|
| 63 | 63 | $zone = GETPOST('areacode', 'aZ09'); |
| 64 | 64 | $userid = GETPOST('userid', 'int'); |
| 65 | 65 | $boxorder = GETPOST('boxorder', 'aZ09'); |
@@ -83,15 +83,15 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // Title |
| 86 | -$title = $langs->trans("HomeArea") . ' - Dolibarr ' . DOL_VERSION; |
|
| 86 | +$title = $langs->trans("HomeArea").' - Dolibarr '.DOL_VERSION; |
|
| 87 | 87 | if (!empty($conf->global->MAIN_APPLICATION_TITLE)) |
| 88 | 88 | { |
| 89 | - $title = $langs->trans("HomeArea") . ' - ' . $conf->global->MAIN_APPLICATION_TITLE; |
|
| 89 | + $title = $langs->trans("HomeArea").' - '.$conf->global->MAIN_APPLICATION_TITLE; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | llxHeader('', $title); |
| 93 | 93 | |
| 94 | -$resultboxes = FormOther::getBoxesArea($user, "0"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) |
|
| 94 | +$resultboxes = FormOther::getBoxesArea($user, "0"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb) |
|
| 95 | 95 | |
| 96 | 96 | print load_fiche_titre($langs->trans("HomeArea"), $resultboxes['selectboxlist'], 'title_home'); |
| 97 | 97 | |
@@ -125,16 +125,16 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | if (empty($user->societe_id)) { |
| 127 | 127 | $boxstat .= '<div class="box">'; |
| 128 | - $boxstat .= '<table summary="' . dol_escape_htmltag($langs->trans("DolibarrStateBoard")) . '" class="noborder boxtable boxtablenobottom nohover" width="100%">'; |
|
| 128 | + $boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom nohover" width="100%">'; |
|
| 129 | 129 | $boxstat .= '<tr class="liste_titre">'; |
| 130 | - $boxstat .= '<th class="liste_titre">' . $langs->trans("DolibarrStateBoard") . '</th>'; |
|
| 130 | + $boxstat .= '<th class="liste_titre">'.$langs->trans("DolibarrStateBoard").'</th>'; |
|
| 131 | 131 | $boxstat .= '</tr>'; |
| 132 | 132 | $boxstat .= '<tr class="impair"><td class="tdboxstats nohover flexcontainer">'; |
| 133 | 133 | |
| 134 | 134 | $object = new stdClass(); |
| 135 | 135 | $parameters = array(); |
| 136 | 136 | $action = ''; |
| 137 | - $reshook = $hookmanager->executeHooks('addStatisticLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 137 | + $reshook = $hookmanager->executeHooks('addStatisticLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 138 | 138 | $boxstat .= $hookmanager->resPrint; |
| 139 | 139 | |
| 140 | 140 | if (empty($reshook)) { |
@@ -162,25 +162,25 @@ discard block |
||
| 162 | 162 | ); |
| 163 | 163 | // Class file containing the method load_state_board for each line |
| 164 | 164 | $includes = array( |
| 165 | - DOL_DOCUMENT_ROOT . "/user/class/user.class.php", |
|
| 166 | - DOL_DOCUMENT_ROOT . "/societe/class/client.class.php", |
|
| 167 | - DOL_DOCUMENT_ROOT . "/societe/class/client.class.php", |
|
| 168 | - DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.class.php", |
|
| 169 | - DOL_DOCUMENT_ROOT . "/contact/class/contact.class.php", |
|
| 170 | - DOL_DOCUMENT_ROOT . "/adherents/class/adherent.class.php", |
|
| 171 | - DOL_DOCUMENT_ROOT . "/product/class/product.class.php", |
|
| 172 | - DOL_DOCUMENT_ROOT . "/product/class/product.class.php", |
|
| 173 | - DOL_DOCUMENT_ROOT . "/comm/propal/class/propal.class.php", |
|
| 174 | - DOL_DOCUMENT_ROOT . "/commande/class/commande.class.php", |
|
| 175 | - DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php", |
|
| 176 | - DOL_DOCUMENT_ROOT . "/contrat/class/contrat.class.php", |
|
| 177 | - DOL_DOCUMENT_ROOT . "/fichinter/class/fichinter.class.php", |
|
| 178 | - DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.commande.class.php", |
|
| 179 | - DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.facture.class.php", |
|
| 180 | - DOL_DOCUMENT_ROOT . "/supplier_proposal/class/supplier_proposal.class.php", |
|
| 181 | - DOL_DOCUMENT_ROOT . "/projet/class/project.class.php", |
|
| 182 | - DOL_DOCUMENT_ROOT . "/expensereport/class/expensereport.class.php", |
|
| 183 | - DOL_DOCUMENT_ROOT . "/don/class/don.class.php" |
|
| 165 | + DOL_DOCUMENT_ROOT."/user/class/user.class.php", |
|
| 166 | + DOL_DOCUMENT_ROOT."/societe/class/client.class.php", |
|
| 167 | + DOL_DOCUMENT_ROOT."/societe/class/client.class.php", |
|
| 168 | + DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php", |
|
| 169 | + DOL_DOCUMENT_ROOT."/contact/class/contact.class.php", |
|
| 170 | + DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php", |
|
| 171 | + DOL_DOCUMENT_ROOT."/product/class/product.class.php", |
|
| 172 | + DOL_DOCUMENT_ROOT."/product/class/product.class.php", |
|
| 173 | + DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php", |
|
| 174 | + DOL_DOCUMENT_ROOT."/commande/class/commande.class.php", |
|
| 175 | + DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php", |
|
| 176 | + DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php", |
|
| 177 | + DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php", |
|
| 178 | + DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php", |
|
| 179 | + DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php", |
|
| 180 | + DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php", |
|
| 181 | + DOL_DOCUMENT_ROOT."/projet/class/project.class.php", |
|
| 182 | + DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php", |
|
| 183 | + DOL_DOCUMENT_ROOT."/don/class/don.class.php" |
|
| 184 | 184 | ); |
| 185 | 185 | // Name class containing the method load_state_board for each line |
| 186 | 186 | $classes = array('User', |
@@ -291,25 +291,25 @@ discard block |
||
| 291 | 291 | ); |
| 292 | 292 | */ |
| 293 | 293 | $links = array( |
| 294 | - BASE_URI . '/?controller=user&method=list', |
|
| 295 | - BASE_URI . '/?controller=societe&method=list&type=c&mainmenu=companies', |
|
| 296 | - BASE_URI . '/?controller=societe&method=list&type=p&mainmenu=companies', |
|
| 297 | - BASE_URI . '/?controller=societe&method=list&type=f&mainmenu=companies', |
|
| 298 | - BASE_URI . '/?controller=contact&method=list&mainmenu=companies', |
|
| 299 | - BASE_URI . '/?controller=adherents&method=list&statut=1&mainmenu=members', |
|
| 300 | - BASE_URI . '/?controller=product&method=list&type=0&mainmenu=products', |
|
| 301 | - BASE_URI . '/?controller=product&method=list&type=1&mainmenu=products', |
|
| 302 | - BASE_URI . '/?controller=comm/propal&method=list&mainmenu=commercial&leftmenu=propals', |
|
| 303 | - BASE_URI . '/?controller=commande&method=list&mainmenu=commercial&leftmenu=orders', |
|
| 304 | - BASE_URI . '/?controller=compta/facture&method=list&mainmenu=billing&leftmenu=customers_bills', |
|
| 305 | - BASE_URI . '/?controller=contrat&method=list&mainmenu=commercial&leftmenu=contracts', |
|
| 306 | - BASE_URI . '/?controller=fichinter&method=list&mainmenu=commercial&leftmenu=ficheinter', |
|
| 307 | - BASE_URI . '/?controller=fourn/commande&method=list&mainmenu=commercial&leftmenu=orders_suppliers', |
|
| 308 | - BASE_URI . '/?controller=fourn/facture&method=list&mainmenu=billing&leftmenu=suppliers_bills', |
|
| 309 | - BASE_URI . '/?controller=supplier_proposal&method=list&mainmenu=commercial&leftmenu=', |
|
| 310 | - BASE_URI . '/?controller=projet&method=list&mainmenu=project', |
|
| 311 | - BASE_URI . '/?controller=expensereport&method=list&mainmenu=hrm&leftmenu=expensereport', |
|
| 312 | - BASE_URI . '/?controller=don&method=list&leftmenu=donations' |
|
| 294 | + BASE_URI.'/?controller=user&method=list', |
|
| 295 | + BASE_URI.'/?controller=societe&method=list&type=c&mainmenu=companies', |
|
| 296 | + BASE_URI.'/?controller=societe&method=list&type=p&mainmenu=companies', |
|
| 297 | + BASE_URI.'/?controller=societe&method=list&type=f&mainmenu=companies', |
|
| 298 | + BASE_URI.'/?controller=contact&method=list&mainmenu=companies', |
|
| 299 | + BASE_URI.'/?controller=adherents&method=list&statut=1&mainmenu=members', |
|
| 300 | + BASE_URI.'/?controller=product&method=list&type=0&mainmenu=products', |
|
| 301 | + BASE_URI.'/?controller=product&method=list&type=1&mainmenu=products', |
|
| 302 | + BASE_URI.'/?controller=comm/propal&method=list&mainmenu=commercial&leftmenu=propals', |
|
| 303 | + BASE_URI.'/?controller=commande&method=list&mainmenu=commercial&leftmenu=orders', |
|
| 304 | + BASE_URI.'/?controller=compta/facture&method=list&mainmenu=billing&leftmenu=customers_bills', |
|
| 305 | + BASE_URI.'/?controller=contrat&method=list&mainmenu=commercial&leftmenu=contracts', |
|
| 306 | + BASE_URI.'/?controller=fichinter&method=list&mainmenu=commercial&leftmenu=ficheinter', |
|
| 307 | + BASE_URI.'/?controller=fourn/commande&method=list&mainmenu=commercial&leftmenu=orders_suppliers', |
|
| 308 | + BASE_URI.'/?controller=fourn/facture&method=list&mainmenu=billing&leftmenu=suppliers_bills', |
|
| 309 | + BASE_URI.'/?controller=supplier_proposal&method=list&mainmenu=commercial&leftmenu=', |
|
| 310 | + BASE_URI.'/?controller=projet&method=list&mainmenu=project', |
|
| 311 | + BASE_URI.'/?controller=expensereport&method=list&mainmenu=hrm&leftmenu=expensereport', |
|
| 312 | + BASE_URI.'/?controller=don&method=list&leftmenu=donations' |
|
| 313 | 313 | ); |
| 314 | 314 | // Translation lang files |
| 315 | 315 | $langfile = array("users", |
@@ -354,10 +354,10 @@ discard block |
||
| 354 | 354 | $langs->load($langfile[$key]); |
| 355 | 355 | $text = $langs->trans($titres[$key]); |
| 356 | 356 | //$sep=($conf->dol_use_jmobile?'<br>':' '); |
| 357 | - $boxstat .= '<a href="' . $links[$key] . '" class="boxstatsindicator thumbstat nobold nounderline">'; |
|
| 357 | + $boxstat .= '<a href="'.$links[$key].'" class="boxstatsindicator thumbstat nobold nounderline">'; |
|
| 358 | 358 | $boxstat .= '<div class="boxstats">'; |
| 359 | - $boxstat .= '<span class="boxstatstext" title="' . dol_escape_htmltag($text) . '">' . $text . '</span><br>'; |
|
| 360 | - $boxstat .= '<span class="boxstatsindicator">' . img_object("", $icons[$key], 'class="inline-block"') . ' ' . ($board->nb[$val] ? $board->nb[$val] : 0) . '</span>'; |
|
| 359 | + $boxstat .= '<span class="boxstatstext" title="'.dol_escape_htmltag($text).'">'.$text.'</span><br>'; |
|
| 360 | + $boxstat .= '<span class="boxstatsindicator">'.img_object("", $icons[$key], 'class="inline-block"').' '.($board->nb[$val] ? $board->nb[$val] : 0).'</span>'; |
|
| 361 | 361 | $boxstat .= '</div>'; |
| 362 | 362 | $boxstat .= '</a>'; |
| 363 | 363 | } |
@@ -391,11 +391,11 @@ discard block |
||
| 391 | 391 | $dashboardlines = array(); |
| 392 | 392 | |
| 393 | 393 | // Do not include sections without management permission |
| 394 | -require_once DOL_DOCUMENT_ROOT . '/core/class/workboardresponse.class.php'; |
|
| 394 | +require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php'; |
|
| 395 | 395 | |
| 396 | 396 | // Number of actions to do (late) |
| 397 | 397 | if (!empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) { |
| 398 | - include_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; |
|
| 398 | + include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; |
|
| 399 | 399 | $board = new ActionComm($db); |
| 400 | 400 | |
| 401 | 401 | $dashboardlines[] = $board->load_board($user); |
@@ -403,21 +403,21 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | // Number of project opened |
| 405 | 405 | if (!empty($conf->projet->enabled) && $user->rights->projet->lire) { |
| 406 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
| 406 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
| 407 | 407 | $board = new Project($db); |
| 408 | 408 | $dashboardlines[] = $board->load_board($user); |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | // Number of tasks to do (late) |
| 412 | 412 | if (!empty($conf->projet->enabled) && empty($conf->global->PROJECT_HIDE_TASKS) && $user->rights->projet->lire) { |
| 413 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php'; |
|
| 413 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; |
|
| 414 | 414 | $board = new Task($db); |
| 415 | 415 | $dashboardlines[] = $board->load_board($user); |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | // Number of commercial proposals opened (expired) |
| 419 | 419 | if (!empty($conf->propal->enabled) && $user->rights->propale->lire) { |
| 420 | - include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php'; |
|
| 420 | + include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; |
|
| 421 | 421 | $board = new Propal($db); |
| 422 | 422 | $dashboardlines[] = $board->load_board($user, "opened"); |
| 423 | 423 | // Number of commercial proposals CLOSED signed (billed) |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | |
| 427 | 427 | // Number of commercial proposals opened (expired) |
| 428 | 428 | if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) { |
| 429 | - include_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php'; |
|
| 429 | + include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; |
|
| 430 | 430 | $board = new SupplierProposal($db); |
| 431 | 431 | $dashboardlines[] = $board->load_board($user, "opened"); |
| 432 | 432 | // Number of commercial proposals CLOSED signed (billed) |
@@ -435,21 +435,21 @@ discard block |
||
| 435 | 435 | |
| 436 | 436 | // Number of customer orders a deal |
| 437 | 437 | if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { |
| 438 | - include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; |
|
| 438 | + include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; |
|
| 439 | 439 | $board = new Commande($db); |
| 440 | 440 | $dashboardlines[] = $board->load_board($user); |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | // Number of suppliers orders a deal |
| 444 | 444 | if (!empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire) { |
| 445 | - include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php'; |
|
| 445 | + include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; |
|
| 446 | 446 | $board = new CommandeFournisseur($db); |
| 447 | 447 | $dashboardlines[] = $board->load_board($user); |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | // Number of services enabled (delayed) |
| 451 | 451 | if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) { |
| 452 | - include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; |
|
| 452 | + include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; |
|
| 453 | 453 | $board = new Contrat($db); |
| 454 | 454 | $dashboardlines[] = $board->load_board($user, "inactives"); |
| 455 | 455 | // Number of active services (expired) |
@@ -457,23 +457,23 @@ discard block |
||
| 457 | 457 | } |
| 458 | 458 | // Number of invoices customers (has paid) |
| 459 | 459 | if (!empty($conf->facture->enabled) && $user->rights->facture->lire) { |
| 460 | - include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; |
|
| 460 | + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; |
|
| 461 | 461 | $board = new Facture($db); |
| 462 | 462 | $dashboardlines[] = $board->load_board($user); |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | // Number of supplier invoices (has paid) |
| 466 | 466 | if (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->fournisseur->facture->lire)) { |
| 467 | - include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; |
|
| 467 | + include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; |
|
| 468 | 468 | $board = new FactureFournisseur($db); |
| 469 | 469 | $dashboardlines[] = $board->load_board($user); |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | // Number of transactions to conciliate |
| 473 | 473 | if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->societe_id) { |
| 474 | - include_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; |
|
| 474 | + include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; |
|
| 475 | 475 | $board = new Account($db); |
| 476 | - $nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate |
|
| 476 | + $nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate |
|
| 477 | 477 | if ($nb > 0) { |
| 478 | 478 | $dashboardlines[] = $board->load_board($user); |
| 479 | 479 | } |
@@ -481,28 +481,28 @@ discard block |
||
| 481 | 481 | |
| 482 | 482 | // Number of cheque to send |
| 483 | 483 | if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->societe_id && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) { |
| 484 | - include_once DOL_DOCUMENT_ROOT . '/compta/paiement/cheque/class/remisecheque.class.php'; |
|
| 484 | + include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; |
|
| 485 | 485 | $board = new RemiseCheque($db); |
| 486 | 486 | $dashboardlines[] = $board->load_board($user); |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | // Number of foundation members |
| 490 | 490 | if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire && !$user->societe_id) { |
| 491 | - include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
| 491 | + include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
| 492 | 492 | $board = new Adherent($db); |
| 493 | 493 | $dashboardlines[] = $board->load_board($user); |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | // Number of expense reports to approve |
| 497 | 497 | if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->approve) { |
| 498 | - include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; |
|
| 498 | + include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; |
|
| 499 | 499 | $board = new ExpenseReport($db); |
| 500 | 500 | $dashboardlines[] = $board->load_board($user, 'toapprove'); |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | // Number of expense reports to pay |
| 504 | 504 | if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid) { |
| 505 | - include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; |
|
| 505 | + include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; |
|
| 506 | 506 | $board = new ExpenseReport($db); |
| 507 | 507 | $dashboardlines[] = $board->load_board($user, 'topay'); |
| 508 | 508 | } |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | $object = new stdClass(); |
| 511 | 511 | $parameters = array(); |
| 512 | 512 | $action = ''; |
| 513 | -$reshook = $hookmanager->executeHooks('addOpenElementsDashboardLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 513 | +$reshook = $hookmanager->executeHooks('addOpenElementsDashboardLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks |
|
| 514 | 514 | if ($reshook == 0) { |
| 515 | 515 | $dashboardlines = array_merge($dashboardlines, $hookmanager->resArray); |
| 516 | 516 | } |
@@ -540,22 +540,22 @@ discard block |
||
| 540 | 540 | //var_dump($totallate); |
| 541 | 541 | $boxwork = ''; |
| 542 | 542 | $boxwork .= '<div class="box">'; |
| 543 | -$boxwork .= '<table summary="' . dol_escape_htmltag($langs->trans("WorkingBoard")) . '" class="noborder boxtable boxtablenobottom boxworkingboard" width="100%">' . "\n"; |
|
| 543 | +$boxwork .= '<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable boxtablenobottom boxworkingboard" width="100%">'."\n"; |
|
| 544 | 544 | $boxwork .= '<tr class="liste_titre">'; |
| 545 | -$boxwork .= '<th class="liste_titre">' . $langs->trans("DolibarrWorkBoard") . '</th>'; |
|
| 546 | -$boxwork .= '</tr>' . "\n"; |
|
| 545 | +$boxwork .= '<th class="liste_titre">'.$langs->trans("DolibarrWorkBoard").'</th>'; |
|
| 546 | +$boxwork .= '</tr>'."\n"; |
|
| 547 | 547 | |
| 548 | 548 | if ($showweather) { |
| 549 | 549 | $boxwork .= '<tr class="nohover">'; |
| 550 | - $boxwork .= '<td class="nohover' . ($conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : '') . ' center valignmiddle">'; |
|
| 550 | + $boxwork .= '<td class="nohover'.($conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : '').' center valignmiddle">'; |
|
| 551 | 551 | $text = ''; |
| 552 | 552 | if ($totallate > 0) |
| 553 | 553 | { |
| 554 | - $text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate") . ' (' . $langs->transnoentitiesnoconv("NActionsLate", $totallate . (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')) . ')'; |
|
| 554 | + $text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate", $totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')'; |
|
| 555 | 555 | } else { |
| 556 | 556 | $text = $langs->transnoentitiesnoconv("NoItemLate"); |
| 557 | 557 | } |
| 558 | - $text .= '. ' . $langs->transnoentitiesnoconv("LateDesc"); |
|
| 558 | + $text .= '. '.$langs->transnoentitiesnoconv("LateDesc"); |
|
| 559 | 559 | //$text.=$form->textwithpicto('',$langs->trans("LateDesc")); |
| 560 | 560 | $options = 'height="64px"'; |
| 561 | 561 | $boxwork .= showWeather($totallate, $text, $options); |
@@ -575,23 +575,23 @@ discard block |
||
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | $textlate = $langs->trans("NActionsLate", $board->nbtodolate); |
| 578 | - $textlate .= ' (' . $langs->trans("Late") . ' = ' . $langs->trans("DateReference") . ' > ' . $langs->trans("DateToday") . ' ' . (ceil($board->warning_delay) >= 0 ? '+' : '') . ceil($board->warning_delay) . ' ' . $langs->trans("days") . ')'; |
|
| 578 | + $textlate .= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')'; |
|
| 579 | 579 | |
| 580 | 580 | $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats130 boxstatsborder">'; |
| 581 | 581 | $boxwork .= '<div class="boxstatscontent">'; |
| 582 | 582 | $sep = ($conf->dol_use_jmobile ? '<br>' : ' '); |
| 583 | - $boxwork .= '<span class="boxstatstext" title="' . dol_escape_htmltag($board->label) . '">' . $board->img . ' ' . $board->label . '</span><br>'; |
|
| 584 | - $boxwork .= '<a class="valignmiddle dashboardlineindicator" href="' . $board->url . '"><span class="dashboardlineindicator' . (($board->nbtodo == 0) ? ' dashboardlineok' : '') . '">' . $board->nbtodo . '</span></a>'; |
|
| 583 | + $boxwork .= '<span class="boxstatstext" title="'.dol_escape_htmltag($board->label).'">'.$board->img.' '.$board->label.'</span><br>'; |
|
| 584 | + $boxwork .= '<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0) ? ' dashboardlineok' : '').'">'.$board->nbtodo.'</span></a>'; |
|
| 585 | 585 | if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) { |
| 586 | - $boxwork .= ' / <a class="valignmiddle dashboardlineindicator" href="' . $board->url . '"><span class="dashboardlineindicator' . (($board->nbtodo == 0) ? ' dashboardlineok' : '') . '">' . price($board->total) . '</span></a>'; |
|
| 586 | + $boxwork .= ' / <a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0) ? ' dashboardlineok' : '').'">'.price($board->total).'</span></a>'; |
|
| 587 | 587 | } |
| 588 | 588 | $boxwork .= '</div>'; |
| 589 | 589 | if ($board->nbtodolate > 0) { |
| 590 | 590 | $boxwork .= '<div class="dashboardlinelatecoin nowrap">'; |
| 591 | - $boxwork .= '<a title="' . dol_escape_htmltag($textlate) . '" class="valignmiddle dashboardlineindicatorlate' . ($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok') . '" href="' . ((!$board->url_late) ? $board->url : $board->url_late ) . '">'; |
|
| 591 | + $boxwork .= '<a title="'.dol_escape_htmltag($textlate).'" class="valignmiddle dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'" href="'.((!$board->url_late) ? $board->url : $board->url_late).'">'; |
|
| 592 | 592 | //$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"').''; |
| 593 | - $boxwork .= img_picto($textlate, "warning_white", 'class="inline-block hideonsmartphone valigntextbottom"') . ''; |
|
| 594 | - $boxwork .= '<span class="dashboardlineindicatorlate' . ($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok') . '">'; |
|
| 593 | + $boxwork .= img_picto($textlate, "warning_white", 'class="inline-block hideonsmartphone valigntextbottom"').''; |
|
| 594 | + $boxwork .= '<span class="dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'">'; |
|
| 595 | 595 | $boxwork .= $board->nbtodolate; |
| 596 | 596 | $boxwork .= '</span>'; |
| 597 | 597 | $boxwork .= '</a>'; |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | |
| 621 | 621 | $boxwork .= '</td></tr>'; |
| 622 | 622 | |
| 623 | -$boxwork .= '</table>'; // End table array of working board |
|
| 623 | +$boxwork .= '</table>'; // End table array of working board |
|
| 624 | 624 | $boxwork .= '</div>'; |
| 625 | 625 | |
| 626 | 626 | print '</div></div></div><div class="clearboth"></div>'; |
@@ -666,11 +666,11 @@ discard block |
||
| 666 | 666 | $message = ''; |
| 667 | 667 | |
| 668 | 668 | // Check if install lock file is present |
| 669 | - $lockfile = DOL_DATA_ROOT . '/install.lock'; |
|
| 670 | - if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT . "/install")) { |
|
| 669 | + $lockfile = DOL_DATA_ROOT.'/install.lock'; |
|
| 670 | + if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT."/install")) { |
|
| 671 | 671 | $langs->load("errors"); |
| 672 | 672 | //if (! empty($message)) $message.='<br>'; |
| 673 | - $message .= info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT) . ' ' . $langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT . "/install"), 0, 0, '1', 'clearboth'); |
|
| 673 | + $message .= info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT).' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth'); |
|
| 674 | 674 | } |
| 675 | 675 | |
| 676 | 676 | // Conf files must be in read only mode |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | $langs->load("errors"); |
| 679 | 679 | //$langs->load("other"); |
| 680 | 680 | //if (! empty($message)) $message.='<br>'; |
| 681 | - $message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly") . ' ' . $langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT . "/install"), 0, 0, '1', 'clearboth'); |
|
| 681 | + $message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly").' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth'); |
|
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | if ($message) { |
@@ -713,20 +713,20 @@ discard block |
||
| 713 | 713 | $used_conf = !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'MAIN_METEO_PERCENTAGE_LEVEL' : 'MAIN_METEO_LEVEL'; |
| 714 | 714 | |
| 715 | 715 | $level0 = $offset; |
| 716 | - if (!empty($conf->global->{$used_conf . '0'})) { |
|
| 717 | - $level0 = $conf->global->{$used_conf . '0'}; |
|
| 716 | + if (!empty($conf->global->{$used_conf.'0'})) { |
|
| 717 | + $level0 = $conf->global->{$used_conf.'0'}; |
|
| 718 | 718 | } |
| 719 | 719 | $level1 = $offset + 1 * $factor; |
| 720 | - if (!empty($conf->global->{$used_conf . '1'})) { |
|
| 721 | - $level1 = $conf->global->{$used_conf . '1'}; |
|
| 720 | + if (!empty($conf->global->{$used_conf.'1'})) { |
|
| 721 | + $level1 = $conf->global->{$used_conf.'1'}; |
|
| 722 | 722 | } |
| 723 | 723 | $level2 = $offset + 2 * $factor; |
| 724 | - if (!empty($conf->global->{$used_conf . '2'})) { |
|
| 725 | - $level2 = $conf->global->{$used_conf . '2'}; |
|
| 724 | + if (!empty($conf->global->{$used_conf.'2'})) { |
|
| 725 | + $level2 = $conf->global->{$used_conf.'2'}; |
|
| 726 | 726 | } |
| 727 | 727 | $level3 = $offset + 3 * $factor; |
| 728 | - if (!empty($conf->global->{$used_conf . '3'})) { |
|
| 729 | - $level3 = $conf->global->{$used_conf . '3'}; |
|
| 728 | + if (!empty($conf->global->{$used_conf.'3'})) { |
|
| 729 | + $level3 = $conf->global->{$used_conf.'3'}; |
|
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | if ($totallate <= $level0) |