add new rule

This commit is contained in:
Frédéric FRANCE 2020-05-21 02:17:21 +02:00
parent ae06b35c63
commit a636f81eac
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
25 changed files with 333 additions and 658 deletions

View File

@ -87,14 +87,12 @@ if ($idobject > 0)
// Change status to validated
$result=$obj->validate($user);
if ($result > 0) print "OK Object created with id ".$idobject."\n";
else
{
else {
$error++;
dol_print_error($db, $obj->error);
}
}
else
{
else {
$error++;
dol_print_error($db, $obj->error);
}
@ -107,8 +105,7 @@ if (! $error)
$db->commit();
print '--- end ok'."\n";
}
else
{
else {
print '--- end error code='.$error."\n";
$db->rollback();
}

View File

@ -85,14 +85,12 @@ if ($idobject > 0)
// Change status to validated
$result=$com->valid($user);
if ($result > 0) print "OK Object created with id ".$idobject."\n";
else
{
else {
$error++;
dol_print_error($db, $com->error);
}
}
else
{
else {
$error++;
dol_print_error($db, $com->error);
}
@ -105,8 +103,7 @@ if (! $error)
$db->commit();
print '--- end ok'."\n";
}
else
{
else {
print '--- end error code='.$error."\n";
$db->rollback();
}

View File

@ -83,8 +83,7 @@ if ($idobject > 0)
{
print "OK Object created with id ".$idobject."\n";
}
else
{
else {
$error++;
dol_print_error($db, $myproduct->error);
}
@ -96,8 +95,7 @@ if (! $error)
$db->commit();
print '--- end ok'."\n";
}
else
{
else {
print '--- end error code='.$error."\n";
$db->rollback();
}

View File

@ -74,8 +74,7 @@ if ($idobject > 0)
// Change status to validated
$result=$obj->setStatut(1);
if ($result > 0) print "OK Object created with id ".$idobject."\n";
else
{
else {
$error++;
dol_print_error($db, $obj->error);
}
@ -84,8 +83,7 @@ elseif ($obj->error == 'ErrorLoginAlreadyExists')
{
print "User with login ".$obj->login." already exists\n";
}
else
{
else {
$error++;
dol_print_error($db, $obj->error);
}
@ -98,8 +96,7 @@ if (! $error)
$db->commit();
print '--- end ok'."\n";
}
else
{
else {
print '--- end error code='.$error."\n";
$db->rollback();
}

View File

@ -227,8 +227,7 @@ while ($fields = $db->fetch_array($resql)) {
$error++; // $errorrecord will be reset
}
$j++;
} else
die("error : $sql");
} else die("error : $sql");

View File

@ -179,8 +179,7 @@ while ($fields = $db->fetch_array($resql)) {
$object->town = trim($fields['FVILLE']);
if ($fields['FPAYS'])
$object->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['FPAYS']))), 'c_country', 'label', 'rowid');
else
$object->country_id = 1;
else $object->country_id = 1;
$object->phone = trim($fields['FTEL']) ? trim($fields['FTEL']) : trim($fields['FCONTACT']);
$object->phone = substr($object->phone, 0, 20);
$object->fax = trim($fields['FFAX']) ? trim($fields['FFAX']) : trim($fields['FCONTACT']);
@ -299,8 +298,7 @@ while ($fields = $db->fetch_array($resql)) {
$contact->town = trim($fields['LVILLE']);
if ($fields['FPAYS'])
$contact->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['LPAYS']))), 'c_country', 'label', 'rowid');
else
$contact->country_id = 1;
else $contact->country_id = 1;
$contact->email = $fields['LMAIL'];
$contact->phone = trim($fields['LTEL']) ? trim($fields['LTEL']) : trim($fields['LCONTACT']);
$contact->fax = trim($fields['LFAX']) ? trim($fields['LFAX']) : trim($fields['LCONTACT']);
@ -340,8 +338,7 @@ while ($fields = $db->fetch_array($resql)) {
$error++; // $errorrecord will be reset
}
$j++;
} else
die("error : $sql");
} else die("error : $sql");
$db->commit();

View File

@ -207,8 +207,7 @@ class DBase
$value = true;
elseif ($value == 'f' || $value == 'n')
$value = false;
else
$value = null;
else $value = null;
}
$record[$i] = $value;
}
@ -295,8 +294,7 @@ class DBase
$i = unpack("S$n", $data);
if ($n == 1)
return (int) $i[1];
else
return array_merge($i);
else return array_merge($i);
}
private static function putInt16($fd, $value)
@ -310,8 +308,7 @@ class DBase
$i = unpack("L$n", $data);
if ($n == 1)
return (int) $i[1];
else
return array_merge($i);
else return array_merge($i);
}
private static function putInt32($fd, $value)

View File

@ -180,13 +180,11 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0)
{
print " OK with ref ".$object->ref."\n";;
}
else
{
else {
dol_print_error($db, $object->error);
}
}
else
{
else {
dol_print_error($db, $object->error);
}
}

View File

@ -207,15 +207,13 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
$db->commit();
print " OK with ref ".$object->ref."\n";
}
else
{
else {
print " KO\n";
$db->rollback();
dol_print_error($db, $object->error);
}
}
else
{
else {
print " KO\n";
$db->rollback();
dol_print_error($db, $object->error);

View File

@ -211,15 +211,13 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
$db->commit();
print " OK with ref ".$object->ref."\n";
}
else
{
else {
print " KO\n";
$db->rollback();
dol_print_error($db, $object->error);
}
}
else
{
else {
dol_print_error($db, $object->error);
}
}

View File

@ -137,8 +137,7 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
print "Company ".$s." created nom=".$soc->name."\n";
}
else
{
else {
print "Error: ".$soc->error."\n";
}
}

View File

@ -164,8 +164,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
print " - Error in create result code = ".$ret." - ".$produit->errorsToString();
$errorrecord++;
}
else
{
else {
print " - Creation OK with ref ".$produit->ref." - id = ".$ret;
}
@ -181,8 +180,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
print " - Error in updatePrice result code = ".$ret1." ".$ret2." - ".$produit->errorsToString();
$errorrecord++;
}
else
{
else {
print " - updatePrice OK";
}
}
@ -201,8 +199,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
print " - Error in setMultiLangs result code = ".$ret." - ".$produit->errorsToString();
$errorrecord++;
}
else
{
else {
print " - setMultiLangs OK";
}
}
@ -228,8 +225,7 @@ if ($mode != 'confirmforced' && ($error || $mode != 'confirm'))
print "Rollback any changes.\n";
$db->rollback();
}
else
{
else {
print "Commit all changes.\n";
$db->commit();
}

View File

@ -182,8 +182,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
print " - Error in create result code = ".$ret." - ".$object->errorsToString();
$errorrecord++;
}
else
{
else {
print " - Creation OK with name ".$object->name." - id = ".$ret;
}
}
@ -213,8 +212,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
print " - Error in create link with sale representative result code = ".$result." - ".$object->errorsToString();
$errorrecord++;
}
else
{
else {
print " - create link sale representative OK";
}
}
@ -244,8 +242,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
print " - Error in create contact result code = ".$ret1." ".$ret2." - ".$object->errorsToString();
$errorrecord++;
}
else
{
else {
print " - create contact OK";
}
}
@ -278,8 +275,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
print " - Error in create contact result code = ".$ret1." ".$ret2." - ".$object->errorsToString();
$errorrecord++;
}
else
{
else {
print " - create contact OK";
}
}
@ -306,8 +302,7 @@ if ($mode != 'confirmforced' && ($error || $mode != 'confirm'))
print "Rollback any changes.\n";
$db->rollback();
}
else
{
else {
print "Commit all changes.\n";
$db->commit();
}

View File

@ -143,8 +143,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape))
print " - Error in create result code = ".$ret." - ".$object->errorsToString();
$errorrecord++;
}
else
{
else {
print " - Creation OK with login ".$object->login." - id = ".$ret;
}
@ -169,8 +168,7 @@ if ($mode != 'confirmforced' && ($error || $mode != 'confirm'))
print "Rollback any changes.\n";
$db->rollback();
}
else
{
else {
print "Commit all changes.\n";
$db->commit();
}

View File

@ -198,7 +198,7 @@ if (empty($option))
if ($option != 'all')
{
$listofoptions=explode(',', $option);
foreach($listofoptions as $cursoroption)
foreach ($listofoptions as $cursoroption)
{
if (! in_array($cursoroption, array_keys($sqls))) {
print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
@ -264,7 +264,7 @@ function processfamily($family, $date)
global $db, $sqls;
$error=0;
foreach($sqls[$family] as $sql)
foreach ($sqls[$family] as $sql)
{
if (preg_match('/^@/', $sql))
{
@ -302,10 +302,10 @@ function processfamily($family, $date)
$db->begin();
$listofoptions=explode(',', $option);
foreach($listofoptions as $cursoroption)
foreach ($listofoptions as $cursoroption)
{
$oldfamily='';
foreach($sqls as $family => $familysql)
foreach ($sqls as $family => $familysql)
{
if ($cursoroption && $cursoroption != 'all' && $cursoroption != $family) continue;
@ -326,8 +326,7 @@ if ($error || $mode != 'confirm')
print "\nRollback any changes.\n";
$db->rollback();
}
else
{
else {
print "Commit all changes.\n";
$db->commit();
}

View File

@ -142,8 +142,7 @@ class Export
{
$bool = $user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]};
}
else
{
else {
$bool = $user->rights->{$perm[0]}->{$perm[1]};
}
if ($perm[0] == 'user' && $user->admin) $bool = true;
@ -295,8 +294,7 @@ class Export
case 'Text':
if (!(strpos($ValueField, '%') === false))
$szFilterQuery .= " ".$NameField." LIKE '".$ValueField."'";
else
$szFilterQuery .= " ".$NameField." = '".$ValueField."'";
else $szFilterQuery .= " ".$NameField." = '".$ValueField."'";
break;
case 'Date':
if (strpos($ValueField, "+") > 0)
@ -306,12 +304,10 @@ class Export
$szFilterQuery = "(".$this->conditionDate($NameField, trim($ValueArray[0]), ">=");
$szFilterQuery .= " AND ".$this->conditionDate($NameField, trim($ValueArray[1]), "<=").")";
}
else
{
else {
if (is_numeric(substr($ValueField, 0, 1)))
$szFilterQuery = $this->conditionDate($NameField, trim($ValueField), "=");
else
$szFilterQuery = $this->conditionDate($NameField, trim(substr($ValueField, 1)), substr($ValueField, 0, 1));
else $szFilterQuery = $this->conditionDate($NameField, trim(substr($ValueField, 1)), substr($ValueField, 0, 1));
}
break;
case 'Duree':
@ -325,12 +321,10 @@ class Export
$szFilterQuery = "(".$NameField.">=".$ValueArray[0];
$szFilterQuery .= " AND ".$NameField."<=".$ValueArray[1].")";
}
else
{
else {
if (is_numeric(substr($ValueField, 0, 1)))
$szFilterQuery = " ".$NameField."=".$ValueField;
else
$szFilterQuery = " ".$NameField.substr($ValueField, 0, 1).substr($ValueField, 1);
else $szFilterQuery = " ".$NameField.substr($ValueField, 0, 1).substr($ValueField, 1);
}
break;
case 'Boolean':
@ -343,8 +337,7 @@ class Export
else {
if (!(strpos($ValueField, '%') === false))
$szFilterQuery = " ".$NameField." LIKE '".$ValueField."'";
else
$szFilterQuery = " ".$NameField." = '".$ValueField."'";
else $szFilterQuery = " ".$NameField." = '".$ValueField."'";
}
break;
default:
@ -367,7 +360,7 @@ class Export
// TODO date_format is forbidden, not performant and not portable. Use instead BETWEEN
if (strlen($Value) == 4) $Condition = " date_format(".$Field.",'%Y') ".$Sens." '".$Value."'";
elseif (strlen($Value) == 6) $Condition = " date_format(".$Field.",'%Y%m') ".$Sens." '".$Value."'";
else $Condition = " date_format(".$Field.",'%Y%m%d') ".$Sens." ".$Value;
else $Condition = " date_format(".$Field.",'%Y%m%d') ".$Sens." ".$Value;
return $Condition;
}
@ -428,8 +421,7 @@ class Export
if (!empty($InfoFieldList[3]))
$keyList = $InfoFieldList[3];
else
$keyList = 'rowid';
else $keyList = 'rowid';
$sql = 'SELECT '.$keyList.' as rowid, '.$InfoFieldList[2].' as label'.(empty($InfoFieldList[3]) ? '' : ', '.$InfoFieldList[3].' as code');
if ($InfoFieldList[1] == 'c_stcomm') $sql = 'SELECT id as id, '.$keyList.' as rowid, '.$InfoFieldList[2].' as label'.(empty($InfoFieldList[3]) ? '' : ', '.$InfoFieldList[3].' as code');
if ($InfoFieldList[1] == 'c_country') $sql = 'SELECT '.$keyList.' as rowid, '.$InfoFieldList[2].' as label, code as code';
@ -474,8 +466,7 @@ class Export
{
$szFilterField .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
}
else
{
else {
$szFilterField .= '<option value="'.$obj->rowid.'" >'.$labeltoshow.'</option>';
}
$i++;
@ -564,8 +555,7 @@ class Export
$objmodel = new $classname($this->db);
if (!empty($sqlquery)) $sql = $sqlquery;
else
{
else {
// Define value for indice from $datatoexport
$foundindice = 0;
foreach ($this->array_export_code as $key => $dataset)
@ -595,8 +585,7 @@ class Export
//$this->array_export_label[$indice]
if ($conf->global->EXPORT_PREFIX_SPEC)
$filename = $conf->global->EXPORT_PREFIX_SPEC."_".$datatoexport;
else
$filename = "export_".$datatoexport;
else $filename = "export_".$datatoexport;
$filename .= '.'.$objmodel->getDriverExtension();
$dirname = $conf->export->dir_temp.'/'.$user->id;
@ -665,8 +654,7 @@ class Export
}
$obj->$alias = $remaintopay;
}
else
{
else {
// TODO FIXME Export of compute field does not work. $obj containt $obj->alias_field and formulat will contains $obj->field
$computestring = $this->array_export_special[$indice][$key];
$tmp = dol_eval($computestring, 1, 0);
@ -689,15 +677,13 @@ class Export
return 1;
}
else
{
else {
$this->error = $objmodel->error;
dol_syslog("Export::build_file Error: ".$this->error, LOG_ERR);
return -1;
}
}
else
{
else {
$this->error = $this->db->error()." - sql=".$sql;
return -1;
}
@ -740,8 +726,7 @@ class Export
$this->db->commit();
return 1;
}
else
{
else {
$this->error = $this->db->lasterror();
$this->errno = $this->db->lasterrno();
$this->db->rollback();
@ -777,14 +762,12 @@ class Export
return 1;
}
else
{
else {
$this->error = "ModelNotFound";
return -2;
}
}
else
{
else {
dol_print_error($this->db);
return -3;
}
@ -823,8 +806,7 @@ class Export
$this->db->rollback();
return -1 * $error;
}
else
{
else {
$this->db->commit();
return 1;
}

View File

@ -174,8 +174,7 @@ if ($action == 'selectfield') // Selection of field at step 2
$_SESSION["export_selected_fields"] = $array_selected;
}
}
else
{
else {
$warnings = array();
$array_selected[$field] = count($array_selected) + 1; // We tag the key $field as "selected"
@ -223,8 +222,7 @@ if ($action == 'unselectfield')
$array_selected = array();
$_SESSION["export_selected_fields"] = $array_selected;
}
else
{
else {
unset($array_selected[$_GET["field"]]);
// Renumber fields of array_selected (from 1 to nb_elements)
asort($array_selected);
@ -288,8 +286,7 @@ if ($action == 'builddoc')
setEventMessages($objexport->error, $objexport->errors, 'errors');
$sqlusedforexport = $objexport->sqlusedforexport;
}
else
{
else {
setEventMessages($langs->trans("FileSuccessfullyBuilt"), null, 'mesgs');
$sqlusedforexport = $objexport->sqlusedforexport;
}
@ -351,17 +348,14 @@ if ($action == 'add_export_model')
{
setEventMessages($langs->trans("ExportModelSaved", $objexport->model_name), null, 'mesgs');
}
else
{
else {
$langs->load("errors");
if ($objexport->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS')
setEventMessages($langs->trans("ErrorExportDuplicateProfil"), null, 'errors');
else
setEventMessages($objexport->error, $objexport->errors, 'errors');
else setEventMessages($objexport->error, $objexport->errors, 'errors');
}
}
else
{
else {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportModelName")), null, 'errors');
}
}
@ -473,15 +467,13 @@ if ($step == 1 || !$datatoexport)
{
print '<a href="'.DOL_URL_ROOT.'/exports/export.php?step=2&module_position='.$objexport->array_export_module[$key]->module_position.'&datatoexport='.$objexport->array_export_code[$key].'">'.img_picto($langs->trans("NewExport"), 'filenew').'</a>';
}
else
{
else {
print $langs->trans("NotEnoughPermissions");
}
print '</td></tr>';
}
}
else
{
else {
print '<tr><td class="oddeven" colspan="3">'.$langs->trans("NoExportableData").'</td></tr>';
}
print '</table>';
@ -615,8 +607,7 @@ if ($step == 2 && $datatoexport)
{
$htmltext .= '<b>'.$langs->trans("ComputedField")." -> ".$langs->trans("Method")." :</b> ".$objexport->array_export_special[0][$code]."<br>";
}
else
{
else {
$htmltext .= '<b>'.$langs->trans("Table")." -> ".$langs->trans("Field").":</b> ".$tablename." -> ".preg_replace('/^.*\./', '', $code)."<br>";
}
if (!empty($objexport->array_export_examplevalues[0][$code]))
@ -643,8 +634,7 @@ if ($step == 2 && $datatoexport)
//print ' ('.$code.')';
print '</td>';
}
else
{
else {
// Fields not selected
print '<td>';
//print $text.'-'.$htmltext."<br>";
@ -673,13 +663,11 @@ if ($step == 2 && $datatoexport)
{
print '<a class="butAction" href="export.php?step=3&datatoexport='.$datatoexport.'">'.$langs->trans("NextStep").'</a>';
}
else
{
else {
print '<a class="butAction" href="export.php?step=4&datatoexport='.$datatoexport.'">'.$langs->trans("NextStep").'</a>';
}
}
else
{
else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("SelectAtLeastOneField")).'">'.$langs->trans("NextStep").'</a>';
}
@ -811,8 +799,7 @@ if ($step == 3 && $datatoexport)
{
$htmltext .= '<b>'.$langs->trans("ComputedField")." -> ".$langs->trans("Method")." :</b> ".$objexport->array_export_special[0][$code]."<br>";
}
else
{
else {
$htmltext .= '<b>'.$langs->trans("Table")." -> ".$langs->trans("Field").":</b> ".$tablename." -> ".preg_replace('/^.*\./', '', $code)."<br>";
}
if (!empty($objexport->array_export_examplevalues[0][$code]))
@ -842,8 +829,7 @@ if ($step == 3 && $datatoexport)
$tmp = $objexport->build_filterField($Typefieldsarray[$code], $code, $ValueFilter);
print $form->textwithpicto($tmp, $szInfoFiltre);
}
else
{
else {
print $objexport->build_filterField($Typefieldsarray[$code], $code, $ValueFilter);
}
}
@ -1006,8 +992,7 @@ if ($step == 4 && $datatoexport)
{
$htmltext .= '<b>'.$langs->trans("ComputedField")." -> ".$langs->trans("Method")." :</b> ".$objexport->array_export_special[0][$code]."<br>";
}
else
{
else {
$htmltext .= '<b>'.$langs->trans("Table")." -> ".$langs->trans("Field").":</b> ".$tablename." -> ".preg_replace('/^.*\./', '', $code)."<br>";
}
if (!empty($objexport->array_export_examplevalues[0][$code]))

View File

@ -88,8 +88,7 @@ elseif (versioncompare(versionphparray(), $arrayphpminversionwarning) < 0) //
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning));
$checksok = 0; // 0=error, 1=warning
}
else
{
else {
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPVersion")." ".versiontostring(versionphparray());
}
if (empty($force_install_nophpinfo)) print ' (<a href="phpinfo.php" target="_blank">'.$langs->trans("MoreInformation").'</a>)';
@ -104,8 +103,7 @@ if (!isset($_GET["testget"]) && !isset($_POST["testpost"]))
print "<br>\n";
$checksok = 0;
}
else
{
else {
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupportPOSTGETOk")."<br>\n";
}
@ -116,8 +114,7 @@ if (!function_exists("session_id"))
print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportSessions")."<br>\n";
$checksok = 0;
}
else
{
else {
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupportSessions")."<br>\n";
}
@ -129,8 +126,7 @@ if (!function_exists("imagecreate"))
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportGD")."<br>\n";
// $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
}
else
{
else {
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupportGD")."<br>\n";
}
@ -142,8 +138,7 @@ if (!function_exists("curl_init"))
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportCurl")."<br>\n";
// $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
}
else
{
else {
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupportCurl")."<br>\n";
}
@ -152,8 +147,7 @@ if (!function_exists("easter_date"))
{
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportCalendar")."<br>\n";
}
else
{
else {
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupportCalendar")."<br>\n";
}
@ -165,8 +159,7 @@ if (!function_exists("utf8_encode"))
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportUTF8")."<br>\n";
// $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
}
else
{
else {
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupportUTF8")."<br>\n";
}
@ -180,8 +173,7 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportIntl")."<br>\n";
// $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
}
else
{
else {
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupportIntl")."<br>\n";
}
}
@ -192,8 +184,7 @@ if (!class_exists('ZipArchive'))
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupport", "ZIP")."<br>\n";
// $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
}
else
{
else {
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupport", "ZIP")."<br>\n";
}
@ -215,8 +206,7 @@ if ($memmaxorig != '')
{
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPMemoryOK", $memmaxorig, $memrequiredorig)."<br>\n";
}
else
{
else {
print '<img src="../theme/eldy/img/warning.png" alt="Warning"> '.$langs->trans("PHPMemoryTooLow", $memmaxorig, $memrequiredorig)."<br>\n";
}
}
@ -236,13 +226,11 @@ if (is_readable($conffile) && filesize($conffile) > 8)
// Already installed for all parts (config and database). We can propose upgrade.
$allowupgrade = true;
}
else
{
else {
$allowupgrade = false;
}
}
else
{
else {
// If not, we create it
dolibarr_install_syslog("check: we try to create conf file '".$conffile."'");
$confexists = 0;
@ -253,8 +241,7 @@ else
// Success
dolibarr_install_syslog("check: successfully copied file ".$conffile.".example into ".$conffile);
}
else
{
else {
// If failed, we try to create an empty file
dolibarr_install_syslog("check: failed to copy file ".$conffile.".example into ".$conffile.". We try to create it.", LOG_WARNING);
@ -285,8 +272,7 @@ if (!file_exists($conffile))
print $langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'].'?testget=ok');
$err++;
}
else
{
else {
if (dol_is_dir($conffile))
{
print '<img src="../theme/eldy/img/error.png" alt="Warning"> '.$langs->trans("ConfFileMustBeAFileNotADir", $conffiletoshow);
@ -300,8 +286,7 @@ else
{
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("ConfFileExists", $conffiletoshow);
}
else
{
else {
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("ConfFileCouldBeCreated", $conffiletoshow);
}
print "<br>";
@ -311,14 +296,12 @@ else
$allowinstall = 0;
}
// File exists and can be modified
else
{
else {
if ($confexists)
{
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("ConfFileExists", $conffiletoshow);
}
else
{
else {
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("ConfFileCouldBeCreated", $conffiletoshow);
}
print "<br>";
@ -345,8 +328,7 @@ else
print '<span class="error">A '.$conffiletoshow.' file exists with a dolibarr_main_document_root to '.$dolibarr_main_document_root.' that seems wrong. Try to fix or remove the '.$conffiletoshow.' file.</span><br>'."\n";
dol_syslog("A '".$conffiletoshow."' file exists with a dolibarr_main_document_root to ".$dolibarr_main_document_root." that seems wrong. Try to fix or remove the '".$conffiletoshow."' file.", LOG_WARNING);
}
else
{
else {
require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
// If password is encoded, we decode it
@ -440,8 +422,7 @@ else
{
$choice .= '<a class="button" href="fileconf.php?selectlang='.$setuplang.'">'.$langs->trans("Start").'</a>';
}
else
{
else {
$choice .= ($foundrecommandedchoice ? '<span class="warning">' : '').$langs->trans("InstallNotAllowed").($foundrecommandedchoice ? '</span>' : '');
}
$choice .= '</td>'."\n";
@ -560,13 +541,11 @@ else
{
$choice .= '<span class="opacitymedium">'.$langs->trans("NotYetAvailable").'</span>';
}
else
{
else {
$choice .= '<a class="button runupgrade" href="upgrade.php?action=upgrade'.($count < count($migrationscript) ? '_'.$versionto : '').'&amp;selectlang='.$setuplang.'&amp;versionfrom='.$versionfrom.'&amp;versionto='.$versionto.'">'.$langs->trans("Start").'</a>';
}
}
else
{
else {
$choice .= $langs->trans("NotAvailable");
}
$choice .= '</td>';

View File

@ -124,13 +124,11 @@ if (!defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) >
}
}
}
else
{
else {
$includeconferror = 'ErrorBadValueForDolibarrMainDocumentRoot';
}
}
else
{
else {
$includeconferror = 'ErrorBadFormatForConfFile';
}
}
@ -210,8 +208,7 @@ if (@file_exists($lockfile))
print $langs->trans("ClickHereToGoToApp");
print '</a>';
}
else
{
else {
print 'If you always reach this page, you must remove install.lock file manually.<br>';
}
exit;
@ -365,8 +362,7 @@ function pHeader($subtitle, $next, $action = 'set', $param = '', $forcejqueryurl
$jQueryCustomPath = $forcejqueryurl;
$jQueryUiCustomPath = $forcejqueryurl;
}
else
{
else {
$jQueryCustomPath = (defined('JS_JQUERY') && constant('JS_JQUERY')) ? JS_JQUERY : false;
$jQueryUiCustomPath = (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) ? JS_JQUERY_UI : false;
}

View File

@ -124,8 +124,7 @@ if ($db->connected)
dolibarr_install_syslog("repair: ".$langs->transnoentities("ServerConnection").": ".$dolibarr_main_db_host.$langs->transnoentities("OK"));
$ok = 1;
}
else
{
else {
print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name)."</td><td class=\"right\">".$langs->transnoentities("Error")."</td></tr>";
dolibarr_install_syslog("repair: ".$langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name));
$ok = 0;
@ -140,8 +139,7 @@ if ($ok)
dolibarr_install_syslog("repair: database connection successful: ".$dolibarr_main_db_name);
$ok = 1;
}
else
{
else {
print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name)."</td><td class=\"right\">".$langs->trans("Error")."</td></tr>";
dolibarr_install_syslog("repair: ".$langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name));
$ok = 0;
@ -257,8 +255,7 @@ if ($ok && GETPOST('standard', 'alpha'))
$fieldname = $obj->Field;
$fieldtype = $obj->Type;
}
else
{
else {
$fieldname = isset($obj->Key) ? $obj->Key : $obj->attname;
$fieldtype = isset($obj->Type) ? $obj->Type : 'varchar';
}
@ -318,13 +315,11 @@ if ($ok && GETPOST('standard', 'alpha'))
{
print "KO ".$db->lasterror."<br>\n";
}
else
{
else {
print "OK<br>\n";
}
}
else
{
else {
print ' - Mode test, no column added.';
}
}
@ -332,8 +327,7 @@ if ($ok && GETPOST('standard', 'alpha'))
print "</td><td>&nbsp;</td></tr>\n";
}
else
{
else {
dol_print_error($db);
}
}
@ -399,13 +393,11 @@ if ($ok && GETPOST('standard', 'alpha'))
print '<tr><td>Widget '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module '.$name.' not enabled in entity '.$obj->entity.', we delete record</td></tr>';
}
else
{
else {
print '<tr><td>Widget '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module '.$name.' not enabled in entity '.$obj->entity.', we should delete record (not done, mode test)</td></tr>';
}
}
else
{
else {
//print '<tr><td>Constant '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module found in entity '.$obj->entity.', we keep record</td></tr>';
}
}
@ -472,13 +464,11 @@ if ($ok && GETPOST('standard', 'alpha'))
print '<tr><td>Constant '.$obj->file.' set in boxes_def for entity '.$obj->entity.' but MAIN_MODULE_'.strtoupper($module).' not defined in entity '.$obj->entity.', we delete record</td></tr>';
}
else
{
else {
print '<tr><td>Constant '.$obj->file.' set in boxes_def for entity '.$obj->entity.' but MAIN_MODULE_'.strtoupper($module).' not defined in entity '.$obj->entity.', we should delete record (not done, mode test)</td></tr>';
}
}
else
{
else {
//print '<tr><td>Constant '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module found in entity '.$obj->entity.', we keep record</td></tr>';
}
}
@ -567,8 +557,7 @@ if ($ok && GETPOST('restore_thirdparties_logos'))
$i++;
}
}
else
{
else {
$ok = 0;
dol_print_error($db);
}
@ -671,8 +660,7 @@ if ($ok && GETPOST('restore_user_pictures', 'alpha'))
$i++;
}
}
else
{
else {
$ok = 0;
dol_print_error($db);
}
@ -730,8 +718,7 @@ if ($ok && GETPOST('rebuild_product_thumbs', 'alpha'))
$i++;
}
}
else
{
else {
$ok = 0;
dol_print_error($db);
}
@ -816,16 +803,13 @@ if ($ok && GETPOST('clean_menus', 'alpha'))
$error++;
dol_print_error($db);
}
else
print ' - <span class="warning">Cleaned</span>';
else print ' - <span class="warning">Cleaned</span>';
}
else
{
else {
print ' - <span class="warning">Canceled (test mode)</span>';
}
}
else
{
else {
print ' - Module condition '.$modulecond.' is ok, we do nothing.';
}
}
@ -840,13 +824,11 @@ if ($ok && GETPOST('clean_menus', 'alpha'))
$i++;
}
}
else
{
else {
print '<tr><td>No menu entries of disabled menus found</td></tr>';
}
}
else
{
else {
dol_print_error($db);
}
}
@ -1049,8 +1031,7 @@ if ($ok && GETPOST('clean_product_stock_batch', 'alpha'))
dol_print_error($db);
}
}
else
{
else {
$error++;
dol_print_error($db);
}
@ -1066,13 +1047,11 @@ if ($ok && GETPOST('clean_product_stock_batch', 'alpha'))
$i++;
}
}
else
{
else {
print '<tr><td colspan="2">Nothing to do</td></tr>';
}
}
else
{
else {
dol_print_error($db);
}
}
@ -1156,13 +1135,11 @@ if ($ok && GETPOST('set_empty_time_spent_amount', 'alpha'))
$i++;
}
}
else
{
else {
print '<tr><td>No time spent with empty line on users with a hourly rate defined</td></tr>';
}
}
else
{
else {
dol_print_error($db);
}
}
@ -1257,16 +1234,13 @@ if ($ok && GETPOST('force_disable_of_modules_not_found', 'alpha'))
$error++;
dol_print_error($db);
}
else
print ' - <span class="warning">Cleaned</span>';
else print ' - <span class="warning">Cleaned</span>';
}
else
{
else {
print ' - <span class="warning">Canceled (test mode)</span>';
}
}
else
{
else {
print ' - File of '.$key.' ('.$reloffile.') found, we do nothing.';
}
}
@ -1282,13 +1256,11 @@ if ($ok && GETPOST('force_disable_of_modules_not_found', 'alpha'))
$i++;
}
}
else
{
else {
print '<tr><td>No active module with missing files found by searching on MAIN_MODULE_(.*)_'.strtoupper($key).'</td></tr>';
}
}
else
{
else {
dol_print_error($db);
}
}
@ -1334,13 +1306,11 @@ if ($ok && GETPOST('clean_perm_table', 'alpha'))
$i++;
}
}
else
{
else {
print '<tr><td>No lines of a disabled external module (with id > 100000) found into table rights_def</td></tr>';
}
}
else
{
else {
dol_print_error($db);
}
}
@ -1392,8 +1362,7 @@ if ($ok && GETPOST('force_utf8_on_tables', 'alpha'))
$resql = $db->query($sql);
}
}
else
{
else {
print '<tr><td colspan="2">Not available with database type '.$db->type.'</td></tr>';
}
}
@ -1496,8 +1465,7 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) {
{
$resql_attach = $db->query($sql_attach);
}
else
{
else {
$resql_attach = true; // Force success in test mode
}
@ -1552,8 +1520,7 @@ if ($oneoptionset)
print $langs->trans("GoToDolibarr");
print '</a></div>';
}
else
{
else {
print '<div class="center warning" style="padding-top: 10px">';
print $langs->trans("SetAtLeastOneOptionAsUrlParameter");
print '</div>';

View File

@ -231,8 +231,7 @@ if (!$error) {
{
$databasefortest = 'postgres';
}
else
{
else {
$databasefortest = 'master';
}
}
@ -275,8 +274,7 @@ if (!$error) {
}
}
}
else
{
else {
print "<br>\nFailed to include_once(\"".$main_dir."/core/db/".$db_type.".class.php\")<br>\n";
print '<div class="error">'.$langs->trans("ErrorWrongValueForParameter", $langs->transnoentities("WebPagesDirectory")).'</div>';
//print '<a href="#" onClick="javascript: history.back();">';
@ -286,8 +284,7 @@ if (!$error) {
}
}
else
{
else {
if (isset($db)) print $db->lasterror();
if (isset($db) && !$db->connected) print '<br>'.$langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
print $langs->trans("ErrorGoBackAndCorrectParameters");
@ -318,7 +315,7 @@ if (!$error && $db->connected)
$defaultCharacterSet = $db->forcecharset;
$defaultDBSortingCollation = $db->forcecollate;
}
else // If already created, we take current value
else // If already created, we take current value
{
$defaultCharacterSet = $db->getDefaultCharacterSetDatabase();
$defaultDBSortingCollation = $db->getDefaultCollationDatabase();
@ -401,8 +398,7 @@ if (!$error && $db->connected && $action == "set")
print '<tr><td colspan="2"><br>'.$langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'].'?testget=ok').'</td></tr>';
$error++;
}
else
{
else {
// Create .htaccess file in document directory
$pathhtaccess = $main_data_dir.'/.htaccess';
if (!file_exists($pathhtaccess))
@ -438,8 +434,7 @@ if (!$error && $db->connected && $action == "set")
{
dolibarr_install_syslog("step1: directory '".$dir[$i]."' exists");
}
else
{
else {
if (dol_mkdir($dir[$i]) < 0)
{
print "<tr><td>";
@ -449,8 +444,7 @@ if (!$error && $db->connected && $action == "set")
print "</td></tr>";
$error++;
}
else
{
else {
dolibarr_install_syslog("step1: directory '".$dir[$i]."' created");
}
}
@ -472,8 +466,7 @@ if (!$error && $db->connected && $action == "set")
print "</td></tr>";
print '<tr><td colspan="2"><br>'.$langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'].'?testget=ok').'</td></tr>';
}
else
{
else {
//ODT templates
$srcroot = $main_dir.'/install/doctemplates';
$destroot = $main_data_dir.'/doctemplates';
@ -592,8 +585,7 @@ if (!$error && $db->connected && $action == "set")
print '</td>';
print '<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
}
else
{
else {
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS'
|| $db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS'
|| $db->errno() == 'DB_ERROR_USER_ALREADY_EXISTS')
@ -605,8 +597,7 @@ if (!$error && $db->connected && $action == "set")
print '</td>';
print '<td>'.$langs->trans("LoginAlreadyExists").'</td></tr>';
}
else
{
else {
dolibarr_install_syslog("step1: failed to create user", LOG_ERR);
print '<tr><td>';
print $langs->trans("UserCreation").' : ';
@ -618,8 +609,7 @@ if (!$error && $db->connected && $action == "set")
$db->close();
}
else
{
else {
print '<tr><td>';
print $langs->trans("UserCreation").' : ';
print $dolibarr_main_db_user;
@ -668,8 +658,7 @@ if (!$error && $db->connected && $action == "set")
//if ($check1 != $dolibarr_main_db_character_set) dolibarr_install_syslog('step1: value for character_set is not the one asked for database creation', LOG_WARNING);
//if ($check2 != $dolibarr_main_db_collation) dolibarr_install_syslog('step1: value for collation is not the one asked for database creation', LOG_WARNING);
}
else
{
else {
// warning message
print '<tr><td colspan="2"><br>';
print $langs->trans("ErrorFailedToCreateDatabase", $dolibarr_main_db_name).'<br>';
@ -735,8 +724,7 @@ if (!$error && $db->connected && $action == "set")
$error = 0;
}
else
{
else {
dolibarr_install_syslog("step1: connection to database ".$conf->db->name." by user ".$conf->db->user." failed", LOG_ERR);
print "<tr><td>";
print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
@ -755,8 +743,7 @@ if (!$error && $db->connected && $action == "set")
$error++;
}
}
else
{
else {
dolibarr_install_syslog("step1: connection to server by user ".$conf->db->user." failed", LOG_ERR);
print "<tr><td>";
print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
@ -1031,8 +1018,7 @@ function write_conf_file($conffile)
print '<img src="../theme/eldy/img/tick.png" alt="Ok">';
print "</td></tr>";
}
else
{
else {
$error++;
}
}

View File

@ -100,8 +100,7 @@ if ($action == "set")
print $langs->trans("ServerConnection")." : ".$conf->db->host.'</td><td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
$ok = 1;
}
else
{
else {
print "<tr><td>Failed to connect to server : ".$conf->db->host.'</td><td><img src="../theme/eldy/img/error.png" alt="Error"></td></tr>';
}
@ -111,8 +110,7 @@ if ($action == "set")
{
dolibarr_install_syslog("step2: successful connection to database: ".$conf->db->name);
}
else
{
else {
dolibarr_install_syslog("step2: failed connection to database :".$conf->db->name, LOG_ERR);
print "<tr><td>Failed to select database ".$conf->db->name.'</td><td><img src="../theme/eldy/img/error.png" alt="Error"></td></tr>';
$ok = 0;
@ -202,8 +200,7 @@ if ($action == "set")
{
$buffer = preg_replace('/type=innodb/i', 'ENGINE=innodb', $buffer);
}
else
{
else {
// Keyword ENGINE is MySQL-specific, so scrub it for
// other database types (mssql, pgsql)
$buffer = preg_replace('/type=innodb/i', '', $buffer);
@ -226,15 +223,13 @@ if ($action == "set")
// print "<td>OK requete ==== $buffer</td></tr>";
$db->free($resql);
}
else
{
else {
if ($db->errno() == 'DB_ERROR_TABLE_ALREADY_EXISTS' ||
$db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS')
{
//print "<td>Deja existante</td></tr>";
}
else
{
else {
print "<tr><td>".$langs->trans("CreateTableAndPrimaryKey", $name);
print "<br>\n".$langs->trans("Request").' '.$requestnb.' : '.$buffer.' <br>Executed query : '.$db->lastquery;
print "\n</td>";
@ -243,8 +238,7 @@ if ($action == "set")
}
}
}
else
{
else {
print "<tr><td>".$langs->trans("CreateTableAndPrimaryKey", $name);
print "</td>";
print '<td><span class="error">'.$langs->trans("Error").' Failed to open file '.$dir.$file.'</span></td></tr>';
@ -262,8 +256,7 @@ if ($action == "set")
$ok = 1;
}
}
else
{
else {
print '<tr><td>'.$langs->trans("ErrorFailedToFindSomeFiles", $dir).'</td><td><img src="../theme/eldy/img/error.png" alt="Error"></td></tr>';
dolibarr_install_syslog("step2: failed to find files to create database in directory ".$dir, LOG_ERR);
}
@ -369,8 +362,7 @@ if ($action == "set")
//print "<td>OK requete ==== $buffer</td></tr>";
$db->free($resql);
}
else
{
else {
if ($db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS' ||
$db->errno() == 'DB_ERROR_CANNOT_CREATE' ||
$db->errno() == 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS' ||
@ -380,8 +372,7 @@ if ($action == "set")
//print "<td>Deja existante</td></tr>";
$key_exists = 1;
}
else
{
else {
print "<tr><td>".$langs->trans("CreateOtherKeysForTable", $name);
print "<br>\n".$langs->trans("Request").' '.$requestnb.' : '.$db->lastqueryerror();
print "\n</td>";
@ -392,8 +383,7 @@ if ($action == "set")
}
}
}
else
{
else {
print "<tr><td>".$langs->trans("CreateOtherKeysForTable", $name);
print "</td>";
print '<td><span class="error">'.$langs->trans("Error")." Failed to open file ".$dir.$file."</span></td></tr>";
@ -465,15 +455,13 @@ if ($action == "set")
$ok = 1;
$db->free($resql);
}
else
{
else {
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS'
|| $db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS')
{
//print "Insert line : ".$buffer."<br>\n";
}
else
{
else {
$ok = 0;
print "<tr><td>".$langs->trans("FunctionsCreation");
@ -491,8 +479,7 @@ if ($action == "set")
{
print '<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
}
else
{
else {
print '<td><img src="../theme/eldy/img/error.png" alt="Error"></td></tr>';
$ok = 1;
}
@ -589,14 +576,12 @@ if ($action == "set")
{
//$db->free($resql); // Not required as request we launch here does not return memory needs.
}
else
{
else {
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{
//print "<tr><td>Insertion ligne : $buffer</td><td>";
}
else
{
else {
$ok = 0;
$okallfile = 0;
print '<span class="error">'.$langs->trans("ErrorSQL")." : ".$db->lasterrno()." - ".$db->lastqueryerror()." - ".$db->lasterror()."</span><br>";
@ -614,16 +599,14 @@ if ($action == "set")
{
print '<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
}
else
{
else {
print '<td><img src="../theme/eldy/img/error.png" alt="Error"></td></tr>';
$ok = 1; // Data loading are not blocking errors
}
}
print '</table>';
}
else
{
else {
print 'Parameter action=set not defined';
}

View File

@ -187,8 +187,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action))
dolibarr_set_const($db, "MAIN_SECURITY_SALT", dol_print_date(dol_now(), 'dayhourlog'), 'chaine', 0, '', 0); // All entities
if (function_exists('password_hash'))
dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'password_hash', 'chaine', 0, '', 0); // All entities
else
dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities
else dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities
}
dolibarr_install_syslog('step5: DATABASE_PWD_ENCRYPTED = '.$conf->global->DATABASE_PWD_ENCRYPTED.' MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO, LOG_INFO);
@ -215,16 +214,14 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action))
print $langs->trans("AdminLoginCreatedSuccessfuly", $login)."<br>";
$success = 1;
}
else
{
else {
if ($newuser->error == 'ErrorLoginAlreadyExists')
{
dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING);
print '<br><div class="warning">'.$langs->trans("AdminLoginAlreadyExists", $login)."</div><br>";
$success = 1;
}
else
{
else {
dolibarr_install_syslog('step5: FailedToCreateAdminLogin '.$newuser->error, LOG_ERR);
print '<br><div class="error">'.$langs->trans("FailedToCreateAdminLogin").' '.$newuser->error.'</div><br><br>';
}
@ -241,8 +238,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action))
$conf->global->MAIN_VERSION_FIRST_INSTALL = $targetversion;
$db->commit();
}
else
{
else {
//if (! $resql) dol_print_error($db,'Error in setup program'); // We ignore errors. Key may already exists
$db->commit();
}
@ -293,8 +289,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action))
$db->commit();
}
}
else
{
else {
print $langs->trans("ErrorFailedToConnect")."<br>";
}
}
@ -311,8 +306,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action))
// Define if we need to update the MAIN_VERSION_LAST_UPGRADE value in database
$tagdatabase = false;
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) $tagdatabase = true; // We don't know what it was before, so now we consider we are version choosed.
else
{
else {
$mainversionlastupgradearray = preg_split('/[.-]/', $conf->global->MAIN_VERSION_LAST_UPGRADE);
$targetversionarray = preg_split('/[.-]/', $targetversion);
if (versioncompare($targetversionarray, $mainversionlastupgradearray) > 0) $tagdatabase = true;
@ -327,18 +321,15 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action))
if (!$resql) dol_print_error($db, 'Error in setup program');
$conf->global->MAIN_VERSION_LAST_UPGRADE = $targetversion;
}
else
{
else {
dolibarr_install_syslog('step5: we run an upgrade to version '.$targetversion.' but database was already upgraded to '.$conf->global->MAIN_VERSION_LAST_UPGRADE.'. We keep MAIN_VERSION_LAST_UPGRADE as it is.');
}
}
else
{
else {
print $langs->trans("ErrorFailedToConnect")."<br>";
}
}
else
{
else {
dol_print_error('', 'step5.php: unknown choice of action');
}
@ -390,8 +381,7 @@ if ($action == "set" && $success)
print '<span class="fas fa-external-link-alt"></span> '.$langs->trans("GoToSetupArea");
print '</a></div>';
}
else
{
else {
// If here MAIN_VERSION_LAST_UPGRADE is not empty
print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>';
print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b><br>';
@ -438,8 +428,7 @@ elseif (empty($action) || preg_match('/upgrade/i', $action))
print '<span class="fas fa-link-alt"></span> '.$langs->trans("GoToDolibarr").'...';
print '</a></div><br>';
}
else
{
else {
// If here MAIN_VERSION_LAST_UPGRADE is not empty
print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>';
print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b>';
@ -451,8 +440,7 @@ elseif (empty($action) || preg_match('/upgrade/i', $action))
print '</a></div>';
}
}
else
{
else {
dol_print_error('', 'step5.php: unknown choice of action');
}

View File

@ -151,8 +151,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ServerConnection").": $dolibarr_main_db_host ".$langs->transnoentities("OK"));
$ok = 1;
}
else
{
else {
print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name)."</td><td align=\"right\">".$langs->transnoentities("Error")."</td></tr>\n";
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name));
$ok = 0;
@ -167,8 +166,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
dolibarr_install_syslog("upgrade: Database connection successful: ".$dolibarr_main_db_name);
$ok = 1;
}
else
{
else {
print "<tr><td>".$langs->trans("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name)."</td><td align=\"right\">".$langs->trans("Error")."</td></tr>\n";
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name));
$ok = 0;
@ -293,8 +291,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
}
$db->free($resql);
}
else
{
else {
if ($db->lasterrno() != 'DB_ERROR_NOSUCHTABLE')
{
print '<tr><td colspan="2"><span class="error">'.$sql.' : '.$db->lasterror()."</font></td></tr>\n";
@ -335,8 +332,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
}
sort($filesindir);
}
else
{
else {
print '<div class="error">'.$langs->trans("ErrorCanNotReadDir", $dir).'</div>';
}
@ -357,8 +353,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
{
print '<div class="error">'.$langs->trans("ErrorNoMigrationFilesFoundForParameters").'</div>';
}
else
{
else {
$listoffileprocessed = array(); // Protection to avoid to process twice the same file
// Loop on each migrate files

File diff suppressed because it is too large Load Diff