@@ -45,7 +45,7 @@ |
||
45 | 45 | // For MultiCompany module. |
46 | 46 | // Do not use GETPOST here, function is not defined and define must be done before including main.inc.php |
47 | 47 | // Because 2 entities can have the same ref. |
48 | -$entity = (!empty($_GET['e']) ? (int)$_GET['e'] : (!empty($_POST['e']) ? (int)$_POST['e'] : 1)); |
|
48 | +$entity = (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1)); |
|
49 | 49 | if (is_numeric($entity)) { |
50 | 50 | define("DOLENTITY", $entity); |
51 | 51 | } |
@@ -505,14 +505,14 @@ discard block |
||
505 | 505 | id="db_pass" autocomplete="off" |
506 | 506 | name="db_pass" |
507 | 507 | value="<?php |
508 | - // If $force_install_databasepass is on, we don't want to set password, we just show '***'. Real value will be extracted from the forced install file at step1. |
|
509 | - // @phan-suppress-next-line PhanParamSuspiciousOrder |
|
510 | - $autofill = ((!empty($_SESSION['dol_save_pass'])) ? $_SESSION['dol_save_pass'] : str_pad('', strlen($force_install_databasepass), '*')); |
|
511 | - if (!empty($dolibarr_main_prod) && empty($_SESSION['dol_save_pass'])) { // So value can't be found if install page still accessible |
|
512 | - $autofill = ''; |
|
513 | - } |
|
514 | - print dol_escape_htmltag($autofill); |
|
515 | - ?>" |
|
508 | + // If $force_install_databasepass is on, we don't want to set password, we just show '***'. Real value will be extracted from the forced install file at step1. |
|
509 | + // @phan-suppress-next-line PhanParamSuspiciousOrder |
|
510 | + $autofill = ((!empty($_SESSION['dol_save_pass'])) ? $_SESSION['dol_save_pass'] : str_pad('', strlen($force_install_databasepass), '*')); |
|
511 | + if (!empty($dolibarr_main_prod) && empty($_SESSION['dol_save_pass'])) { // So value can't be found if install page still accessible |
|
512 | + $autofill = ''; |
|
513 | + } |
|
514 | + print dol_escape_htmltag($autofill); |
|
515 | + ?>" |
|
516 | 516 | <?php if (($force_install_noedit == 2 || $force_install_noedit == 3) && $force_install_databasepass !== null) { |
517 | 517 | print ' disabled'; |
518 | 518 | } ?> |
@@ -591,23 +591,23 @@ discard block |
||
591 | 591 | name="db_pass_root" |
592 | 592 | class="needroot text-security" |
593 | 593 | value="<?php |
594 | - // If $force_install_databaserootpass is on, we don't want to set password here, we just show '***'. Real value will be extracted from the forced install file at step1. |
|
595 | - // @phan-suppress-next-line PhanParamSuspiciousOrder |
|
596 | - $autofill = ((!empty($force_install_databaserootpass)) ? str_pad('', strlen($force_install_databaserootpass), '*') : (isset($db_pass_root) ? $db_pass_root : '')); |
|
597 | - if (!empty($dolibarr_main_prod)) { |
|
598 | - $autofill = ''; |
|
599 | - } |
|
600 | - // Do not autofill password if instance is a production instance |
|
601 | - if ( |
|
602 | - !empty($_SERVER["SERVER_NAME"]) && !in_array( |
|
603 | - $_SERVER["SERVER_NAME"], |
|
604 | - array('127.0.0.1', 'localhost', 'localhostgit') |
|
605 | - ) |
|
606 | - ) { |
|
607 | - $autofill = ''; |
|
608 | - } // Do not autofill password for remote access |
|
609 | - print dol_escape_htmltag($autofill); |
|
610 | - ?>" |
|
594 | + // If $force_install_databaserootpass is on, we don't want to set password here, we just show '***'. Real value will be extracted from the forced install file at step1. |
|
595 | + // @phan-suppress-next-line PhanParamSuspiciousOrder |
|
596 | + $autofill = ((!empty($force_install_databaserootpass)) ? str_pad('', strlen($force_install_databaserootpass), '*') : (isset($db_pass_root) ? $db_pass_root : '')); |
|
597 | + if (!empty($dolibarr_main_prod)) { |
|
598 | + $autofill = ''; |
|
599 | + } |
|
600 | + // Do not autofill password if instance is a production instance |
|
601 | + if ( |
|
602 | + !empty($_SERVER["SERVER_NAME"]) && !in_array( |
|
603 | + $_SERVER["SERVER_NAME"], |
|
604 | + array('127.0.0.1', 'localhost', 'localhostgit') |
|
605 | + ) |
|
606 | + ) { |
|
607 | + $autofill = ''; |
|
608 | + } // Do not autofill password for remote access |
|
609 | + print dol_escape_htmltag($autofill); |
|
610 | + ?>" |
|
611 | 611 | <?php if ($force_install_noedit > 0 && !empty($force_install_databaserootpass)) { |
612 | 612 | print ' disabled'; /* May be removed by javascript*/ |
613 | 613 | } ?> |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $arrayofmassactions = array(); |
209 | 209 | |
210 | 210 | $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; |
211 | -$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup |
|
211 | +$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup |
|
212 | 212 | $selectedfields = ($mode != 'kanban' ? $htmlofselectarray : ''); |
213 | 213 | $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); |
214 | 214 | |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | usort( |
296 | 296 | $moduleList, |
297 | 297 | /** @return int */ |
298 | - function (stdClass $a, stdClass $b) { |
|
298 | + function(stdClass $a, stdClass $b) { |
|
299 | 299 | return strcasecmp($a->name, $b->name); |
300 | 300 | } |
301 | 301 | ); |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | usort( |
304 | 304 | $moduleList, |
305 | 305 | /** @return int */ |
306 | - static function (stdClass $a, stdClass $b) { |
|
306 | + static function(stdClass $a, stdClass $b) { |
|
307 | 307 | return strcasecmp($b->name, $a->name); |
308 | 308 | } |
309 | 309 | ); |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | usort( |
312 | 312 | $moduleList, |
313 | 313 | /** @return int */ |
314 | - static function (stdClass $a, stdClass $b) { |
|
314 | + static function(stdClass $a, stdClass $b) { |
|
315 | 315 | return strcasecmp($a->version, $b->version); |
316 | 316 | } |
317 | 317 | ); |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | usort( |
320 | 320 | $moduleList, |
321 | 321 | /** @return int */ |
322 | - static function (stdClass $a, stdClass $b) { |
|
322 | + static function(stdClass $a, stdClass $b) { |
|
323 | 323 | return strcasecmp($b->version, $a->version); |
324 | 324 | } |
325 | 325 | ); |
@@ -418,11 +418,11 @@ discard block |
||
418 | 418 | */ |
419 | 419 | function compareIdAsc(stdClass $a, stdClass $b) |
420 | 420 | { |
421 | - if ((int)$a->id == (int)$b->id) { |
|
421 | + if ((int) $a->id == (int) $b->id) { |
|
422 | 422 | return 0; |
423 | 423 | } |
424 | 424 | |
425 | - return ((int)$a->id < (int)$b->id) ? -1 : 1; |
|
425 | + return ((int) $a->id < (int) $b->id) ? -1 : 1; |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | /** |
@@ -434,11 +434,11 @@ discard block |
||
434 | 434 | */ |
435 | 435 | function compareIdDesc(stdClass $a, stdClass $b) |
436 | 436 | { |
437 | - if ((int)$a->id == (int)$b->id) { |
|
437 | + if ((int) $a->id == (int) $b->id) { |
|
438 | 438 | return 0; |
439 | 439 | } |
440 | 440 | |
441 | - return ((int)$b->id < (int)$a->id) ? -1 : 1; |
|
441 | + return ((int) $b->id < (int) $a->id) ? -1 : 1; |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | // Force entity if a value is provided into HTTP header. Otherwise, will use the entity of user of token used. |
76 | 76 | if (!empty($_SERVER['HTTP_DOLAPIENTITY'])) { |
77 | - define("DOLENTITY", (int)$_SERVER['HTTP_DOLAPIENTITY']); |
|
77 | + define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // Response for preflight requests (used by browser when into a CORS context) |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | // If MAIN_API_DEBUG is set to 1, we save logs into file "dolibarr_api.log" |
184 | 184 | if (getDolGlobalString('MAIN_API_DEBUG')) { |
185 | 185 | $r = $api->r; |
186 | - $r->onCall(function () use ($r) { |
|
186 | + $r->onCall(function() use ($r) { |
|
187 | 187 | // Don't log Luracast Restler Explorer resources calls |
188 | 188 | //if (!preg_match('/^explorer/', $r->url)) { |
189 | 189 | // 'method' => $api->r->requestMethod, |
@@ -448,8 +448,8 @@ discard block |
||
448 | 448 | $sql = "SELECT up.value"; |
449 | 449 | $sql .= " FROM " . MAIN_DB_PREFIX . "user_param as up"; |
450 | 450 | $sql .= " WHERE up.param = 'API_COUNT_CALL'"; |
451 | - $sql .= " AND up.fk_user = " . ((int)$userid); |
|
452 | - $sql .= " AND up.entity = " . ((int)$conf->entity); |
|
451 | + $sql .= " AND up.fk_user = " . ((int) $userid); |
|
452 | + $sql .= " AND up.entity = " . ((int) $conf->entity); |
|
453 | 453 | |
454 | 454 | $result = $db->query($sql); |
455 | 455 | if ($result) { |
@@ -458,14 +458,14 @@ discard block |
||
458 | 458 | if ($nbrows == 0) { |
459 | 459 | $sql2 = "INSERT INTO " . MAIN_DB_PREFIX . "user_param"; |
460 | 460 | $sql2 .= " (fk_user, entity, param, value)"; |
461 | - $sql2 .= " VALUES (" . ((int)$userid) . ", " . ((int)$conf->entity) . ", 'API_COUNT_CALL', 1)"; |
|
461 | + $sql2 .= " VALUES (" . ((int) $userid) . ", " . ((int) $conf->entity) . ", 'API_COUNT_CALL', 1)"; |
|
462 | 462 | } else { |
463 | 463 | $updateapi = true; |
464 | 464 | $sql2 = "UPDATE " . MAIN_DB_PREFIX . "user_param as up"; |
465 | 465 | $sql2 .= " SET up.value = up.value + 1"; |
466 | 466 | $sql2 .= " WHERE up.param = 'API_COUNT_CALL'"; |
467 | - $sql2 .= " AND up.fk_user = " . ((int)$userid); |
|
468 | - $sql2 .= " AND up.entity = " . ((int)$conf->entity); |
|
467 | + $sql2 .= " AND up.fk_user = " . ((int) $userid); |
|
468 | + $sql2 .= " AND up.entity = " . ((int) $conf->entity); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | $result2 = $db->query($sql2); |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | $sql .= " FROM " . MAIN_DB_PREFIX . "rights_def as r,"; |
154 | 154 | $sql .= " " . MAIN_DB_PREFIX . "usergroup_rights as gr"; |
155 | 155 | $sql .= " WHERE gr.fk_id = r.id"; |
156 | - $sql .= " AND gr.entity = " . ((int)$entity); |
|
157 | - $sql .= " AND gr.fk_usergroup = " . ((int)$object->id); |
|
156 | + $sql .= " AND gr.entity = " . ((int) $entity); |
|
157 | + $sql .= " AND gr.fk_usergroup = " . ((int) $object->id); |
|
158 | 158 | |
159 | 159 | dol_syslog("get user perms", LOG_DEBUG); |
160 | 160 | $result = $db->query($sql); |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | $sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault"; |
261 | 261 | $sql .= " FROM " . MAIN_DB_PREFIX . "rights_def as r"; |
262 | 262 | $sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" |
263 | - $sql .= " AND r.entity = " . ((int)$entity); |
|
263 | + $sql .= " AND r.entity = " . ((int) $entity); |
|
264 | 264 | if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { |
265 | 265 | $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is disable |
266 | 266 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $login = GETPOST('login', 'alpha') ? GETPOST('login', 'alpha') : (empty($argv[5]) ? '' : $argv[5]); |
78 | 78 | $pass = GETPOST('pass', 'alpha') ? GETPOST('pass', 'alpha') : (empty($argv[6]) ? '' : $argv[6]); |
79 | 79 | $pass_verif = GETPOST('pass_verif', 'alpha') ? GETPOST('pass_verif', 'alpha') : (empty($argv[7]) ? '' : $argv[7]); |
80 | -$force_install_lockinstall = (int)(!empty($force_install_lockinstall) ? $force_install_lockinstall : (GETPOST('installlock', 'aZ09') ? GETPOST('installlock', 'aZ09') : (empty($argv[8]) ? '' : $argv[8]))); |
|
80 | +$force_install_lockinstall = (int) (!empty($force_install_lockinstall) ? $force_install_lockinstall : (GETPOST('installlock', 'aZ09') ? GETPOST('installlock', 'aZ09') : (empty($argv[8]) ? '' : $argv[8]))); |
|
81 | 81 | |
82 | 82 | $success = 0; |
83 | 83 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $conf->db->dolibarr_main_db_encryption = isset($dolibarr_main_db_encryption) ? $dolibarr_main_db_encryption : 0; |
170 | 170 | $conf->db->dolibarr_main_db_cryptkey = isset($dolibarr_main_db_cryptkey) ? $dolibarr_main_db_cryptkey : ''; |
171 | 171 | |
172 | - $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int)$conf->db->port); |
|
172 | + $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int) $conf->db->port); |
|
173 | 173 | |
174 | 174 | // Create the global $hookmanager object |
175 | 175 | include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | $newuser->admin = 1; |
237 | 237 | $newuser->entity = 0; |
238 | 238 | |
239 | - $conf->global->USER_MAIL_REQUIRED = 0; // Force global option to be sure to create a new user with no email |
|
240 | - $conf->global->USER_PASSWORD_GENERATED = ''; // To not use any rule for password validation |
|
239 | + $conf->global->USER_MAIL_REQUIRED = 0; // Force global option to be sure to create a new user with no email |
|
240 | + $conf->global->USER_PASSWORD_GENERATED = ''; // To not use any rule for password validation |
|
241 | 241 | |
242 | 242 | $result = $newuser->create($createuser, 1); |
243 | 243 | if ($result > 0) { |
@@ -317,8 +317,8 @@ discard block |
||
317 | 317 | // with |
318 | 318 | // 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401 + 200100000, 'PCG99-ABREGE','CAPIT', '1234', 1400 + 200100000,...' |
319 | 319 | // Note: string with 'PCG99-ABREGE','CAPIT', 1234 instead of 'PCG99-ABREGE','CAPIT', '1234' is also supported |
320 | - $newsql = preg_replace('/VALUES\s*\(__ENTITY__, \s*(\d+)\s*,(\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'?[^\',]*\'?\s*),\s*\'?([^\',]*)\'?/ims', 'VALUES (__ENTITY__, \1 + ' . ((int)$offsetforchartofaccount) . ', \2, \3 + ' . ((int)$offsetforchartofaccount), $newsql); |
|
321 | - $newsql = preg_replace('/([,\s])0 \+ ' . ((int)$offsetforchartofaccount) . '/ims', '\1 0', $newsql); |
|
320 | + $newsql = preg_replace('/VALUES\s*\(__ENTITY__, \s*(\d+)\s*,(\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'?[^\',]*\'?\s*),\s*\'?([^\',]*)\'?/ims', 'VALUES (__ENTITY__, \1 + ' . ((int) $offsetforchartofaccount) . ', \2, \3 + ' . ((int) $offsetforchartofaccount), $newsql); |
|
321 | + $newsql = preg_replace('/([,\s])0 \+ ' . ((int) $offsetforchartofaccount) . '/ims', '\1 0', $newsql); |
|
322 | 322 | //var_dump($newsql); |
323 | 323 | $arraysql[$i] = $newsql; |
324 | 324 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | $sql = preg_replace('/__DATABASE__/i', $db->escape($database), $sql); |
418 | 418 | } |
419 | 419 | |
420 | - $newsql = preg_replace('/__ENTITY__/i', (!empty($entity) ? $entity : (string)$conf->entity), $sql); |
|
420 | + $newsql = preg_replace('/__ENTITY__/i', (!empty($entity) ? $entity : (string) $conf->entity), $sql); |
|
421 | 421 | |
422 | 422 | // Add log of request |
423 | 423 | if (!$silent) { |
@@ -594,11 +594,11 @@ discard block |
||
594 | 594 | $sql = "DELETE FROM " . MAIN_DB_PREFIX . "const"; |
595 | 595 | $sql .= " WHERE (" . $db->decrypt('name') . " = '" . $db->escape($name) . "'"; |
596 | 596 | if (is_numeric($name)) { |
597 | - $sql .= " OR rowid = " . ((int)$name); |
|
597 | + $sql .= " OR rowid = " . ((int) $name); |
|
598 | 598 | } |
599 | 599 | $sql .= ")"; |
600 | 600 | if ($entity >= 0) { |
601 | - $sql .= " AND entity = " . ((int)$entity); |
|
601 | + $sql .= " AND entity = " . ((int) $entity); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | dol_syslog("admin.lib::dolibarr_del_const", LOG_DEBUG); |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | $sql = "SELECT " . $db->decrypt('value') . " as value"; |
630 | 630 | $sql .= " FROM " . MAIN_DB_PREFIX . "const"; |
631 | 631 | $sql .= " WHERE name = " . $db->encrypt($name); |
632 | - $sql .= " AND entity = " . ((int)$entity); |
|
632 | + $sql .= " AND entity = " . ((int) $entity); |
|
633 | 633 | |
634 | 634 | dol_syslog("admin.lib::dolibarr_get_const", LOG_DEBUG); |
635 | 635 | $resql = $db->query($sql); |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | $sql = "DELETE FROM " . MAIN_DB_PREFIX . "const"; |
679 | 679 | $sql .= " WHERE name = " . $db->encrypt($name); |
680 | 680 | if ($entity >= 0) { |
681 | - $sql .= " AND entity = " . ((int)$entity); |
|
681 | + $sql .= " AND entity = " . ((int) $entity); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | dol_syslog("admin.lib::dolibarr_set_const", LOG_DEBUG); |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | $sql .= " VALUES ("; |
701 | 701 | $sql .= $db->encrypt($name); |
702 | 702 | $sql .= ", " . $db->encrypt($newvalue); |
703 | - $sql .= ", '" . $db->escape($type) . "', " . ((int)$visible) . ", '" . $db->escape($note) . "', " . ((int)$entity) . ")"; |
|
703 | + $sql .= ", '" . $db->escape($type) . "', " . ((int) $visible) . ", '" . $db->escape($note) . "', " . ((int) $entity) . ")"; |
|
704 | 704 | |
705 | 705 | //print "sql".$value."-".pg_escape_string($value)."-".$sql;exit; |
706 | 706 | //print "xx".$db->escape($value); |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | $sql = "SELECT COUNT(r.id) as nb"; |
863 | 863 | $sql .= " FROM " . MAIN_DB_PREFIX . "rights_def as r"; |
864 | 864 | $sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" |
865 | - $sql .= " AND entity = " . ((int)$conf->entity); |
|
865 | + $sql .= " AND entity = " . ((int) $conf->entity); |
|
866 | 866 | $sql .= " AND bydefault = 1"; |
867 | 867 | if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { |
868 | 868 | $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled |
@@ -1695,7 +1695,7 @@ discard block |
||
1695 | 1695 | $obj = $db->fetch_object($result); // Take first result of select |
1696 | 1696 | |
1697 | 1697 | if (empty($obj)) { // If not yet into table |
1698 | - $obj = (object)array('rowid' => '', 'name' => $const, 'value' => '', 'type' => $type, 'note' => ''); |
|
1698 | + $obj = (object) array('rowid' => '', 'name' => $const, 'value' => '', 'type' => $type, 'note' => ''); |
|
1699 | 1699 | } |
1700 | 1700 | |
1701 | 1701 | if (empty($strictw3c)) { |
@@ -1895,7 +1895,7 @@ discard block |
||
1895 | 1895 | $db->begin(); |
1896 | 1896 | |
1897 | 1897 | $sql = "INSERT INTO " . MAIN_DB_PREFIX . "document_model (nom, type, entity, libelle, description)"; |
1898 | - $sql .= " VALUES ('" . $db->escape($name) . "','" . $db->escape($type) . "'," . ((int)$conf->entity) . ", "; |
|
1898 | + $sql .= " VALUES ('" . $db->escape($name) . "','" . $db->escape($type) . "'," . ((int) $conf->entity) . ", "; |
|
1899 | 1899 | $sql .= ($label ? "'" . $db->escape($label) . "'" : 'null') . ", "; |
1900 | 1900 | $sql .= (!empty($description) ? "'" . $db->escape($description) . "'" : "null"); |
1901 | 1901 | $sql .= ")"; |
@@ -1928,7 +1928,7 @@ discard block |
||
1928 | 1928 | $sql = "DELETE FROM " . MAIN_DB_PREFIX . "document_model"; |
1929 | 1929 | $sql .= " WHERE nom = '" . $db->escape($name) . "'"; |
1930 | 1930 | $sql .= " AND type = '" . $db->escape($type) . "'"; |
1931 | - $sql .= " AND entity = " . ((int)$conf->entity); |
|
1931 | + $sql .= " AND entity = " . ((int) $conf->entity); |
|
1932 | 1932 | |
1933 | 1933 | dol_syslog("admin.lib::delDocumentModel", LOG_DEBUG); |
1934 | 1934 | $resql = $db->query($sql); |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | |
144 | 144 | // Add here list of permission defined by an id, a label, a boolean and two constant strings. |
145 | 145 | // Example: |
146 | - $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) |
|
146 | + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) |
|
147 | 147 | $this->rights[$r][1] = 'Generate/modify users API key'; // Permission label |
148 | - $this->rights[$r][3] = 0; // Permission by default for new user (0/1) |
|
149 | - $this->rights[$r][4] = 'apikey'; // In php code, permission will be checked by test if ($user->hasRight('permkey','level1','level2')) |
|
150 | - $this->rights[$r][5] = 'generate'; // In php code, permission will be checked by test if ($user->hasRight('permkey','level1','level2')) |
|
148 | + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) |
|
149 | + $this->rights[$r][4] = 'apikey'; // In php code, permission will be checked by test if ($user->hasRight('permkey','level1','level2')) |
|
150 | + $this->rights[$r][5] = 'generate'; // In php code, permission will be checked by test if ($user->hasRight('permkey','level1','level2')) |
|
151 | 151 | $r++; |
152 | 152 | |
153 | 153 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | { |
231 | 231 | // Remove old constants with entity fields different of 0 |
232 | 232 | $sql = array( |
233 | - "DELETE FROM " . MAIN_DB_PREFIX . "const WHERE name = " . $this->db->encrypt('MAIN_MODULE_API'), // API can't be enabled per environment. Why ? |
|
233 | + "DELETE FROM " . MAIN_DB_PREFIX . "const WHERE name = " . $this->db->encrypt('MAIN_MODULE_API'), // API can't be enabled per environment. Why ? |
|
234 | 234 | "DELETE FROM " . MAIN_DB_PREFIX . "const WHERE name = " . $this->db->encrypt('API_PRODUCTION_MODE') // Not in production mode by default at activation |
235 | 235 | ); |
236 | 236 |
@@ -236,82 +236,82 @@ discard block |
||
236 | 236 | /* END MODULEBUILDER TOPMENU */ |
237 | 237 | /* BEGIN MODULEBUILDER LEFTMENU CONFERENCEORBOOTH*/ |
238 | 238 | $this->menu[$r++] = array( |
239 | - 'fk_menu' => 'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
240 | - 'type' => 'left', // This is a Left menu entry |
|
239 | + 'fk_menu' => 'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
240 | + 'type' => 'left', // This is a Left menu entry |
|
241 | 241 | 'titre' => 'EventOrganizationMenuLeft', |
242 | 242 | 'prefix' => img_picto('', 'eventorganization', 'class="paddingright pictofixedwidth"'), |
243 | 243 | 'mainmenu' => 'project', |
244 | 244 | 'leftmenu' => 'eventorganization', |
245 | 245 | 'url' => '', |
246 | - 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
246 | + 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
247 | 247 | 'position' => 1000 + $r, |
248 | - 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
249 | - 'perms' => '$user->hasRight("eventorganization", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
248 | + 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
249 | + 'perms' => '$user->hasRight("eventorganization", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
250 | 250 | 'target' => '', |
251 | - 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
251 | + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
252 | 252 | ); |
253 | 253 | $this->menu[$r++] = array( |
254 | - 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
255 | - 'type' => 'left', // This is a Left menu entry |
|
254 | + 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
255 | + 'type' => 'left', // This is a Left menu entry |
|
256 | 256 | 'titre' => 'New', |
257 | 257 | 'url' => '/projet/card.php?leftmenu=projects&action=create&usage_organize_event=1&usage_opportunity=0', |
258 | - 'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
258 | + 'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
259 | 259 | 'position' => 1000 + $r, |
260 | - 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
261 | - 'perms' => '$user->hasRight("eventorganization", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
260 | + 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
261 | + 'perms' => '$user->hasRight("eventorganization", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
262 | 262 | 'target' => '', |
263 | - 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
263 | + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
264 | 264 | ); |
265 | 265 | $this->menu[$r++] = array( |
266 | - 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
267 | - 'type' => 'left', // This is a Left menu entry |
|
266 | + 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
267 | + 'type' => 'left', // This is a Left menu entry |
|
268 | 268 | 'titre' => 'List', |
269 | 269 | 'url' => '/projet/list.php?search_usage_event_organization=1&search_status=99&mainmenu=project&contextpage=organizedevents', |
270 | - 'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
270 | + 'langs' => 'eventorganization@eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
271 | 271 | 'position' => 1000 + $r, |
272 | - 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
273 | - 'perms' => '$user->hasRight("eventorganization", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
272 | + 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
273 | + 'perms' => '$user->hasRight("eventorganization", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
274 | 274 | 'target' => '', |
275 | - 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
275 | + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
276 | 276 | ); |
277 | 277 | $this->menu[$r++] = array( |
278 | - 'fk_menu' => 'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
279 | - 'type' => 'left', // This is a Left menu entry |
|
278 | + 'fk_menu' => 'fk_mainmenu=project', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
279 | + 'type' => 'left', // This is a Left menu entry |
|
280 | 280 | 'titre' => 'ConferenceOrBooth', |
281 | 281 | 'prefix' => img_picto('', 'conferenceorbooth', 'class="paddingright pictofixedwidth"'), |
282 | 282 | 'mainmenu' => 'project', |
283 | 283 | 'leftmenu' => 'eventorganizationconforbooth', |
284 | 284 | 'url' => '', |
285 | - 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
285 | + 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
286 | 286 | 'position' => 1000 + $r, |
287 | - 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
288 | - 'perms' => '$user->hasRight("eventorganization", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
287 | + 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
288 | + 'perms' => '$user->hasRight("eventorganization", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
289 | 289 | 'target' => '', |
290 | - 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
290 | + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
291 | 291 | ); |
292 | 292 | $this->menu[$r++] = array( |
293 | - 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
294 | - 'type' => 'left', // This is a Left menu entry |
|
293 | + 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
294 | + 'type' => 'left', // This is a Left menu entry |
|
295 | 295 | 'titre' => 'New', |
296 | 296 | 'url' => '/eventorganization/conferenceorbooth_card.php?leftmenu=projects&action=create', |
297 | - 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
297 | + 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
298 | 298 | 'position' => 1000 + $r, |
299 | - 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
300 | - 'perms' => '$user->hasRight("eventorganization", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
299 | + 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
300 | + 'perms' => '$user->hasRight("eventorganization", "write")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
301 | 301 | 'target' => '', |
302 | - 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
302 | + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
303 | 303 | ); |
304 | 304 | $this->menu[$r++] = array( |
305 | - 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
306 | - 'type' => 'left', // This is a Left menu entry |
|
305 | + 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode |
|
306 | + 'type' => 'left', // This is a Left menu entry |
|
307 | 307 | 'titre' => 'List', |
308 | 308 | 'url' => '/eventorganization/conferenceorbooth_list.php?mainmenu=project', |
309 | - 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
309 | + 'langs' => 'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. |
|
310 | 310 | 'position' => 1000 + $r, |
311 | - 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
312 | - 'perms' => '$user->hasRight("eventorganization", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
311 | + 'enabled' => 'isModEnabled("eventorganization")', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. |
|
312 | + 'perms' => '$user->hasRight("eventorganization", "read")', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules |
|
313 | 313 | 'target' => '', |
314 | - 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
314 | + 'user' => 2, // 0=Menu for internal users, 1=external users, 2=both |
|
315 | 315 | ); |
316 | 316 | /* END MODULEBUILDER LEFTMENU CONFERENCEORBOOTH */ |
317 | 317 | |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | $keyforelement = 'conferenceorboothattendee'; |
330 | 330 | include DOL_DOCUMENT_ROOT . '/core/commonfieldsinexport.inc.php'; |
331 | 331 | $this->export_entities_array[$r]['t.fk_invoice'] = 'invoice'; |
332 | - unset($this->export_fields_array[$r]['t.fk_project']); // Remove field so we can add it at end just after |
|
333 | - unset($this->export_fields_array[$r]['t.fk_soc']); // Remove field so we can add it at end just after |
|
332 | + unset($this->export_fields_array[$r]['t.fk_project']); // Remove field so we can add it at end just after |
|
333 | + unset($this->export_fields_array[$r]['t.fk_soc']); // Remove field so we can add it at end just after |
|
334 | 334 | $this->export_fields_array[$r]['t.fk_invoice'] = 'InvoiceId'; |
335 | 335 | $this->export_fields_array[$r]['t.fk_project'] = 'ProjectId'; |
336 | 336 | $this->export_fields_array[$r]['p.ref'] = 'ProjectRef'; |
@@ -362,16 +362,16 @@ discard block |
||
362 | 362 | /* BEGIN MODULEBUILDER EXPORT CONFERENCEORBOOTH */ |
363 | 363 | $langs->load("eventorganization"); |
364 | 364 | $this->export_code[$r] = $this->rights_class . '_' . $r; |
365 | - $this->export_label[$r] = 'ListOfConfOrBoothOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
365 | + $this->export_label[$r] = 'ListOfConfOrBoothOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found) |
|
366 | 366 | $this->export_icon[$r] = 'conferenceorbooth'; |
367 | 367 | // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array |
368 | 368 | $keyforclass = 'ConferenceOrBooth'; |
369 | 369 | $keyforclassfile = '/eventorganization/class/conferenceorbooth.class.php'; |
370 | 370 | $keyforelement = 'conferenceorbooth'; |
371 | 371 | include DOL_DOCUMENT_ROOT . '/core/commonfieldsinexport.inc.php'; |
372 | - unset($this->export_fields_array[$r]['t.fk_action']); // Remove field so we can add it at end just after |
|
373 | - unset($this->export_fields_array[$r]['t.fk_project']); // Remove field so we can add it at end just after |
|
374 | - unset($this->export_fields_array[$r]['t.fk_soc']); // Remove field so we can add it at end just after |
|
372 | + unset($this->export_fields_array[$r]['t.fk_action']); // Remove field so we can add it at end just after |
|
373 | + unset($this->export_fields_array[$r]['t.fk_project']); // Remove field so we can add it at end just after |
|
374 | + unset($this->export_fields_array[$r]['t.fk_soc']); // Remove field so we can add it at end just after |
|
375 | 375 | $this->export_fields_array[$r]['t.fk_action'] = 'ConferenceOrBoothFormatID'; |
376 | 376 | $this->export_fields_array[$r]['ca.code'] = 'ConferenceOrBoothFormatCode'; |
377 | 377 | $this->export_fields_array[$r]['ca.libelle'] = 'ConferenceOrBoothFormatLabel'; |
@@ -471,10 +471,10 @@ discard block |
||
471 | 471 | } |
472 | 472 | |
473 | 473 | $sql = array_merge($sql, array( |
474 | - "DELETE FROM " . MAIN_DB_PREFIX . "document_model WHERE nom = 'standard_" . strtolower($myTmpObjectKey) . "' AND type = '" . $this->db->escape(strtolower($myTmpObjectKey)) . "' AND entity = " . ((int)$conf->entity), |
|
475 | - "INSERT INTO " . MAIN_DB_PREFIX . "document_model (nom, type, entity) VALUES('standard_" . strtolower($myTmpObjectKey) . "','" . $this->db->escape(strtolower($myTmpObjectKey)) . "'," . ((int)$conf->entity) . ")", |
|
476 | - "DELETE FROM " . MAIN_DB_PREFIX . "document_model WHERE nom = 'generic_" . strtolower($myTmpObjectKey) . "_odt' AND type = '" . $this->db->escape(strtolower($myTmpObjectKey)) . "' AND entity = " . ((int)$conf->entity), |
|
477 | - "INSERT INTO " . MAIN_DB_PREFIX . "document_model (nom, type, entity) VALUES('generic_" . strtolower($myTmpObjectKey) . "_odt', '" . $this->db->escape(strtolower($myTmpObjectKey)) . "', " . ((int)$conf->entity) . ")" |
|
474 | + "DELETE FROM " . MAIN_DB_PREFIX . "document_model WHERE nom = 'standard_" . strtolower($myTmpObjectKey) . "' AND type = '" . $this->db->escape(strtolower($myTmpObjectKey)) . "' AND entity = " . ((int) $conf->entity), |
|
475 | + "INSERT INTO " . MAIN_DB_PREFIX . "document_model (nom, type, entity) VALUES('standard_" . strtolower($myTmpObjectKey) . "','" . $this->db->escape(strtolower($myTmpObjectKey)) . "'," . ((int) $conf->entity) . ")", |
|
476 | + "DELETE FROM " . MAIN_DB_PREFIX . "document_model WHERE nom = 'generic_" . strtolower($myTmpObjectKey) . "_odt' AND type = '" . $this->db->escape(strtolower($myTmpObjectKey)) . "' AND entity = " . ((int) $conf->entity), |
|
477 | + "INSERT INTO " . MAIN_DB_PREFIX . "document_model (nom, type, entity) VALUES('generic_" . strtolower($myTmpObjectKey) . "_odt', '" . $this->db->escape(strtolower($myTmpObjectKey)) . "', " . ((int) $conf->entity) . ")" |
|
478 | 478 | )); |
479 | 479 | } |
480 | 480 | } |