Debug v16 - Fix for postgresql - Fix for sql loading per module - php8

This commit is contained in:
Laurent Destailleur
2022-05-08 15:18:34 +02:00
parent 3256ac2f2a
commit f52a7a26f6
63 changed files with 640 additions and 378 deletions

View File

@@ -232,6 +232,9 @@ class PrestaShopWebservice
if ($response != '') {
libxml_clear_errors();
libxml_use_internal_errors(true);
if (!function_exists('simplexml_load_string')) {
throw new PrestaShopWebserviceException('Method simplexml_load_string not available. Your PHP does not support xml.');
}
$xml = simplexml_load_string($response, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
if (libxml_get_errors()) {
$msg = var_export(libxml_get_errors(), true);

View File

@@ -457,7 +457,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
print '<td class="center">';
$constforvar = 'EVENTORGANIZATION_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $file) {
if (getDolGlobalString($constforvar) == $file) {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
@@ -597,7 +597,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
// Default
print '<td class="center">';
$constforvar = 'EVENTORGANIZATION_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $name) {
if (getDolGlobalString($constforvar) == $name) {
//print img_picto($langs->trans("Default"), 'on');
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&amp;token='.newToken().'&amp;object='.urlencode(strtolower($myTmpObjectKey)).'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';

View File

@@ -279,7 +279,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
print '<td class="center">';
$constforvar = 'HRMTEST_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $file) {
if (getDolGlobalString($constforvar) == $file) {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
@@ -421,7 +421,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
// Default
print '<td class="center">';
$constforvar = 'HRMTEST_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $name) {
if (getDolGlobalString($constforvar) == $name) {
//print img_picto($langs->trans("Default"), 'on');
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&amp;token='.newToken().'&amp;object='.urlencode(strtolower($myTmpObjectKey)).'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';

View File

@@ -403,7 +403,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
print '<td class="center">';
$constforvar = 'KNOWLEDGEMANAGEMENT_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $file) {
if (getDolGlobalString($constforvar) == $file) {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
@@ -545,7 +545,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
// Default
print '<td class="center">';
$constforvar = 'KNOWLEDGEMANAGEMENT_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $name) {
if (getDolGlobalString($constforvar) == $name) {
//print img_picto($langs->trans("Default"), 'on');
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&amp;token='.newToken().'&amp;object='.urlencode(strtolower($myTmpObjectKey)).'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';

View File

@@ -554,7 +554,7 @@ $help_url = '';
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
$title = $langs->trans("EMailsSetup");
} else {
$title = $langs->trans("EMailsTemplates");
$title = $langs->trans("EMailTemplates");
}
llxHeader('', $title, $help_url);
@@ -949,6 +949,7 @@ if ($resql) {
while ($i < $num) {
$obj = $db->fetch_object($resql);
if ($obj) {
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
@@ -1155,7 +1156,7 @@ if ($resql) {
print "</tr>\n";
}
}
$i++;
}

View File

@@ -172,6 +172,10 @@ foreach ($modulesdir as $dir) {
$moduleposition = '80'; // External modules at end by default
}
if (empty($familyinfo[$familykey]['position'])) {
$familyinfo[$familykey]['position'] = '0';
}
$orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
$dirmod[$i] = $dir;
//print $i.'-'.$dirmod[$i].'<br>';
@@ -250,19 +254,19 @@ if (!empty($conf->global->$const_name)) {
$text .= $langs->trans("Disabled");
}
$tmp = $objMod->getLastActivationInfo();
$authorid = $tmp['authorid'];
$authorid = (empty($tmp['authorid']) ? '' : $tmp['authorid']);
if ($authorid > 0) {
$tmpuser = new User($db);
$tmpuser->fetch($authorid);
$text .= '<br><span class="opacitymedium">'.$langs->trans("LastActivationAuthor").':</span> ';
$text .= $tmpuser->getNomUrl(1);
}
$ip = $tmp['ip'];
$ip = (empty($tmp['ip']) ? '' : $tmp['ip']);
if ($ip) {
$text .= '<br><span class="opacitymedium">'.$langs->trans("LastActivationIP").':</span> ';
$text .= $ip;
}
$lastactivationversion = $tmp['lastactivationversion'];
$lastactivationversion = (empty($tmp['lastactivationversion']) ? '' : $tmp['lastactivationversion']);
if ($lastactivationversion) {
$text .= '<br><span class="opacitymedium">'.$langs->trans("LastActivationVersion").':</span> ';
$text .= $lastactivationversion;

View File

@@ -295,7 +295,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
print '<td class="center">';
$constforvar = 'WORKSTATION_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $file) {
if (getDolGlobalString($constforvar) == $file) {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
@@ -437,7 +437,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
// Default
print '<td class="center">';
$constforvar = 'WORKSTATION_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $name) {
if (getDolGlobalString($constforvar) == $name) {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';

View File

@@ -266,7 +266,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
print '<td class="center">';
$constforvar = 'ASSET_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $file) {
if (getDolGlobalString($constforvar) == $file) {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
@@ -408,7 +408,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
// Default
print '<td class="center">';
$constforvar = 'ASSET_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $name) {
if (getDolGlobalString($constforvar) == $name) {
//print img_picto($langs->trans("Default"), 'on');
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&amp;type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';

View File

@@ -1089,11 +1089,12 @@ class Translate
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($resql);
// Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
if ($obj) {
// If a translation exists, we use it lese we use the default label
$this->cache_currencies[$obj->code_iso]['label'] = ($obj->code_iso && $this->trans("Currency".$obj->code_iso) != "Currency".$obj->code_iso ? $this->trans("Currency".$obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
$this->cache_currencies[$obj->code_iso]['unicode'] = (array) json_decode($obj->unicode, true);
$label[$obj->code_iso] = $this->cache_currencies[$obj->code_iso]['label'];
}
$i++;
}
if (empty($currency_code)) {

View File

@@ -116,7 +116,7 @@ class DoliDBPgsql extends DoliDB
$this->connected = false;
$this->ok = false;
$this->error = 'Host, login or password incorrect';
dol_syslog(get_class($this)."::DoliDBPgsql : Erreur Connect ".$this->error, LOG_ERR);
dol_syslog(get_class($this)."::DoliDBPgsql : Erreur Connect ".$this->error.'. Failed to connect to host='.$host.' port='.$port.' user='.$user, LOG_ERR);
}
// Si connexion serveur ok et si connexion base demandee, on essaie connexion base
@@ -423,7 +423,7 @@ class DoliDBPgsql extends DoliDB
}
// if local connection failed or not requested, use TCP/IP
if (!$this->db) {
if (empty($this->db)) {
if (!$host) {
$host = "localhost";
}
@@ -432,7 +432,11 @@ class DoliDBPgsql extends DoliDB
}
$con_string = "host='".$host."' port='".$port."' dbname='".$name."' user='".$login."' password='".$passwd."'";
try {
$this->db = @pg_connect($con_string);
} catch (Exception $e) {
print $e->getMessage();
}
}
// now we test if at least one connect method was a success
@@ -916,7 +920,8 @@ class DoliDBPgsql extends DoliDB
// Test charset match LC_TYPE (pgsql error otherwise)
//print $charset.' '.setlocale(LC_CTYPE,'0'); exit;
$sql = "CREATE DATABASE '".$this->escape($database)."' OWNER '".$this->escape($owner)."' ENCODING '".$this->escape($charset)."'";
// NOTE: Do not use ' around the database name
$sql = "CREATE DATABASE ".$this->escape($database)." OWNER '".$this->escape($owner)."' ENCODING '".$this->escape($charset)."'";
dol_syslog($sql, LOG_DEBUG);
$ret = $this->query($sql);
return $ret;

View File

@@ -29,10 +29,10 @@
/**
* Prepare array with list of tabs
*
* @param Object $object Object related to tabs
* @param User $object Object related to tabs
* @return array Array of tabs to show
*/
function user_prepare_head($object)
function user_prepare_head(User $object)
{
global $langs, $conf, $user, $db;

View File

@@ -956,11 +956,11 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$err++;
} else {
$obj = $this->db->fetch_object($resql);
if ($obj) {
$tmp = array();
if ($obj->note) {
$tmp = json_decode($obj->note, true);
}
if ($obj) {
return array(
'authorid' => $tmp['authorid'],
'ip' => $tmp['ip'],
@@ -1054,16 +1054,16 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps,PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Create tables and keys required by module:
* - Files module.sql with create table instructions
* - Then modules.key.sql with create keys instructions
* - Files table.sql or table-module.sql with create table instructions
* - Then table.key.sql or table-module.key.sql with create keys instructions
* - Then data_xxx.sql (usualy provided by external modules only)
* - Then update_xxx.sql (usualy provided by external modules only)
* Files must be stored in directory defined by reldir (Example: '/install/mysql/tables' or '/module/sql/')
* Files must be stored in subdirectory 'tables' or 'data' into directory $reldir (Example: '/install/mysql/' or '/module/sql/')
* This function may also be called by :
* - _load_tables('/install/mysql/tables/', 'modulename') into the this->init() of core module descriptors.
* - _load_tables('/install/mysql/', 'modulename') into the this->init() of core module descriptors.
* - _load_tables('/mymodule/sql/') into the this->init() of external module descriptors.
*
* @param string $reldir Relative directory where to scan files. Example: '/install/mysql/tables' or '/module/sql/'
* @param string $reldir Relative directory where to scan files. Example: '/install/mysql/' or '/module/sql/'
* @param string $onlywithsuffix Only with the defined suffix
* @return int <=0 if KO, >0 if OK
*/
@@ -1084,9 +1084,18 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$ok = 1;
foreach ($conf->file->dol_document_root as $dirroot) {
if ($ok) {
$dir = $dirroot.$reldir;
$dirsql = $dirroot.$reldir;
$ok = 0;
// We will loop on xxx/, xxx/tables/, xxx/data/
$listofsubdir = array('', 'tables/', 'data/');
if ($this->db->type == 'pgsql') {
$listofsubdir[] = '../pgsql/functions/';
}
foreach ($listofsubdir as $subdir) {
$dir = $dirsql.$subdir;
$handle = @opendir($dir); // Dir may not exists
if (is_resource($handle)) {
$dirfound++;
@@ -1106,7 +1115,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
//print 'File '.$file.' match suffix '.$onlywithsuffix.' so we keep it<br>'."\n";
}
}
if (preg_match('/\.sql$/i', $file) && !preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 4) == 'llx_' && substr($file, 0, 4) != 'data') {
if (preg_match('/\.sql$/i', $file) && !preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 4) == 'llx_') {
$result = run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0, '', 1);
if ($result <= 0) {
$error++;
@@ -1131,7 +1140,32 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
//print 'File '.$file.' match suffix '.$onlywithsuffix.' so we keep it<br>'."\n";
}
}
if (preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 4) == 'llx_' && substr($file, 0, 4) != 'data') {
if (preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 4) == 'llx_') {
$result = run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0, '', 1);
if ($result <= 0) {
$error++;
}
}
}
rewinddir($handle);
// Run functions-xxx.sql files (Must be done after llx_mytable.key.sql)
$files = array();
while (($file = readdir($handle)) !== false) {
$files[] = $file;
}
sort($files);
foreach ($files as $file) {
if ($onlywithsuffix) {
if (!preg_match('/\-'.preg_quote($onlywithsuffix, '/').'\./i', $file)) {
//print 'File '.$file.' does not match suffix '.$onlywithsuffix.' so it is discarded<br>'."\n";
continue;
} else {
//print 'File '.$file.' match suffix '.$onlywithsuffix.' so we keep it<br>'."\n";
}
}
if (preg_match('/\.sql$/i', $file) && !preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 9) == 'functions') {
$result = run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0, '', 1);
if ($result <= 0) {
$error++;
@@ -1191,6 +1225,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
closedir($handle);
}
}
if ($error == 0) {
$ok = 1;

View File

@@ -240,7 +240,7 @@ class modAsset extends DolibarrModules
*/
public function init($options = '')
{
$result = $this->_load_tables('/install/mysql/tables/', 'asset');
$result = $this->_load_tables('/install/mysql/', 'asset');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

View File

@@ -159,7 +159,7 @@ class modDeplacement extends DolibarrModules
*/
public function init($options = '')
{
$result = $this->_load_tables('/install/mysql/tables/', 'deplacement');
$result = $this->_load_tables('/install/mysql/', 'deplacement');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

View File

@@ -155,7 +155,7 @@ class modDon extends DolibarrModules
{
global $conf;
$result = $this->_load_tables('/install/mysql/tables/', 'deplacement');
$result = $this->_load_tables('/install/mysql/', 'don');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

View File

@@ -280,7 +280,7 @@ class modHRM extends DolibarrModules
// Permissions
$this->remove($options);
$result = $this->_load_tables('/install/mysql/tables/', 'hrm');
$result = $this->_load_tables('/install/mysql/', 'hrm');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

View File

@@ -138,7 +138,7 @@ class modIntracommreport extends DolibarrModules
{
global $conf;
$result = $this->_load_tables('/install/mysql/tables/', 'intracommreport');
$result = $this->_load_tables('/install/mysql/', 'intracommreport');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

View File

@@ -442,7 +442,7 @@ class modKnowledgeManagement extends DolibarrModules
{
global $conf, $langs;
$result = $this->_load_tables('/install/mysql/tables/', 'knowledgemanagement');
$result = $this->_load_tables('/install/mysql/', 'knowledgemanagement');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

View File

@@ -160,7 +160,7 @@ class modLoan extends DolibarrModules
{
global $conf;
$result = $this->_load_tables('/install/mysql/tables/', 'loan');
$result = $this->_load_tables('/install/mysql/', 'loan');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

View File

@@ -159,7 +159,7 @@ class modMailing extends DolibarrModules
*/
public function init($options = '')
{
$result = $this->_load_tables('/install/mysql/tables/', 'mailing');
$result = $this->_load_tables('/install/mysql/', 'mailing');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

View File

@@ -184,7 +184,7 @@ class modOpenSurvey extends DolibarrModules
{
global $conf, $langs;
$result = $this->_load_tables('/install/mysql/tables/', 'opensurvey');
$result = $this->_load_tables('/install/mysql/', 'opensurvey');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

View File

@@ -410,7 +410,7 @@ class modPartnership extends DolibarrModules
{
global $conf, $langs;
$result = $this->_load_tables('/install/mysql/tables/', 'partnership');
$result = $this->_load_tables('/install/mysql/', 'partnership');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

View File

@@ -403,7 +403,7 @@ class modRecruitment extends DolibarrModules
{
global $conf, $langs;
$result = $this->_load_tables('/install/mysql/tables/', 'recruitment');
$result = $this->_load_tables('/install/mysql/', 'recruitment');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

View File

@@ -434,7 +434,7 @@ class modStock extends DolibarrModules
{
global $conf, $langs;
$result = $this->_load_tables('/install/mysql/tables/', 'stock');
$result = $this->_load_tables('/install/mysql/', 'stock');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

View File

@@ -331,7 +331,7 @@ class modTicket extends DolibarrModules
{
global $conf, $langs;
$result = $this->_load_tables('/install/mysql/tables/', 'ticket');
$result = $this->_load_tables('/install/mysql/', 'ticket');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

View File

@@ -164,7 +164,7 @@ class modWebsite extends DolibarrModules
{
global $conf, $langs;
$result = $this->_load_tables('/install/mysql/tables/', 'website');
$result = $this->_load_tables('/install/mysql/', 'website');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

View File

@@ -390,7 +390,7 @@ class modWorkstation extends DolibarrModules
{
global $conf, $langs;
$result = $this->_load_tables('/install/mysql/tables/', 'workstation');
$result = $this->_load_tables('/install/mysql/', 'workstation');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

View File

@@ -281,7 +281,7 @@ class modZapier extends DolibarrModules
*/
public function init($options = '')
{
$result = $this->_load_tables('/install/mysql/tables/', 'zapier');
$result = $this->_load_tables('/install/mysql/', 'zapier');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

View File

@@ -91,6 +91,8 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View
*/
$textobject = $langs->transnoentitiesnoconv("Evaluation");
$help_url = '';
$page_name = "HrmSetup";

View File

@@ -91,6 +91,8 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View
*/
$textobject = $langs->transnoentitiesnoconv("Job");
$help_url = '';
$page_name = "HrmSetup";

View File

@@ -91,6 +91,8 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View
*/
$textobject = $langs->transnoentitiesnoconv("Skills");
$help_url = '';
$page_name = "HrmSetup";

View File

@@ -105,6 +105,8 @@ ALTER TABLE llx_bank ADD COLUMN amount_main_currency double(24,8) NULL;
-- v16
ALTER TABLE llx_societe_account DROP FOREIGN KEY llx_societe_account_fk_website;
UPDATE llx_cronjob set label = 'RecurringInvoicesJob' where label = 'RecurringInvoices';
UPDATE llx_cronjob set label = 'RecurringSupplierInvoicesJob' where label = 'RecurringSupplierInvoices';

View File

@@ -25,6 +25,8 @@ ALTER TABLE llx_societe_account ADD INDEX idx_societe_account_fk_soc (fk_soc);
ALTER TABLE llx_societe_account ADD UNIQUE INDEX uk_societe_account_login_website_soc(entity, fk_soc, login, site, fk_website);
ALTER TABLE llx_societe_account ADD UNIQUE INDEX uk_societe_account_key_account_soc(entity, fk_soc, key_account, site, fk_website);
ALTER TABLE llx_societe_account ADD CONSTRAINT llx_societe_account_fk_website FOREIGN KEY (fk_website) REFERENCES llx_website(rowid);
-- Table website does not always exists
--ALTER TABLE llx_societe_account ADD CONSTRAINT llx_societe_account_fk_website FOREIGN KEY (fk_website) REFERENCES llx_website(rowid);
ALTER TABLE llx_societe_account ADD CONSTRAINT llx_societe_account_fk_societe FOREIGN KEY (fk_soc) REFERENCES llx_societe(rowid);

View File

@@ -0,0 +1,20 @@
-- ============================================================================
-- Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
-- ============================================================================
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();

View File

@@ -0,0 +1,19 @@
-- ============================================================================
-- Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
-- ============================================================================
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_loan FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();

View File

@@ -0,0 +1,20 @@
-- ============================================================================
-- Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
-- ============================================================================
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_mailing FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_mailing_cibles FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();

View File

@@ -0,0 +1,21 @@
-- ============================================================================
-- Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
-- ============================================================================
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_opensurvey_comments FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_opensurvey_sondage FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_opensurvey_user_studs FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();

View File

@@ -0,0 +1,20 @@
-- ============================================================================
-- Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
-- ============================================================================
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_partnership FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_partnership_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();

View File

@@ -0,0 +1,23 @@
-- ============================================================================
-- Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
-- ============================================================================
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentjobposition FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentjobposition_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentcandidature FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentcandidature_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();

View File

@@ -0,0 +1,21 @@
-- ============================================================================
-- Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
-- ============================================================================
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website_page FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();

View File

@@ -100,9 +100,6 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_contratdet_extrafiel
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_contratdet_log FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_subscription FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_cronjob FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_deplacement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_don_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directories FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_files FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_element_resources FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
@@ -126,19 +123,13 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_fichinter FOR EACH R
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_fichinter_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_fichinterdet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_delivery FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_loan FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_localtax FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_mailing FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_mailing_cibles FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_menu FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_mrp_mo FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_mrp_mo_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_mrp_production FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_notify FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_notify_def FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_opensurvey_comments FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_opensurvey_sondage FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_opensurvey_user_studs FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_paiement FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_paiementcharge FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_paiementfourn FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
@@ -165,10 +156,6 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_propal_extrafields F
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_propal_merge_pdf_product FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_propaldet_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_resource FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentjobposition FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentjobposition_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentcandidature FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentcandidature_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_salary FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe_address FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
@@ -187,5 +174,3 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user FOR EACH ROW EX
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_user_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_usergroup FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_usergroup_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_website_page FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();

View File

@@ -261,6 +261,7 @@ if (!$error) {
$error++;
}
}
// If we need simple access
if (!$error && (empty($db_create_database) && empty($db_create_user))) {
$db = getDoliDBInstance($db_type, $db_host, $db_user, $db_pass, $db_name, $db_port);

View File

@@ -82,9 +82,9 @@ if ($db->ok) {
print '<tr><td><label for="login">'.$langs->trans("Login").' :</label></td><td>';
print '<input id="login" name="login" type="text" value="'.(GETPOSTISSET("login") ? GETPOST("login", 'alpha') : (isset($force_install_dolibarrlogin) ? $force_install_dolibarrlogin : '')).'"'.(@$force_install_noedit == 2 && $force_install_dolibarrlogin !== null ? ' disabled' : '').'></td></tr>';
print '<tr><td><label for="pass">'.$langs->trans("Password").' :</label></td><td>';
print '<input type="password" id="pass" name="pass" autocomplete="new-password" minlength="6"></td></tr>';
print '<input type="password" id="pass" name="pass" autocomplete="new-password" minlength="8"></td></tr>';
print '<tr><td><label for="pass_verif">'.$langs->trans("PasswordAgain").' :</label></td><td>';
print '<input type="password" id="pass_verif" name="pass_verif" autocomplete="new-password" minlength="6"></td></tr>';
print '<input type="password" id="pass_verif" name="pass_verif" autocomplete="new-password" minlength="8"></td></tr>';
print '</table>';
if (isset($_GET["error"]) && $_GET["error"] == 1) {

View File

@@ -2150,7 +2150,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId6", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_PROFID6"), 6).'</span>';
}
$dropdownBody .= '<br><b>'.$langs->trans("VATIntraShort").'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_TVAINTRA"), 'VAT').'</span>';
$dropdownBody .= '<br><b>'.$langs->trans("Country").'</b>: <span>'.$langs->trans("Country".$mysoc->country_code).'</span>';
$dropdownBody .= '<br><b>'.$langs->trans("Country").'</b>: <span>'.($mysoc->country_code ? $langs->trans("Country".$mysoc->country_code) : '').'</span>';
$dropdownBody .= '</div>';

View File

@@ -89,7 +89,8 @@ if (preg_match('/del_(.*)/', $action, $reg)) {
$form = new Form($db);
llxHeader('', $langs->trans("ModulebuilderSetup"));
$help_url = '';
llxHeader('', $langs->trans("ModulebuilderSetup"), $help_url);
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';

View File

@@ -91,6 +91,8 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View
*/
$textobject = $langs->transnoentitiesnoconv("MyObject");
$help_url = '';
$page_name = "MyModuleSetup";

View File

@@ -531,7 +531,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
print '<td class="center">';
$constforvar = 'MYMODULE_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $file) {
if (getDolGlobalString($constforvar) == $file) {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
@@ -673,7 +673,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
// Default
print '<td class="center">';
$constforvar = 'MYMODULE_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $name) {
if (getDolGlobalString($constforvar) == $name) {
//print img_picto($langs->trans("Default"), 'on');
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&amp;type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';

View File

@@ -428,7 +428,7 @@ class modMyModule extends DolibarrModules
{
global $conf, $langs;
//$result = $this->_load_tables('/install/mysql/tables/', 'mymodule');
//$result = $this->_load_tables('/install/mysql/', 'mymodule');
$result = $this->_load_tables('/mymodule/sql/');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')

View File

@@ -65,6 +65,8 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View
*/
$textobject = $langs->transnoentitiesnoconv("Partnership");
$help_url = '';
$title = $langs->trans("PartnershipSetup");

View File

@@ -73,6 +73,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View
*/
$textobject = $langs->transnoentitiesnoconv("Inventory");
llxHeader('', $langs->trans("InventorySetup"), $help_url);

View File

@@ -73,6 +73,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View
*/
$textobject = $langs->transnoentitiesnoconv("StockMovement");
llxHeader('', $langs->trans("StockSetup"), $help_url);

View File

@@ -59,7 +59,9 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View
*/
$textobject = $langs->transnoentitiesnoconv("Candidature");
$help_url = '';
llxHeader('', $langs->trans("RecruitmentSetup"), $help_url);

View File

@@ -59,7 +59,9 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View
*/
$textobject = $langs->transnoentitiesnoconv("JobPosition");
$help_url = '';
llxHeader('', $langs->trans("RecruitmentSetup"), $help_url);

View File

@@ -96,6 +96,7 @@ print dol_get_fiche_head($head, 'publicurl', '', -1, '');
print '<span class="opacitymedium">'.$langs->trans("PublicInterfaceRecruitmentDesc").'</span><br><br>';
$param = '';
$enabledisablehtml = $langs->trans("EnablePublicRecruitmentPages").' ';
if (empty($conf->global->RECRUITMENT_ENABLE_PUBLIC_INTERFACE)) {

View File

@@ -330,7 +330,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
print '<td class="center">';
$constforvar = 'RECRUITMENT_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $file) {
if (getDolGlobalString($constforvar) == $file) {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
@@ -473,7 +473,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
// Default
print '<td class="center">';
$constforvar = 'RECRUITMENT_'.strtoupper($myTmpObjectKey).'_ADDON_PDF';
if ($conf->global->$constforvar == $name) {
if (getDolGlobalString($constforvar) == $name) {
//print img_picto($langs->trans("Default"), 'on');
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';

View File

@@ -328,7 +328,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
print '<td class="center">';
$constforvar = 'RECRUITMENT_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $file) {
if (getDolGlobalString($constforvar) == $file) {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
@@ -471,7 +471,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
// Default
print '<td class="center">';
$constforvar = 'RECRUITMENT_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $name) {
if (getDolGlobalString($constforvar) == $name) {
//print img_picto($langs->trans("Default"), 'on');
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';

View File

@@ -130,7 +130,7 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi
// List of directories area
$texte .= '<tr><td>';
$texttitle = $langs->trans("ListOfDirectories");
$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->RECRUITMENT_RECRUITMENTJOBPOSITION_ADDON_PDF_ODT_PATH)));
$listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim(getDolGlobalString('RECRUITMENT_RECRUITMENTJOBPOSITION_ADDON_PDF_ODT_PATH'))));
$listoffiles = array();
foreach ($listofdir as $key => $tmpdir) {
$tmpdir = trim($tmpdir);
@@ -155,7 +155,7 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi
$texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1);
$texte .= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
$texte .= '<textarea class="flat" cols="60" name="value1">';
$texte .= $conf->global->RECRUITMENT_RECRUITMENTJOBPOSITION_ADDON_PDF_ODT_PATH;
$texte .= getDolGlobalString('RECRUITMENT_RECRUITMENTJOBPOSITION_ADDON_PDF_ODT_PATH');
$texte .= '</textarea>';
$texte .= '</div><div style="display: inline-block; vertical-align: middle;">';
$texte .= '<input type="submit" class="button small reposition" name="modify" value="'.$langs->trans("Modify").'">';

View File

@@ -849,8 +849,8 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
pdf_pagehead($pdf, $outputlangs, $this->page_hauteur);
// Show Draft Watermark
if ($object->statut == $object::STATUS_DRAFT && (!empty($conf->global->FACTURE_DRAFT_WATERMARK))) {
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK);
if ($object->statut == $object::STATUS_DRAFT && (!empty($conf->global->RECRUITMENT_RECRUITMENTJOBPOSITION_DRAFT_WATERMARK))) {
pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->RECRUITMENT_RECRUITMENTJOBPOSITION_DRAFT_WATERMARK);
}
$pdf->SetTextColor(0, 0, 60);

View File

@@ -79,7 +79,7 @@ class mod_recruitmentjobposition_advanced extends ModeleNumRefRecruitmentJobPosi
// Parametrage du prefix
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskRecruitmentJobPosition" value="'.$conf->global->RECRUITMENT_RECRUITMENTJOBPOSITION_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskRecruitmentJobPosition" value="'.getDolGlobalString('RECRUITMENT_RECRUITMENTJOBPOSITION_ADVANCED_MASK').'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"></td>';
@@ -132,7 +132,7 @@ class mod_recruitmentjobposition_advanced extends ModeleNumRefRecruitmentJobPosi
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// We get cursor rule
$mask = $conf->global->RECRUITMENT_RECRUITMENTJOBPOSITION_ADVANCED_MASK;
$mask = getDolGlobalString('RECRUITMENT_RECRUITMENTJOBPOSITION_ADVANCED_MASK');
if (!$mask) {
$this->error = 'NotConfigured';

View File

@@ -297,7 +297,7 @@ class User extends CommonObject
public $all_permissions_are_loaded;
/**
* @var int Number of rights granted to the user
* @var int Number of rights granted to the user. Value loaded after a getrights().
*/
public $nb_rights;
@@ -883,6 +883,8 @@ class User extends CommonObject
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($result);
if ($obj) {
$nid = $obj->id;
$sql = "DELETE FROM ".$this->db->prefix()."user_rights WHERE fk_user = ".((int) $this->id)." AND fk_id = ".((int) $nid)." AND entity = ".((int) $entity);
@@ -893,6 +895,7 @@ class User extends CommonObject
if (!$this->db->query($sql)) {
$error++;
}
}
$i++;
}
@@ -1096,6 +1099,14 @@ class User extends CommonObject
}
}
// For avoid error
if (!isset($this->rights) || !is_object($this->rights)) {
$this->rights = new stdClass(); // For avoid error
}
if (!isset($this->rights->user) || !is_object($this->rights->user)) {
$this->rights->user = new stdClass(); // For avoid error
}
// Get permission of users + Get permissions of groups
// First user permissions
@@ -1121,7 +1132,6 @@ class User extends CommonObject
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
@@ -1131,9 +1141,6 @@ class User extends CommonObject
$subperms = $obj->subperms;
if (!empty($perms)) {
if (!isset($this->rights) || !is_object($this->rights)) {
$this->rights = new stdClass(); // For avoid error
}
if (!empty($module)) {
if (!isset($this->rights->$module) || !is_object($this->rights->$module)) {
$this->rights->$module = new stdClass();
@@ -1200,9 +1207,6 @@ class User extends CommonObject
$subperms = $obj->subperms;
if (!empty($perms)) {
if (!isset($this->rights) || !is_object($this->rights)) {
$this->rights = new stdClass(); // For avoid error
}
if (!empty($module)) {
if (!isset($this->rights->$module) || !is_object($this->rights->$module)) {
$this->rights->$module = new stdClass();
@@ -1232,6 +1236,63 @@ class User extends CommonObject
$this->db->free($resql);
}
// Force permission on user for admin
if (!empty($this->admin)) {
if (empty($this->rights->user->user)) {
$this->rights->user->user = new stdClass();
}
$listofpermtotest = array('lire', 'creer', 'password', 'supprimer', 'export');
foreach ($listofpermtotest as $permtotest) {
if (empty($this->rights->user->user->$permtotest)) {
$this->rights->user->user->$permtotest = 1;
$this->nb_rights++;
}
}
if (empty($this->rights->user->self)) {
$this->rights->user->self = new stdClass();
}
$listofpermtotest = array('creer', 'password');
foreach ($listofpermtotest as $permtotest) {
if (empty($this->rights->user->self->$permtotest)) {
$this->rights->user->self->$permtotest = 1;
$this->nb_rights++;
}
}
// Add test on advanced permissions
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
if (empty($this->rights->user->user_advance)) {
$this->rights->user->user_advance = new stdClass();
}
$listofpermtotest = array('readperms', 'write');
foreach ($listofpermtotest as $permtotest) {
if (empty($this->rights->user->user_advance->$permtotest)) {
$this->rights->user->user_advance->$permtotest = 1;
$this->nb_rights++;
}
}
if (empty($this->rights->user->self_advance)) {
$this->rights->user->self_advance = new stdClass();
}
$listofpermtotest = array('readperms', 'writeperms');
foreach ($listofpermtotest as $permtotest) {
if (empty($this->rights->user->self_advance->$permtotest)) {
$this->rights->user->self_advance->$permtotest = 1;
$this->nb_rights++;
}
}
if (empty($this->rights->user->group_advance)) {
$this->rights->user->group_advance = new stdClass();
}
$listofpermtotest = array('read', 'readperms', 'write', 'delete');
foreach ($listofpermtotest as $permtotest) {
if (empty($this->rights->user) || empty($this->rights->user->group_advance->$permtotest)) {
$this->rights->user->group_advance->$permtotest = 1;
$this->nb_rights++;
}
}
}
}
// For backward compatibility
if (isset($this->rights->propale) && !isset($this->rights->propal)) {
$this->rights->propal = $this->rights->propale;

View File

@@ -454,7 +454,7 @@ if ($action == 'create') {
print '<td class="center">'.$useringroup->getLibStatut(5).'</td>';
print '<td class="right">';
if (!empty($user->admin)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=removeuser&amp;user='.$useringroup->id.'">';
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=removeuser&token='.newToken().'&user='.$useringroup->id.'">';
print img_picto($langs->trans("RemoveFromGroup"), 'unlink');
print '</a>';
} else {
@@ -483,7 +483,7 @@ if ($action == 'create') {
$genallowed = $user->rights->user->user->creer;
$delallowed = $user->rights->user->user->supprimer;
$somethingshown = $formfile->showdocuments('usergroup', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
$somethingshown = $formfile->showdocuments('usergroup', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', 0, '', $mysoc->default_lang);
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, null);

View File

@@ -328,7 +328,7 @@ if ($object->id > 0) {
//print img_object('', $picto, 'class="inline-block pictoobjectwidth"').' '.$objMod->getName();
print '</td>';
if (is_array($permsgroupbyentity[$entity])) {
if (!empty($permsgroupbyentity[$entity]) && is_array($permsgroupbyentity[$entity])) {
if (in_array($obj->id, $permsgroupbyentity[$entity])) {
// Own permission by group
if ($caneditperms) {