forked from Wavyzz/dolibarr
add new rule
This commit is contained in:
@@ -185,8 +185,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
|
||||
{
|
||||
$qualified = 0;
|
||||
}
|
||||
}
|
||||
else // This is a test on a constant. For example when we have -- VMYSQLUTF8UNICODE, we test constant $conf->global->UTF8UNICODE
|
||||
} else // This is a test on a constant. For example when we have -- VMYSQLUTF8UNICODE, we test constant $conf->global->UTF8UNICODE
|
||||
{
|
||||
$dbcollation = strtoupper(preg_replace('/_/', '', $conf->db->dolibarr_main_db_collation));
|
||||
//var_dump($reg[2]);
|
||||
@@ -225,8 +224,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
|
||||
|
||||
if ($buffer) $arraysql[$i] = $buffer;
|
||||
fclose($fp);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dol_syslog("Admin.lib::run_sql failed to open file ".$sqlfile, LOG_ERR);
|
||||
}
|
||||
|
||||
@@ -250,8 +248,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
|
||||
$obj = $db->fetch_object($resql);
|
||||
$listofmaxrowid[$table] = $obj->max;
|
||||
if (empty($listofmaxrowid[$table])) $listofmaxrowid[$table] = 0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (!$silent) print '<tr><td class="tdtop" colspan="2">';
|
||||
if (!$silent) print '<div class="error">'.$langs->trans("Failed to get max rowid for ".$table)."</div></td>";
|
||||
if (!$silent) print '</tr>';
|
||||
@@ -367,8 +364,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
|
||||
dol_syslog('Admin.lib::run_sql Insert nb '.$cursorinsert.', done in table '.$table.', rowid is '.$listofinsertedrowid[$cursorinsert], LOG_DEBUG);
|
||||
}
|
||||
// print '<td class="right">OK</td>';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$errno = $db->errno();
|
||||
if (!$silent) print '<!-- Result = '.$errno.' -->'."\n";
|
||||
|
||||
@@ -410,8 +406,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
|
||||
if (!$silent) print '<tr><td>'.$langs->trans("ProcessMigrateScript").'</td>';
|
||||
if (!$silent) print '<td class="right">'.$langs->trans("OK").'</td></tr>'."\n";
|
||||
$ok = 1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (!$silent) print '<tr><td>'.$langs->trans("ProcessMigrateScript").'</td>';
|
||||
if (!$silent) print '<td class="right"><font class="error">'.$langs->trans("KO").'</font></td></tr>'."\n";
|
||||
$ok = 0;
|
||||
@@ -453,8 +448,7 @@ function dolibarr_del_const($db, $name, $entity = 1)
|
||||
{
|
||||
$conf->global->$name = '';
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
return -1;
|
||||
}
|
||||
@@ -549,8 +543,7 @@ function dolibarr_set_const($db, $name, $value, $type = 'chaine', $visible = 0,
|
||||
$db->commit();
|
||||
$conf->global->$name = $value;
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$error = $db->lasterror();
|
||||
$db->rollback();
|
||||
return -1;
|
||||
@@ -652,8 +645,7 @@ function security_prepare_head()
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj) $nbPerms = $obj->nb;
|
||||
}
|
||||
else dol_print_error($db);
|
||||
} else dol_print_error($db);
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/perms.php";
|
||||
$head[$h][1] = $langs->trans("DefaultRights");
|
||||
@@ -964,8 +956,7 @@ function activateModule($value, $withdeps = 1)
|
||||
if ($result <= 0)
|
||||
{
|
||||
$ret['errors'][] = $objMod->error;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ($withdeps)
|
||||
{
|
||||
if (isset($objMod->depends) && is_array($objMod->depends) && !empty($objMod->depends))
|
||||
@@ -1001,8 +992,7 @@ function activateModule($value, $withdeps = 1)
|
||||
{
|
||||
$ret['nbmodules'] += $resarray['nbmodules'];
|
||||
$ret['nbperms'] += $resarray['nbperms'];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$ret['errors'][] = $langs->trans('activateModuleDependNotSatisfied', $objMod->name, $modulestring);
|
||||
}
|
||||
}
|
||||
@@ -1073,8 +1063,7 @@ function unActivateModule($value, $requiredby = 1)
|
||||
$objMod = new $modName($db);
|
||||
$result = $objMod->remove();
|
||||
if ($result <= 0) $ret = $objMod->error;
|
||||
}
|
||||
else // We come here when we try to unactivate a module when module does not exists anymore in sources
|
||||
} else // We come here when we try to unactivate a module when module does not exists anymore in sources
|
||||
{
|
||||
//print $dir.$modFile;exit;
|
||||
// TODO Replace this after DolibarrModules is moved as abstract class with a try catch to show module we try to disable has not been found or could not be loaded
|
||||
@@ -1154,8 +1143,7 @@ function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tab
|
||||
if ($objMod->numero > 0)
|
||||
{
|
||||
$j = $objMod->numero;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$j = 1000 + $i;
|
||||
}
|
||||
|
||||
@@ -1200,22 +1188,19 @@ function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tab
|
||||
{
|
||||
print 'Error in descriptor of module '.$const_name.'. Array ->dictionaries has not same number of record for key "tabname", "tablib", "tabsql" and "tabsqlsort"';
|
||||
//print "$const_name: $nbtabname=$nbtablib=$nbtabsql=$nbtabsqlsort=$nbtabfield=$nbtabfieldvalue=$nbtabfieldinsert=$nbtabrowid=$nbtabcond=$nbtabfieldcheck=$nbtabhelp\n";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$taborder[] = 0; // Add an empty line
|
||||
}
|
||||
}
|
||||
|
||||
$j++;
|
||||
$i++;
|
||||
}
|
||||
else dol_syslog("Module ".get_class($objMod)." not qualified");
|
||||
} else dol_syslog("Module ".get_class($objMod)." not qualified");
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING);
|
||||
}
|
||||
}
|
||||
@@ -1273,14 +1258,12 @@ function activateModulesRequiredByCountry($country_code)
|
||||
|
||||
setEventMessages($objMod->automatic_activation[$country_code], null, 'warnings');
|
||||
}
|
||||
}
|
||||
else dol_syslog("Module ".get_class($objMod)." not qualified");
|
||||
} else dol_syslog("Module ".get_class($objMod)." not qualified");
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING);
|
||||
}
|
||||
}
|
||||
@@ -1335,8 +1318,7 @@ function complete_elementList_with_modules(&$elementList)
|
||||
if ($objMod->numero > 0)
|
||||
{
|
||||
$j = $objMod->numero;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$j = 1000 + $i;
|
||||
}
|
||||
|
||||
@@ -1373,14 +1355,12 @@ function complete_elementList_with_modules(&$elementList)
|
||||
|
||||
$j++;
|
||||
$i++;
|
||||
}
|
||||
else dol_syslog("Module ".get_class($objMod)." not qualified");
|
||||
} else dol_syslog("Module ".get_class($objMod)." not qualified");
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING);
|
||||
}
|
||||
}
|
||||
@@ -1433,15 +1413,13 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '')
|
||||
// $const is a const key like 'MYMODULE_ABC'
|
||||
if (is_numeric($key)) { // Very old behaviour
|
||||
$type = 'string';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (is_array($const))
|
||||
{
|
||||
$type = $const['type'];
|
||||
$label = $const['label'];
|
||||
$const = $key;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$type = $const;
|
||||
$const = $key;
|
||||
}
|
||||
@@ -1532,8 +1510,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '')
|
||||
print '<input type="hidden" name="consttype" value="yesno">';
|
||||
print '<input type="hidden" name="constnote'.(empty($strictw3c) ? '' : '[]').'" value="'.nl2br(dol_escape_htmltag($obj->note)).'">';
|
||||
print '</td>';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="consttype'.(empty($strictw3c) ? '' : '[]').'" value="'.($obj->type ? $obj->type : 'string').'">';
|
||||
print '<input type="hidden" name="constnote'.(empty($strictw3c) ? '' : '[]').'" value="'.nl2br(dol_escape_htmltag($obj->note)).'">';
|
||||
@@ -1542,18 +1519,15 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '')
|
||||
print '<textarea class="flat" name="constvalue'.(empty($strictw3c) ? '' : '[]').'" cols="50" rows="5" wrap="soft">'."\n";
|
||||
print $obj->value;
|
||||
print "</textarea>\n";
|
||||
}
|
||||
elseif ($obj->type == 'html')
|
||||
} elseif ($obj->type == 'html')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('constvalue_'.$const.(empty($strictw3c) ? '' : '[]'), $obj->value, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%');
|
||||
$doleditor->Create();
|
||||
}
|
||||
elseif ($obj->type == 'yesno')
|
||||
} elseif ($obj->type == 'yesno')
|
||||
{
|
||||
print $form->selectyesno('constvalue'.(empty($strictw3c) ? '' : '[]'), $obj->value, 1);
|
||||
}
|
||||
elseif (preg_match('/emailtemplate/', $obj->type))
|
||||
} elseif (preg_match('/emailtemplate/', $obj->type))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
@@ -1577,8 +1551,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '')
|
||||
//var_dump($arraydefaultmessage);
|
||||
//var_dump($arrayofmessagename);
|
||||
print $form->selectarray('constvalue_'.$obj->name, $arrayofmessagename, $obj->value.':'.$tmp[1], 'None', 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
}
|
||||
else // type = 'string' ou 'chaine'
|
||||
} else // type = 'string' ou 'chaine'
|
||||
{
|
||||
print '<input type="text" class="flat" size="48" name="constvalue'.(empty($strictw3c) ? '' : '[]').'" value="'.dol_escape_htmltag($obj->value).'">';
|
||||
}
|
||||
@@ -1667,8 +1640,7 @@ function addDocumentModel($name, $type, $label = '', $description = '')
|
||||
{
|
||||
$db->commit();
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
$db->rollback();
|
||||
return -1;
|
||||
@@ -1699,8 +1671,7 @@ function delDocumentModel($name, $type)
|
||||
{
|
||||
$db->commit();
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
$db->rollback();
|
||||
return -1;
|
||||
@@ -1729,8 +1700,7 @@ function phpinfo_array()
|
||||
if (preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val))
|
||||
{
|
||||
$info_arr[trim($cat)][trim($val[1])] = $val[2];
|
||||
}
|
||||
elseif (preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val))
|
||||
} elseif (preg_match("~<tr><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td><td[^>]+>([^<]*)</td></tr>~", $line, $val))
|
||||
{
|
||||
$info_arr[trim($cat)][trim($val[1])] = array("local" => $val[2], "master" => $val[3]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user