2
0
forked from Wavyzz/dolibarr

add new rule

This commit is contained in:
Frédéric FRANCE
2020-05-21 09:35:30 +02:00
parent f4011520a3
commit 85625a46bb
122 changed files with 1031 additions and 2128 deletions

View File

@@ -61,8 +61,7 @@ if ($resql)
$i++; $i++;
} }
$db->free($resql); $db->free($resql);
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -106,8 +105,7 @@ if ($action == "save" && empty($cancel))
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
$db->commit(); $db->commit();
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
$db->rollback(); $db->rollback();
} }

View File

@@ -107,8 +107,7 @@ if ($actionsave)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
$db->rollback(); $db->rollback();
if (empty($errorsaved)) setEventMessages($langs->trans("Error"), null, 'errors'); if (empty($errorsaved)) setEventMessages($langs->trans("Error"), null, 'errors');
} }
@@ -161,13 +160,11 @@ print '<td class="center">';
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print ajax_constantonoff('AGENDA_DISABLE_EXT', array('enabled'=>array(0=>'.hideifnotset')), null, 1); print ajax_constantonoff('AGENDA_DISABLE_EXT', array('enabled'=>array(0=>'.hideifnotset')), null, 1);
} } else {
else {
if (empty($conf->global->AGENDA_DISABLE_EXT)) if (empty($conf->global->AGENDA_DISABLE_EXT))
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?save=1&AGENDA_DISABLE_EXT=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?save=1&AGENDA_DISABLE_EXT=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} } else {
else {
print '<a href="'.$_SERVER['PHP_SELF'].'?save=1&AGENDA_DISABLE_EXT=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?save=1&AGENDA_DISABLE_EXT=0">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
} }

View File

@@ -59,8 +59,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
{ {
Header("Location: ".$_SERVER["PHP_SELF"]); Header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -72,8 +71,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
{ {
Header("Location: ".$_SERVER["PHP_SELF"]); Header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -85,8 +83,7 @@ if ($action == 'set')
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', $defaultfilter, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', $defaultfilter, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity);
} } elseif ($action == 'specimen') // For orders
elseif ($action == 'specimen') // For orders
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@@ -118,13 +115,11 @@ elseif ($action == 'specimen') // For orders
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($module->error, $module->errors, 'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
@@ -135,9 +130,7 @@ elseif ($action == 'setmodel')
{ {
//print "sssd".$value; //print "sssd".$value;
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} } elseif ($action == 'del')
elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
@@ -209,8 +202,7 @@ if ($resql)
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -270,13 +262,11 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">';
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
} } else {
else {
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
} }
print "</td>"; print "</td>";
} } else {
else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -287,8 +277,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
if ($conf->global->ACTION_EVENT_ADDON_PDF == "$name") if ($conf->global->ACTION_EVENT_ADDON_PDF == "$name")
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@@ -337,8 +326,7 @@ print '<td class="right">'."\n";
if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) if (empty($conf->global->AGENDA_USE_EVENT_TYPE))
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_USE_EVENT_TYPE">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_USE_EVENT_TYPE">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
} } else {
else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_USE_EVENT_TYPE">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_USE_EVENT_TYPE">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>';
} }
print '</td></tr>'."\n"; print '</td></tr>'."\n";

View File

@@ -54,8 +54,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
{ {
Header("Location: ".$_SERVER["PHP_SELF"]); Header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -67,8 +66,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
{ {
Header("Location: ".$_SERVER["PHP_SELF"]); Header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -78,8 +76,7 @@ if ($action == 'set')
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', GETPOST('AGENDA_DEFAULT_FILTER_TYPE'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', GETPOST('AGENDA_DEFAULT_FILTER_TYPE'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity);
} } elseif ($action == 'specimen') // For orders
elseif ($action == 'specimen') // For orders
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@@ -111,13 +108,11 @@ elseif ($action == 'specimen') // For orders
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($module->error, $module->errors, 'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
@@ -128,9 +123,7 @@ elseif ($action == 'setmodel')
{ {
//print "sssd".$value; //print "sssd".$value;
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} } elseif ($action == 'del')
elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)

View File

@@ -54,8 +54,7 @@ if ($actionsave)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
$db->rollback(); $db->rollback();
setEventMessages($langs->trans("SaveFailed"), null, 'errors'); setEventMessages($langs->trans("SaveFailed"), null, 'errors');
} }

View File

@@ -55,8 +55,7 @@ if ($action == 'setbankorder') {
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -67,18 +66,15 @@ if ($action == 'setreportlastnumreleve') {
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} } elseif ($action == 'unsetreportlastnumreleve') {
elseif ($action == 'unsetreportlastnumreleve') {
if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 0, 'chaine', 0, '', $conf->entity) > 0) if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 0, 'chaine', 0, '', $conf->entity) > 0)
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -89,18 +85,15 @@ if ($action == 'setbankcolorizemovement') {
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} } elseif ($action == 'unsetbankcolorizemovement') {
elseif ($action == 'unsetbankcolorizemovement') {
if (dolibarr_set_const($db, "BANK_COLORIZE_MOVEMENT", 0, 'chaine', 0, '', $conf->entity) > 0) if (dolibarr_set_const($db, "BANK_COLORIZE_MOVEMENT", 0, 'chaine', 0, '', $conf->entity) > 0)
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -127,8 +120,7 @@ if ($actionsave)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
$db->rollback(); $db->rollback();
if (empty($errorsaved)) setEventMessages($langs->trans("Error"), null, 'errors'); if (empty($errorsaved)) setEventMessages($langs->trans("Error"), null, 'errors');
} }
@@ -140,8 +132,7 @@ if ($action == 'specimen') {
if ($modele == 'sepamandate') { if ($modele == 'sepamandate') {
$object = new CompanyBankAccount($db); $object = new CompanyBankAccount($db);
} } else {
else {
$object = new Account($db); $object = new Account($db);
} }
$object->initAsSpecimen(); $object->initAsSpecimen();
@@ -168,13 +159,11 @@ if ($action == 'specimen') {
if ($module->write_file($object, $langs) > 0) { if ($module->write_file($object, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bank&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bank&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($module->error, null, 'errors'); setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
@@ -183,8 +172,7 @@ if ($action == 'specimen') {
// Activate a model // Activate a model
if ($action == 'set') { if ($action == 'set') {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} } elseif ($action == 'del') {
elseif ($action == 'del') {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) { if ($ret > 0) {
if ($conf->global->BANKADDON_PDF == "$value") if ($conf->global->BANKADDON_PDF == "$value")
@@ -269,8 +257,7 @@ while ($i < $nbofbank) {
print '<td class="center">'; print '<td class="center">';
print img_picto($langs->trans("Activated"), 'on'); print img_picto($langs->trans("Activated"), 'on');
print '</td>'; print '</td>';
} } else {
else {
print '<td class="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbankorder&amp;value='.$i.'">'; print '<td class="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbankorder&amp;value='.$i.'">';
print img_picto($langs->trans("Disabled"), 'off'); print img_picto($langs->trans("Disabled"), 'off');
print '</a></td>'; print '</a></td>';
@@ -307,8 +294,7 @@ if ($resql) {
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -368,8 +354,7 @@ foreach ($dirmodels as $reldir) {
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print '</td>'; print '</td>';
} } else {
else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -379,8 +364,7 @@ foreach ($dirmodels as $reldir) {
print '<td class="center">'; print '<td class="center">';
if ($conf->global->BANKADDON_PDF == $name) { if ($conf->global->BANKADDON_PDF == $name) {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@@ -408,8 +392,7 @@ foreach ($dirmodels as $reldir) {
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') { if ($module->type == 'pdf') {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
} } else {
else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }
print '</td>'; print '</td>';
@@ -445,8 +428,7 @@ if ($conf->global->BANK_COLORIZE_MOVEMENT) {
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print '</td>'; print '</td>';
} } else {
else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setbankcolorizemovement">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setbankcolorizemovement">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -505,8 +487,7 @@ if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) {
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print '</td>'; print '</td>';
} } else {
else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setreportlastnumreleve">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setreportlastnumreleve">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";

View File

@@ -50,8 +50,7 @@ if ($action == 'setbarcodeproducton')
{ {
$res = dolibarr_set_const($db, "BARCODE_STANDARD_PRODUCT_MASK", '020{000000000}', 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BARCODE_STANDARD_PRODUCT_MASK", '020{000000000}', 'chaine', 0, '', $conf->entity);
} }
} } elseif ($action == 'setbarcodeproductoff')
elseif ($action == 'setbarcodeproductoff')
{ {
$res = dolibarr_del_const($db, "BARCODE_PRODUCT_ADDON_NUM", $conf->entity); $res = dolibarr_del_const($db, "BARCODE_PRODUCT_ADDON_NUM", $conf->entity);
} }
@@ -67,8 +66,7 @@ if ($action == 'setcoder')
$resql = $db->query($sqlp); $resql = $db->query($sqlp);
if (!$resql) dol_print_error($db); if (!$resql) dol_print_error($db);
} } elseif ($action == 'update')
elseif ($action == 'update')
{ {
$location = GETPOST('GENBARCODE_LOCATION', 'alpha'); $location = GETPOST('GENBARCODE_LOCATION', 'alpha');
$res = dolibarr_set_const($db, "GENBARCODE_LOCATION", $location, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "GENBARCODE_LOCATION", $location, 'chaine', 0, '', $conf->entity);
@@ -80,12 +78,10 @@ elseif ($action == 'update')
if ($res > 0) if ($res > 0)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'updateengine')
elseif ($action == 'updateengine')
{ {
$sql = "SELECT rowid, coder"; $sql = "SELECT rowid, coder";
$sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type"; $sql .= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
@@ -263,17 +259,14 @@ if ($resql)
$url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&amp;generator='.urlencode($obj->coder).'&amp;code='.urlencode($obj->example).'&amp;encoding='.urlencode($obj->encoding); $url = DOL_URL_ROOT.'/viewimage.php?modulepart=barcode&amp;generator='.urlencode($obj->coder).'&amp;code='.urlencode($obj->example).'&amp;encoding='.urlencode($obj->encoding);
//print $url; //print $url;
print '<img src="'.$url.'" title="'.$obj->example.'" border="0">'; print '<img src="'.$url.'" title="'.$obj->example.'" border="0">';
} } else {
else {
print $langs->trans("FormatNotSupportedByGenerator"); print $langs->trans("FormatNotSupportedByGenerator");
} }
} } else {
else {
print 'ErrorClassNotFoundInModule '.$classname.' '.$obj->coder; print 'ErrorClassNotFoundInModule '.$classname.' '.$obj->coder;
} }
} }
} } else {
else {
print $langs->trans("ChooseABarCode"); print $langs->trans("ChooseABarCode");
} }
print '</td>'; print '</td>';
@@ -388,8 +381,7 @@ if ($conf->product->enabled)
try { try {
dol_include_once($dirroot.$file.'.php'); dol_include_once($dirroot.$file.'.php');
} } catch (Exception $e)
catch (Exception $e)
{ {
dol_syslog($e->getMessage(), LOG_ERR); dol_syslog($e->getMessage(), LOG_ERR);
} }
@@ -407,8 +399,7 @@ if ($conf->product->enabled)
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&amp;value='.$file.'">'; print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&amp;value='.$file.'">';
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>'; print '</a></td>';
} } else {
else {
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducton&amp;value='.$file.'">'; print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducton&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>'; print '</a></td>';

View File

@@ -57,13 +57,10 @@ if ($action == 'updateMask')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'specimen')
elseif ($action == 'specimen')
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@@ -94,13 +91,11 @@ elseif ($action == 'specimen')
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bom&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bom&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($module->error, null, 'errors'); setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
@@ -110,9 +105,7 @@ elseif ($action == 'specimen')
elseif ($action == 'set') elseif ($action == 'set')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} } elseif ($action == 'del')
elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
@@ -137,17 +130,13 @@ elseif ($action == 'setdoc')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} } elseif ($action == 'setmod')
elseif ($action == 'setmod')
{ {
// TODO Check if numbering module chosen can be activated // TODO Check if numbering module chosen can be activated
// by calling method canBeActivated // by calling method canBeActivated
dolibarr_set_const($db, "BOM_ADDON", $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "BOM_ADDON", $value, 'chaine', 0, '', $conf->entity);
} } elseif ($action == 'set_BOM_DRAFT_WATERMARK')
elseif ($action == 'set_BOM_DRAFT_WATERMARK')
{ {
$draft = GETPOST("BOM_DRAFT_WATERMARK"); $draft = GETPOST("BOM_DRAFT_WATERMARK");
$res = dolibarr_set_const($db, "BOM_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BOM_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
@@ -157,13 +146,10 @@ elseif ($action == 'set_BOM_DRAFT_WATERMARK')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'set_BOM_FREE_TEXT')
elseif ($action == 'set_BOM_FREE_TEXT')
{ {
$freetext = GETPOST("BOM_FREE_TEXT", 'none'); // No alpha here, we want exact string $freetext = GETPOST("BOM_FREE_TEXT", 'none'); // No alpha here, we want exact string
@@ -174,8 +160,7 @@ elseif ($action == 'set_BOM_FREE_TEXT')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -256,8 +241,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->BOM_ADDON == $file) if ($conf->global->BOM_ADDON == $file)
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>'; print '</a>';
@@ -321,8 +305,7 @@ if ($resql)
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -391,8 +374,7 @@ foreach ($dirmodels as $reldir)
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print '</td>'; print '</td>';
} } else {
else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -403,8 +385,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->BOM_ADDON_PDF == $name) if ($conf->global->BOM_ADDON_PDF == $name)
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@@ -432,8 +413,7 @@ foreach ($dirmodels as $reldir)
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
} } else {
else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }
print '</td>'; print '</td>';
@@ -478,8 +458,7 @@ $variablename = 'BOM_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} } else {
else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();

View File

@@ -83,8 +83,7 @@ if ($action == 'add') {
$distinctfkuser[$obj->fk_user] = $obj->fk_user; $distinctfkuser[$obj->fk_user] = $obj->fk_user;
$i++; $i++;
} }
} } else {
else {
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
$error++; $error++;
} }
@@ -108,8 +107,7 @@ if ($action == 'add') {
if (preg_match('/A/', $boxorder)) $nbboxonleft++; if (preg_match('/A/', $boxorder)) $nbboxonleft++;
if (preg_match('/B/', $boxorder)) $nbboxonright++; if (preg_match('/B/', $boxorder)) $nbboxonright++;
} }
} } else dol_print_error($db);
else dol_print_error($db);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
$sql .= "box_id, position, box_order, fk_user, entity"; $sql .= "box_id, position, box_order, fk_user, entity";
@@ -133,8 +131,7 @@ if ($action == 'add') {
{ {
$db->commit(); $db->commit();
$action = ''; $action = '';
} } else {
else {
$db->rollback(); $db->rollback();
} }
} }
@@ -202,8 +199,7 @@ if ($action == 'switch')
if ($resultupdatefrom && $resultupdateto) if ($resultupdatefrom && $resultupdateto)
{ {
$db->commit(); $db->commit();
} } else {
else {
$db->rollback(); $db->rollback();
} }
} }
@@ -285,23 +281,20 @@ if ($resql)
$box_order = "A0".$record['box_order']; $box_order = "A0".$record['box_order'];
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'"; $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'";
$resql = $db->query($sql); $resql = $db->query($sql);
} } elseif (preg_match("/[02468]{1}/", substr($record['box_order'], -1)))
elseif (preg_match("/[02468]{1}/", substr($record['box_order'], -1)))
{ {
$box_order = "B0".$record['box_order']; $box_order = "B0".$record['box_order'];
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'"; $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'";
$resql = $db->query($sql); $resql = $db->query($sql);
} }
} } elseif (dol_strlen($record['box_order']) == 2)
elseif (dol_strlen($record['box_order']) == 2)
{ {
if (preg_match("/[13579]{1}/", substr($record['box_order'], -1))) if (preg_match("/[13579]{1}/", substr($record['box_order'], -1)))
{ {
$box_order = "A".$record['box_order']; $box_order = "A".$record['box_order'];
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'"; $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'";
$resql = $db->query($sql); $resql = $db->query($sql);
} } elseif (preg_match("/[02468]{1}/", substr($record['box_order'], -1)))
elseif (preg_match("/[02468]{1}/", substr($record['box_order'], -1)))
{ {
$box_order = "B".$record['box_order']; $box_order = "B".$record['box_order'];
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'"; $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'";
@@ -342,8 +335,7 @@ foreach ($boxtoadd as $box)
if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg)) if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg))
{ {
$logo = $box->boximg; $logo = $box->boximg;
} } else {
else {
$logo = preg_replace("/^object_/i", "", $box->boximg); $logo = preg_replace("/^object_/i", "", $box->boximg);
} }
@@ -357,8 +349,7 @@ foreach ($boxtoadd as $box)
{ {
$langs->load("errors"); $langs->load("errors");
print $langs->trans("WarningUsingThisBoxSlowDown"); print $langs->trans("WarningUsingThisBoxSlowDown");
} } else print ($box->note ? $box->note : '&nbsp;');
else print ($box->note ? $box->note : '&nbsp;');
print '</td>'."\n"; print '</td>'."\n";
print '<td>'.$box->sourcefile.'</td>'."\n"; print '<td>'.$box->sourcefile.'</td>'."\n";
@@ -406,8 +397,7 @@ foreach ($boxactivated as $key => $box)
if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg)) if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg))
{ {
$logo = $box->boximg; $logo = $box->boximg;
} } else {
else {
$logo = preg_replace("/^object_/i", "", $box->boximg); $logo = preg_replace("/^object_/i", "", $box->boximg);
} }
@@ -421,8 +411,7 @@ foreach ($boxactivated as $key => $box)
{ {
$langs->load("errors"); $langs->load("errors");
print img_warning('', 0).' '.$langs->trans("WarningUsingThisBoxSlowDown"); print img_warning('', 0).' '.$langs->trans("WarningUsingThisBoxSlowDown");
} } else print ($box->note ? $box->note : '&nbsp;');
else print ($box->note ? $box->note : '&nbsp;');
print '</td>'; print '</td>';
print '<td class="center">'.(empty($pos_name[$box->position]) ? '' : $langs->trans($pos_name[$box->position])).'</td>'; print '<td class="center">'.(empty($pos_name[$box->position]) ? '' : $langs->trans($pos_name[$box->position])).'</td>';
$hasnext = ($key < (count($boxactivated) - 1)); $hasnext = ($key < (count($boxactivated) - 1));

View File

@@ -60,8 +60,7 @@ if ($action == 'updateMask')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -82,8 +81,7 @@ if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -179,8 +177,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->CHEQUERECEIPTS_ADDON == $file || $conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file) if ($conf->global->CHEQUERECEIPTS_ADDON == $file || $conf->global->CHEQUERECEIPTS_ADDON.'.php' == $file)
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
} }
print '</td>'; print '</td>';
@@ -256,8 +253,7 @@ $variablename = 'BANK_CHEQUERECEIPT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} } else {
else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();

View File

@@ -46,8 +46,7 @@ if ($action == 'setvalue' && $user->admin)
if ($result1 >= 0 && $result2 >= 0) if ($result1 >= 0 && $result2 >= 0)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -132,8 +131,7 @@ if (!empty($conf->global->CLICKTODIAL_URL))
if ($setupcomplete) if ($setupcomplete)
{ {
print $langs->trans("LinkToTest", $user->login).': '.dol_print_phone($phonefortest, '', 0, 0, 'AC_TEL'); print $langs->trans("LinkToTest", $user->login).': '.dol_print_phone($phonefortest, '', 0, 0, 'AC_TEL');
} } else {
else {
$langs->load("errors"); $langs->load("errors");
print '<div class="warning">'.$langs->trans("WarningClickToDialUserSetupNotComplete").'</div>'; print '<div class="warning">'.$langs->trans("WarningClickToDialUserSetupNotComplete").'</div>';
} }

View File

@@ -66,13 +66,10 @@ if ($action == 'updateMask')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'specimen')
elseif ($action == 'specimen')
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@@ -103,13 +100,11 @@ elseif ($action == 'specimen')
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($module->error, null, 'errors'); setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
@@ -119,9 +114,7 @@ elseif ($action == 'specimen')
elseif ($action == 'set') elseif ($action == 'set')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} } elseif ($action == 'del')
elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
@@ -146,17 +139,13 @@ elseif ($action == 'setdoc')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} } elseif ($action == 'setmod')
elseif ($action == 'setmod')
{ {
// TODO Check if numbering module chosen can be activated // TODO Check if numbering module chosen can be activated
// by calling method canBeActivated // by calling method canBeActivated
dolibarr_set_const($db, "COMMANDE_ADDON", $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "COMMANDE_ADDON", $value, 'chaine', 0, '', $conf->entity);
} } elseif ($action == 'set_COMMANDE_DRAFT_WATERMARK')
elseif ($action == 'set_COMMANDE_DRAFT_WATERMARK')
{ {
$draft = GETPOST("COMMANDE_DRAFT_WATERMARK"); $draft = GETPOST("COMMANDE_DRAFT_WATERMARK");
$res = dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
@@ -166,13 +155,10 @@ elseif ($action == 'set_COMMANDE_DRAFT_WATERMARK')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'set_ORDER_FREE_TEXT')
elseif ($action == 'set_ORDER_FREE_TEXT')
{ {
$freetext = GETPOST("ORDER_FREE_TEXT", 'none'); // No alpha here, we want exact string $freetext = GETPOST("ORDER_FREE_TEXT", 'none'); // No alpha here, we want exact string
@@ -183,12 +169,10 @@ elseif ($action == 'set_ORDER_FREE_TEXT')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == "setshippableiconinlist") {
elseif ($action == "setshippableiconinlist") {
// Activate Set Shippable Icon In List // Activate Set Shippable Icon In List
$setshippableiconinlist = GETPOST('value', 'int'); $setshippableiconinlist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity);
@@ -198,8 +182,7 @@ elseif ($action == "setshippableiconinlist") {
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'setribchq')
elseif ($action == 'setribchq')
{ {
$rib = GETPOST('rib', 'alpha'); $rib = GETPOST('rib', 'alpha');
$chq = GETPOST('chq', 'alpha'); $chq = GETPOST('chq', 'alpha');
@@ -212,8 +195,7 @@ elseif ($action == 'setribchq')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -228,8 +210,7 @@ elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -244,8 +225,7 @@ elseif ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -326,8 +306,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->COMMANDE_ADDON == $file) if ($conf->global->COMMANDE_ADDON == $file)
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>'; print '</a>';
@@ -391,8 +370,7 @@ if ($resql)
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -461,8 +439,7 @@ foreach ($dirmodels as $reldir)
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print '</td>'; print '</td>';
} } else {
else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -473,8 +450,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->COMMANDE_ADDON_PDF == $name) if ($conf->global->COMMANDE_ADDON_PDF == $name)
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@@ -507,8 +483,7 @@ foreach ($dirmodels as $reldir)
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
} } else {
else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }
print '</td>'; print '</td>';
@@ -581,17 +556,14 @@ if (empty($conf->facture->enabled))
$i++; $i++;
} }
print "</select>"; print "</select>";
} } else {
else {
print "<i>".$langs->trans("NoActiveBankAccountDefined")."</i>"; print "<i>".$langs->trans("NoActiveBankAccountDefined")."</i>";
} }
} }
} } else {
else {
print '<span class="opacitymedium">'.$langs->trans("BankModuleNotActive").'</span>'; print '<span class="opacitymedium">'.$langs->trans("BankModuleNotActive").'</span>';
} }
} } else {
else {
print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>'; print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>';
} }
print "</td></tr>"; print "</td></tr>";
@@ -628,8 +600,7 @@ if (empty($conf->facture->enabled))
} }
} }
print "</select>"; print "</select>";
} } else {
else {
print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>'; print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>';
} }
print "</td></tr>"; print "</td></tr>";
@@ -666,8 +637,7 @@ $variablename = 'ORDER_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} } else {
else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();

View File

@@ -84,8 +84,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
$s = $mysoc->state_id.':'.$mysoc->state_code.':'.$mysoc->state_label; $s = $mysoc->state_id.':'.$mysoc->state_code.':'.$mysoc->state_label;
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", $s, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", $s, 'chaine', 0, '', $conf->entity);
} } else {
else {
dolibarr_del_const($db, "MAIN_INFO_SOCIETE_STATE", $conf->entity); dolibarr_del_const($db, "MAIN_INFO_SOCIETE_STATE", $conf->entity);
} }
@@ -145,8 +144,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
{ {
$imgThumbSmall = $reg[1]; // Save only basename $imgThumbSmall = $reg[1]; // Save only basename
dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity);
} } else dol_syslog($imgThumbSmall);
else dol_syslog($imgThumbSmall);
// Create mini thumb, Used on menu or for setup page for example // Create mini thumb, Used on menu or for setup page for example
$imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality); $imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality);
@@ -154,22 +152,18 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
{ {
$imgThumbMini = $reg[1]; // Save only basename $imgThumbMini = $reg[1]; // Save only basename
dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity);
} } else dol_syslog($imgThumbMini);
else dol_syslog($imgThumbMini); } else dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING);
}
else dol_syslog("ErrorImageFormatNotSupported", LOG_WARNING);
} elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) { } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result)) {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$tmparray = explode(':', $result); $tmparray = explode(':', $result);
setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors'); setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors');
} } else {
else {
$error++; $error++;
setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
} }
} } else {
else {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
@@ -225,8 +219,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
if (!isset($_REQUEST['lt1'])) if (!isset($_REQUEST['lt1']))
{ {
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", 0, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", 0, 'chaine', 0, '', $conf->entity);
} } else {
else {
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1', 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1', 'aZ09'), 'chaine', 0, '', $conf->entity);
} }
dolibarr_set_const($db, "MAIN_INFO_LOCALTAX_CALC1", GETPOST("clt1", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_LOCALTAX_CALC1", GETPOST("clt1", 'aZ09'), 'chaine', 0, '', $conf->entity);
@@ -236,8 +229,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
if (!isset($_REQUEST['lt2'])) if (!isset($_REQUEST['lt2']))
{ {
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", 0, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", 0, 'chaine', 0, '', $conf->entity);
} } else {
else {
dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2', 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2', 'aZ09'), 'chaine', 0, '', $conf->entity);
} }
dolibarr_set_const($db, "MAIN_INFO_LOCALTAX_CALC2", GETPOST("clt2", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_LOCALTAX_CALC2", GETPOST("clt2", 'aZ09'), 'chaine', 0, '', $conf->entity);
@@ -246,8 +238,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
if (!$error) if (!$error)
{ {
$db->commit(); $db->commit();
} } else {
else {
$db->rollback(); $db->rollback();
} }
@@ -281,8 +272,7 @@ if ($action == 'addthumb' || $action == 'addthumbsquarred') // Regenerate thumb
{ {
$imgThumbSmall = $reg[1]; // Save only basename $imgThumbSmall = $reg[1]; // Save only basename
dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, $constant."_SMALL", $imgThumbSmall, 'chaine', 0, '', $conf->entity);
} } else dol_syslog($imgThumbSmall);
else dol_syslog($imgThumbSmall);
// Create mini thumbs. Used on menu or for setup page for example // Create mini thumbs. Used on menu or for setup page for example
$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthmini, $maxheightmini, '_mini', $quality); $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthmini, $maxheightmini, '_mini', $quality);
@@ -290,20 +280,17 @@ if ($action == 'addthumb' || $action == 'addthumbsquarred') // Regenerate thumb
{ {
$imgThumbMini = $reg[1]; // Save only basename $imgThumbMini = $reg[1]; // Save only basename
dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, $constant."_MINI", $imgThumbMini, 'chaine', 0, '', $conf->entity);
} } else dol_syslog($imgThumbMini);
else dol_syslog($imgThumbMini);
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
dol_syslog($langs->transnoentities("ErrorBadImageFormat"), LOG_INFO); dol_syslog($langs->transnoentities("ErrorBadImageFormat"), LOG_INFO);
} }
} } else {
else {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans("ErrorFileDoesNotExists", $_GET["file"]), null, 'errors'); setEventMessages($langs->trans("ErrorFileDoesNotExists", $_GET["file"]), null, 'errors');
@@ -574,8 +561,7 @@ if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-')
if (!empty($mysoc->country_code)) if (!empty($mysoc->country_code))
{ {
print '<input name="siren" id="profid1" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_SIREN) ? $conf->global->MAIN_INFO_SIREN : '').'">'; print '<input name="siren" id="profid1" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_SIREN) ? $conf->global->MAIN_INFO_SIREN : '').'">';
} } else {
else {
print $countrynotdefined; print $countrynotdefined;
} }
print '</td></tr>'; print '</td></tr>';
@@ -588,8 +574,7 @@ if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-')
if (!empty($mysoc->country_code)) if (!empty($mysoc->country_code))
{ {
print '<input name="siret" id="profid2" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_SIRET) ? $conf->global->MAIN_INFO_SIRET : '').'">'; print '<input name="siret" id="profid2" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_SIRET) ? $conf->global->MAIN_INFO_SIRET : '').'">';
} } else {
else {
print $countrynotdefined; print $countrynotdefined;
} }
print '</td></tr>'; print '</td></tr>';
@@ -602,8 +587,7 @@ if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-')
if (!empty($mysoc->country_code)) if (!empty($mysoc->country_code))
{ {
print '<input name="ape" id="profid3" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_APE) ? $conf->global->MAIN_INFO_APE : '').'">'; print '<input name="ape" id="profid3" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_APE) ? $conf->global->MAIN_INFO_APE : '').'">';
} } else {
else {
print $countrynotdefined; print $countrynotdefined;
} }
print '</td></tr>'; print '</td></tr>';
@@ -616,8 +600,7 @@ if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-')
if (!empty($mysoc->country_code)) if (!empty($mysoc->country_code))
{ {
print '<input name="rcs" id="profid4" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_RCS) ? $conf->global->MAIN_INFO_RCS : '').'">'; print '<input name="rcs" id="profid4" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_RCS) ? $conf->global->MAIN_INFO_RCS : '').'">';
} } else {
else {
print $countrynotdefined; print $countrynotdefined;
} }
print '</td></tr>'; print '</td></tr>';
@@ -630,8 +613,7 @@ if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-')
if (!empty($mysoc->country_code)) if (!empty($mysoc->country_code))
{ {
print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_PROFID5) ? $conf->global->MAIN_INFO_PROFID5 : '').'">'; print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_PROFID5) ? $conf->global->MAIN_INFO_PROFID5 : '').'">';
} } else {
else {
print $countrynotdefined; print $countrynotdefined;
} }
print '</td></tr>'; print '</td></tr>';
@@ -644,8 +626,7 @@ if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-')
if (!empty($mysoc->country_code)) if (!empty($mysoc->country_code))
{ {
print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_PROFID6) ? $conf->global->MAIN_INFO_PROFID6 : '').'">'; print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_PROFID6) ? $conf->global->MAIN_INFO_PROFID6 : '').'">';
} } else {
else {
print $countrynotdefined; print $countrynotdefined;
} }
print '</td></tr>'; print '</td></tr>';

View File

@@ -101,8 +101,7 @@ if ($action == 'update')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@@ -70,8 +70,7 @@ if ($action == 'activate_delivery')
dolibarr_set_const($db, "MAIN_SUBMODULE_LIVRAISON", "1", 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SUBMODULE_LIVRAISON", "1", 'chaine', 0, '', $conf->entity);
header("Location: confexped.php"); header("Location: confexped.php");
exit; exit;
} } elseif ($action == 'disable_delivery')
elseif ($action == 'disable_delivery')
{ {
dolibarr_del_const($db, "MAIN_SUBMODULE_LIVRAISON", $conf->entity); dolibarr_del_const($db, "MAIN_SUBMODULE_LIVRAISON", $conf->entity);
header("Location: confexped.php"); header("Location: confexped.php");
@@ -135,8 +134,7 @@ print '<td class="center">';
if (empty($conf->global->MAIN_SUBMODULE_LIVRAISON)) if (empty($conf->global->MAIN_SUBMODULE_LIVRAISON))
{ {
print '<a href="confexped.php?action=activate_delivery">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="confexped.php?action=activate_delivery">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
} } else {
else {
print '<a href="confexped.php?action=disable_delivery">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>'; print '<a href="confexped.php?action=disable_delivery">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>';
} }

View File

@@ -85,8 +85,7 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update'))
$constname = ""; $constname = "";
$constvalue = ""; $constvalue = "";
$constnote = ""; $constnote = "";
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -103,8 +102,7 @@ if (!empty($consts) && $action == 'update')
if (dolibarr_set_const($db, $const["name"], $const["value"], $const["type"], 1, $const["note"], $const["entity"]) >= 0) if (dolibarr_set_const($db, $const["name"], $const["value"], $const["type"], 1, $const["note"], $const["entity"]) >= 0)
{ {
$nbmodified++; $nbmodified++;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -124,8 +122,7 @@ if (!empty($consts) && $action == 'delete')
if (dolibarr_del_const($db, $const["rowid"], -1) >= 0) if (dolibarr_del_const($db, $const["rowid"], -1) >= 0)
{ {
$nbdeleted++; $nbdeleted++;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -140,8 +137,7 @@ if ($action == 'delete')
if (dolibarr_del_const($db, $rowid, $entity) >= 0) if (dolibarr_del_const($db, $rowid, $entity) >= 0)
{ {
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -226,8 +222,7 @@ if (!empty($conf->multicompany->enabled) && !$user->entity)
print '<input type="text" class="flat" size="1" name="entity" value="'.$conf->entity.'">'; print '<input type="text" class="flat" size="1" name="entity" value="'.$conf->entity.'">';
print '</td>'; print '</td>';
print '<td class="center">'; print '<td class="center">';
} } else {
else {
print '<td class="center">'; print '<td class="center">';
print '<input type="hidden" name="entity" value="'.$conf->entity.'">'; print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
} }
@@ -292,8 +287,7 @@ if ($result)
print '<input type="text" class="flat" size="1" name="const['.$i.'][entity]" value="'.$obj->entity.'">'; print '<input type="text" class="flat" size="1" name="const['.$i.'][entity]" value="'.$obj->entity.'">';
print '</td>'; print '</td>';
print '<td class="center">'; print '<td class="center">';
} } else {
else {
print '<td class="center">'; print '<td class="center">';
print '<input type="hidden" name="const['.$i.'][entity]" value="'.$obj->entity.'">'; print '<input type="hidden" name="const['.$i.'][entity]" value="'.$obj->entity.'">';
} }
@@ -301,8 +295,7 @@ if ($result)
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print '<input type="checkbox" class="flat checkboxfordelete" id="check_'.$i.'" name="const['.$i.'][check]" value="1">'; print '<input type="checkbox" class="flat checkboxfordelete" id="check_'.$i.'" name="const['.$i.'][check]" value="1">';
} } else {
else {
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete'.((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete'.((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
} }

View File

@@ -62,13 +62,10 @@ if ($action == 'updateMask')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'specimen') // For contract
elseif ($action == 'specimen') // For contract
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@@ -99,13 +96,11 @@ elseif ($action == 'specimen') // For contract
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=contract&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=contract&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($obj->error, $obj->errors, 'errors'); setEventMessages($obj->error, $obj->errors, 'errors');
dol_syslog($obj->error, LOG_ERR); dol_syslog($obj->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
@@ -115,9 +110,7 @@ elseif ($action == 'specimen') // For contract
elseif ($action == 'set') elseif ($action == 'set')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} } elseif ($action == 'del')
elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
@@ -142,17 +135,13 @@ elseif ($action == 'setdoc')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} } elseif ($action == 'setmod')
elseif ($action == 'setmod')
{ {
// TODO Verifier si module numerotation choisi peut etre active // TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated // par appel methode canBeActivated
dolibarr_set_const($db, "CONTRACT_ADDON", $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "CONTRACT_ADDON", $value, 'chaine', 0, '', $conf->entity);
} } elseif ($action == 'set_other')
elseif ($action == 'set_other')
{ {
$freetext = GETPOST('CONTRACT_FREE_TEXT', 'none'); // No alpha here, we want exact string $freetext = GETPOST('CONTRACT_FREE_TEXT', 'none'); // No alpha here, we want exact string
$res1 = dolibarr_set_const($db, "CONTRACT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); $res1 = dolibarr_set_const($db, "CONTRACT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
@@ -165,8 +154,7 @@ elseif ($action == 'set_other')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -238,8 +226,7 @@ foreach ($dirmodels as $reldir)
// Show example of numbering model // Show example of numbering model
print '<td class="nowrap">'; print '<td class="nowrap">';
$tmp = $module->getExample(); $tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) { $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; } if (preg_match('/^Error/', $tmp)) { $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; } elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp; else print $tmp;
print '</td>'."\n"; print '</td>'."\n";
@@ -247,8 +234,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->CONTRACT_ADDON == "$file") if ($conf->global->CONTRACT_ADDON == "$file")
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>'; print '</a>';
@@ -311,8 +297,7 @@ if ($resql)
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -381,8 +366,7 @@ foreach ($dirmodels as $reldir)
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print '</td>'; print '</td>';
} } else {
else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -393,8 +377,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->CONTRACT_ADDON_PDF == $name) if ($conf->global->CONTRACT_ADDON_PDF == $name)
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@@ -425,8 +408,7 @@ foreach ($dirmodels as $reldir)
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>';
} } else {
else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }
print '</td>'; print '</td>';
@@ -473,8 +455,7 @@ $variablename = 'CONTRACT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} } else {
else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();

View File

@@ -96,12 +96,10 @@ if ($action == 'edit')
if ($key == 'DAV_ALLOW_PRIVATE_DIR') if ($key == 'DAV_ALLOW_PRIVATE_DIR')
{ {
print $langs->trans("AlwaysActive"); print $langs->trans("AlwaysActive");
} } elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR')
elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR')
{ {
print $form->selectyesno($key, $conf->global->$key, 1); print $form->selectyesno($key, $conf->global->$key, 1);
} } else {
else {
print '<input name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->$key.'">'; print '<input name="'.$key.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->$key.'">';
} }
print '</td></tr>'; print '</td></tr>';
@@ -115,8 +113,7 @@ if ($action == 'edit')
print '</form>'; print '</form>';
print '<br>'; print '<br>';
} } else {
else {
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
@@ -134,12 +131,10 @@ else {
if ($key == 'DAV_ALLOW_PRIVATE_DIR') if ($key == 'DAV_ALLOW_PRIVATE_DIR')
{ {
print $langs->trans("AlwaysActive"); print $langs->trans("AlwaysActive");
} } elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR')
elseif ($key == 'DAV_ALLOW_PUBLIC_DIR' || $key == 'DAV_ALLOW_ECM_DIR')
{ {
print yn($conf->global->$key); print yn($conf->global->$key);
} } else {
else {
print $conf->global->$key; print $conf->global->$key;
} }
print '</td></tr>'; print '</td></tr>';

View File

@@ -58,8 +58,7 @@ if ($action == 'set')
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
$db->rollback(); $db->rollback();
setEventMessages($error, null, 'errors'); setEventMessages($error, null, 'errors');
} }

View File

@@ -150,8 +150,7 @@ if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('ac
$defaulturl = ''; $defaulturl = '';
$defaultkey = ''; $defaultkey = '';
$defaultvalue = ''; $defaultvalue = '';
} } else {
else {
$db->rollback(); $db->rollback();
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
$action = ''; $action = '';
@@ -168,8 +167,7 @@ if ($action == 'delete')
if ($result >= 0) if ($result >= 0)
{ {
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -195,8 +193,7 @@ if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=1'.$param.'">'; $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=1'.$param.'">';
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
$enabledisablehtml .= '</a>'; $enabledisablehtml .= '</a>';
} } else {
else {
// Button on, click to disable // Button on, click to disable
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=0'.$param.'">'; $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&value=0'.$param.'">';
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on'); $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
@@ -257,8 +254,7 @@ $texthelp = $langs->trans("TheKeyIsTheNameOfHtmlField");
if ($mode != 'sortorder') if ($mode != 'sortorder')
{ {
$textkey = $form->textwithpicto($langs->trans("Field"), $texthelp); $textkey = $form->textwithpicto($langs->trans("Field"), $texthelp);
} } else {
else {
$texthelp = 'field or alias.field'; $texthelp = 'field or alias.field';
$textkey = $form->textwithpicto($langs->trans("Field"), $texthelp); $textkey = $form->textwithpicto($langs->trans("Field"), $texthelp);
} }
@@ -276,8 +272,7 @@ if ($mode != 'focus' && $mode != 'mandatory')
$texthelp .= $key.' -> '.$val.'<br>'; $texthelp .= $key.' -> '.$val.'<br>';
} }
$textvalue = $form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, 'subsitutiontooltip'); $textvalue = $form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, 'subsitutiontooltip');
} } else {
else {
$texthelp = 'ASC or DESC'; $texthelp = 'ASC or DESC';
$textvalue = $form->textwithpicto($langs->trans("SortOrder"), $texthelp); $textvalue = $form->textwithpicto($langs->trans("SortOrder"), $texthelp);
} }
@@ -316,8 +311,7 @@ if (!empty($conf->multicompany->enabled) && !$user->entity)
print '<td>'; print '<td>';
print '<input type="text" class="flat" size="1" disabled name="entity" value="'.$conf->entity.'">'; // We see environment, but to change it we must switch on other entity print '<input type="text" class="flat" size="1" disabled name="entity" value="'.$conf->entity.'">'; // We see environment, but to change it we must switch on other entity
print '</td>'; print '</td>';
} } else {
else {
print '<td class="center">'; print '<td class="center">';
print '<input type="hidden" name="entity" value="'.$conf->entity.'">'; print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
print '</td>'; print '</td>';
@@ -387,8 +381,7 @@ if ($result)
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=edit'.((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=edit'.((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
print ' &nbsp; '; print ' &nbsp; ';
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=delete'.((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=delete'.((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
} } else {
else {
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$id.'">'; print '<input type="hidden" name="rowid" value="'.$id.'">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : 'none').'"></div>'; print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : 'none').'"></div>';
@@ -401,8 +394,7 @@ if ($result)
print "\n"; print "\n";
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }

View File

@@ -249,8 +249,7 @@ if ($action == 'edit')
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
} } else {
else {
/* /*
* Show parameters * Show parameters
*/ */

View File

@@ -697,8 +697,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if (in_array($tablib[$id], array('DictionaryCompanyType', 'DictionaryHolidayTypes'))) // Field country is no mandatory for such dictionaries if (in_array($tablib[$id], array('DictionaryCompanyType', 'DictionaryHolidayTypes'))) // Field country is no mandatory for such dictionaries
{ {
$_POST["country"] = ''; $_POST["country"] = '';
} } else {
else {
$ok = 0; $ok = 0;
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors'); setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors');
} }
@@ -758,8 +757,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') { if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') {
$_POST[$keycode] = price2num($_POST[$keycode], 'MU'); $_POST[$keycode] = price2num($_POST[$keycode], 'MU');
} } elseif ($value == 'entity') {
elseif ($value == 'entity') {
$_POST[$keycode] = getEntity($tabname[$id]); $_POST[$keycode] = getEntity($tabname[$id]);
} }
@@ -768,15 +766,12 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($keycode == 'sortorder') // For column name 'sortorder', we use the field name 'position' if ($keycode == 'sortorder') // For column name 'sortorder', we use the field name 'position'
{ {
$sql .= "'".(int) GETPOST('position', 'int')."'"; $sql .= "'".(int) GETPOST('position', 'int')."'";
} } elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
elseif ($keycode == 'content') { elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
} } elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
$sql .= (int) GETPOST($keycode, 'int'); $sql .= (int) GETPOST($keycode, 'int');
} } else {
else {
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
} }
@@ -790,12 +785,10 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
{ {
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
$_POST = array('id'=>$id); // Clean $_POST array, we keep only $_POST = array('id'=>$id); // Clean $_POST array, we keep only
} } else {
else {
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -804,8 +797,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
// If verif ok and action modify, modify the line // If verif ok and action modify, modify the line
if ($ok && GETPOST('actionmodify')) if ($ok && GETPOST('actionmodify'))
{ {
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
else { $rowidcol = "rowid"; }
// Modify entry // Modify entry
$sql = "UPDATE ".$tabname[$id]." SET "; $sql = "UPDATE ".$tabname[$id]." SET ";
@@ -823,8 +815,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($field == 'price' || preg_match('/^amount/i', $field) || $field == 'taux') { if ($field == 'price' || preg_match('/^amount/i', $field) || $field == 'taux') {
$_POST[$keycode] = price2num($_POST[$keycode], 'MU'); $_POST[$keycode] = price2num($_POST[$keycode], 'MU');
} } elseif ($field == 'entity') {
elseif ($field == 'entity') {
$_POST[$keycode] = getEntity($tabname[$id]); $_POST[$keycode] = getEntity($tabname[$id]);
} }
@@ -833,15 +824,12 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
if ($listfieldvalue[$i] == 'sortorder') // For column name 'sortorder', we use the field name 'position' if ($listfieldvalue[$i] == 'sortorder') // For column name 'sortorder', we use the field name 'position'
{ {
$sql .= (int) GETPOST('position', 'int'); $sql .= (int) GETPOST('position', 'int');
} } elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
elseif ($keycode == 'content') { elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
} } elseif (in_array($keycode, array('private', 'position', 'scale'))) {
elseif (in_array($keycode, array('private', 'position', 'scale'))) {
$sql .= (int) GETPOST($keycode, 'int'); $sql .= (int) GETPOST($keycode, 'int');
} } else {
else {
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
} }
@@ -868,8 +856,7 @@ if (GETPOST('actioncancel'))
if ($action == 'confirm_delete' && $confirm == 'yes') // delete if ($action == 'confirm_delete' && $confirm == 'yes') // delete
{ {
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
else { $rowidcol = "rowid"; }
$sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); $sql = "DELETE FROM ".$tabname[$id]." WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
@@ -880,8 +867,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
{ {
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -890,13 +876,11 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
// activate // activate
if ($action == $acts[0]) if ($action == $acts[0])
{ {
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
else { $rowidcol = "rowid"; }
if ($rowid) { if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} } elseif ($code) {
elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} }
@@ -910,13 +894,11 @@ if ($action == $acts[0])
// disable // disable
if ($action == $acts[1]) if ($action == $acts[1])
{ {
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
else { $rowidcol = "rowid"; }
if ($rowid) { if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} } elseif ($code) {
elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} }
@@ -930,13 +912,11 @@ if ($action == $acts[1])
// favorite // favorite
if ($action == 'activate_favorite') if ($action == 'activate_favorite')
{ {
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
else { $rowidcol = "rowid"; }
if ($rowid) { if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} } elseif ($code) {
elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} }
@@ -950,13 +930,11 @@ if ($action == 'activate_favorite')
// disable favorite // disable favorite
if ($action == 'disable_favorite') if ($action == 'disable_favorite')
{ {
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
else { $rowidcol = "rowid"; }
if ($rowid) { if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} } elseif ($code) {
elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($code)."'".($entity != '' ? " AND entity = ".(int) $entity : '');
} }
@@ -1053,8 +1031,7 @@ if ($id)
// Clear the required sort criteria for the tabsqlsort to be able to force it with selected value // Clear the required sort criteria for the tabsqlsort to be able to force it with selected value
$tabsqlsort[$id] = preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i', '', $tabsqlsort[$id]); $tabsqlsort[$id] = preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i', '', $tabsqlsort[$id]);
$tabsqlsort[$id] = preg_replace('/([a-z]+\.)?'.$sortfield.',/i', '', $tabsqlsort[$id]); $tabsqlsort[$id] = preg_replace('/([a-z]+\.)?'.$sortfield.',/i', '', $tabsqlsort[$id]);
} } else {
else {
$sql .= " ORDER BY "; $sql .= " ORDER BY ";
} }
$sql .= $tabsqlsort[$id]; $sql .= $tabsqlsort[$id];
@@ -1291,15 +1268,13 @@ if ($id)
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth150 maxwidthonsmartphone'); print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth150 maxwidthonsmartphone');
print '</td>'; print '</td>';
$filterfound++; $filterfound++;
} } elseif ($value == 'code')
elseif ($value == 'code')
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="maxwidth100" name="search_code" value="'.dol_escape_htmltag($search_code).'">'; print '<input type="text" class="maxwidth100" name="search_code" value="'.dol_escape_htmltag($search_code).'">';
print '</td>'; print '</td>';
$filterfound++; $filterfound++;
} } else {
else {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
} }
@@ -1434,8 +1409,7 @@ if ($id)
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>'; print '</td>';
} } else {
else {
$tmpaction = 'view'; $tmpaction = 'view';
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
@@ -1461,29 +1435,23 @@ if ($id)
if ($value == 'element') if ($value == 'element')
{ {
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow; $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
} } elseif ($value == 'source')
elseif ($value == 'source')
{ {
$valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow; $valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow;
} } elseif ($valuetoshow == 'all') {
elseif ($valuetoshow == 'all') {
$valuetoshow = $langs->trans('All'); $valuetoshow = $langs->trans('All');
} } elseif ($fieldlist[$field] == 'country') {
elseif ($fieldlist[$field] == 'country') {
if (empty($obj->country_code)) if (empty($obj->country_code))
{ {
$valuetoshow = '-'; $valuetoshow = '-';
} } else {
else {
$key = $langs->trans("Country".strtoupper($obj->country_code)); $key = $langs->trans("Country".strtoupper($obj->country_code));
$valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country); $valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country);
} }
} } elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
$valuetoshow = yn($valuetoshow); $valuetoshow = yn($valuetoshow);
$class = "center"; $class = "center";
} } elseif ($fieldlist[$field] == 'type_cdr') {
elseif ($fieldlist[$field] == 'type_cdr') {
if (empty($valuetoshow)) $valuetoshow = $langs->trans('None'); if (empty($valuetoshow)) $valuetoshow = $langs->trans('None');
elseif ($valuetoshow == 1) $valuetoshow = $langs->trans('AtEndOfMonth'); elseif ($valuetoshow == 1) $valuetoshow = $langs->trans('AtEndOfMonth');
elseif ($valuetoshow == 2) $valuetoshow = $langs->trans('CurrentNext'); elseif ($valuetoshow == 2) $valuetoshow = $langs->trans('CurrentNext');
@@ -1494,130 +1462,102 @@ if ($id)
if ($value == 'private') if ($value == 'private')
{ {
$valuetoshow = yn($elementList[$valuetoshow]); $valuetoshow = yn($elementList[$valuetoshow]);
} } elseif ($fieldlist[$field] == 'libelle_facture') {
elseif ($fieldlist[$field] == 'libelle_facture') {
$langs->load("bills"); $langs->load("bills");
$key = $langs->trans("PaymentCondition".strtoupper($obj->code)); $key = $langs->trans("PaymentCondition".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "PaymentCondition".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->code && $key != "PaymentCondition".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
$valuetoshow = nl2br($valuetoshow); $valuetoshow = nl2br($valuetoshow);
} } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') {
elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') {
$key = $langs->trans("Country".strtoupper($obj->code)); $key = $langs->trans("Country".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') {
elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') {
$langs->load("propal"); $langs->load("propal");
$key = $langs->trans("AvailabilityType".strtoupper($obj->code)); $key = $langs->trans("AvailabilityType".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} } elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') {
elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') {
$key = $langs->trans("Action".strtoupper($obj->code)); $key = $langs->trans("Action".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} } elseif (!empty($obj->code_iso) && $fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_currencies') {
elseif (!empty($obj->code_iso) && $fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_currencies') {
$key = $langs->trans("Currency".strtoupper($obj->code_iso)); $key = $langs->trans("Currency".strtoupper($obj->code_iso));
$valuetoshow = ($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso) ? $key : $obj->{$fieldlist[$field]});
} } elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_typent') {
elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_typent') {
$key = $langs->trans(strtoupper($obj->code)); $key = $langs->trans(strtoupper($obj->code));
$valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} } elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_prospectlevel') {
elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_prospectlevel') {
$key = $langs->trans(strtoupper($obj->code)); $key = $langs->trans(strtoupper($obj->code));
$valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_civility') {
elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_civility') {
$key = $langs->trans("Civility".strtoupper($obj->code)); $key = $langs->trans("Civility".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "Civility".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->code && $key != "Civility".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} } elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_contact') {
elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_contact') {
$langs->load('agenda'); $langs->load('agenda');
$key = $langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)); $key = $langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} } elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_payment_term') {
elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_payment_term') {
$langs->load("bills"); $langs->load("bills");
$key = $langs->trans("PaymentConditionShort".strtoupper($obj->code)); $key = $langs->trans("PaymentConditionShort".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} } elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_paiement') {
elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_paiement') {
$langs->load("bills"); $langs->load("bills");
$key = $langs->trans("PaymentType".strtoupper($obj->code)); $key = $langs->trans("PaymentType".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "PaymentType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->code && $key != "PaymentType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} } elseif ($fieldlist[$field] == 'type' && $tabname[$id] == MAIN_DB_PREFIX.'c_paiement') {
elseif ($fieldlist[$field] == 'type' && $tabname[$id] == MAIN_DB_PREFIX.'c_paiement') {
$payment_type_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth')); $payment_type_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth'));
$valuetoshow = $payment_type_list[$valuetoshow]; $valuetoshow = $payment_type_list[$valuetoshow];
} } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_input_reason') {
elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_input_reason') {
$key = $langs->trans("DemandReasonType".strtoupper($obj->code)); $key = $langs->trans("DemandReasonType".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "DemandReasonType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->code && $key != "DemandReasonType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} } elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_input_method') {
elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_input_method') {
$langs->load("orders"); $langs->load("orders");
$key = $langs->trans($obj->code); $key = $langs->trans($obj->code);
$valuetoshow = ($obj->code && $key != $obj->code) ? $key : $obj->{$fieldlist[$field]}; $valuetoshow = ($obj->code && $key != $obj->code) ? $key : $obj->{$fieldlist[$field]};
} } elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_shipment_mode') {
elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_shipment_mode') {
$langs->load("sendings"); $langs->load("sendings");
$key = $langs->trans("SendingMethod".strtoupper($obj->code)); $key = $langs->trans("SendingMethod".strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != "SendingMethod".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->code && $key != "SendingMethod".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} } elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_paper_format')
elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_paper_format')
{ {
$key = $langs->trans('PaperFormat'.strtoupper($obj->code)); $key = $langs->trans('PaperFormat'.strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees')
elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees')
{ {
$langs->load('trips'); $langs->load('trips');
$key = $langs->trans(strtoupper($obj->code)); $key = $langs->trans(strtoupper($obj->code));
$valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]});
} } elseif ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
elseif ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') {
$showfield = 0; $showfield = 0;
} } elseif ($fieldlist[$field] == 'unicode') {
elseif ($fieldlist[$field] == 'unicode') {
$valuetoshow = $langs->getCurrencySymbol($obj->code, 1); $valuetoshow = $langs->getCurrencySymbol($obj->code, 1);
} } elseif ($fieldlist[$field] == 'label' && $tabname[$_GET["id"]] == MAIN_DB_PREFIX.'c_units') {
elseif ($fieldlist[$field] == 'label' && $tabname[$_GET["id"]] == MAIN_DB_PREFIX.'c_units') {
$langs->load("products"); $langs->load("products");
$valuetoshow = $langs->trans($obj->{$fieldlist[$field]}); $valuetoshow = $langs->trans($obj->{$fieldlist[$field]});
} } elseif ($fieldlist[$field] == 'short_label' && $tabname[$_GET["id"]] == MAIN_DB_PREFIX.'c_units') {
elseif ($fieldlist[$field] == 'short_label' && $tabname[$_GET["id"]] == MAIN_DB_PREFIX.'c_units') {
$langs->load("products"); $langs->load("products");
$valuetoshow = $langs->trans($obj->{$fieldlist[$field]}); $valuetoshow = $langs->trans($obj->{$fieldlist[$field]});
} } elseif (($fieldlist[$field] == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX.'c_paper_format'))
elseif (($fieldlist[$field] == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX.'c_paper_format'))
{ {
$key = $langs->trans('SizeUnit'.strtolower($obj->unit)); $key = $langs->trans('SizeUnit'.strtolower($obj->unit));
$valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$fieldlist[$field]});
} } elseif ($fieldlist[$field] == 'localtax1' || $fieldlist[$field] == 'localtax2') {
elseif ($fieldlist[$field] == 'localtax1' || $fieldlist[$field] == 'localtax2') {
$class = "center"; $class = "center";
} } elseif ($fieldlist[$field] == 'localtax1_type') {
elseif ($fieldlist[$field] == 'localtax1_type') {
if ($obj->localtax1 != 0) if ($obj->localtax1 != 0)
$valuetoshow = $localtax_typeList[$valuetoshow]; $valuetoshow = $localtax_typeList[$valuetoshow];
else $valuetoshow = ''; else $valuetoshow = '';
$class = "center"; $class = "center";
} } elseif ($fieldlist[$field] == 'localtax2_type') {
elseif ($fieldlist[$field] == 'localtax2_type') {
if ($obj->localtax2 != 0) if ($obj->localtax2 != 0)
$valuetoshow = $localtax_typeList[$valuetoshow]; $valuetoshow = $localtax_typeList[$valuetoshow];
else $valuetoshow = ''; else $valuetoshow = '';
$class = "center"; $class = "center";
} } elseif ($fieldlist[$field] == 'taux') {
elseif ($fieldlist[$field] == 'taux') {
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0); $valuetoshow = price($valuetoshow, 0, $langs, 0, 0);
$class = "center"; $class = "center";
} elseif (in_array($fieldlist[$field], array('recuperableonly'))) { } elseif (in_array($fieldlist[$field], array('recuperableonly'))) {
$class = "center"; $class = "center";
} } elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy') {
elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy') {
$valuetoshow = length_accountg($valuetoshow); $valuetoshow = length_accountg($valuetoshow);
} } elseif ($fieldlist[$field] == 'fk_tva')
elseif ($fieldlist[$field] == 'fk_tva')
{ {
foreach ($form->cache_vatrates as $key => $Tab) foreach ($form->cache_vatrates as $key => $Tab)
{ {
@@ -1627,23 +1567,19 @@ if ($id)
break; break;
} }
} }
} } elseif ($fieldlist[$field] == 'fk_c_exp_tax_cat')
elseif ($fieldlist[$field] == 'fk_c_exp_tax_cat')
{ {
$valuetoshow = getDictvalue(MAIN_DB_PREFIX.'c_exp_tax_cat', 'label', $valuetoshow); $valuetoshow = getDictvalue(MAIN_DB_PREFIX.'c_exp_tax_cat', 'label', $valuetoshow);
$valuetoshow = $langs->trans($valuetoshow); $valuetoshow = $langs->trans($valuetoshow);
} } elseif ($tabname[$id] == MAIN_DB_PREFIX.'c_exp_tax_cat')
elseif ($tabname[$id] == MAIN_DB_PREFIX.'c_exp_tax_cat')
{ {
$valuetoshow = $langs->trans($valuetoshow); $valuetoshow = $langs->trans($valuetoshow);
} } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_units')
elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_units')
{ {
$langs->load('other'); $langs->load('other');
$key = $langs->trans($obj->label); $key = $langs->trans($obj->label);
$valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$fieldlist[$field]}); $valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$fieldlist[$field]});
} } elseif ($fieldlist[$field] == 'code' && $id == 3) {
elseif ($fieldlist[$field] == 'code' && $id == 3) {
$valuetoshow = $obj->state_code; $valuetoshow = $obj->state_code;
} }
$class .= ($class ? ' ' : '').'tddict'; $class .= ($class ? ' ' : '').'tddict';
@@ -1664,9 +1600,7 @@ if ($id)
$canbemodified = 1; $canbemodified = 1;
if (isset($obj->code) && $id != 10) if (isset($obj->code) && $id != 10)
{ {
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) { $iserasable = 0; $canbedisabled = 0; } if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) { $iserasable = 0; $canbedisabled = 0; } elseif ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; } elseif ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; }
elseif ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; }
elseif ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; }
} }
if ($id == 25 && in_array($obj->code, array('banner', 'blogpost', 'other', 'page'))) if ($id == 25 && in_array($obj->code, array('banner', 'blogpost', 'other', 'page')))
{ {
@@ -1720,8 +1654,7 @@ if ($id)
if ($user->admin) print '<a href="'.$url.'action=delete">'.img_delete().'</a>'; if ($user->admin) print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin //else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
print '</td>'; print '</td>';
} } else print '<td>&nbsp;</td>';
else print '<td>&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
} }
@@ -1731,14 +1664,12 @@ if ($id)
print '</table>'; print '</table>';
print '</div>'; print '</div>';
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
print '</form>'; print '</form>';
} } else {
else {
/* /*
* Show list of dictionary to show * Show list of dictionary to show
*/ */
@@ -1771,8 +1702,7 @@ else {
if (!empty($tabcond[$i])) if (!empty($tabcond[$i]))
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$i.'">'.$langs->trans($tablib[$i]).'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$i.'">'.$langs->trans($tablib[$i]).'</a>';
} } else {
else {
print $langs->trans($tablib[$i]); print $langs->trans($tablib[$i]);
} }
print '</td>'; print '</td>';
@@ -1784,8 +1714,7 @@ else {
print '</td>'; print '</td>';
print '<td>'.$tabname[$i].'</td></tr>'; print '<td>'.$tabname[$i].'</td></tr>';
$lastlineisempty = false; $lastlineisempty = false;
} } else {
else {
if (!$lastlineisempty) if (!$lastlineisempty)
{ {
$showemptyline = 1; $showemptyline = 1;
@@ -1840,8 +1769,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$hidden.'">'; print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$hidden.'">';
print $langs->trans($hidden); print $langs->trans($hidden);
print '</td>'; print '</td>';
} } elseif ($fieldlist[$field] == 'country')
elseif ($fieldlist[$field] == 'country')
{ {
if (in_array('region_id', $fieldlist)) if (in_array('region_id', $fieldlist))
{ {
@@ -1853,8 +1781,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
$fieldname = 'country'; $fieldname = 'country';
print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : '')), $fieldname, '', 28, 'maxwidth150 maxwidthonsmartphone'); print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : '')), $fieldname, '', 28, 'maxwidth150 maxwidthonsmartphone');
print '</td>'; print '</td>';
} } elseif ($fieldlist[$field] == 'country_id')
elseif ($fieldlist[$field] == 'country_id')
{ {
if (!in_array('country', $fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate) if (!in_array('country', $fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate)
{ {
@@ -1863,21 +1790,18 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$country_id.'">'; print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$country_id.'">';
print '</td>'; print '</td>';
} }
} } elseif ($fieldlist[$field] == 'region')
elseif ($fieldlist[$field] == 'region')
{ {
print '<td>'; print '<td>';
$formcompany->select_region($region_id, 'region'); $formcompany->select_region($region_id, 'region');
print '</td>'; print '</td>';
} } elseif ($fieldlist[$field] == 'region_id')
elseif ($fieldlist[$field] == 'region_id')
{ {
$region_id = (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:0); $region_id = (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:0);
print '<td>'; print '<td>';
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">'; print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">';
print '</td>'; print '</td>';
} } elseif ($fieldlist[$field] == 'lang')
elseif ($fieldlist[$field] == 'lang')
{ {
print '<td>'; print '<td>';
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'lang'); print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'lang');
@@ -1896,28 +1820,24 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '<td>'; print '<td>';
print $form->selectarray('source', $sourceList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'')); print $form->selectarray('source', $sourceList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''));
print '</td>'; print '</td>';
} } elseif ($fieldlist[$field] == 'private')
elseif ($fieldlist[$field] == 'private')
{ {
print '<td>'; print '<td>';
print $form->selectyesno("private", (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'')); print $form->selectyesno("private", (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''));
print '</td>'; print '</td>';
} } elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm")
elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm")
{ {
$type = (!empty($obj->type) ? $obj->type : 'user'); // Check if type is different of 'user' (external module) $type = (!empty($obj->type) ? $obj->type : 'user'); // Check if type is different of 'user' (external module)
print '<td>'; print '<td>';
print $type.'<input type="hidden" name="type" value="'.$type.'">'; print $type.'<input type="hidden" name="type" value="'.$type.'">';
print '</td>'; print '</td>';
} } elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX.'c_paiement')
elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX.'c_paiement')
{ {
print '<td>'; print '<td>';
$select_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth')); $select_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth'));
print $form->selectarray($fieldlist[$field], $select_list, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'2')); print $form->selectarray($fieldlist[$field], $select_list, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'2'));
print '</td>'; print '</td>';
} } elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
if ($fieldlist[$field] == 'type_cdr') print '<td class="center">'; if ($fieldlist[$field] == 'type_cdr') print '<td class="center">';
else print '<td>'; else print '<td>';
if ($fieldlist[$field] == 'type_cdr') { if ($fieldlist[$field] == 'type_cdr') {
@@ -1926,15 +1846,13 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1); print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1);
} }
print '</td>'; print '</td>';
} } elseif (in_array($fieldlist[$field], array('nbjour', 'decalage', 'taux', 'localtax1', 'localtax2'))) {
elseif (in_array($fieldlist[$field], array('nbjour', 'decalage', 'taux', 'localtax1', 'localtax2'))) {
$class = "left"; $class = "left";
if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2'))) $class = "center"; // Fields aligned on right if (in_array($fieldlist[$field], array('taux', 'localtax1', 'localtax2'))) $class = "center"; // Fields aligned on right
print '<td class="'.$class.'">'; print '<td class="'.$class.'">';
print '<input type="text" class="flat" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" size="3" name="'.$fieldlist[$field].'">'; print '<input type="text" class="flat" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : '').'" size="3" name="'.$fieldlist[$field].'">';
print '</td>'; print '</td>';
} } elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
print '<td>'; print '<td>';
$transfound = 0; $transfound = 0;
$transkey = ''; $transkey = '';
@@ -1952,19 +1870,15 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
if (!$transfound) if (!$transfound)
{ {
print '<textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'</textarea>'; print '<textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'</textarea>';
} } else {
else {
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$transkey.'">'; print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$transkey.'">';
} }
print '</td>'; print '</td>';
} } elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) {
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i', $fieldlist[$field])) {
print '<td><input type="text" class="flat minwidth75" value="'.price((!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'')).'" name="'.$fieldlist[$field].'"></td>'; print '<td><input type="text" class="flat minwidth75" value="'.price((!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'')).'" name="'.$fieldlist[$field].'"></td>';
} } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
print '<td><input type="text" class="flat minwidth75 maxwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>'; print '<td><input type="text" class="flat minwidth75 maxwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
} } elseif ($fieldlist[$field] == 'unit') {
elseif ($fieldlist[$field] == 'unit') {
print '<td>'; print '<td>';
$units = array( $units = array(
'mm' => $langs->trans('SizeUnitmm'), 'mm' => $langs->trans('SizeUnitmm'),
@@ -1981,8 +1895,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '<td class="center">'; print '<td class="center">';
print $form->selectarray($fieldlist[$field], $localtax_typeList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'')); print $form->selectarray($fieldlist[$field], $localtax_typeList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''));
print '</td>'; print '</td>';
} } elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy')
elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy')
{ {
print '<td>'; print '<td>';
if (!empty($conf->accounting->enabled)) if (!empty($conf->accounting->enabled))
@@ -1990,32 +1903,27 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
$fieldname = $fieldlist[$field]; $fieldname = $fieldlist[$field];
$accountancy_account = (!empty($obj->$fieldname) ? $obj->$fieldname : 0); $accountancy_account = (!empty($obj->$fieldname) ? $obj->$fieldname : 0);
print $formaccounting->select_account($accountancy_account, '.'.$fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone'); print $formaccounting->select_account($accountancy_account, '.'.$fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone');
} } else {
else {
$fieldname = $fieldlist[$field]; $fieldname = $fieldlist[$field];
print '<input type="text" size="10" class="flat" value="'.(isset($obj->$fieldname) ? $obj->$fieldname : '').'" name="'.$fieldlist[$field].'">'; print '<input type="text" size="10" class="flat" value="'.(isset($obj->$fieldname) ? $obj->$fieldname : '').'" name="'.$fieldlist[$field].'">';
} }
print '</td>'; print '</td>';
} } elseif ($fieldlist[$field] == 'fk_tva')
elseif ($fieldlist[$field] == 'fk_tva')
{ {
print '<td>'; print '<td>';
print $form->load_tva('fk_tva', $obj->taux, $mysoc, new Societe($db), 0, 0, '', false, -1); print $form->load_tva('fk_tva', $obj->taux, $mysoc, new Societe($db), 0, 0, '', false, -1);
print '</td>'; print '</td>';
} } elseif ($fieldlist[$field] == 'fk_c_exp_tax_cat')
elseif ($fieldlist[$field] == 'fk_c_exp_tax_cat')
{ {
print '<td>'; print '<td>';
print $form->selectExpenseCategories($obj->fk_c_exp_tax_cat); print $form->selectExpenseCategories($obj->fk_c_exp_tax_cat);
print '</td>'; print '</td>';
} } elseif ($fieldlist[$field] == 'fk_range')
elseif ($fieldlist[$field] == 'fk_range')
{ {
print '<td>'; print '<td>';
print $form->selectExpenseRanges($obj->fk_range); print $form->selectExpenseRanges($obj->fk_range);
print '</td>'; print '</td>';
} } else {
else {
$fieldValue = isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''; $fieldValue = isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'';
if ($fieldlist[$field] == 'sortorder') if ($fieldlist[$field] == 'sortorder')
@@ -2049,8 +1957,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
if (!$transfound) if (!$transfound)
{ {
print '<input type="text" class="flat'.($class ? ' '.$class : '').'" value="'.dol_escape_htmltag($fieldValue).'" name="'.$fieldlist[$field].'">'; print '<input type="text" class="flat'.($class ? ' '.$class : '').'" value="'.dol_escape_htmltag($fieldValue).'" name="'.$fieldlist[$field].'">';
} } else {
else {
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$transkey.'">'; print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$transkey.'">';
} }
print '</td>'; print '</td>';

View File

@@ -237,8 +237,7 @@ class PrestaShopWebservice
throw new PrestaShopWebserviceException('HTTP XML response is not parsable: '.$msg); throw new PrestaShopWebserviceException('HTTP XML response is not parsable: '.$msg);
} }
return $xml; return $xml;
} } else {
else {
throw new PrestaShopWebserviceException('HTTP response is empty'); throw new PrestaShopWebserviceException('HTTP response is empty');
} }
} }

View File

@@ -41,8 +41,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -54,8 +53,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -91,13 +89,11 @@ print '<td class="center" width="100">';
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print ajax_constantonoff('ECM_AUTO_TREE_ENABLED'); print ajax_constantonoff('ECM_AUTO_TREE_ENABLED');
} } else {
else {
if (empty($conf->global->ECM_AUTO_TREE_ENABLED)) if (empty($conf->global->ECM_AUTO_TREE_ENABLED))
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_ECM_AUTO_TREE_ENABLED">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_ECM_AUTO_TREE_ENABLED">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} } elseif (!empty($conf->global->USER_MAIL_REQUIRED))
elseif (!empty($conf->global->USER_MAIL_REQUIRED))
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_ECM_AUTO_TREE_ENABLED">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_ECM_AUTO_TREE_ENABLED">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} }

View File

@@ -126,8 +126,7 @@ if (GETPOST('addfilter', 'alpha'))
if ($result > 0) if ($result > 0)
{ {
$object->fetchFilters(); $object->fetchFilters();
} } else {
else {
setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors'); setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors');
} }
} }
@@ -140,8 +139,7 @@ if ($action == 'deletefilter')
if ($result > 0) if ($result > 0)
{ {
$object->fetchFilters(); $object->fetchFilters();
} } else {
else {
setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors'); setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors');
} }
} }
@@ -160,8 +158,7 @@ if (GETPOST('addoperation', 'alpha'))
if ($result > 0) if ($result > 0)
{ {
$object->fetchActions(); $object->fetchActions();
} } else {
else {
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
} }
} }
@@ -178,8 +175,7 @@ if ($action == 'updateoperation')
if ($result > 0) if ($result > 0)
{ {
$object->fetchActions(); $object->fetchActions();
} } else {
else {
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
} }
} }
@@ -191,8 +187,7 @@ if ($action == 'deleteoperation')
if ($result > 0) if ($result > 0)
{ {
$object->fetchActions(); $object->fetchActions();
} } else {
else {
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
} }
} }
@@ -206,8 +201,7 @@ if ($action == 'confirm_collect')
{ {
$debuginfo = $object->debuginfo; $debuginfo = $object->debuginfo;
setEventMessages($object->lastresult, null, 'mesgs'); setEventMessages($object->lastresult, null, 'mesgs');
} } else {
else {
$debuginfo = $object->debuginfo; $debuginfo = $object->debuginfo;
setEventMessages($object->error, null, 'errors'); setEventMessages($object->error, null, 'errors');
} }
@@ -426,23 +420,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
} }
$connection = imap_open($connectstringsource, $object->login, $object->password); $connection = imap_open($connectstringsource, $object->login, $object->password);
} } catch (Exception $e)
catch (Exception $e)
{ {
print $e->getMessage(); print $e->getMessage();
} }
$morehtml .= $form->textwithpicto('', 'connect string '.$connectstringserver); $morehtml .= $form->textwithpicto('', 'connect string '.$connectstringserver);
} } else {
else {
$morehtml .= 'IMAP functions not available on your PHP'; $morehtml .= 'IMAP functions not available on your PHP';
} }
if (!$connection) if (!$connection)
{ {
$morehtml .= 'Failed to open IMAP connection '.$connectstringsource; $morehtml .= 'Failed to open IMAP connection '.$connectstringsource;
} } else {
else {
$morehtml .= imap_num_msg($connection); $morehtml .= imap_num_msg($connection);
} }
@@ -605,8 +596,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (in_array($ruleaction['type'], array('recordevent'))) if (in_array($ruleaction['type'], array('recordevent')))
{ {
print $form->textwithpicto('', $langs->transnoentitiesnoconv('IfTrackingIDFoundEventWillBeLinked')); print $form->textwithpicto('', $langs->transnoentitiesnoconv('IfTrackingIDFoundEventWillBeLinked'));
} } elseif (in_array($ruleaction['type'], array('loadthirdparty', 'loadandcreatethirdparty'))) {
elseif (in_array($ruleaction['type'], array('loadthirdparty', 'loadandcreatethirdparty'))) {
print $form->textwithpicto('', $langs->transnoentitiesnoconv('EmailCollectorLoadThirdPartyHelp')); print $form->textwithpicto('', $langs->transnoentitiesnoconv('EmailCollectorLoadThirdPartyHelp'));
} }
print '</td>'; print '</td>';
@@ -616,8 +606,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<input type="text" class="quatrevingtquinzepercent" name="operationparam2" value="'.$ruleaction['actionparam'].'"><br>'; print '<input type="text" class="quatrevingtquinzepercent" name="operationparam2" value="'.$ruleaction['actionparam'].'"><br>';
print '<input type="hidden" name="rowidoperation2" value="'.$ruleaction['id'].'"><br>'; print '<input type="hidden" name="rowidoperation2" value="'.$ruleaction['id'].'"><br>';
print '<input type="submit" class="button" name="saveoperation2" value="'.$langs->trans("Save").'"> <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="saveoperation2" value="'.$langs->trans("Save").'"> <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
} } else {
else {
print $ruleaction['actionparam']; print $ruleaction['actionparam'];
} }
print '</td>'; print '</td>';

View File

@@ -241,8 +241,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
{ {
$num = $nbtotalofrecords; $num = $nbtotalofrecords;
} } else {
else {
$sql .= $db->plimit($limit + 1, $offset); $sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@@ -71,9 +71,7 @@ if ($action == 'updateMask')
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
else setEventMessages($langs->trans("Error"), null, 'errors'); else setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'set_param')
elseif ($action == 'set_param')
{ {
$freetext = GETPOST('SHIPPING_FREE_TEXT', 'none'); // No alpha here, we want exact string $freetext = GETPOST('SHIPPING_FREE_TEXT', 'none'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
@@ -95,9 +93,7 @@ elseif ($action == 'set_param')
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
} } elseif ($action == 'specimen')
elseif ($action == 'specimen')
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@@ -128,13 +124,11 @@ elseif ($action == 'specimen')
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=expedition&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=expedition&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($module->error, $module->errors, 'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
@@ -144,9 +138,7 @@ elseif ($action == 'specimen')
elseif ($action == 'set') elseif ($action == 'set')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} } elseif ($action == 'del')
elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
@@ -171,9 +163,7 @@ elseif ($action == 'setdoc')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} } elseif ($action == 'setmodel')
elseif ($action == 'setmodel')
{ {
dolibarr_set_const($db, "EXPEDITION_ADDON_NUMBER", $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "EXPEDITION_ADDON_NUMBER", $value, 'chaine', 0, '', $conf->entity);
} }
@@ -246,8 +236,7 @@ foreach ($dirmodels as $reldir)
$tmp = $module->getExample(); $tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) { if (preg_match('/^Error/', $tmp)) {
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
} } elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp; else print $tmp;
print '</td>'."\n"; print '</td>'."\n";
@@ -255,8 +244,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->EXPEDITION_ADDON_NUMBER == "$file") if ($conf->global->EXPEDITION_ADDON_NUMBER == "$file")
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$file.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$file.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Disabled"), 'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>'; print '</a>';
@@ -322,8 +310,7 @@ if ($resql)
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -390,8 +377,7 @@ foreach ($dirmodels as $reldir)
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print '</td>'; print '</td>';
} } else {
else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -402,8 +388,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->EXPEDITION_ADDON_PDF == $name) if ($conf->global->EXPEDITION_ADDON_PDF == $name)
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@@ -431,8 +416,7 @@ foreach ($dirmodels as $reldir)
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'sending').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'sending').'</a>';
} } else {
else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }
print '</td>'; print '</td>';
@@ -478,8 +462,7 @@ $variablename = 'SHIPPING_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} } else {
else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();

View File

@@ -63,13 +63,10 @@ if ($action == 'updateMask')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'specimen') // For fiche inter
elseif ($action == 'specimen') // For fiche inter
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@@ -102,13 +99,11 @@ elseif ($action == 'specimen') // For fiche inter
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=expensereport&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=expensereport&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($module->error, $module->errors, 'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
@@ -122,9 +117,7 @@ elseif ($action == 'set')
{ {
dolibarr_set_const($db, 'EXPENSEREPORT_ADDON_PDF', $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'EXPENSEREPORT_ADDON_PDF', $value, 'chaine', 0, '', $conf->entity);
} }
} } elseif ($action == 'del')
elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
@@ -149,17 +142,13 @@ elseif ($action == 'setdoc')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} } elseif ($action == 'setmod')
elseif ($action == 'setmod')
{ {
// TODO Verifier si module numerotation choisi peut etre active // TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated // par appel methode canBeActivated
dolibarr_set_const($db, "EXPENSEREPORT_ADDON", $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "EXPENSEREPORT_ADDON", $value, 'chaine', 0, '', $conf->entity);
} } elseif ($action == 'setoptions')
elseif ($action == 'setoptions')
{ {
$db->begin(); $db->begin();
@@ -175,8 +164,7 @@ elseif ($action == 'setoptions')
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
$db->rollback(); $db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
@@ -259,8 +247,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->EXPENSEREPORT_ADDON == $file) if ($conf->global->EXPENSEREPORT_ADDON == $file)
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>'; print '</a>';
@@ -323,8 +310,7 @@ if ($resql)
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -389,8 +375,7 @@ foreach ($dirmodels as $reldir)
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print "</td>"; print "</td>";
} } else {
else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -401,8 +386,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$name") if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$name")
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@@ -426,8 +410,7 @@ foreach ($dirmodels as $reldir)
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'intervention').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'intervention').'</a>';
} } else {
else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }
print '</td>'; print '</td>';
@@ -475,8 +458,7 @@ $variablename = 'EXPENSEREPORT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} } else {
else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();

View File

@@ -63,8 +63,7 @@ if ($action == 'updateik')
header('Location: '.$_SERVER['PHP_SELF']); header('Location: '.$_SERVER['PHP_SELF']);
exit; exit;
} } elseif ($action == 'delete') // TODO add confirm
elseif ($action == 'delete') // TODO add confirm
{ {
$expIk = new ExpenseReportIk($db); $expIk = new ExpenseReportIk($db);
if ($id > 0) if ($id > 0)
@@ -161,8 +160,7 @@ foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab)
{ {
echo '<input id="" class="button" name="save" value="'.$langs->trans('Save').'" type="submit" />'; echo '<input id="" class="button" name="save" value="'.$langs->trans('Save').'" type="submit" />';
echo '<input class="button" value="'.$langs->trans('Cancel').'" onclick="javascript:history.go(-1)" type="button" />'; echo '<input class="button" value="'.$langs->trans('Cancel').'" onclick="javascript:history.go(-1)" type="button" />';
} } else {
else {
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$range->ik->id.'&fk_c_exp_tax_cat='.$range->fk_c_exp_tax_cat.'&fk_range='.$range->rowid.'">'.img_edit().'</a>'; echo '<a href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$range->ik->id.'&fk_c_exp_tax_cat='.$range->fk_c_exp_tax_cat.'&fk_range='.$range->rowid.'">'.img_edit().'</a>';
if (!empty($range->ik->id)) echo '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$range->ik->id.'">'.img_delete().'</a>'; if (!empty($range->ik->id)) echo '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$range->ik->id.'">'.img_delete().'</a>';
// TODO add delete link // TODO add delete link

View File

@@ -100,11 +100,11 @@ if ($action == 'save')
$object->fk_user = (int) $fk_user; $object->fk_user = (int) $fk_user;
$object->fk_usergroup = 0; $object->fk_usergroup = 0;
$object->is_for_all = 0; $object->is_for_all = 0;
}elseif ($apply_to == 'G') { } elseif ($apply_to == 'G') {
$object->fk_usergroup = (int) $fk_usergroup; $object->fk_usergroup = (int) $fk_usergroup;
$object->fk_user = 0; $object->fk_user = 0;
$object->is_for_all = 0; $object->is_for_all = 0;
}elseif ($apply_to == 'A') { } elseif ($apply_to == 'A') {
$object->is_for_all = 1; $object->is_for_all = 1;
$object->fk_user = 0; $object->fk_user = 0;
$object->fk_usergroup = 0; $object->fk_usergroup = 0;
@@ -122,8 +122,7 @@ if ($action == 'save')
header('Location: '.$_SERVER['PHP_SELF']); header('Location: '.$_SERVER['PHP_SELF']);
exit; exit;
} }
} } elseif ($action == 'delete')
elseif ($action == 'delete')
{ {
// TODO add confirm // TODO add confirm
$res = $object->delete($user); $res = $object->delete($user);
@@ -228,8 +227,7 @@ foreach ($rules as $rule)
echo '<div class="float">'.$form->selectarray('apply_to', $tab_apply, $selected, 0).'</div>'; echo '<div class="float">'.$form->selectarray('apply_to', $tab_apply, $selected, 0).'</div>';
echo '<div id="user" class="float">'.$form->select_dolusers($object->fk_user, 'fk_user').'</div>'; echo '<div id="user" class="float">'.$form->select_dolusers($object->fk_user, 'fk_user').'</div>';
echo '<div id="group" class="float">'.$form->select_dolgroups($object->fk_usergroup, 'fk_usergroup').'</div>'; echo '<div id="group" class="float">'.$form->select_dolgroups($object->fk_usergroup, 'fk_usergroup').'</div>';
} } else {
else {
if ($rule->is_for_all > 0) echo $tab_apply['A']; if ($rule->is_for_all > 0) echo $tab_apply['A'];
elseif ($rule->fk_usergroup > 0) echo $tab_apply['G'].' ('.$rule->getGroupLabel().')'; elseif ($rule->fk_usergroup > 0) echo $tab_apply['G'].' ('.$rule->getGroupLabel().')';
elseif ($rule->fk_user > 0) echo $tab_apply['U'].' ('.$rule->getUserName().')'; elseif ($rule->fk_user > 0) echo $tab_apply['U'].' ('.$rule->getUserName().')';
@@ -241,8 +239,7 @@ foreach ($rules as $rule)
if ($action == 'edit' && $object->id == $rule->id) if ($action == 'edit' && $object->id == $rule->id)
{ {
echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1); echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1);
} } else {
else {
if ($rule->fk_c_type_fees == -1) echo $langs->trans('AllExpenseReport'); if ($rule->fk_c_type_fees == -1) echo $langs->trans('AllExpenseReport');
else { else {
$key = getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id'); $key = getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
@@ -257,8 +254,7 @@ foreach ($rules as $rule)
if ($action == 'edit' && $object->id == $rule->id) if ($action == 'edit' && $object->id == $rule->id)
{ {
echo $form->selectarray('code_expense_rules_type', $tab_rules_type, $object->code_expense_rules_type, 0); echo $form->selectarray('code_expense_rules_type', $tab_rules_type, $object->code_expense_rules_type, 0);
} } else {
else {
echo $tab_rules_type[$rule->code_expense_rules_type]; echo $tab_rules_type[$rule->code_expense_rules_type];
} }
echo '</td>'; echo '</td>';
@@ -268,8 +264,7 @@ foreach ($rules as $rule)
if ($action == 'edit' && $object->id == $rule->id) if ($action == 'edit' && $object->id == $rule->id)
{ {
print $form->selectDate(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0); print $form->selectDate(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0);
} } else {
else {
echo dol_print_date($rule->dates, 'day'); echo dol_print_date($rule->dates, 'day');
} }
echo '</td>'; echo '</td>';
@@ -279,8 +274,7 @@ foreach ($rules as $rule)
if ($action == 'edit' && $object->id == $rule->id) if ($action == 'edit' && $object->id == $rule->id)
{ {
print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0); print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0);
} } else {
else {
echo dol_print_date($rule->datee, 'day'); echo dol_print_date($rule->datee, 'day');
} }
echo '</td>'; echo '</td>';
@@ -290,8 +284,7 @@ foreach ($rules as $rule)
if ($action == 'edit' && $object->id == $rule->id) if ($action == 'edit' && $object->id == $rule->id)
{ {
echo '<input type="text" value="'.price2num($object->amount).'" name="amount" class="amount" />'.$conf->currency; echo '<input type="text" value="'.price2num($object->amount).'" name="amount" class="amount" />'.$conf->currency;
} } else {
else {
echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency); echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency);
} }
echo '</td>'; echo '</td>';
@@ -301,8 +294,7 @@ foreach ($rules as $rule)
if ($action == 'edit' && $object->id == $rule->id) if ($action == 'edit' && $object->id == $rule->id)
{ {
echo $form->selectyesno('restrictive', $object->restrictive, 1); echo $form->selectyesno('restrictive', $object->restrictive, 1);
} } else {
else {
echo yn($rule->restrictive, 1, 1); echo yn($rule->restrictive, 1, 1);
} }
echo '</td>'; echo '</td>';
@@ -313,8 +305,7 @@ foreach ($rules as $rule)
{ {
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$rule->id.'">'.img_edit().'</a>&nbsp;'; echo '<a href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$rule->id.'">'.img_edit().'</a>&nbsp;';
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$rule->id.'">'.img_delete().'</a>'; echo '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$rule->id.'">'.img_delete().'</a>';
} } else {
else {
echo '<input type="submit" class="button" value="'.$langs->trans('Update').'" />&nbsp;'; echo '<input type="submit" class="button" value="'.$langs->trans('Update').'" />&nbsp;';
echo '<a href="'.$_SERVER['PHP_SELF'].'" class="button">'.$langs->trans('Cancel').'</a>'; echo '<a href="'.$_SERVER['PHP_SELF'].'" class="button">'.$langs->trans('Cancel').'</a>';
} }

View File

@@ -60,8 +60,7 @@ if ($result)
preg_match('/([0-9]+)$/i', $obj->name, $reg); preg_match('/([0-9]+)$/i', $obj->name, $reg);
if ($reg[1] && $reg[1] > $lastexternalrss) $lastexternalrss = $reg[1]; if ($reg[1] && $reg[1] > $lastexternalrss) $lastexternalrss = $reg[1];
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -91,8 +90,7 @@ if ($action == 'add' || GETPOST("modify"))
exit; exit;
} }
*/ */
} } else {
else {
// Ajoute boite box_external_rss dans definition des boites // Ajoute boite box_external_rss dans definition des boites
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes_def (file, note)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes_def (file, note)";
$sql .= " VALUES ('box_external_rss.php','".$db->escape(GETPOST("norss", 'int').' ('.GETPOST($external_rss_title, 'alpha')).")')"; $sql .= " VALUES ('box_external_rss.php','".$db->escape(GETPOST("norss", 'int').' ('.GETPOST($external_rss_title, 'alpha')).")')";
@@ -111,8 +109,7 @@ if ($action == 'add' || GETPOST("modify"))
$db->commit(); $db->commit();
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
$db->rollback(); $db->rollback();
dol_print_error($db); dol_print_error($db);
} }
@@ -158,8 +155,7 @@ if ($_POST["delete"])
} }
$db->commit(); $db->commit();
} } else {
else {
$db->rollback(); $db->rollback();
dol_print_error($db, "sql=".$sql); dol_print_error($db, "sql=".$sql);
exit; exit;
@@ -174,8 +170,7 @@ if ($_POST["delete"])
$db->commit(); $db->commit();
header("Location: external_rss.php"); header("Location: external_rss.php");
exit; exit;
} } else {
else {
$db->rollback(); $db->rollback();
dol_print_error($db); dol_print_error($db);
} }
@@ -287,8 +282,7 @@ if ($resql)
if ($result > 0 && empty($rss->error)) if ($result > 0 && empty($rss->error))
{ {
print '<font class="ok">'.$langs->trans("Online").'</div>'; print '<font class="ok">'.$langs->trans("Online").'</div>';
} } else {
else {
print '<font class="error">'.$langs->trans("Offline"); print '<font class="error">'.$langs->trans("Offline");
$langs->load("errors"); $langs->load("errors");
if ($rssparser->error) print ' - '.$langs->trans($rssparser->error); if ($rssparser->error) print ' - '.$langs->trans($rssparser->error);
@@ -325,8 +319,7 @@ if ($resql)
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }

View File

@@ -71,12 +71,10 @@ if ($action == 'updateMask')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'specimen')
elseif ($action == 'specimen')
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@@ -107,13 +105,11 @@ elseif ($action == 'specimen')
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($module->error, $module->errors, 'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
@@ -122,9 +118,7 @@ elseif ($action == 'specimen')
elseif ($action == 'set') elseif ($action == 'set')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} } elseif ($action == 'del')
elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
@@ -148,15 +142,13 @@ elseif ($action == 'setdoc')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} } elseif ($action == 'setmod')
elseif ($action == 'setmod')
{ {
// TODO Verifier si module numerotation choisi peut etre active // TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated // par appel methode canBeActivated
dolibarr_set_const($db, "FACTURE_ADDON", $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "FACTURE_ADDON", $value, 'chaine', 0, '', $conf->entity);
} } elseif ($action == 'setribchq')
elseif ($action == 'setribchq')
{ {
$rib = GETPOST('rib', 'alpha'); $rib = GETPOST('rib', 'alpha');
$chq = GETPOST('chq', 'alpha'); $chq = GETPOST('chq', 'alpha');
@@ -169,12 +161,10 @@ elseif ($action == 'setribchq')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'set_FACTURE_DRAFT_WATERMARK')
elseif ($action == 'set_FACTURE_DRAFT_WATERMARK')
{ {
$draft = GETPOST('FACTURE_DRAFT_WATERMARK', 'alpha'); $draft = GETPOST('FACTURE_DRAFT_WATERMARK', 'alpha');
@@ -185,13 +175,10 @@ elseif ($action == 'set_FACTURE_DRAFT_WATERMARK')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'set_INVOICE_FREE_TEXT')
elseif ($action == 'set_INVOICE_FREE_TEXT')
{ {
$freetext = GETPOST('INVOICE_FREE_TEXT', 'none'); // No alpha here, we want exact string $freetext = GETPOST('INVOICE_FREE_TEXT', 'none'); // No alpha here, we want exact string
@@ -202,12 +189,10 @@ elseif ($action == 'set_INVOICE_FREE_TEXT')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'setforcedate')
elseif ($action == 'setforcedate')
{ {
$forcedate = GETPOST('forcedate', 'alpha'); $forcedate = GETPOST('forcedate', 'alpha');
@@ -218,12 +203,10 @@ elseif ($action == 'setforcedate')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'setDefaultPDFModulesByType')
elseif ($action == 'setDefaultPDFModulesByType')
{ {
$invoicetypemodels = GETPOST('invoicetypemodels'); $invoicetypemodels = GETPOST('invoicetypemodels');
@@ -240,8 +223,7 @@ elseif ($action == 'setDefaultPDFModulesByType')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -341,8 +323,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->FACTURE_ADDON == $file || $conf->global->FACTURE_ADDON.'.php' == $file) if ($conf->global->FACTURE_ADDON == $file || $conf->global->FACTURE_ADDON.'.php' == $file)
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
} }
print '</td>'; print '</td>';
@@ -453,8 +434,7 @@ if ($resql)
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -524,8 +504,7 @@ foreach ($dirmodels as $reldir)
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print '</td>'; print '</td>';
} } else {
else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("SetAsDefault"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("SetAsDefault"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -536,8 +515,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->FACTURE_ADDON_PDF == "$name") if ($conf->global->FACTURE_ADDON_PDF == "$name")
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@@ -570,8 +548,7 @@ foreach ($dirmodels as $reldir)
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
} } else {
else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }
print '</td>'; print '</td>';
@@ -677,13 +654,11 @@ if (!empty($conf->banque->enabled))
$i++; $i++;
} }
print "</select>"; print "</select>";
} } else {
else {
print '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>'; print '<span class="opacitymedium">'.$langs->trans("NoActiveBankAccountDefined").'</span>';
} }
} }
} } else {
else {
print $langs->trans("BankModuleNotActive"); print $langs->trans("BankModuleNotActive");
} }
print "</td></tr>"; print "</td></tr>";
@@ -761,8 +736,7 @@ $variablename = 'INVOICE_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} } else {
else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();

View File

@@ -246,10 +246,9 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra
print '<input type="hidden" name="action" value="setModuleOptions">'; print '<input type="hidden" name="action" value="setModuleOptions">';
if ($type == 'textarea') { if ($type == 'textarea') {
print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>'; print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>';
}elseif ($type == 'input') { } elseif ($type == 'input') {
print '<input '.$metascompil.' />'; print '<input '.$metascompil.' />';
} } else {
else {
// custom // custom
print $type; print $type;
} }

View File

@@ -126,8 +126,7 @@ if (GETPOST('save', 'alpha'))
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -145,8 +144,7 @@ print '<br>';
if (empty($conf->use_javascript_ajax)) if (empty($conf->use_javascript_ajax))
{ {
setEventMessages(array($langs->trans("NotAvailable"), $langs->trans("JavascriptDisabled")), null, 'errors'); setEventMessages(array($langs->trans("NotAvailable"), $langs->trans("JavascriptDisabled")), null, 'errors');
} } else {
else {
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("ActivateFCKeditor").'</td>'; print '<td colspan="2">'.$langs->trans("ActivateFCKeditor").'</td>';
@@ -168,8 +166,7 @@ else {
if ($value == 0) if ($value == 0)
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=activate_'.strtolower($const).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=activate_'.strtolower($const).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
} } elseif ($value == 1)
elseif ($value == 1)
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=disable_'.strtolower($const).'">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=disable_'.strtolower($const).'">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>';
} }
@@ -209,8 +206,7 @@ else {
$readonly = ($mode == 'dolibarr_readonly' ? 1 : 0); $readonly = ($mode == 'dolibarr_readonly' ? 1 : 0);
$editor = new DolEditor('formtestfield', isset($conf->global->FCKEDITOR_TEST) ? $conf->global->FCKEDITOR_TEST : 'Test', '', 200, $mode, 'In', true, $uselocalbrowser, 1, 120, 8, $readonly); $editor = new DolEditor('formtestfield', isset($conf->global->FCKEDITOR_TEST) ? $conf->global->FCKEDITOR_TEST : 'Test', '', 200, $mode, 'In', true, $uselocalbrowser, 1, 120, 8, $readonly);
$editor->Create(); $editor->Create();
} } else {
else {
print '<div style="border: 1px solid #888;" contenteditable="true">'; print '<div style="border: 1px solid #888;" contenteditable="true">';
print $conf->global->FCKEDITOR_TEST; print $conf->global->FCKEDITOR_TEST;
print '</div>'; print '</div>';

View File

@@ -63,13 +63,10 @@ if ($action == 'updateMask')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'specimen') // For fiche inter
elseif ($action == 'specimen') // For fiche inter
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@@ -100,13 +97,11 @@ elseif ($action == 'specimen') // For fiche inter
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=ficheinter&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=ficheinter&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($module->error, $module->errors, 'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
@@ -116,9 +111,7 @@ elseif ($action == 'specimen') // For fiche inter
elseif ($action == 'set') elseif ($action == 'set')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} } elseif ($action == 'del')
elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
@@ -143,17 +136,13 @@ elseif ($action == 'setdoc')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} } elseif ($action == 'setmod')
elseif ($action == 'setmod')
{ {
// TODO Verifier si module numerotation choisi peut etre active // TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated // par appel methode canBeActivated
dolibarr_set_const($db, "FICHEINTER_ADDON", $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "FICHEINTER_ADDON", $value, 'chaine', 0, '', $conf->entity);
} } elseif ($action == 'set_FICHINTER_FREE_TEXT')
elseif ($action == 'set_FICHINTER_FREE_TEXT')
{ {
$freetext = GETPOST('FICHINTER_FREE_TEXT', 'none'); // No alpha here, we want exact string $freetext = GETPOST('FICHINTER_FREE_TEXT', 'none'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
@@ -163,13 +152,10 @@ elseif ($action == 'set_FICHINTER_FREE_TEXT')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'set_FICHINTER_DRAFT_WATERMARK')
elseif ($action == 'set_FICHINTER_DRAFT_WATERMARK')
{ {
$draft = GETPOST('FICHINTER_DRAFT_WATERMARK', 'alpha'); $draft = GETPOST('FICHINTER_DRAFT_WATERMARK', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
@@ -179,13 +165,10 @@ elseif ($action == 'set_FICHINTER_DRAFT_WATERMARK')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS')
elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS')
{ {
$val = GETPOST('FICHINTER_PRINT_PRODUCTS', 'alpha'); $val = GETPOST('FICHINTER_PRINT_PRODUCTS', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_PRINT_PRODUCTS", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity); $res = dolibarr_set_const($db, "FICHINTER_PRINT_PRODUCTS", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
@@ -195,8 +178,7 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == 'set_FICHINTER_USE_SERVICE_DURATION') { } elseif ($action == 'set_FICHINTER_USE_SERVICE_DURATION') {
@@ -318,8 +300,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->FICHEINTER_ADDON == $classname) if ($conf->global->FICHEINTER_ADDON == $classname)
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$classname.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$classname.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
} }
print '</td>'; print '</td>';
@@ -381,8 +362,7 @@ if ($resql)
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -449,8 +429,7 @@ foreach ($dirmodels as $reldir)
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print "</td>"; print "</td>";
} } else {
else {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -461,8 +440,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->FICHEINTER_ADDON_PDF == "$name") if ($conf->global->FICHEINTER_ADDON_PDF == "$name")
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@@ -488,8 +466,7 @@ foreach ($dirmodels as $reldir)
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'intervention').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'intervention').'</a>';
} } else {
else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }
print '</td>'; print '</td>';
@@ -533,8 +510,7 @@ $variablename = 'FICHINTER_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} } else {
else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();

View File

@@ -64,8 +64,7 @@ if ($action == 'set')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -181,8 +180,7 @@ if ($geoip)
$result = dol_print_ip($ip, 1); $result = dol_print_ip($ip, 1);
if ($result) print $result; if ($result) print $result;
else print $langs->trans("Error"); else print $langs->trans("Error");
} } else {
else {
print '<br>'.$ip.' -> '; print '<br>'.$ip.' -> ';
$result = dol_print_ip($ip, 1); $result = dol_print_ip($ip, 1);
if ($result) print $result; if ($result) print $result;

View File

@@ -64,13 +64,10 @@ if ($action == 'updateMask')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'specimen') // For contract
elseif ($action == 'specimen') // For contract
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@@ -101,13 +98,11 @@ elseif ($action == 'specimen') // For contract
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=holiday&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=holiday&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($obj->error, $obj->errors, 'errors'); setEventMessages($obj->error, $obj->errors, 'errors');
dol_syslog($obj->error, LOG_ERR); dol_syslog($obj->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
@@ -117,9 +112,7 @@ elseif ($action == 'specimen') // For contract
elseif ($action == 'set') elseif ($action == 'set')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} } elseif ($action == 'del')
elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
@@ -144,17 +137,13 @@ elseif ($action == 'setdoc')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} } elseif ($action == 'setmod')
elseif ($action == 'setmod')
{ {
// TODO Verifier si module numerotation choisi peut etre active // TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated // par appel methode canBeActivated
dolibarr_set_const($db, "HOLIDAY_ADDON", $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "HOLIDAY_ADDON", $value, 'chaine', 0, '', $conf->entity);
} } elseif ($action == 'set_other')
elseif ($action == 'set_other')
{ {
$freetext = GETPOST('HOLIDAY_FREE_TEXT', 'none'); // No alpha here, we want exact string $freetext = GETPOST('HOLIDAY_FREE_TEXT', 'none'); // No alpha here, we want exact string
$res1 = dolibarr_set_const($db, "HOLIDAY_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); $res1 = dolibarr_set_const($db, "HOLIDAY_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
@@ -167,8 +156,7 @@ elseif ($action == 'set_other')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -241,8 +229,7 @@ foreach ($dirmodels as $reldir)
// Show example of numbering model // Show example of numbering model
print '<td class="nowrap">'; print '<td class="nowrap">';
$tmp = $module->getExample(); $tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) { $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; } if (preg_match('/^Error/', $tmp)) { $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; } elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp; else print $tmp;
print '</td>'."\n"; print '</td>'."\n";
@@ -250,8 +237,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->HOLIDAY_ADDON == "$file") if ($conf->global->HOLIDAY_ADDON == "$file")
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>'; print '</a>';
@@ -326,8 +312,7 @@ if ($resql)
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -397,8 +382,7 @@ foreach ($dirmodels as $reldir)
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print '</td>'; print '</td>';
} } else {
else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -409,8 +393,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->HOLIDAY_ADDON_PDF == $name) if ($conf->global->HOLIDAY_ADDON_PDF == $name)
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@@ -441,8 +424,7 @@ foreach ($dirmodels as $reldir)
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>';
} } else {
else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }
print '</td>'; print '</td>';
@@ -492,8 +474,7 @@ $variablename = 'HOLIDAY_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} } else {
else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();

View File

@@ -189,20 +189,17 @@ if ($action == 'update')
if ($result > 0) if ($result > 0)
{ {
dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity);
} } elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result))
elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/', $result))
{ {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$tmparray = explode(':', $result); $tmparray = explode(':', $result);
setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors'); setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors');
} } else {
else {
$error++; $error++;
setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
} }
} } else {
else {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');

View File

@@ -76,8 +76,7 @@ if (empty($reshook))
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
$db->rollback(); $db->rollback();
dol_print_error($db); dol_print_error($db);
} }
@@ -213,8 +212,7 @@ print '<tr class="oddeven"><td>'.$langs->trans("LDAPServerPort").'</td><td>';
if (!empty($conf->global->LDAP_SERVER_PORT)) if (!empty($conf->global->LDAP_SERVER_PORT))
{ {
print '<input size="25" type="text" name="port" value="'.$conf->global->LDAP_SERVER_PORT.'">'; print '<input size="25" type="text" name="port" value="'.$conf->global->LDAP_SERVER_PORT.'">';
} } else {
else {
print '<input size="25" type="text" name="port" value="389">'; print '<input size="25" type="text" name="port" value="389">';
} }
print '</td><td>'.$langs->trans("LDAPServerPortExample").'</td></tr>'; print '</td><td>'.$langs->trans("LDAPServerPortExample").'</td></tr>';
@@ -246,8 +244,7 @@ print '<tr class="oddeven"><td>'.$langs->trans("LDAPPassword").'</td><td>';
if (!empty($conf->global->LDAP_ADMIN_PASS)) if (!empty($conf->global->LDAP_ADMIN_PASS))
{ {
print '<input size="25" type="password" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">'; // je le met en visible pour test print '<input size="25" type="password" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">'; // je le met en visible pour test
} } else {
else {
print '<input size="25" type="text" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">'; print '<input size="25" type="text" name="pass" value="'.$conf->global->LDAP_ADMIN_PASS.'">';
} }
print '</td><td>'.$langs->trans('Password').' (ex: secret)</td></tr>'; print '</td><td>'.$langs->trans('Password').' (ex: secret)</td></tr>';
@@ -292,16 +289,14 @@ if (function_exists("ldap_connect"))
print img_picto('', 'info').' '; print img_picto('', 'info').' ';
print '<font class="ok">'.$langs->trans("LDAPBindOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</font>'; print '<font class="ok">'.$langs->trans("LDAPBindOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</font>';
print '<br>'; print '<br>';
} } else {
else {
print img_picto('', 'error').' '; print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPBindKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</font>'; print '<font class="error">'.$langs->trans("LDAPBindKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).'</font>';
print '<br>'; print '<br>';
print $langs->trans("Error").' '.$ldap->error; print $langs->trans("Error").' '.$ldap->error;
print '<br>'; print '<br>';
} }
} } else {
else {
print img_picto('', 'warning').' '; print img_picto('', 'warning').' ';
print '<font class="warning">'.$langs->trans("LDAPNoUserOrPasswordProvidedAccessIsReadOnly").'</font>'; print '<font class="warning">'.$langs->trans("LDAPNoUserOrPasswordProvidedAccessIsReadOnly").'</font>';
print '<br>'; print '<br>';
@@ -314,16 +309,14 @@ if (function_exists("ldap_connect"))
print img_picto('', 'info').' '; print img_picto('', 'info').' ';
print '<font class="ok">'.$langs->trans("LDAPSetupForVersion3").'</font>'; print '<font class="ok">'.$langs->trans("LDAPSetupForVersion3").'</font>';
print '<br>'; print '<br>';
} } else {
else {
print img_picto('', 'info').' '; print img_picto('', 'info').' ';
print '<font class="ok">'.$langs->trans("LDAPSetupForVersion2").'</font>'; print '<font class="ok">'.$langs->trans("LDAPSetupForVersion2").'</font>';
print '<br>'; print '<br>';
} }
$unbind = $ldap->unbind(); $unbind = $ldap->unbind();
} } else {
else {
print img_picto('', 'error').' '; print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPTCPConnectKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).'</font>'; print '<font class="error">'.$langs->trans("LDAPTCPConnectKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).'</font>';
print '<br>'; print '<br>';

View File

@@ -78,8 +78,7 @@ if ($action == 'setvalue' && $user->admin)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
$db->rollback(); $db->rollback();
dol_print_error($db); dol_print_error($db);
} }
@@ -291,8 +290,7 @@ if (function_exists("ldap_connect"))
{ {
print img_picto('', 'info').' '; print img_picto('', 'info').' ';
print '<font class="ok">'.$langs->trans("LDAPSynchroOK").'</font><br>'; print '<font class="ok">'.$langs->trans("LDAPSynchroOK").'</font><br>';
} } else {
else {
print img_picto('', 'error').' '; print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions"); print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
print ': '.$ldap->error; print ': '.$ldap->error;
@@ -304,8 +302,7 @@ if (function_exists("ldap_connect"))
print "LDAP input file used for test:<br><br>\n"; print "LDAP input file used for test:<br><br>\n";
print nl2br($ldap->dump_content($dn, $info)); print nl2br($ldap->dump_content($dn, $info));
print "\n<br>"; print "\n<br>";
} } else {
else {
print img_picto('', 'error').' '; print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKO"); print '<font class="error">'.$langs->trans("LDAPSynchroKO");
print ': '.$ldap->error; print ': '.$ldap->error;

View File

@@ -70,8 +70,7 @@ if ($action == 'setvalue' && $user->admin)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
$db->rollback(); $db->rollback();
dol_print_error($db); dol_print_error($db);
} }
@@ -232,8 +231,7 @@ if (function_exists("ldap_connect"))
{ {
print img_picto('', 'info').' '; print img_picto('', 'info').' ';
print '<font class="ok">'.$langs->trans("LDAPSynchroOK").'</font><br>'; print '<font class="ok">'.$langs->trans("LDAPSynchroOK").'</font><br>';
} } else {
else {
print img_picto('', 'error').' '; print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions"); print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
print ': '.$ldap->error; print ': '.$ldap->error;
@@ -245,8 +243,7 @@ if (function_exists("ldap_connect"))
print "LDAP input file used for test:<br><br>\n"; print "LDAP input file used for test:<br><br>\n";
print nl2br($ldap->dump_content($dn, $info)); print nl2br($ldap->dump_content($dn, $info));
print "\n<br>"; print "\n<br>";
} } else {
else {
print img_picto('', 'error').' '; print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKO"); print '<font class="error">'.$langs->trans("LDAPSynchroKO");
print ': '.$ldap->error; print ': '.$ldap->error;

View File

@@ -95,8 +95,7 @@ if ($action == 'setvalue' && $user->admin)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
$db->rollback(); $db->rollback();
dol_print_error($db); dol_print_error($db);
} }
@@ -414,8 +413,7 @@ if (function_exists("ldap_connect"))
{ {
print img_picto('', 'info').' '; print img_picto('', 'info').' ';
print '<font class="ok">'.$langs->trans("LDAPSynchroOK").'</font><br>'; print '<font class="ok">'.$langs->trans("LDAPSynchroOK").'</font><br>';
} } else {
else {
print img_picto('', 'error').' '; print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions"); print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
print ': '.$ldap->error; print ': '.$ldap->error;
@@ -427,8 +425,7 @@ if (function_exists("ldap_connect"))
print "LDAP input file used for test:<br><br>\n"; print "LDAP input file used for test:<br><br>\n";
print nl2br($ldap->dump_content($dn, $info)); print nl2br($ldap->dump_content($dn, $info));
print "\n<br>"; print "\n<br>";
} } else {
else {
print img_picto('', 'error').' '; print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKO"); print '<font class="error">'.$langs->trans("LDAPSynchroKO");
print ': '.$ldap->error; print ': '.$ldap->error;

View File

@@ -68,8 +68,7 @@ if ($action == 'setvalue' && $user->admin)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
$db->rollback(); $db->rollback();
dol_print_error($db); dol_print_error($db);
} }
@@ -214,8 +213,7 @@ if (function_exists("ldap_connect"))
{ {
print img_picto('', 'info').' '; print img_picto('', 'info').' ';
print '<font class="ok">'.$langs->trans("LDAPSynchroOK").'</font><br>'; print '<font class="ok">'.$langs->trans("LDAPSynchroOK").'</font><br>';
} } else {
else {
print img_picto('', 'error').' '; print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions"); print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
print ': '.$ldap->error; print ': '.$ldap->error;
@@ -227,8 +225,7 @@ if (function_exists("ldap_connect"))
print "LDAP input file used for test:<br><br>\n"; print "LDAP input file used for test:<br><br>\n";
print nl2br($ldap->dump_content($dn, $info)); print nl2br($ldap->dump_content($dn, $info));
print "\n<br>"; print "\n<br>";
} } else {
else {
print img_picto('', 'error').' '; print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKO"); print '<font class="error">'.$langs->trans("LDAPSynchroKO");
print ': '.$ldap->error; print ': '.$ldap->error;

View File

@@ -89,8 +89,7 @@ if ($action == 'setvalue' && $user->admin)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
$db->rollback(); $db->rollback();
dol_print_error($db); dol_print_error($db);
} }
@@ -356,8 +355,7 @@ if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
$objectclass = $conf->global->LDAP_USER_OBJECT_CLASS; $objectclass = $conf->global->LDAP_USER_OBJECT_CLASS;
show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass); show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
} } elseif ($conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr')
elseif ($conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr')
{ {
$butlabel = $langs->trans("LDAPTestSearch"); $butlabel = $langs->trans("LDAPTestSearch");
$testlabel = 'testsearchuser'; $testlabel = 'testsearchuser';
@@ -394,8 +392,7 @@ if (function_exists("ldap_connect"))
{ {
print img_picto('', 'info').' '; print img_picto('', 'info').' ';
print '<font class="ok">'.$langs->trans("LDAPSynchroOK").'</font><br>'; print '<font class="ok">'.$langs->trans("LDAPSynchroOK").'</font><br>';
} } else {
else {
print img_picto('', 'error').' '; print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions"); print '<font class="error">'.$langs->trans("LDAPSynchroKOMayBePermissions");
print ': '.$ldap->error; print ': '.$ldap->error;
@@ -407,8 +404,7 @@ if (function_exists("ldap_connect"))
print "LDAP input file used for test:<br><br>\n"; print "LDAP input file used for test:<br><br>\n";
print nl2br($ldap->dump_content($dn, $info)); print nl2br($ldap->dump_content($dn, $info));
print "\n<br>"; print "\n<br>";
} } else {
else {
print img_picto('', 'error').' '; print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKO"); print '<font class="error">'.$langs->trans("LDAPSynchroKO");
print ': '.$ldap->error; print ': '.$ldap->error;
@@ -473,8 +469,7 @@ if (function_exists("ldap_connect"))
} }
$liste[$key] = $label; $liste[$key] = $label;
} }
} } else {
else {
setEventMessages($ldap->error, $ldap->errors, 'errors'); setEventMessages($ldap->error, $ldap->errors, 'errors');
} }
@@ -486,8 +481,7 @@ if (function_exists("ldap_connect"))
print "required_fields: ".implode(',', $required_fields)."<br>\n"; print "required_fields: ".implode(',', $required_fields)."<br>\n";
print "=> ".count($liste)." records<br>\n"; print "=> ".count($liste)." records<br>\n";
print "\n<br>"; print "\n<br>";
} } else {
else {
print img_picto('', 'error').' '; print img_picto('', 'error').' ';
print '<font class="error">'.$langs->trans("LDAPSynchroKO"); print '<font class="error">'.$langs->trans("LDAPSynchroKO");
print ': '.$ldap->error; print ': '.$ldap->error;

View File

@@ -162,8 +162,7 @@ if ($action == 'edit')
print '</form>'; print '</form>';
print '<br>'; print '<br>';
} } else {
else {
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
@@ -202,8 +201,7 @@ if (empty($mysoc->country_code))
$langs->load("errors"); $langs->load("errors");
$warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete")); $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"));
print '<br><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a>'; print '<br><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a>';
} } else {
else {
// Show examples // Show examples
print load_fiche_titre($langs->trans("ExamplesWithCurrentSetup"), '', ''); print load_fiche_titre($langs->trans("ExamplesWithCurrentSetup"), '', '');
@@ -250,8 +248,7 @@ else {
$vat_rates[$i] = $obj->vat_rate; $vat_rates[$i] = $obj->vat_rate;
} }
} }
} } else dol_print_error($db);
else dol_print_error($db);
if (count($vat_rates)) if (count($vat_rates))
{ {
@@ -267,8 +264,7 @@ else {
print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n"; print ' &nbsp; -> &nbsp; <span class="opacitymedium">'.$langs->trans("TotalPriceAfterRounding").":</span> ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
} }
} }
} } else {
else {
// More examples if not specific vat rate found // More examples if not specific vat rate found
// This example must be kept for test purpose with current value because value used (2/7, 10/3, and vat 0, 10) // This example must be kept for test purpose with current value because value used (2/7, 10/3, and vat 0, 10)
// were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule. // were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule.

View File

@@ -63,8 +63,7 @@ if ($action == 'updateMask')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -79,8 +78,7 @@ if ($action == 'set_DELIVERY_FREE_TEXT')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -116,13 +114,11 @@ if ($action == 'specimen')
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=livraison&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=livraison&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($module->error, $module->errors, 'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
@@ -236,8 +232,7 @@ foreach ($dirmodels as $reldir)
$tmp = $module->getExample(); $tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) { if (preg_match('/^Error/', $tmp)) {
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
} } elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp; else print $tmp;
print '</td>'."\n"; print '</td>'."\n";
@@ -245,8 +240,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->LIVRAISON_ADDON_NUMBER == "$file") if ($conf->global->LIVRAISON_ADDON_NUMBER == "$file")
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
} }
print '</td>'; print '</td>';
@@ -311,8 +305,7 @@ if ($resql)
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -377,8 +370,7 @@ foreach ($dirmodels as $reldir)
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print "</td>"; print "</td>";
} } else {
else {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -389,8 +381,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->LIVRAISON_ADDON_PDF == "$name") if ($conf->global->LIVRAISON_ADDON_PDF == "$name")
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@@ -409,8 +400,7 @@ foreach ($dirmodels as $reldir)
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'sending').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'sending').'</a>';
} } else {
else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }
print '</td>'; print '</td>';
@@ -453,8 +443,7 @@ $variablename = 'DELIVERY_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} } else {
else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();

View File

@@ -63,8 +63,7 @@ if ($action == 'update')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -106,8 +105,7 @@ foreach ($list as $key)
if (!empty($conf->accounting->enabled)) if (!empty($conf->accounting->enabled))
{ {
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
} } else {
else {
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">'; print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
} }
print '</td></tr>'; print '</td></tr>';

View File

@@ -65,8 +65,7 @@ if ($action == 'setvalue')
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
$db->rollback(); $db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }

View File

@@ -65,8 +65,7 @@ if ($action == 'update' || $action == 'add')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -98,8 +97,7 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && !empty($conf
{ {
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans("ErrorBadEMail", $email), null, 'errors'); setEventMessages($langs->trans("ErrorBadEMail", $email), null, 'errors');
} } else {
else {
include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php';
$mailmanspip = new MailmanSpip($db); $mailmanspip = new MailmanSpip($db);
@@ -116,8 +114,7 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && !empty($conf
{ {
$error++; $error++;
setEventMessages($mailmanspip->error, $mailmanspip->errors, 'errors'); setEventMessages($mailmanspip->error, $mailmanspip->errors, 'errors');
} } else {
else {
setEventMessages($langs->trans("MailmanCreationSuccess"), null); setEventMessages($langs->trans("MailmanCreationSuccess"), null);
} }
} }
@@ -128,8 +125,7 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && !empty($conf
{ {
$error++; $error++;
setEventMessages($mailmanspip->error, $mailmanspip->errors, 'errors'); setEventMessages($mailmanspip->error, $mailmanspip->errors, 'errors');
} } else {
else {
setEventMessages($langs->trans("MailmanDeletionSuccess"), null); setEventMessages($langs->trans("MailmanDeletionSuccess"), null);
} }
} }
@@ -207,8 +203,7 @@ if (!empty($conf->global->ADHERENT_USE_MAILMAN))
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>'; print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
print '</form>'; print '</form>';
} } else {
else {
dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user'); dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
$link = '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">'; $link = '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_MAILMAN">';

View File

@@ -169,8 +169,7 @@ if ($action == 'edit')
jQuery("#MAIN_MAIL_SMTP_PORT").hide(); jQuery("#MAIN_MAIL_SMTP_PORT").hide();
jQuery("#smtp_server_mess").show(); jQuery("#smtp_server_mess").show();
jQuery("#smtp_port_mess").show();'; jQuery("#smtp_port_mess").show();';
} } else {
else {
print ' print '
jQuery("#MAIN_MAIL_SMTP_SERVER").prop("disabled", true); jQuery("#MAIN_MAIL_SMTP_SERVER").prop("disabled", true);
jQuery("#MAIN_MAIL_SMTP_PORT").prop("disabled", true); jQuery("#MAIN_MAIL_SMTP_PORT").prop("disabled", true);
@@ -285,8 +284,7 @@ if ($action == 'edit')
if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity)) if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity))
{ {
print $form->selectarray('MAIN_MAIL_SENDMODE', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE); print $form->selectarray('MAIN_MAIL_SENDMODE', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE);
} } else {
else {
$text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE]; $text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE];
if (empty($text)) $text = $langs->trans("Undefined"); if (empty($text)) $text = $langs->trans("Undefined");
$htmltext = $langs->trans("ContactSuperAdminForChange"); $htmltext = $langs->trans("ContactSuperAdminForChange");
@@ -302,8 +300,7 @@ if ($action == 'edit')
print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
print '</td><td>'; print '</td><td>';
print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>'; print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
} } else {
else {
$mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : ''); $mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '');
$smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined"); $smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined");
if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
@@ -315,8 +312,7 @@ if ($action == 'edit')
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" size="18" value="'.$mainserver.'" autocomplete="off">'; print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" size="18" value="'.$mainserver.'" autocomplete="off">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_sav" name="MAIN_MAIL_SMTP_SERVER_sav" value="'.$mainserver.'">'; print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_sav" name="MAIN_MAIL_SMTP_SERVER_sav" value="'.$mainserver.'">';
print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>'; print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
} } else {
else {
$text = !empty($mainserver) ? $mainserver : $smtpserver; $text = !empty($mainserver) ? $mainserver : $smtpserver;
$htmltext = $langs->trans("ContactSuperAdminForChange"); $htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($text, $htmltext, 1, 'superadmin'); print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
@@ -332,8 +328,7 @@ if ($action == 'edit')
print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
print '</td><td>'; print '</td><td>';
print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>'; print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
} } else {
else {
$mainport = (!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : ''); $mainport = (!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '');
$smtpport = ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined"); $smtpport = ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined");
if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
@@ -345,8 +340,7 @@ if ($action == 'edit')
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT" name="MAIN_MAIL_SMTP_PORT" size="3" value="'.$mainport.'">'; print '<input class="flat" id="MAIN_MAIL_SMTP_PORT" name="MAIN_MAIL_SMTP_PORT" size="3" value="'.$mainport.'">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_sav" name="MAIN_MAIL_SMTP_PORT_sav" value="'.$mainport.'">'; print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_sav" name="MAIN_MAIL_SMTP_PORT_sav" value="'.$mainport.'">';
print '<span id="smtp_port_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>'; print '<span id="smtp_port_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
} } else {
else {
$text = (!empty($mainport) ? $mainport : $smtpport); $text = (!empty($mainport) ? $mainport : $smtpport);
$htmltext = $langs->trans("ContactSuperAdminForChange"); $htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($text, $htmltext, 1, 'superadmin'); print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
@@ -364,8 +358,7 @@ if ($action == 'edit')
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{ {
print '<input class="flat" name="MAIN_MAIL_SMTPS_ID" size="32" value="'.$mainstmpid.'">'; print '<input class="flat" name="MAIN_MAIL_SMTPS_ID" size="32" value="'.$mainstmpid.'">';
} } else {
else {
$htmltext = $langs->trans("ContactSuperAdminForChange"); $htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID, $htmltext, 1, 'superadmin'); print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID, $htmltext, 1, 'superadmin');
print '<input type="hidden" name="MAIN_MAIL_SMTPS_ID" value="'.$mainstmpid.'">'; print '<input type="hidden" name="MAIN_MAIL_SMTPS_ID" value="'.$mainstmpid.'">';
@@ -384,8 +377,7 @@ if ($action == 'edit')
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{ {
print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW" size="32" value="'.$mainsmtppw.'" autocomplete="off">'; print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW" size="32" value="'.$mainsmtppw.'" autocomplete="off">';
} } else {
else {
$htmltext = $langs->trans("ContactSuperAdminForChange"); $htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_PW, $htmltext, 1, 'superadmin'); print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_PW, $htmltext, 1, 'superadmin');
print '<input type="hidden" name="MAIN_MAIL_SMTPS_PW" value="'.$mainsmtppw.'">'; print '<input type="hidden" name="MAIN_MAIL_SMTPS_PW" value="'.$mainsmtppw.'">';
@@ -400,10 +392,8 @@ if ($action == 'edit')
if (function_exists('openssl_open')) if (function_exists('openssl_open'))
{ {
print $form->selectyesno('MAIN_MAIL_EMAIL_TLS', (!empty($conf->global->MAIN_MAIL_EMAIL_TLS) ? $conf->global->MAIN_MAIL_EMAIL_TLS : 0), 1); print $form->selectyesno('MAIN_MAIL_EMAIL_TLS', (!empty($conf->global->MAIN_MAIL_EMAIL_TLS) ? $conf->global->MAIN_MAIL_EMAIL_TLS : 0), 1);
} } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } else print yn(0).' ('.$langs->trans("NotSupported").')';
}
else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>'; print '</td></tr>';
// STARTTLS // STARTTLS
@@ -413,10 +403,8 @@ if ($action == 'edit')
if (function_exists('openssl_open')) if (function_exists('openssl_open'))
{ {
print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS', (!empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS : 0), 1); print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS', (!empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS : 0), 1);
} } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } else print yn(0).' ('.$langs->trans("NotSupported").')';
}
else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>'; print '</td></tr>';
// DKIM // DKIM
@@ -426,10 +414,8 @@ if ($action == 'edit')
if (function_exists('openssl_open')) if (function_exists('openssl_open'))
{ {
print $form->selectyesno('MAIN_MAIL_EMAIL_DKIM_ENABLED', (!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED : 0), 1); print $form->selectyesno('MAIN_MAIL_EMAIL_DKIM_ENABLED', (!empty($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED) ? $conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED : 0), 1);
} } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } else print yn(0).' ('.$langs->trans("NotSupported").')';
}
else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>'; print '</td></tr>';
// DKIM Domain // DKIM Domain
@@ -488,8 +474,7 @@ if ($action == 'edit')
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} } else {
else {
dol_fiche_head($head, 'common', '', -1); dol_fiche_head($head, 'common', '', -1);
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
@@ -529,8 +514,7 @@ else {
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail')) if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail'))
{ {
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td><span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span></td></tr>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td><span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span></td></tr>';
} } else {
else {
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '').'</td></tr>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '').'</td></tr>';
} }
@@ -538,8 +522,7 @@ else {
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail')) if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail'))
{ {
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td><span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span></td></tr>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td><span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span></td></tr>';
} } else {
else {
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '').'</td></tr>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '').'</td></tr>';
} }
@@ -562,10 +545,8 @@ else {
if (function_exists('openssl_open')) if (function_exists('openssl_open'))
{ {
print yn($conf->global->MAIN_MAIL_EMAIL_TLS); print yn($conf->global->MAIN_MAIL_EMAIL_TLS);
} } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } else print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
}
else print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
print '</td></tr>'; print '</td></tr>';
// STARTTLS // STARTTLS
@@ -575,10 +556,8 @@ else {
if (function_exists('openssl_open')) if (function_exists('openssl_open'))
{ {
print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS); print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS);
} } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } else print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
}
else print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
print '</td></tr>'; print '</td></tr>';
@@ -591,10 +570,8 @@ else {
if (function_exists('openssl_open')) if (function_exists('openssl_open'))
{ {
print yn($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED); print yn($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED);
} } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } else print yn(0).' ('.$langs->trans("NotSupported").')';
}
else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>'; print '</td></tr>';
// Domain // Domain
@@ -642,24 +619,20 @@ else {
} }
$i++; $i++;
} }
} } else dol_print_error($db);
else dol_print_error($db);
print '<tr class="oddeven"><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td>'; print '<tr class="oddeven"><td>'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').'</td>';
print '<td>'; print '<td>';
if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'robot') if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'robot')
{ {
print $langs->trans('RobotEmail'); print $langs->trans('RobotEmail');
} } elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user')
elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user')
{ {
print $langs->trans('UserEmail'); print $langs->trans('UserEmail');
} } elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'company')
elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'company')
{ {
print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>'); print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>');
} } else {
else {
$id = preg_replace('/senderprofile_/', '', $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE); $id = preg_replace('/senderprofile_/', '', $conf->global->MAIN_MAIL_DEFAULT_FROMTYPE);
if ($id > 0) if ($id > 0)
{ {
@@ -687,8 +660,7 @@ else {
{ {
print $conf->global->MAIN_MAIL_AUTOCOPY_TO; print $conf->global->MAIN_MAIL_AUTOCOPY_TO;
if (!isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail")); if (!isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail"));
} } else {
else {
print '&nbsp;'; print '&nbsp;';
} }
print '</td></tr>'; print '</td></tr>';
@@ -709,8 +681,7 @@ else {
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect#formmailbeforetitle">'.$langs->trans("DoTestServerAvailability").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect#formmailbeforetitle">'.$langs->trans("DoTestServerAvailability").'</a>';
} }
} } else {
else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>'; print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
} }

View File

@@ -156,8 +156,7 @@ if ($action == 'edit')
jQuery("#smtp_server_mess").show(); jQuery("#smtp_server_mess").show();
jQuery("#smtp_port_mess").show(); jQuery("#smtp_port_mess").show();
'; ';
} } else {
else {
print ' print '
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").prop("disabled", true); jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").prop("disabled", true);
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").prop("disabled", true); jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").prop("disabled", true);
@@ -235,8 +234,7 @@ if ($action == 'edit')
if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity)) if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity))
{ {
print $form->selectarray('MAIN_MAIL_SENDMODE_EMAILING', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE_EMAILING); print $form->selectarray('MAIN_MAIL_SENDMODE_EMAILING', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE_EMAILING);
} } else {
else {
$text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE_EMAILING]; $text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE_EMAILING];
if (empty($text)) $text = $langs->trans("Undefined"); if (empty($text)) $text = $langs->trans("Undefined");
$htmltext = $langs->trans("ContactSuperAdminForChange"); $htmltext = $langs->trans("ContactSuperAdminForChange");
@@ -253,8 +251,7 @@ if ($action == 'edit')
print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
print '</td><td>'; print '</td><td>';
print $langs->trans("SeeLocalSendMailSetup"); print $langs->trans("SeeLocalSendMailSetup");
} } else {
else {
$mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : ''); $mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : '');
$smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined"); $smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined");
if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
@@ -266,8 +263,7 @@ if ($action == 'edit')
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" size="18" value="'.$mainserver.'">'; print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" size="18" value="'.$mainserver.'">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" name="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" value="'.$mainserver.'">'; print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" name="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" value="'.$mainserver.'">';
print '<span id="smtp_server_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>'; print '<span id="smtp_server_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
} } else {
else {
$text = !empty($mainserver) ? $mainserver : $smtpserver; $text = !empty($mainserver) ? $mainserver : $smtpserver;
$htmltext = $langs->trans("ContactSuperAdminForChange"); $htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($text, $htmltext, 1, 'superadmin'); print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
@@ -284,8 +280,7 @@ if ($action == 'edit')
print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
print '</td><td>'; print '</td><td>';
print $langs->trans("SeeLocalSendMailSetup"); print $langs->trans("SeeLocalSendMailSetup");
} } else {
else {
$mainport = (!empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : ''); $mainport = (!empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : '');
$smtpport = ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined"); $smtpport = ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined");
if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
@@ -297,8 +292,7 @@ if ($action == 'edit')
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT_EMAILING" name="MAIN_MAIL_SMTP_PORT_EMAILING" size="3" value="'.$mainport.'">'; print '<input class="flat" id="MAIN_MAIL_SMTP_PORT_EMAILING" name="MAIN_MAIL_SMTP_PORT_EMAILING" size="3" value="'.$mainport.'">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_EMAILING_sav" name="MAIN_MAIL_SMTP_PORT_EMAILING_sav" value="'.$mainport.'">'; print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_EMAILING_sav" name="MAIN_MAIL_SMTP_PORT_EMAILING_sav" value="'.$mainport.'">';
print '<span id="smtp_port_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>'; print '<span id="smtp_port_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
} } else {
else {
$text = (!empty($mainport) ? $mainport : $smtpport); $text = (!empty($mainport) ? $mainport : $smtpport);
$htmltext = $langs->trans("ContactSuperAdminForChange"); $htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($text, $htmltext, 1, 'superadmin'); print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
@@ -316,8 +310,7 @@ if ($action == 'edit')
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{ {
print '<input class="flat" name="MAIN_MAIL_SMTPS_ID_EMAILING" size="32" value="'.$mainstmpid.'">'; print '<input class="flat" name="MAIN_MAIL_SMTPS_ID_EMAILING" size="32" value="'.$mainstmpid.'">';
} } else {
else {
$htmltext = $langs->trans("ContactSuperAdminForChange"); $htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING, $htmltext, 1, 'superadmin'); print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING, $htmltext, 1, 'superadmin');
print '<input type="hidden" name="MAIN_MAIL_SMTPS_ID_EMAILING" value="'.$mainstmpid.'">'; print '<input type="hidden" name="MAIN_MAIL_SMTPS_ID_EMAILING" value="'.$mainstmpid.'">';
@@ -334,8 +327,7 @@ if ($action == 'edit')
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity))
{ {
print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW_EMAILING" size="32" value="'.$mainsmtppw.'">'; print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW_EMAILING" size="32" value="'.$mainsmtppw.'">';
} } else {
else {
$htmltext = $langs->trans("ContactSuperAdminForChange"); $htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_PW_EMAILING, $htmltext, 1, 'superadmin'); print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_PW_EMAILING, $htmltext, 1, 'superadmin');
print '<input type="hidden" name="MAIN_MAIL_SMTPS_PW_EMAILING" value="'.$mainsmtppw.'">'; print '<input type="hidden" name="MAIN_MAIL_SMTPS_PW_EMAILING" value="'.$mainsmtppw.'">';
@@ -351,10 +343,8 @@ if ($action == 'edit')
if (function_exists('openssl_open')) if (function_exists('openssl_open'))
{ {
print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_EMAILING', (!empty($conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING) ? $conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING : 0), 1); print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_EMAILING', (!empty($conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING) ? $conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING : 0), 1);
} } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } else print yn(0).' ('.$langs->trans("NotSupported").')';
}
else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>'; print '</td></tr>';
// STARTTLS // STARTTLS
@@ -365,10 +355,8 @@ if ($action == 'edit')
if (function_exists('openssl_open')) if (function_exists('openssl_open'))
{ {
print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_EMAILING', (!empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING) ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING : 0), 1); print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_EMAILING', (!empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING) ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING : 0), 1);
} } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } else print yn(0).' ('.$langs->trans("NotSupported").')';
}
else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
@@ -382,8 +370,7 @@ if ($action == 'edit')
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} } else {
else {
dol_fiche_head($head, 'common_emailing', '', -1); dol_fiche_head($head, 'common_emailing', '', -1);
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n"; print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
@@ -405,8 +392,7 @@ else {
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail')) if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail'))
{ {
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>'; print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
} } else {
else {
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : '').'</td></tr>'; print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : '').'</td></tr>';
} }
@@ -414,8 +400,7 @@ else {
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail')) if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail'))
{ {
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>'; print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
} } else {
else {
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : '').'</td></tr>'; print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : '').'</td></tr>';
} }
@@ -438,10 +423,8 @@ else {
if (function_exists('openssl_open')) if (function_exists('openssl_open'))
{ {
print yn($conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING); print yn($conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING);
} } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } else print yn(0).' ('.$langs->trans("NotSupported").')';
}
else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>'; print '</td></tr>';
// STARTTLS // STARTTLS
@@ -451,10 +434,8 @@ else {
if (function_exists('openssl_open')) if (function_exists('openssl_open'))
{ {
print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING); print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING);
} } else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
else print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; } else print yn(0).' ('.$langs->trans("NotSupported").')';
}
else print yn(0).' ('.$langs->trans("NotSupported").')';
print '</td></tr>'; print '</td></tr>';
} }
@@ -495,8 +476,7 @@ else {
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect">'.$langs->trans("DoTestServerAvailability").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect">'.$langs->trans("DoTestServerAvailability").'</a>';
} }
} } else {
else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>'; print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
} }

View File

@@ -171,8 +171,7 @@ if (empty($reshook))
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error").' '.$db->lasterror(), null, 'errors'); setEventMessages($langs->trans("Error").' '.$db->lasterror(), null, 'errors');
} }
} }
@@ -281,8 +280,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit)))
{ {
$num = $nbtotalofrecords; $num = $nbtotalofrecords;
} } else {
else {
if ($limit) $sql .= $db->plimit($limit + 1, $offset); if ($limit) $sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);
@@ -449,8 +447,7 @@ foreach ($object->fields as $key => $val)
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
elseif (strpos($val['type'], 'integer:') === 0) { elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
print '</td>'; print '</td>';
} }
} }

View File

@@ -122,8 +122,7 @@ if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
$helpsubstit .= $key.' -> '.$val.'<br>'; $helpsubstit .= $key.' -> '.$val.'<br>';
$helpsubstitforlines .= $key.' -> '.$val.'<br>'; $helpsubstitforlines .= $key.' -> '.$val.'<br>';
} }
} } else {
else {
$tmp = FormMail::getAvailableSubstitKey('formemailwithlines'); $tmp = FormMail::getAvailableSubstitKey('formemailwithlines');
$tmp['__(AnyTranslationKey)__'] = 'Translation'; $tmp['__(AnyTranslationKey)__'] = 'Translation';
$helpsubstit = $langs->trans("AvailableVariables").':<br>'; $helpsubstit = $langs->trans("AvailableVariables").':<br>';
@@ -277,11 +276,9 @@ if (empty($reshook))
elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work
elseif ($keycode == 'content') { elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
} } elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
$sql .= (int) GETPOST($keycode, 'int'); $sql .= (int) GETPOST($keycode, 'int');
} } else {
else {
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
} }
@@ -295,12 +292,10 @@ if (empty($reshook))
{ {
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
$_POST = array('id'=>$id); // Clean $_POST array, we keep only id $_POST = array('id'=>$id); // Clean $_POST array, we keep only id
} } else {
else {
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -335,11 +330,9 @@ if (empty($reshook))
elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work
elseif ($keycode == 'content') { elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
} } elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
$sql .= (int) GETPOST($keycode, 'int'); $sql .= (int) GETPOST($keycode, 'int');
} } else {
else {
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
} }
@@ -353,8 +346,7 @@ if (empty($reshook))
if ($resql) if ($resql)
{ {
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($db->error(), null, 'errors'); setEventMessages($db->error(), null, 'errors');
} }
} }
@@ -373,8 +365,7 @@ if (empty($reshook))
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
{ {
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -501,8 +492,7 @@ foreach ($fieldlist as $field => $value)
{ {
if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover
} } else print $valuetoshow;
else print $valuetoshow;
print '</td>'; print '</td>';
} }
} }
@@ -569,11 +559,9 @@ foreach ($fieldsforcontent as $tmpfieldlist)
// Input field // Input field
if ($tmpfieldlist == 'topic') { if ($tmpfieldlist == 'topic') {
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">'; print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
} } elseif ($tmpfieldlist == 'joinfiles') {
elseif ($tmpfieldlist == 'joinfiles') {
print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="'.(isset($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '1').'">'; print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'" value="'.(isset($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '1').'">';
} } else {
else {
if ($context != 'hide') { if ($context != 'hide') {
// print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>'; // print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
$okforextended = true; $okforextended = true;
@@ -581,8 +569,7 @@ foreach ($fieldsforcontent as $tmpfieldlist)
$okforextended = false; $okforextended = false;
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%'); $doleditor = new DolEditor($tmpfieldlist, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
} } else print '&nbsp;';
else print '&nbsp;';
} }
print '</td>'; print '</td>';
if ($tmpfieldlist == 'topic') { if ($tmpfieldlist == 'topic') {
@@ -654,8 +641,7 @@ if ($resql)
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth100'); print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth100');
print '</td>'; print '</td>';
} } elseif ($value == 'fk_user')
elseif ($value == 'fk_user')
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
$restrictid = array(); $restrictid = array();
@@ -663,13 +649,11 @@ if ($resql)
//var_dump($restrictid); //var_dump($restrictid);
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth100'); print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth100');
print '</td>'; print '</td>';
} } elseif ($value == 'topic') print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
elseif ($value == 'topic') print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
elseif ($value == 'type_template') elseif ($value == 'type_template')
{ {
print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100 maxwidth100onsmartphone').'</td>'; print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100 maxwidth100onsmartphone').'</td>';
} } elseif (!in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
elseif (!in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
} }
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>'; if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
// Action column // Action column
@@ -795,8 +779,7 @@ if ($resql)
} }
print "</tr>\n"; print "</tr>\n";
} } else {
else {
$keyforobj = 'type_template'; $keyforobj = 'type_template';
if (!in_array($obj->$keyforobj, array_keys($elementList))) if (!in_array($obj->$keyforobj, array_keys($elementList)))
{ {
@@ -938,8 +921,7 @@ if ($resql)
$i++; $i++;
} }
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -981,22 +963,19 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
if ($user->admin) if ($user->admin)
{ {
print $form->select_dolusers($obj->{$fieldlist[$field]}, 'fk_user', 1, null, 0, '', null, 0, 0, 1, '', 0, '', 'maxwidth200'); print $form->select_dolusers($obj->{$fieldlist[$field]}, 'fk_user', 1, null, 0, '', null, 0, 0, 1, '', 0, '', 'maxwidth200');
} } else {
else {
if ($context == 'add') // I am not admin and we show the add form if ($context == 'add') // I am not admin and we show the add form
{ {
print $user->getNomUrl(1); // Me print $user->getNomUrl(1); // Me
$forcedvalue = $user->id; $forcedvalue = $user->id;
} } else {
else {
if ($obj && !empty($obj->{$fieldlist[$field]}) && $obj->{$fieldlist[$field]} > 0) if ($obj && !empty($obj->{$fieldlist[$field]}) && $obj->{$fieldlist[$field]} > 0)
{ {
$fuser = new User($db); $fuser = new User($db);
$fuser->fetch($obj->{$fieldlist[$field]}); $fuser->fetch($obj->{$fieldlist[$field]});
print $fuser->getNomUrl(1); print $fuser->getNomUrl(1);
$forcedvalue = $fuser->id; $forcedvalue = $fuser->id;
} } else {
else {
$forcedvalue = $obj->{$fieldlist[$field]}; $forcedvalue = $obj->{$fieldlist[$field]};
} }
} }
@@ -1004,8 +983,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '<input type="hidden" value="'.$forcedvalue.'" name="'.$keyname.'">'; print '<input type="hidden" value="'.$forcedvalue.'" name="'.$keyname.'">';
} }
print '</td>'; print '</td>';
} } elseif ($fieldlist[$field] == 'lang')
elseif ($fieldlist[$field] == 'lang')
{ {
print '<td>'; print '<td>';
if (!empty($conf->global->MAIN_MULTILANGS)) if (!empty($conf->global->MAIN_MULTILANGS))
@@ -1013,8 +991,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
$selectedlang = GETPOSTISSET('langcode') ?GETPOST('langcode', 'aZ09') : $langs->defaultlang; $selectedlang = GETPOSTISSET('langcode') ?GETPOST('langcode', 'aZ09') : $langs->defaultlang;
if ($context == 'edit') $selectedlang = $obj->{$fieldlist[$field]}; if ($context == 'edit') $selectedlang = $obj->{$fieldlist[$field]};
print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150'); print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150');
} } else {
else {
if (!empty($obj->{$fieldlist[$field]})) if (!empty($obj->{$fieldlist[$field]}))
{ {
print $obj->{$fieldlist[$field]}.' - '.$langs->trans('Language_'.$obj->{$fieldlist[$field]}); print $obj->{$fieldlist[$field]}.' - '.$langs->trans('Language_'.$obj->{$fieldlist[$field]});
@@ -1034,13 +1011,11 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
// Current tempalte type is an unknown type, so we must keep it as it is. // Current tempalte type is an unknown type, so we must keep it as it is.
print '<input type="hidden" name="type_template" value="'.$obj->{$fieldlist[$field]}.'">'; print '<input type="hidden" name="type_template" value="'.$obj->{$fieldlist[$field]}.'">';
print $obj->{$fieldlist[$field]}; print $obj->{$fieldlist[$field]};
} } else {
else {
print $form->selectarray('type_template', $elementList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth150 maxwidth100onsmartphone'); print $form->selectarray('type_template', $elementList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth150 maxwidth100onsmartphone');
} }
print '</td>'; print '</td>';
} } elseif ($context == 'add' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
elseif ($context == 'add' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
elseif ($context == 'edit' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue; elseif ($context == 'edit' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
elseif ($context == 'hide' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue; elseif ($context == 'hide' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
else { else {
@@ -1059,13 +1034,11 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
if (empty($user->admin)) if (empty($user->admin))
{ {
print $form->selectyesno($fieldlist[$field], '1', 1); print $form->selectyesno($fieldlist[$field], '1', 1);
} } else {
else {
//print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="1" name="'.$fieldlist[$field].'">'; //print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="1" name="'.$fieldlist[$field].'">';
print $form->selectyesno($fieldlist[$field], (isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1); print $form->selectyesno($fieldlist[$field], (isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1);
} }
} } else {
else {
print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">'; print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
} }
print '</td>'; print '</td>';

View File

@@ -96,8 +96,7 @@ if ($action == 'update' && !$cancel)
if ($result > 0) if ($result > 0)
{ {
$db->commit(); $db->commit();
} } else {
else {
$error++; $error++;
setEventMessages($langs->trans("FailedToInitializeMenu").' '.$key, null, 'errors'); setEventMessages($langs->trans("FailedToInitializeMenu").' '.$key, null, 'errors');
$db->rollback(); $db->rollback();

View File

@@ -124,8 +124,7 @@ if ($action == 'update')
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler); header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
exit; exit;
} } else {
else {
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler); header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
exit; exit;
} }
@@ -214,8 +213,7 @@ if ($action == 'add')
if (is_numeric(GETPOST('menuId', 'alpha', 3))) if (is_numeric(GETPOST('menuId', 'alpha', 3)))
{ {
$menu->fk_menu = GETPOST('menuId', 'alpha', 3); $menu->fk_menu = GETPOST('menuId', 'alpha', 3);
} } else {
else {
if (GETPOST('type', 'alpha') == 'top') $menu->fk_menu = 0; if (GETPOST('type', 'alpha') == 'top') $menu->fk_menu = 0;
else $menu->fk_menu = -1; else $menu->fk_menu = -1;
$menu->fk_mainmenu = $mainmenu; $menu->fk_mainmenu = $mainmenu;
@@ -227,8 +225,7 @@ if ($action == 'add')
{ {
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".GETPOST('menu_handler', 'aZ09')); header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".GETPOST('menu_handler', 'aZ09'));
exit; exit;
} } else {
else {
$action = 'create'; $action = 'create';
setEventMessages($menu->error, $menu->errors, 'errors'); setEventMessages($menu->error, $menu->errors, 'errors');
} }
@@ -251,8 +248,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == 'yes')
setEventMessages($langs->trans("MenuDeleted"), null, 'mesgs'); setEventMessages($langs->trans("MenuDeleted"), null, 'mesgs');
llxFooter(); llxFooter();
exit; exit;
} } else {
else {
$this->db->rollback(); $this->db->rollback();
$reload = 0; $reload = 0;
@@ -348,8 +344,7 @@ if ($action == 'create')
{ {
print $langs->trans('Left'); print $langs->trans('Left');
print '<input type="hidden" name="type" value="left">'; print '<input type="hidden" name="type" value="left">';
} } else {
else {
print '<select name="type" class="flat" id="topleft">'; print '<select name="type" class="flat" id="topleft">';
print '<option value="">&nbsp;</option>'; print '<option value="">&nbsp;</option>';
print '<option value="top"'.($_POST["type"] && $_POST["type"] == 'top' ? ' selected' : '').'>'.$langs->trans('Top').'</option>'; print '<option value="top"'.($_POST["type"] && $_POST["type"] == 'top' ? ' selected' : '').'>'.$langs->trans('Top').'</option>';
@@ -370,8 +365,7 @@ if ($action == 'create')
if ($parent_rowid) if ($parent_rowid)
{ {
print '<td>'.$parent_rowid.'<input type="hidden" name="menuId" value="'.$parent_rowid.'"></td>'; print '<td>'.$parent_rowid.'<input type="hidden" name="menuId" value="'.$parent_rowid.'"></td>';
} } else {
else {
print '<td><input type="text" class="minwidth300" id="menuId" name="menuId" value="'.(GETPOST("menuId", 'int') ?GETPOST("menuId", 'int') : '').'"></td>'; print '<td><input type="text" class="minwidth300" id="menuId" name="menuId" value="'.(GETPOST("menuId", 'int') ?GETPOST("menuId", 'int') : '').'"></td>';
} }
print '<td>'.$langs->trans('DetailMenuIdParent'); print '<td>'.$langs->trans('DetailMenuIdParent');
@@ -413,8 +407,7 @@ if ($action == 'create')
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} } elseif ($action == 'edit')
elseif ($action == 'edit')
{ {
print load_fiche_titre($langs->trans("ModifMenu"), '', 'title_setup'); print load_fiche_titre($langs->trans("ModifMenu"), '', 'title_setup');
print '<br>'; print '<br>';

View File

@@ -118,9 +118,7 @@ if ($action == 'up')
$sql .= " WHERE m.rowid = ".$previous['rowid']; // Descend celui du dessus $sql .= " WHERE m.rowid = ".$previous['rowid']; // Descend celui du dessus
dol_syslog("admin/menus/index.php ".$sql); dol_syslog("admin/menus/index.php ".$sql);
$db->query($sql); $db->query($sql);
} } elseif ($action == 'down')
elseif ($action == 'down')
{ {
$current = array(); $current = array();
$next = array(); $next = array();
@@ -174,9 +172,7 @@ elseif ($action == 'down')
$sql .= " WHERE m.rowid = ".$next['rowid']; $sql .= " WHERE m.rowid = ".$next['rowid'];
dol_syslog("admin/menus/index.php ".$sql); dol_syslog("admin/menus/index.php ".$sql);
$db->query($sql); $db->query($sql);
} } elseif ($action == 'confirm_delete' && $confirm == 'yes')
elseif ($action == 'confirm_delete' && $confirm == 'yes')
{ {
$db->begin(); $db->begin();
@@ -191,8 +187,7 @@ elseif ($action == 'confirm_delete' && $confirm == 'yes')
header("Location: ".DOL_URL_ROOT.'/admin/menus/index.php?menu_handler='.$menu_handler); header("Location: ".DOL_URL_ROOT.'/admin/menus/index.php?menu_handler='.$menu_handler);
exit; exit;
} } else {
else {
$db->rollback(); $db->rollback();
$reload = 0; $reload = 0;
@@ -407,8 +402,7 @@ if ($conf->use_javascript_ajax)
} }
print '</div>'; print '</div>';
} } else {
else {
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans("ErrorFeatureNeedJavascript"), null, 'errors'); setEventMessages($langs->trans("ErrorFeatureNeedJavascript"), null, 'errors');
} }

View File

@@ -41,8 +41,7 @@ if ($action == 'activate_hidemenu')
dolibarr_set_const($db, "MAIN_MENU_HIDE_UNAUTHORIZED", '1', 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MENU_HIDE_UNAUTHORIZED", '1', 'chaine', 0, '', $conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } elseif ($action == 'disable_hidemenu')
elseif ($action == 'disable_hidemenu')
{ {
dolibarr_del_const($db, "MAIN_MENU_HIDE_UNAUTHORIZED", $conf->entity); dolibarr_del_const($db, "MAIN_MENU_HIDE_UNAUTHORIZED", $conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
@@ -94,8 +93,7 @@ print '<td class="center">';
if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED))
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=activate_hidemenu">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=activate_hidemenu">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_hidemenu">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_hidemenu">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>';
} }
print "</td>"; print "</td>";

View File

@@ -139,8 +139,7 @@ foreach ($modulesdir as $dir)
if ($publisher) if ($publisher)
{ {
$arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher; $arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher;
} } else {
else {
$arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers"); $arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers");
} }
} }
@@ -178,19 +177,15 @@ foreach ($modulesdir as $dir)
else $categ[$specialstring] = 1; else $categ[$specialstring] = 1;
$j++; $j++;
$i++; $i++;
} } else dol_syslog("Module ".get_class($objMod)." not qualified");
else dol_syslog("Module ".get_class($objMod)." not qualified"); } catch (Exception $e)
}
catch (Exception $e)
{ {
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
} }
} } else {
else {
print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>"; print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
} }
} } catch (Exception $e)
catch (Exception $e)
{ {
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
} }
@@ -198,8 +193,7 @@ foreach ($modulesdir as $dir)
} }
} }
closedir($handle); closedir($handle);
} } else {
else {
dol_syslog("htdocs/admin/modulehelp.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING); dol_syslog("htdocs/admin/modulehelp.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING);
} }
} }
@@ -327,8 +321,7 @@ if ($mode == 'desc')
if (!empty($objMod->editor_url) && !preg_match('/dolibarr\.org/i', $objMod->editor_url)) $textexternal .= ($objMod->editor_name != 'dolibarr' ? ' - ' : '').img_picto('', 'globe').' <a href="'.$editor_url.'" target="_blank">'.$objMod->editor_url.'</a>'; if (!empty($objMod->editor_url) && !preg_match('/dolibarr\.org/i', $objMod->editor_url)) $textexternal .= ($objMod->editor_name != 'dolibarr' ? ' - ' : '').img_picto('', 'globe').' <a href="'.$editor_url.'" target="_blank">'.$objMod->editor_url.'</a>';
$text .= $textexternal; $text .= $textexternal;
$text .= '<br>'; $text .= '<br>';
} } else {
else {
$text .= '<br><span class="opacitymedium">'.$langs->trans("Origin").':</span> '.$langs->trans("Core").'<br>'; $text .= '<br><span class="opacitymedium">'.$langs->trans("Origin").':</span> '.$langs->trans("Core").'<br>';
} }
@@ -359,8 +352,7 @@ if ($mode == 'feature')
$i++; $i++;
} }
$text .= ')'; $text .= ')';
} } else $text .= $langs->trans("No");
else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
@@ -373,8 +365,7 @@ if ($mode == 'feature')
$text .= ($i ? ', ' : '').$val; $text .= ($i ? ', ' : '').$val;
$i++; $i++;
} }
} } else $text .= $langs->trans("No");
else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
@@ -383,8 +374,7 @@ if ($mode == 'feature')
if (dol_is_file($filedata)) if (dol_is_file($filedata))
{ {
$text .= $langs->trans("Yes").' ('.$moduledir.'/sql/data.sql)'; $text .= $langs->trans("Yes").' ('.$moduledir.'/sql/data.sql)';
} } else $text .= $langs->trans("No");
else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
@@ -402,8 +392,7 @@ if ($mode == 'feature')
$i++; $i++;
} }
} }
} } else $text .= $langs->trans("No");
else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
@@ -411,8 +400,7 @@ if ($mode == 'feature')
if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models']) if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models'])
{ {
$text .= $langs->trans("Yes"); $text .= $langs->trans("Yes");
} } else $text .= $langs->trans("No");
else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
@@ -420,8 +408,7 @@ if ($mode == 'feature')
if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions']) if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions'])
{ {
$text .= $langs->trans("Yes"); $text .= $langs->trans("Yes");
} } else $text .= $langs->trans("No");
else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
@@ -434,8 +421,7 @@ if ($mode == 'feature')
$text .= ($i ? ', ' : '').($val['label']); $text .= ($i ? ', ' : '').($val['label']);
$i++; $i++;
} }
} } else $text .= $langs->trans("No");
else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
@@ -444,8 +430,7 @@ if ($mode == 'feature')
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers']) if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
{ {
$yesno = 'Yes'; $yesno = 'Yes';
} } else {
else {
$yesno = 'No'; $yesno = 'No';
} }
require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
@@ -473,8 +458,7 @@ if ($mode == 'feature')
$text .= ($i ? ', ' : '').($val['file'] ? $val['file'] : $val[0]); $text .= ($i ? ', ' : '').($val['file'] ? $val['file'] : $val[0]);
$i++; $i++;
} }
} } else $text .= $langs->trans("No");
else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
@@ -504,8 +488,7 @@ if ($mode == 'feature')
$text .= ($i ? ', ' : '').($val); $text .= ($i ? ', ' : '').($val);
$i++; $i++;
} }
} } else $text .= $langs->trans("No");
else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
@@ -518,8 +501,7 @@ if ($mode == 'feature')
$text .= ($i ? ', ' : '').($val[1]); $text .= ($i ? ', ' : '').($val[1]);
$i++; $i++;
} }
} } else $text .= $langs->trans("No");
else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
@@ -527,8 +509,7 @@ if ($mode == 'feature')
if (isset($objMod->menu) && !empty($objMod->menu)) // objMod can be an array or just an int 1 if (isset($objMod->menu) && !empty($objMod->menu)) // objMod can be an array or just an int 1
{ {
$text .= $langs->trans("Yes"); $text .= $langs->trans("Yes");
} } else $text .= $langs->trans("No");
else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
@@ -541,8 +522,7 @@ if ($mode == 'feature')
$text .= ($i ? ', ' : '').($val); $text .= ($i ? ', ' : '').($val);
$i++; $i++;
} }
} } else $text .= $langs->trans("No");
else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';
@@ -555,8 +535,7 @@ if ($mode == 'feature')
$text .= ($i ? ', ' : '').($val); $text .= ($i ? ', ' : '').($val);
$i++; $i++;
} }
} } else $text .= $langs->trans("No");
else $text .= $langs->trans("No");
$text .= '<br>'; $text .= '<br>';

View File

@@ -125,8 +125,7 @@ if ($action == 'install')
$langs->load("Error"); $langs->load("Error");
setEventMessages($langs->trans("ErrorModuleFileRequired"), null, 'warnings'); setEventMessages($langs->trans("ErrorModuleFileRequired"), null, 'warnings');
$error++; $error++;
} } else {
else {
if (!$error && !preg_match('/\.zip$/i', $original_file)) if (!$error && !preg_match('/\.zip$/i', $original_file))
{ {
$langs->load("errors"); $langs->load("errors");
@@ -172,8 +171,7 @@ if ($action == 'install')
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans($result['error'], $original_file), null, 'errors'); setEventMessages($langs->trans($result['error'], $original_file), null, 'errors');
$error++; $error++;
} } else {
else {
// Now we move the dir of the module // Now we move the dir of the module
$modulename = preg_replace('/module_/', '', $original_file); $modulename = preg_replace('/module_/', '', $original_file);
$modulename = preg_replace('/\-([0-9][0-9\.]*)\.zip$/i', '', $modulename); $modulename = preg_replace('/\-([0-9][0-9\.]*)\.zip$/i', '', $modulename);
@@ -228,8 +226,7 @@ if ($action == 'install')
} }
} }
} }
} } else {
else {
setEventMessages($langs->trans("ErrorFailToRenameFile", $_FILES['fileinstall']['tmp_name'], $newfile), null, 'errors'); setEventMessages($langs->trans("ErrorFailToRenameFile", $_FILES['fileinstall']['tmp_name'], $newfile), null, 'errors');
$error++; $error++;
} }
@@ -260,14 +257,12 @@ if ($action == 'set' && $user->admin)
$msg = $langs->trans('ModuleEnabledAdminMustCheckRights'); $msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
setEventMessages($msg, null, 'warnings'); setEventMessages($msg, null, 'warnings');
} }
} } else dol_print_error($db);
else dol_print_error($db);
} }
} }
header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : '')); header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
exit; exit;
} } elseif ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes')
elseif ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes')
{ {
$result = unActivateModule($value); $result = unActivateModule($value);
if ($result) setEventMessages($result, null, 'errors'); if ($result) setEventMessages($result, null, 'errors');
@@ -370,8 +365,7 @@ foreach ($modulesdir as $dir)
if ($publisher) if ($publisher)
{ {
$arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher; $arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher;
} } else {
else {
$arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers"); $arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers");
} }
} }
@@ -424,19 +418,15 @@ foreach ($modulesdir as $dir)
else $categ[$specialstring] = 1; else $categ[$specialstring] = 1;
$j++; $j++;
$i++; $i++;
} } else dol_syslog("Module ".get_class($objMod)." not qualified");
else dol_syslog("Module ".get_class($objMod)." not qualified"); } catch (Exception $e)
}
catch (Exception $e)
{ {
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
} }
} } else {
else {
print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>"; print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
} }
} } catch (Exception $e)
catch (Exception $e)
{ {
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
} }
@@ -444,8 +434,7 @@ foreach ($modulesdir as $dir)
} }
} }
closedir($handle); closedir($handle);
} } else {
else {
dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING); dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING);
} }
} }
@@ -698,8 +687,7 @@ if ($mode == 'common' || $mode == 'commonkanban')
if (!empty($objMod->disabled)) if (!empty($objMod->disabled))
{ {
$codeenabledisable .= $langs->trans("Disabled"); $codeenabledisable .= $langs->trans("Disabled");
} } elseif (!empty($objMod->always_enabled) || ((!empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity != 1)))
elseif (!empty($objMod->always_enabled) || ((!empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity != 1)))
{ {
if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) $codeenabledisable .= $langs->trans("Used"); if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) $codeenabledisable .= $langs->trans("Used");
else { else {
@@ -707,14 +695,12 @@ if ($mode == 'common' || $mode == 'commonkanban')
//print $langs->trans("Required"); //print $langs->trans("Required");
} }
if (!empty($conf->multicompany->enabled) && $user->entity) $disableSetup++; if (!empty($conf->multicompany->enabled) && $user->entity) $disableSetup++;
} } else {
else {
if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) { if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
$codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;module_position='.$module_position.'&amp;action=reset_confirm&amp;confirm_message_code='.$objMod->warnings_unactivation[$mysoc->country_code].'&amp;value='.$modName.'&amp;mode='.$mode.$param.'">'; $codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;module_position='.$module_position.'&amp;action=reset_confirm&amp;confirm_message_code='.$objMod->warnings_unactivation[$mysoc->country_code].'&amp;value='.$modName.'&amp;mode='.$mode.$param.'">';
$codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on'); $codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on');
$codeenabledisable .= '</a>'; $codeenabledisable .= '</a>';
} } else {
else {
$codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;module_position='.$module_position.'&amp;action=reset&amp;value='.$modName.'&amp;mode='.$mode.'&amp;confirm=yes'.$param.'">'; $codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;module_position='.$module_position.'&amp;action=reset&amp;value='.$modName.'&amp;mode='.$mode.'&amp;confirm=yes'.$param.'">';
$codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on'); $codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on');
$codeenabledisable .= '</a>'; $codeenabledisable .= '</a>';
@@ -742,44 +728,36 @@ if ($mode == 'common' || $mode == 'commonkanban')
{ {
$codetoconfig .= '<a href="'.$urlpage.'" title="'.$langs->trans($page).'">'.img_picto(ucfirst($page), "setup").'</a>'; $codetoconfig .= '<a href="'.$urlpage.'" title="'.$langs->trans($page).'">'.img_picto(ucfirst($page), "setup").'</a>';
// print '<a href="'.$page.'">'.ucfirst($page).'</a>&nbsp;'; // print '<a href="'.$page.'">'.ucfirst($page).'</a>&nbsp;';
} } else {
else {
if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs))
{ {
$urltouse = dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1); $urltouse = dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1);
$codetoconfig .= '<a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>'; $codetoconfig .= '<a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>';
} } else {
else {
$urltouse = $urlpage; $urltouse = $urlpage;
$codetoconfig .= '<a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>'; $codetoconfig .= '<a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>';
} }
} }
} }
} } elseif (preg_match('/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs))
elseif (preg_match('/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs))
{ {
$codetoconfig .= '<a class="valignmiddle" href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1).'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>'; $codetoconfig .= '<a class="valignmiddle" href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1).'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>';
} } else {
else {
$codetoconfig .= '<a class="valignmiddle" href="'.$objMod->config_page_url.'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>'; $codetoconfig .= '<a class="valignmiddle" href="'.$objMod->config_page_url.'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>';
} }
} } else {
else {
$codetoconfig .= img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"', false, 0, 0, '', 'fa-15'); $codetoconfig .= img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"', false, 0, 0, '', 'fa-15');
} }
} } else // Module not yet activated
else // Module not yet activated
{ {
// Set $codeenabledisable // Set $codeenabledisable
if (!empty($objMod->always_enabled)) if (!empty($objMod->always_enabled))
{ {
// Should never happened // Should never happened
} } elseif (!empty($objMod->disabled))
elseif (!empty($objMod->disabled))
{ {
$codeenabledisable .= $langs->trans("Disabled"); $codeenabledisable .= $langs->trans("Disabled");
} } else {
else {
// Module qualified for activation // Module qualified for activation
$warningmessage = ''; $warningmessage = '';
if (!empty($arrayofwarnings[$modName])) if (!empty($arrayofwarnings[$modName]))
@@ -842,8 +820,7 @@ if ($mode == 'common' || $mode == 'commonkanban')
{ {
if (preg_match('/^\//i', $objMod->picto)) print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly"', 1); if (preg_match('/^\//i', $objMod->picto)) print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly"', 1);
else print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly"'); else print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly"');
} } else {
else {
print img_object($alttext, 'generic', 'class="valignmiddle paddingrightonly"'); print img_object($alttext, 'generic', 'class="valignmiddle paddingrightonly"');
} }
print ' <span class="valignmiddle">'.$objMod->getName().'</span>'; print ' <span class="valignmiddle">'.$objMod->getName().'</span>';
@@ -1012,8 +989,7 @@ if ($mode == 'deploy')
{ {
$message = info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); $message = info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
$allowfromweb = -1; $allowfromweb = -1;
} } else {
else {
if ($dirins_ok) if ($dirins_ok)
{ {
if (!is_writable(dol_osencode($dirins))) if (!is_writable(dol_osencode($dirins)))
@@ -1022,14 +998,12 @@ if ($mode == 'deploy')
$message = info_admin($langs->trans("ErrorFailedToWriteInDir", $dirins), 0, 0, '1', 'warning'); $message = info_admin($langs->trans("ErrorFailedToWriteInDir", $dirins), 0, 0, '1', 'warning');
$allowfromweb = 0; $allowfromweb = 0;
} }
} } else {
else {
$message = info_admin($langs->trans("NotExistsDirect", $dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); $message = info_admin($langs->trans("NotExistsDirect", $dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
$allowfromweb = 0; $allowfromweb = 0;
} }
} }
} } else {
else {
$message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.'/installmodules.lock')); $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.'/installmodules.lock'));
$allowfromweb = 0; $allowfromweb = 0;
} }
@@ -1049,8 +1023,7 @@ if ($mode == 'deploy')
if ($allowfromweb == 1) if ($allowfromweb == 1)
{ {
//print $langs->trans("ThisIsProcessToFollow").'<br>'; //print $langs->trans("ThisIsProcessToFollow").'<br>';
} } else {
else {
print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>'; print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
print '<b>'.$langs->trans("StepNb", 1).'</b>: '; print '<b>'.$langs->trans("StepNb", 1).'</b>: ';
print $langs->trans("FindPackageFromWebSite", $fullurl).'<br>'; print $langs->trans("FindPackageFromWebSite", $fullurl).'<br>';
@@ -1130,8 +1103,7 @@ if ($mode == 'deploy')
print ' '; print ' ';
print info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow, $maxphptoshowparam), 1); print info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow, $maxphptoshowparam), 1);
} }
} } else {
else {
print ' ('.$langs->trans("UploadDisabled").')'; print ' ('.$langs->trans("UploadDisabled").')';
} }
@@ -1141,8 +1113,7 @@ if ($mode == 'deploy')
print '<br>'; print '<br>';
print '<div class="center"><div class="logo_setup"></div></div>'; print '<div class="center"><div class="logo_setup"></div></div>';
} } else {
else {
print $langs->trans("UnpackPackageInModulesRoot", $dirins).'<br>'; print $langs->trans("UnpackPackageInModulesRoot", $dirins).'<br>';
print '<b>'.$langs->trans("StepNb", 4).'</b>: '; print '<b>'.$langs->trans("StepNb", 4).'</b>: ';
print $langs->trans("SetupIsReadyForUse").'<br>'; print $langs->trans("SetupIsReadyForUse").'<br>';

View File

@@ -58,13 +58,10 @@ if ($action == 'updateMask')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'specimen')
elseif ($action == 'specimen')
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@@ -95,13 +92,11 @@ elseif ($action == 'specimen')
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=mrp&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=mrp&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($module->error, null, 'errors'); setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
@@ -111,9 +106,7 @@ elseif ($action == 'specimen')
elseif ($action == 'set') elseif ($action == 'set')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} } elseif ($action == 'del')
elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
@@ -138,17 +131,13 @@ elseif ($action == 'setdoc')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} } elseif ($action == 'setmod')
elseif ($action == 'setmod')
{ {
// TODO Check if numbering module chosen can be activated // TODO Check if numbering module chosen can be activated
// by calling method canBeActivated // by calling method canBeActivated
dolibarr_set_const($db, "MRP_MO_ADDON", $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MRP_MO_ADDON", $value, 'chaine', 0, '', $conf->entity);
} } elseif ($action == 'set_MRP_MO_DRAFT_WATERMARK')
elseif ($action == 'set_MRP_MO_DRAFT_WATERMARK')
{ {
$draft = GETPOST("MRP_MO_DRAFT_WATERMARK"); $draft = GETPOST("MRP_MO_DRAFT_WATERMARK");
$res = dolibarr_set_const($db, "MRP_MO_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MRP_MO_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
@@ -158,13 +147,10 @@ elseif ($action == 'set_MRP_MO_DRAFT_WATERMARK')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'set_MRP_MO_FREE_TEXT')
elseif ($action == 'set_MRP_MO_FREE_TEXT')
{ {
$freetext = GETPOST("MRP_MO_FREE_TEXT", 'none'); // No alpha here, we want exact string $freetext = GETPOST("MRP_MO_FREE_TEXT", 'none'); // No alpha here, we want exact string
@@ -175,8 +161,7 @@ elseif ($action == 'set_MRP_MO_FREE_TEXT')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -257,8 +242,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->MRP_MO_ADDON == $file) if ($conf->global->MRP_MO_ADDON == $file)
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>'; print '</a>';
@@ -322,8 +306,7 @@ if ($resql)
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -392,8 +375,7 @@ foreach ($dirmodels as $reldir)
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print '</td>'; print '</td>';
} } else {
else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -404,8 +386,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->MRP_MO_ADDON_PDF == $name) if ($conf->global->MRP_MO_ADDON_PDF == $name)
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@@ -433,8 +414,7 @@ foreach ($dirmodels as $reldir)
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
} } else {
else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }
print '</td>'; print '</td>';
@@ -479,8 +459,7 @@ $variablename = 'MRP_MO_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} } else {
else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();

View File

@@ -53,8 +53,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0) if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -65,8 +64,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
if (dolibarr_del_const($db, $code, 0) > 0) if (dolibarr_del_const($db, $code, 0) > 0)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -94,11 +92,9 @@ if ($action == 'add_currency')
{ {
if ($currency->addRate($rate)) setEventMessages($langs->trans('RecordSaved'), array()); if ($currency->addRate($rate)) setEventMessages($langs->trans('RecordSaved'), array());
else setEventMessages($langs->trans('ErrorAddRateFail'), array(), 'errors'); else setEventMessages($langs->trans('ErrorAddRateFail'), array(), 'errors');
} } else setEventMessages($langs->trans('ErrorAddCurrencyFail'), $currency->errors, 'errors');
else setEventMessages($langs->trans('ErrorAddCurrencyFail'), $currency->errors, 'errors');
} }
} } elseif ($action == 'update_currency')
elseif ($action == 'update_currency')
{ {
$error = 0; $error = 0;
@@ -123,8 +119,7 @@ elseif ($action == 'update_currency')
} }
} }
} }
} } elseif (GETPOST('deletecurrency', 'alpha'))
elseif (GETPOST('deletecurrency', 'alpha'))
{ {
$fk_multicurrency = GETPOST('fk_multicurrency', 'int'); $fk_multicurrency = GETPOST('fk_multicurrency', 'int');
$currency = new MultiCurrency($db); $currency = new MultiCurrency($db);
@@ -135,16 +130,14 @@ elseif ($action == 'update_currency')
else setEventMessages($langs->trans('ErrorDeleteCurrencyFail'), array(), 'errors'); else setEventMessages($langs->trans('ErrorDeleteCurrencyFail'), array(), 'errors');
} }
} }
} } elseif ($action == 'setapilayer')
elseif ($action == 'setapilayer')
{ {
if (GETPOSTISSET('modify_apilayer')) if (GETPOSTISSET('modify_apilayer'))
{ {
dolibarr_set_const($db, 'MULTICURRENCY_APP_ID', GETPOST('MULTICURRENCY_APP_ID', 'alpha')); dolibarr_set_const($db, 'MULTICURRENCY_APP_ID', GETPOST('MULTICURRENCY_APP_ID', 'alpha'));
dolibarr_set_const($db, 'MULTICURRENCY_APP_SOURCE', GETPOST('MULTICURRENCY_APP_SOURCE', 'alpha')); dolibarr_set_const($db, 'MULTICURRENCY_APP_SOURCE', GETPOST('MULTICURRENCY_APP_SOURCE', 'alpha'));
//dolibarr_set_const($db, 'MULTICURRENCY_ALTERNATE_SOURCE', GETPOST('MULTICURRENCY_ALTERNATE_SOURCE', 'alpha')); //dolibarr_set_const($db, 'MULTICURRENCY_ALTERNATE_SOURCE', GETPOST('MULTICURRENCY_ALTERNATE_SOURCE', 'alpha'));
} } else {
else {
$result = MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID); $result = MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID);
if ($result > 0) { if ($result > 0) {
setEventMessages($langs->trans("CurrencyRateSyncSucceed"), null, "mesgs"); setEventMessages($langs->trans("CurrencyRateSyncSucceed"), null, "mesgs");

View File

@@ -84,8 +84,7 @@ if ($action == 'settemplates')
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
$db->rollback(); $db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
@@ -105,8 +104,7 @@ if ($action == 'setvalue' && $user->admin)
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
$db->rollback(); $db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
@@ -138,8 +136,7 @@ if ($action == 'setfixednotif' && $user->admin)
$newkey = 'NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.((int) GETPOST($shortkey.'_amount')); $newkey = 'NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.((int) GETPOST($shortkey.'_amount'));
$newval = GETPOST($shortkey.'_key'); $newval = GETPOST($shortkey.'_key');
//print $newkey.' - '.$newval.'<br>'; //print $newkey.' - '.$newval.'<br>';
} } elseif (preg_match('/^NOTIF_(.*)_new_key/', $key, $reg))
elseif (preg_match('/^NOTIF_(.*)_new_key/', $key, $reg))
{ {
// Add a new entry // Add a new entry
$newkey = 'NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.((int) GETPOST($shortkey.'_amount')); $newkey = 'NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.((int) GETPOST($shortkey.'_amount'));
@@ -158,8 +155,7 @@ if ($action == 'setfixednotif' && $user->admin)
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
$db->rollback(); $db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');

View File

@@ -119,8 +119,7 @@ foreach ($list as $key)
print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>'; print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
print '<td><input style="width: 80%" type"text" name="uri'.$key[0].'" value="'.$redirect_uri.'">'; print '<td><input style="width: 80%" type"text" name="uri'.$key[0].'" value="'.$redirect_uri.'">';
print '</td></tr>'; print '</td></tr>';
} } else {
else {
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>'; print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
print '<td>'.$langs->trans("FeatureNotYetSupported").'</td>'; print '<td>'.$langs->trans("FeatureNotYetSupported").'</td>';

View File

@@ -78,8 +78,7 @@ if ($action == 'setconst' && $user->admin)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null); setEventMessages($langs->trans("SetupSaved"), null);
} } else {
else {
$db->rollback(); $db->rollback();
dol_print_error($db); dol_print_error($db);
} }
@@ -97,8 +96,7 @@ if ($action == 'setvalue' && $user->admin)
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null); setEventMessages($langs->trans("SetupSaved"), null);
} } else {
else {
$db->rollback(); $db->rollback();
dol_print_error($db); dol_print_error($db);
} }
@@ -151,8 +149,7 @@ if ($mode == 'setup' && $user->admin)
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltocheckperms = 'https://github.com/settings/applications/'; $urltocheckperms = 'https://github.com/settings/applications/';
} } elseif ($key[0] == 'OAUTH_GOOGLE_NAME')
elseif ($key[0] == 'OAUTH_GOOGLE_NAME')
{ {
$OAUTH_SERVICENAME = 'Google'; $OAUTH_SERVICENAME = 'Google';
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service). // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
@@ -162,22 +159,19 @@ if ($mode == 'setup' && $user->admin)
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltocheckperms = 'https://security.google.com/settings/security/permissions'; $urltocheckperms = 'https://security.google.com/settings/security/permissions';
} } elseif ($key[0] == 'OAUTH_STRIPE_TEST_NAME')
elseif ($key[0] == 'OAUTH_STRIPE_TEST_NAME')
{ {
$OAUTH_SERVICENAME = 'StripeTest'; $OAUTH_SERVICENAME = 'StripeTest';
$urltorenew = $urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltorenew = $urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = ''; $urltodelete = '';
$urltocheckperms = ''; $urltocheckperms = '';
} } elseif ($key[0] == 'OAUTH_STRIPE_LIVE_NAME')
elseif ($key[0] == 'OAUTH_STRIPE_LIVE_NAME')
{ {
$OAUTH_SERVICENAME = 'StripeLive'; $OAUTH_SERVICENAME = 'StripeLive';
$urltorenew = $urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltorenew = $urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = ''; $urltodelete = '';
$urltocheckperms = ''; $urltocheckperms = '';
} } else {
else {
$urltorenew = ''; $urltorenew = '';
$urltodelete = ''; $urltodelete = '';
$urltocheckperms = ''; $urltocheckperms = '';
@@ -193,8 +187,7 @@ if ($mode == 'setup' && $user->admin)
$storage = new DoliStorage($db, $conf); $storage = new DoliStorage($db, $conf);
try { try {
$tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
} } catch (Exception $e)
catch (Exception $e)
{ {
// Return an error if token not found // Return an error if token not found
} }
@@ -217,12 +210,10 @@ if ($mode == 'setup' && $user->admin)
if ($endoflife == $tokenobj::EOL_NEVER_EXPIRES) if ($endoflife == $tokenobj::EOL_NEVER_EXPIRES)
{ {
$expiredat = $langs->trans("Never"); $expiredat = $langs->trans("Never");
} } elseif ($endoflife == $tokenobj::EOL_UNKNOWN)
elseif ($endoflife == $tokenobj::EOL_UNKNOWN)
{ {
$expiredat = $langs->trans("Unknown"); $expiredat = $langs->trans("Unknown");
} } else {
else {
$expiredat = dol_print_date($endoflife, "dayhour"); $expiredat = dol_print_date($endoflife, "dayhour");
} }
} }
@@ -367,8 +358,7 @@ if ($mode == 'test' && $user->admin)
} else { } else {
setEventMessages($printer->error, $printer->errors, 'errors'); setEventMessages($printer->error, $printer->errors, 'errors');
} }
} } else {
else {
print $langs->trans('PleaseConfigureDriverfromList'); print $langs->trans('PleaseConfigureDriverfromList');
} }
} }

View File

@@ -56,8 +56,7 @@ if ($action == 'updateMask')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -182,8 +181,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->PAYMENT_ADDON == $file || $conf->global->PAYMENT_ADDON.'.php' == $file) if ($conf->global->PAYMENT_ADDON == $file || $conf->global->PAYMENT_ADDON.'.php' == $file)
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
} }
print '</td>'; print '</td>';

View File

@@ -92,8 +92,7 @@ if ($action == 'activate_pdfsecurity')
dolibarr_set_const($db, "PDF_SECURITY_ENCRYPTION", "1", 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "PDF_SECURITY_ENCRYPTION", "1", 'chaine', 0, '', $conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit; exit;
} } elseif ($action == 'disable_pdfsecurity')
elseif ($action == 'disable_pdfsecurity')
{ {
dolibarr_del_const($db, "PDF_SECURITY_ENCRYPTION", $conf->entity); dolibarr_del_const($db, "PDF_SECURITY_ENCRYPTION", $conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
@@ -189,8 +188,7 @@ for ($i = 1; $i <= 6; $i++)
{ {
$pid = $langs->transcountry("ProfId".$i, $mysoc->country_code); $pid = $langs->transcountry("ProfId".$i, $mysoc->country_code);
if ($pid == '-') $pid = false; if ($pid == '-') $pid = false;
} } else {
else {
$pid = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>'; $pid = img_warning().' <font class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</font>';
} }
if ($pid) if ($pid)

View File

@@ -229,8 +229,7 @@ if ($result)
print '<td class="center">'; print '<td class="center">';
print img_picto($langs->trans("Active"), 'tick'); print img_picto($langs->trans("Active"), 'tick');
print '</td>'; print '</td>';
} } else {
else {
print '<td>'; print '<td>';
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&amp;action=add">'.img_edit_add().'</a>'; print '<a class="reposition" href="perms.php?pid='.$obj->id.'&amp;action=add">'.img_edit_add().'</a>';
print '</td>'; print '</td>';
@@ -246,8 +245,7 @@ if ($result)
$i++; $i++;
} }
} } else dol_print_error($db);
else dol_print_error($db);
print '</table>'; print '</table>';
print '</div>'; print '</div>';

View File

@@ -70,8 +70,7 @@ if ($action == "set")
$res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
*/ */
} } else $error++;
else $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!$res > 0) $error++;
@@ -100,8 +99,7 @@ if ($action == "set")
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
$db->rollback(); $db->rollback();
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }

View File

@@ -63,12 +63,10 @@ if ($action == 'updateMask')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'specimen')
elseif ($action == 'specimen')
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@@ -99,18 +97,15 @@ elseif ($action == 'specimen')
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=propal&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=propal&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($module->error, $module->errors, 'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} } elseif ($action == 'setribchq')
elseif ($action == 'setribchq')
{ {
$rib = GETPOST('rib', 'alpha'); $rib = GETPOST('rib', 'alpha');
$chq = GETPOST('chq', 'alpha'); $chq = GETPOST('chq', 'alpha');
@@ -123,12 +118,10 @@ elseif ($action == 'setribchq')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'set_PROPALE_DRAFT_WATERMARK')
elseif ($action == 'set_PROPALE_DRAFT_WATERMARK')
{ {
$draft = GETPOST('PROPALE_DRAFT_WATERMARK', 'alpha'); $draft = GETPOST('PROPALE_DRAFT_WATERMARK', 'alpha');
@@ -138,12 +131,10 @@ elseif ($action == 'set_PROPALE_DRAFT_WATERMARK')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'set_PROPOSAL_FREE_TEXT')
elseif ($action == 'set_PROPOSAL_FREE_TEXT')
{ {
$freetext = GETPOST('PROPOSAL_FREE_TEXT', 'none'); // No alpha here, we want exact string $freetext = GETPOST('PROPOSAL_FREE_TEXT', 'none'); // No alpha here, we want exact string
@@ -154,12 +145,10 @@ elseif ($action == 'set_PROPOSAL_FREE_TEXT')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'setdefaultduration')
elseif ($action == 'setdefaultduration')
{ {
$res = dolibarr_set_const($db, "PROPALE_VALIDITY_DURATION", $value, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PROPALE_VALIDITY_DURATION", $value, 'chaine', 0, '', $conf->entity);
@@ -168,13 +157,10 @@ elseif ($action == 'setdefaultduration')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL')
elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL')
{ {
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL", $value, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL", $value, 'chaine', 0, '', $conf->entity);
@@ -183,8 +169,7 @@ elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -192,17 +177,14 @@ elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL')
elseif ($action == 'set') elseif ($action == 'set')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} } elseif ($action == 'del')
elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
{ {
if ($conf->global->PROPALE_ADDON_PDF == "$value") dolibarr_del_const($db, 'PROPALE_ADDON_PDF', $conf->entity); if ($conf->global->PROPALE_ADDON_PDF == "$value") dolibarr_del_const($db, 'PROPALE_ADDON_PDF', $conf->entity);
} }
} } elseif ($action == 'setdoc')
elseif ($action == 'setdoc')
{ {
if (dolibarr_set_const($db, "PROPALE_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) if (dolibarr_set_const($db, "PROPALE_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity))
{ {
@@ -215,9 +197,7 @@ elseif ($action == 'setdoc')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} } elseif ($action == 'setmod')
elseif ($action == 'setmod')
{ {
// TODO Verifier si module numerotation choisi peut etre active // TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated // par appel methode canBeActivated
@@ -302,8 +282,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->PROPALE_ADDON == "$file") if ($conf->global->PROPALE_ADDON == "$file")
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>'; print '</a>';
@@ -367,8 +346,7 @@ if ($resql)
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -438,8 +416,7 @@ foreach ($dirmodels as $reldir)
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print '</td>'; print '</td>';
} } else {
else {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -450,8 +427,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->PROPALE_ADDON_PDF == "$name") if ($conf->global->PROPALE_ADDON_PDF == "$name")
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@@ -484,8 +460,7 @@ foreach ($dirmodels as $reldir)
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
} } else {
else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }
print '</td>'; print '</td>';
@@ -558,17 +533,14 @@ if (empty($conf->facture->enabled))
$i++; $i++;
} }
print "</select>"; print "</select>";
} } else {
else {
print "<i>".$langs->trans("NoActiveBankAccountDefined")."</i>"; print "<i>".$langs->trans("NoActiveBankAccountDefined")."</i>";
} }
} }
} } else {
else {
print '<span class="opacitymedium">'.$langs->trans("BankModuleNotActive").'</span>'; print '<span class="opacitymedium">'.$langs->trans("BankModuleNotActive").'</span>';
} }
} } else {
else {
print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>'; print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>';
} }
print "</td></tr>"; print "</td></tr>";
@@ -605,8 +577,7 @@ if (empty($conf->facture->enabled))
} }
} }
print "</select>"; print "</select>";
} } else {
else {
print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>'; print '<span class="opacitymedium">'.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).'</span>';
} }
print "</td></tr>"; print "</td></tr>";
@@ -670,8 +641,7 @@ $variablename = 'PROPOSAL_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} } else {
else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();

View File

@@ -89,8 +89,7 @@ if ($action == 'addprinter' && $user->admin) {
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("PrinterAdded", $printername), null); setEventMessages($langs->trans("PrinterAdded", $printername), null);
} } else {
else {
$db->rollback(); $db->rollback();
dol_print_error($db); dol_print_error($db);
} }
@@ -114,8 +113,7 @@ if ($action == 'deleteprinter' && $user->admin) {
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("PrinterDeleted", $printername), null); setEventMessages($langs->trans("PrinterDeleted", $printername), null);
} } else {
else {
$db->rollback(); $db->rollback();
dol_print_error($db); dol_print_error($db);
} }

View File

@@ -74,9 +74,7 @@ if ($action == 'updateMask')
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
else setEventMessages($langs->trans("Error"), null, 'errors'); else setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'set_param')
elseif ($action == 'set_param')
{ {
$freetext = GETPOST('RECEPTION_FREE_TEXT', 'none'); // No alpha here, we want exact string $freetext = GETPOST('RECEPTION_FREE_TEXT', 'none'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "RECEPTION_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "RECEPTION_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
@@ -98,9 +96,7 @@ elseif ($action == 'set_param')
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
} } elseif ($action == 'specimen')
elseif ($action == 'specimen')
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@@ -131,13 +127,11 @@ elseif ($action == 'specimen')
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=reception&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=reception&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($module->error, $module->errors, 'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
@@ -147,9 +141,7 @@ elseif ($action == 'specimen')
elseif ($action == 'set') elseif ($action == 'set')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} } elseif ($action == 'del')
elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
@@ -174,9 +166,7 @@ elseif ($action == 'setdoc')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} } elseif ($action == 'setmodel')
elseif ($action == 'setmodel')
{ {
dolibarr_set_const($db, "RECEPTION_ADDON_NUMBER", $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "RECEPTION_ADDON_NUMBER", $value, 'chaine', 0, '', $conf->entity);
} }
@@ -251,8 +241,7 @@ foreach ($dirmodels as $reldir)
$tmp = $module->getExample(); $tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) { if (preg_match('/^Error/', $tmp)) {
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
} } elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp; else print $tmp;
print '</td>'."\n"; print '</td>'."\n";
@@ -260,8 +249,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->RECEPTION_ADDON_NUMBER == "$file") if ($conf->global->RECEPTION_ADDON_NUMBER == "$file")
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$file.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmodel&amp;value='.$file.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Disabled"), 'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>'; print '</a>';
@@ -327,8 +315,7 @@ if ($resql)
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -396,8 +383,7 @@ foreach ($dirmodels as $reldir)
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print '</td>'; print '</td>';
} } else {
else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -408,8 +394,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->RECEPTION_ADDON_PDF == $name) if ($conf->global->RECEPTION_ADDON_PDF == $name)
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@@ -439,8 +424,7 @@ foreach ($dirmodels as $reldir)
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'reception').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'reception').'</a>';
} } else {
else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }
print '</td>'; print '</td>';

View File

@@ -91,8 +91,7 @@ if (empty($conf->use_javascript_ajax))
print '<td class="nowrap right" colspan="2">'; print '<td class="nowrap right" colspan="2">';
print $langs->trans("NotAvailableWhenAjaxDisabled"); print $langs->trans("NotAvailableWhenAjaxDisabled");
print '</td>'; print '</td>';
} } else {
else {
print '<td width="60" class="right">'; print '<td width="60" class="right">';
$arrval = array( $arrval = array(
'0'=>$langs->trans("No"), '0'=>$langs->trans("No"),

View File

@@ -45,8 +45,7 @@ if ($action == 'setgeneraterule')
if (!dolibarr_set_const($db, 'USER_PASSWORD_GENERATED', $_GET["value"], 'chaine', 0, '', $conf->entity)) if (!dolibarr_set_const($db, 'USER_PASSWORD_GENERATED', $_GET["value"], 'chaine', 0, '', $conf->entity))
{ {
dol_print_error($db); dol_print_error($db);
} } else {
else {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
@@ -90,8 +89,7 @@ if ($action == 'activate_encrypt')
$i++; $i++;
} }
} }
} } else dol_print_error($db);
else dol_print_error($db);
//print $error." ".$sql; //print $error." ".$sql;
//exit; //exit;
@@ -100,13 +98,11 @@ if ($action == 'activate_encrypt')
$db->commit(); $db->commit();
header("Location: security.php"); header("Location: security.php");
exit; exit;
} } else {
else {
$db->rollback(); $db->rollback();
dol_print_error($db, ''); dol_print_error($db, '');
} }
} } elseif ($action == 'disable_encrypt')
elseif ($action == 'disable_encrypt')
{ {
//On n'autorise pas l'annulation de l'encryption car les mots de passe ne peuvent pas etre decodes //On n'autorise pas l'annulation de l'encryption car les mots de passe ne peuvent pas etre decodes
//Do not allow "disable encryption" as passwords cannot be decrypted //Do not allow "disable encryption" as passwords cannot be decrypted
@@ -129,12 +125,10 @@ if ($action == 'activate_encryptdbpassconf')
//dolibarr_set_const($db, "MAIN_DATABASE_PWD_CONFIG_ENCRYPTED", "1"); //dolibarr_set_const($db, "MAIN_DATABASE_PWD_CONFIG_ENCRYPTED", "1");
header("Location: security.php"); header("Location: security.php");
exit; exit;
} } else {
else {
setEventMessages($langs->trans('InstrucToEncodePass', dol_encode($dolibarr_main_db_pass)), null, 'warnings'); setEventMessages($langs->trans('InstrucToEncodePass', dol_encode($dolibarr_main_db_pass)), null, 'warnings');
} }
} } elseif ($action == 'disable_encryptdbpassconf')
elseif ($action == 'disable_encryptdbpassconf')
{ {
$result = encodedecode_dbpassconf(0); $result = encodedecode_dbpassconf(0);
if ($result > 0) if ($result > 0)
@@ -145,8 +139,7 @@ elseif ($action == 'disable_encryptdbpassconf')
//dolibarr_del_const($db, "MAIN_DATABASE_PWD_CONFIG_ENCRYPTED",$conf->entity); //dolibarr_del_const($db, "MAIN_DATABASE_PWD_CONFIG_ENCRYPTED",$conf->entity);
header("Location: security.php"); header("Location: security.php");
exit; exit;
} } else {
else {
setEventMessages($langs->trans('InstrucToClearPass', $dolibarr_main_db_pass), null, 'warnings'); setEventMessages($langs->trans('InstrucToClearPass', $dolibarr_main_db_pass), null, 'warnings');
} }
} }
@@ -156,8 +149,7 @@ if ($action == 'activate_MAIN_SECURITY_DISABLEFORGETPASSLINK')
dolibarr_set_const($db, "MAIN_SECURITY_DISABLEFORGETPASSLINK", '1', 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SECURITY_DISABLEFORGETPASSLINK", '1', 'chaine', 0, '', $conf->entity);
header("Location: security.php"); header("Location: security.php");
exit; exit;
} } elseif ($action == 'disable_MAIN_SECURITY_DISABLEFORGETPASSLINK')
elseif ($action == 'disable_MAIN_SECURITY_DISABLEFORGETPASSLINK')
{ {
dolibarr_del_const($db, "MAIN_SECURITY_DISABLEFORGETPASSLINK", $conf->entity); dolibarr_del_const($db, "MAIN_SECURITY_DISABLEFORGETPASSLINK", $conf->entity);
header("Location: security.php"); header("Location: security.php");
@@ -264,8 +256,7 @@ foreach ($arrayhandler as $key => $module)
// Show example of numbering module // Show example of numbering module
print '<td class="nowrap">'; print '<td class="nowrap">';
$tmp = $module->getExample(); $tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) { $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; } if (preg_match('/^Error/', $tmp)) { $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; } elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp; else print $tmp;
print '</td>'."\n"; print '</td>'."\n";
@@ -273,8 +264,7 @@ foreach ($arrayhandler as $key => $module)
if ($conf->global->USER_PASSWORD_GENERATED == $key) if ($conf->global->USER_PASSWORD_GENERATED == $key)
{ {
print img_picto('', 'tick'); print img_picto('', 'tick');
} } else {
else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setgeneraterule&amp;value='.$key.'">'.$langs->trans("Activate").'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=setgeneraterule&amp;value='.$key.'">'.$langs->trans("Activate").'</a>';
} }
print "</td></tr>\n"; print "</td></tr>\n";
@@ -430,8 +420,7 @@ if (!empty($conf->global->DATABASE_PWD_ENCRYPTED))
//On n'autorise pas l'annulation de l'encryption car les mots de passe ne peuvent pas etre decodes //On n'autorise pas l'annulation de l'encryption car les mots de passe ne peuvent pas etre decodes
//Do not allow "disable encryption" as passwords cannot be decrypted //Do not allow "disable encryption" as passwords cannot be decrypted
print '<a href="security.php?action=disable_encrypt">'.$langs->trans("Disable").'</a>'; print '<a href="security.php?action=disable_encrypt">'.$langs->trans("Disable").'</a>';
} } else {
else {
print '-'; print '-';
} }
print "</td>"; print "</td>";
@@ -456,8 +445,7 @@ if (empty($dolibarr_main_db_pass) && empty($dolibarr_main_db_encrypted_pass))
{ {
$langs->load("errors"); $langs->load("errors");
print img_warning($langs->trans("WarningPassIsEmpty")); print img_warning($langs->trans("WarningPassIsEmpty"));
} } else {
else {
if (empty($dolibarr_main_db_encrypted_pass)) if (empty($dolibarr_main_db_encrypted_pass))
{ {
print '<a href="security.php?action=activate_encryptdbpassconf">'.$langs->trans("Activate").'</a>'; print '<a href="security.php?action=activate_encryptdbpassconf">'.$langs->trans("Activate").'</a>';
@@ -508,8 +496,7 @@ if (GETPOST('info', 'int') > 0)
if (function_exists('password_hash')) if (function_exists('password_hash'))
{ {
print $langs->trans("Note: The function password_hash exists on your PHP")."<br>\n"; print $langs->trans("Note: The function password_hash exists on your PHP")."<br>\n";
} } else {
else {
print $langs->trans("Note: The function password_hash does not exists on your PHP")."<br>\n"; print $langs->trans("Note: The function password_hash does not exists on your PHP")."<br>\n";
} }
print 'MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO."<br>\n"; print 'MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO."<br>\n";

View File

@@ -50,8 +50,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
{ {
Header("Location: ".$_SERVER["PHP_SELF"]); Header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} elseif (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) { } elseif (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
@@ -60,13 +59,10 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
{ {
Header("Location: ".$_SERVER["PHP_SELF"]); Header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} } elseif ($action == 'updateform')
elseif ($action == 'updateform')
{ {
$res1 = dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", GETPOST("MAIN_APPLICATION_TITLE", 'alphanohtml'), 'chaine', 0, '', $conf->entity); $res1 = dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", GETPOST("MAIN_APPLICATION_TITLE", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
$res2 = dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", GETPOST("MAIN_SESSION_TIMEOUT", 'alphanohtml'), 'chaine', 0, '', $conf->entity); $res2 = dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", GETPOST("MAIN_SESSION_TIMEOUT", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
@@ -116,18 +112,15 @@ if (function_exists("imagecreatefrompng"))
if (!empty($conf->use_javascript_ajax)) if (!empty($conf->use_javascript_ajax))
{ {
print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA'); print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA');
} } else {
else {
if (empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) if (empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_MAIN_SECURITY_ENABLECAPTCHA">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_MAIN_SECURITY_ENABLECAPTCHA">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} } else {
else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_MAIN_SECURITY_ENABLECAPTCHA">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_MAIN_SECURITY_ENABLECAPTCHA">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} }
} }
} } else {
else {
$desc = $form->textwithpicto('', $langs->transnoentities("EnableGDLibraryDesc"), 1, 'warning'); $desc = $form->textwithpicto('', $langs->transnoentities("EnableGDLibraryDesc"), 1, 'warning');
print $desc; print $desc;
} }
@@ -140,13 +133,11 @@ print '<td class="right">';
if (!empty($conf->use_javascript_ajax)) if (!empty($conf->use_javascript_ajax))
{ {
print ajax_constantonoff('MAIN_USE_ADVANCED_PERMS'); print ajax_constantonoff('MAIN_USE_ADVANCED_PERMS');
} } else {
else {
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_MAIN_USE_ADVANCED_PERMS">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_MAIN_USE_ADVANCED_PERMS">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} } else {
else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_MAIN_USE_ADVANCED_PERMS">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_MAIN_USE_ADVANCED_PERMS">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} }
} }

View File

@@ -122,8 +122,7 @@ if ($action == 'send' && !$_POST['cancel'])
{ {
setEventMessages($langs->trans("SmsSuccessfulySent", $smsfrom, $sendto), null, 'mesgs'); setEventMessages($langs->trans("SmsSuccessfulySent", $smsfrom, $sendto), null, 'mesgs');
setEventMessages($smsfile->error, $smsfile->errors, 'mesgs'); setEventMessages($smsfile->error, $smsfile->errors, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("ResultKo"), null, 'errors'); setEventMessages($langs->trans("ResultKo"), null, 'errors');
setEventMessages($smsfile->error, $smsfile->errors, 'errors'); setEventMessages($smsfile->error, $smsfile->errors, 'errors');
} }
@@ -204,8 +203,7 @@ if ($action == 'edit')
print '</form>'; print '</form>';
print '<br>'; print '<br>';
} } else {
else {
if (!count($listofmethods)) print '<div class="warning">'.$langs->trans("NoSmsEngine", '<a target="_blank" href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=smsmanager">DoliStore</a>').'</div>'; if (!count($listofmethods)) print '<div class="warning">'.$langs->trans("NoSmsEngine", '<a target="_blank" href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=smsmanager">DoliStore</a>').'</div>';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
@@ -262,8 +260,7 @@ else {
if (count($listofmethods) && !empty($conf->global->MAIN_SMS_SENDMODE)) if (count($listofmethods) && !empty($conf->global->MAIN_SMS_SENDMODE))
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&amp;mode=init">'.$langs->trans("DoTestSend").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&amp;mode=init">'.$langs->trans("DoTestSend").'</a>';
} } else {
else {
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("DoTestSend").'</a>'; print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("DoTestSend").'</a>';
} }
print '</div>'; print '</div>';

View File

@@ -48,8 +48,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -61,8 +60,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }

View File

@@ -73,8 +73,7 @@ if ($action == 'update' || $action == 'add')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -152,8 +151,7 @@ if (!empty($conf->global->ADHERENT_USE_SPIP))
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>'; print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
print '</form>'; print '</form>';
} } else {
else {
dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user'); dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
$link = '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">'; $link = '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';

View File

@@ -48,8 +48,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -61,8 +60,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg))
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -117,8 +115,7 @@ if (!empty($conf->facture->enabled))
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL); print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL);
} }
} } else {
else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module30Name")); print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module30Name"));
} }
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
@@ -136,8 +133,7 @@ if (!empty($conf->commande->enabled))
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER); print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER);
} }
} } else {
else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module25Name")); print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module25Name"));
} }
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
@@ -157,8 +153,7 @@ if (!empty($conf->expedition->enabled))
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT); print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT);
} }
} } else {
else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name")); print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name"));
} }
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
@@ -176,8 +171,7 @@ if (!empty($conf->expedition->enabled))
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE); print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE);
} }
} } else {
else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name")); print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name"));
} }
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
@@ -215,8 +209,7 @@ if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUP
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL);
} }
} } else {
else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
} }
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
@@ -235,8 +228,7 @@ if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUP
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER);
} }
} } else {
else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
} }
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
@@ -271,8 +263,7 @@ if (!empty($conf->reception->enabled))
} }
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
$found++; $found++;
} } else {
else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("ReStockOnDispatchOrder").'</td>'; print '<td>'.$langs->trans("ReStockOnDispatchOrder").'</td>';
print '<td class="right">'; print '<td class="right">';
@@ -284,8 +275,7 @@ else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER);
} }
} } else {
else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name"));
} }
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";

View File

@@ -70,8 +70,7 @@ if ($action == 'updateMask')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -108,13 +107,11 @@ if ($action == 'specimen') // For invoices
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture_fournisseur&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture_fournisseur&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($module->error, $module->errors, 'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
@@ -124,9 +121,7 @@ if ($action == 'specimen') // For invoices
elseif ($action == 'set') elseif ($action == 'set')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} } elseif ($action == 'del')
elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
@@ -151,8 +146,7 @@ elseif ($action == 'setdoc')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} } elseif ($action == 'unsetdoc')
elseif ($action == 'unsetdoc')
{ {
dolibarr_del_const($db, "INVOICE_SUPPLIER_ADDON_PDF", $conf->entity); dolibarr_del_const($db, "INVOICE_SUPPLIER_ADDON_PDF", $conf->entity);
} }
@@ -182,8 +176,7 @@ if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -259,8 +252,7 @@ foreach ($dirmodels as $reldir)
$tmp = $module->getExample(); $tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) { if (preg_match('/^Error/', $tmp)) {
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
} } elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp; else print $tmp;
print '</td>'."\n"; print '</td>'."\n";
@@ -268,8 +260,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER == "$file") if ($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER == "$file")
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
} }
print '</td>'; print '</td>';
@@ -335,8 +326,7 @@ if ($resql)
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -403,8 +393,7 @@ foreach ($dirmodels as $reldir)
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
}*/ }*/
print "</td>"; print "</td>";
} } else {
else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -417,8 +406,7 @@ foreach ($dirmodels as $reldir)
//print img_picto($langs->trans("Default"),'on'); //print img_picto($langs->trans("Default"),'on');
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@@ -479,8 +467,7 @@ $variablename = 'SUPPLIER_INVOICE_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} } else {
else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();

View File

@@ -68,13 +68,10 @@ if ($action == 'updateMask')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} } elseif ($action == 'specimen') // For orders
elseif ($action == 'specimen') // For orders
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@@ -106,13 +103,11 @@ elseif ($action == 'specimen') // For orders
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($module->error, $module->errors, 'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
@@ -122,9 +117,7 @@ elseif ($action == 'specimen') // For orders
elseif ($action == 'set') elseif ($action == 'set')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} } elseif ($action == 'del')
elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
@@ -149,23 +142,17 @@ elseif ($action == 'setdoc')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} } elseif ($action == 'setmod')
elseif ($action == 'setmod')
{ {
// TODO Verifier si module numerotation choisi peut etre active // TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated // par appel methode canBeActivated
dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_NUMBER", $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_NUMBER", $value, 'chaine', 0, '', $conf->entity);
} } elseif ($action == 'addcat')
elseif ($action == 'addcat')
{ {
$fourn = new Fournisseur($db); $fourn = new Fournisseur($db);
$fourn->CreateCategory($user, GETPOST('cat', 'alphanohtml')); $fourn->CreateCategory($user, GETPOST('cat', 'alphanohtml'));
} } elseif ($action == 'set_SUPPLIER_ORDER_OTHER')
elseif ($action == 'set_SUPPLIER_ORDER_OTHER')
{ {
$freetext = GETPOST('SUPPLIER_ORDER_FREE_TEXT', 'none'); // No alpha here, we want exact string $freetext = GETPOST('SUPPLIER_ORDER_FREE_TEXT', 'none'); // No alpha here, we want exact string
$doubleapproval = GETPOST('SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED', 'alpha'); $doubleapproval = GETPOST('SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED', 'alpha');
@@ -193,8 +180,7 @@ elseif ($action == 'set_SUPPLIER_ORDER_OTHER')
// Insert // Insert
$newmodule->insert_permissions(1); $newmodule->insert_permissions(1);
} } else {
else {
// Remove all rights with Permission1190 // Remove all rights with Permission1190
$newmodule->delete_permissions(); $newmodule->delete_permissions();
@@ -213,8 +199,7 @@ elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -290,8 +275,7 @@ foreach ($dirmodels as $reldir)
$tmp = $module->getExample(); $tmp = $module->getExample();
if (preg_match('/^Error/', $tmp)) { if (preg_match('/^Error/', $tmp)) {
$langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>'; $langs->load("errors"); print '<div class="error">'.$langs->trans($tmp).'</div>';
} } elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
else print $tmp; else print $tmp;
print '</td>'."\n"; print '</td>'."\n";
@@ -299,8 +283,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER == "$file") if ($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER == "$file")
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
} }
print '</td>'; print '</td>';
@@ -364,8 +347,7 @@ if ($resql)
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -422,13 +404,11 @@ foreach ($dirmodels as $reldir)
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier">';
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
} } else {
else {
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
} }
print "</td>"; print "</td>";
} } else {
else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -439,8 +419,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name") if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name")
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=order_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@@ -543,8 +522,7 @@ $variablename = 'SUPPLIER_ORDER_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} } else {
else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();
@@ -561,8 +539,7 @@ print '<td class="center">';
if ($conf->reception->enabled) if ($conf->reception->enabled)
{ {
print '<span class="opacitymedium">'.$langs->trans("FeatureNotAvailableWithReceptionModule").'</span>'; print '<span class="opacitymedium">'.$langs->trans("FeatureNotAvailableWithReceptionModule").'</span>';
} } else {
else {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('SUPPLIER_ORDER_USE_DISPATCH_STATUS'); print ajax_constantonoff('SUPPLIER_ORDER_USE_DISPATCH_STATUS');
} else { } else {

View File

@@ -57,11 +57,10 @@ if ($action == 'updateMask')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
}elseif ($action == 'setmod') } elseif ($action == 'setmod')
{ {
dolibarr_set_const($db, "SUPPLIER_PAYMENT_ADDON", $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "SUPPLIER_PAYMENT_ADDON", $value, 'chaine', 0, '', $conf->entity);
} }
@@ -70,9 +69,7 @@ if ($action == 'updateMask')
elseif ($action == 'set') elseif ($action == 'set')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} } elseif ($action == 'del')
elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
@@ -97,9 +94,7 @@ elseif ($action == 'setdoc')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} } elseif ($action == 'specimen')
elseif ($action == 'specimen')
{ {
$modele = GETPOST('module', 'alpha'); $modele = GETPOST('module', 'alpha');
@@ -130,21 +125,15 @@ elseif ($action == 'specimen')
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=supplier_payment&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=supplier_payment&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($module->error, $module->errors, 'errors'); setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} } elseif ($action == 'setparams')
elseif ($action == 'setparams')
{ {
$res = dolibarr_set_const($db, "PAYMENTS_FOURN_REPORT_GROUP_BY_MOD", GETPOST('PAYMENTS_FOURN_REPORT_GROUP_BY_MOD', 'int'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PAYMENTS_FOURN_REPORT_GROUP_BY_MOD", GETPOST('PAYMENTS_FOURN_REPORT_GROUP_BY_MOD', 'int'), 'chaine', 0, '', $conf->entity);
if (!$res > 0) $error++; if (!$res > 0) $error++;
@@ -203,8 +192,7 @@ if ($resql)
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -278,8 +266,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->SUPPLIER_PAYMENT_ADDON == $file || $conf->global->SUPPLIER_PAYMENT_ADDON.'.php' == $file) if ($conf->global->SUPPLIER_PAYMENT_ADDON == $file || $conf->global->SUPPLIER_PAYMENT_ADDON.'.php' == $file)
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
} }
print '</td>'; print '</td>';
@@ -393,8 +380,7 @@ foreach ($dirmodels as $reldir)
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
}*/ }*/
print "</td>"; print "</td>";
} } else {
else {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=SUPPLIER_PAYMENT">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=SUPPLIER_PAYMENT">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -407,8 +393,7 @@ foreach ($dirmodels as $reldir)
//print img_picto($langs->trans("Default"),'on'); //print img_picto($langs->trans("Default"),'on');
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=SUPPLIER_PAYMENT"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=SUPPLIER_PAYMENT"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=SUPPLIER_PAYMENT"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=SUPPLIER_PAYMENT"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';

View File

@@ -60,8 +60,7 @@ if ($action == 'updateMask')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -97,13 +96,11 @@ if ($action == 'specimen')
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=supplier_proposal&file=SPECIMEN.pdf"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=supplier_proposal&file=SPECIMEN.pdf");
return; return;
} } else {
else {
setEventMessages($module->error, null, 'errors'); setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} } else {
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
@@ -119,8 +116,7 @@ if ($action == 'set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -136,8 +132,7 @@ if ($action == 'set_SUPPLIER_PROPOSAL_FREE_TEXT')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -151,8 +146,7 @@ if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -161,18 +155,14 @@ if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL')
if ($action == 'set') if ($action == 'set')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} } elseif ($action == 'del')
elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
{ {
if ($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF == "$value") dolibarr_del_const($db, 'SUPPLIER_PROPOSAL_ADDON_PDF', $conf->entity); if ($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF == "$value") dolibarr_del_const($db, 'SUPPLIER_PROPOSAL_ADDON_PDF', $conf->entity);
} }
} } elseif ($action == 'setdoc')
elseif ($action == 'setdoc')
{ {
if (dolibarr_set_const($db, "SUPPLIER_PROPOSAL_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) if (dolibarr_set_const($db, "SUPPLIER_PROPOSAL_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity))
{ {
@@ -185,9 +175,7 @@ elseif ($action == 'setdoc')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} } elseif ($action == 'setmod')
elseif ($action == 'setmod')
{ {
// TODO Verifier si module numerotation choisi peut etre active // TODO Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated // par appel methode canBeActivated
@@ -272,8 +260,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->SUPPLIER_PROPOSAL_ADDON == "$file") if ($conf->global->SUPPLIER_PROPOSAL_ADDON == "$file")
{ {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} } else {
else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>'; print '</a>';
@@ -336,8 +323,7 @@ if ($resql)
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} } else {
else {
dol_print_error($db); dol_print_error($db);
} }
@@ -406,8 +392,7 @@ foreach ($dirmodels as $reldir)
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
print '</td>'; print '</td>';
} } else {
else {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>"; print "</td>";
@@ -418,8 +403,7 @@ foreach ($dirmodels as $reldir)
if ($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF == "$name") if ($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF == "$name")
{ {
print img_picto($langs->trans("Default"), 'on'); print img_picto($langs->trans("Default"), 'on');
} } else {
else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
} }
print '</td>'; print '</td>';
@@ -452,8 +436,7 @@ foreach ($dirmodels as $reldir)
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
} } else {
else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }
print '</td>'; print '</td>';
@@ -500,8 +483,7 @@ $variablename = 'SUPPLIER_PROPOSAL_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{ {
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>'; print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
} } else {
else {
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create(); print $doleditor->Create();
@@ -531,19 +513,16 @@ if ($conf->banque->enabled)
if (!empty($conf->use_javascript_ajax)) if (!empty($conf->use_javascript_ajax))
{ {
print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL'); print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL');
} } else {
else {
if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL)) if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL))
{ {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL&amp;value=1">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL&amp;value=1">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
} } else {
else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL&amp;value=0">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL&amp;value=0">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>';
} }
} }
print '</td></tr>'; print '</td></tr>';
} } else {
else {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
} }

View File

@@ -126,8 +126,7 @@ if ($action == 'set')
{ {
$db->commit(); $db->commit();
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
$db->rollback(); $db->rollback();
setEventMessages($error, $errors, 'errors'); setEventMessages($error, $errors, 'errors');
} }
@@ -154,8 +153,7 @@ if ($action == 'setlevel')
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
@@ -228,8 +226,7 @@ foreach ($syslogModules as $moduleName)
{ {
if (isset($_POST[$tmpoption])) $value = $_POST[$tmpoption]; if (isset($_POST[$tmpoption])) $value = $_POST[$tmpoption];
elseif (!empty($conf->global->$tmpoption)) $value = $conf->global->$tmpoption; elseif (!empty($conf->global->$tmpoption)) $value = $conf->global->$tmpoption;
} } else $value = (isset($option['default']) ? $option['default'] : '');
else $value = (isset($option['default']) ? $option['default'] : '');
print $option['name'].': <input type="text" class="flat" name="'.$option['constant'].'" value="'.$value.'"'.(isset($option['attr']) ? ' '.$option['attr'] : '').'>'; print $option['name'].': <input type="text" class="flat" name="'.$option['constant'].'" value="'.$value.'"'.(isset($option['attr']) ? ' '.$option['attr'] : '').'>';
if (!empty($option['example'])) print '<br>'.$langs->trans("Example").': '.$option['example']; if (!empty($option['example'])) print '<br>'.$langs->trans("Example").': '.$option['example'];

View File

@@ -200,8 +200,7 @@ if ($showpromotemessage)
print '<textarea style="width:80%; min-height: 60px">'; print '<textarea style="width:80%; min-height: 60px">';
print $langs->trans("ExampleOfNewsMessageForMajorRelease", DOL_VERSION, DOL_VERSION); print $langs->trans("ExampleOfNewsMessageForMajorRelease", DOL_VERSION, DOL_VERSION);
print '</textarea>'; print '</textarea>';
} } else {
else {
print $langs->trans("TitleExampleForMaintenanceRelease").':<br>'; print $langs->trans("TitleExampleForMaintenanceRelease").':<br>';
print '<textarea style="width:80%; min-height: 60px">'; print '<textarea style="width:80%; min-height: 60px">';
print $langs->trans("ExampleOfNewsMessageForMaintenanceRelease", DOL_VERSION, DOL_VERSION); print $langs->trans("ExampleOfNewsMessageForMaintenanceRelease", DOL_VERSION, DOL_VERSION);

View File

@@ -173,8 +173,7 @@ foreach ($configfileparameters as $key)
if ($newkey == 'separator') if ($newkey == 'separator')
{ {
print '<td colspan="3">&nbsp;</td>'; print '<td colspan="3">&nbsp;</td>';
} } else {
else {
// Label // Label
print "<td>".$configfilelib[$i].'</td>'; print "<td>".$configfilelib[$i].'</td>';
// Key // Key
@@ -218,8 +217,7 @@ if (empty($conf->multicompany->enabled))
{ {
// If no multicompany mode, admins can see global and their constantes // If no multicompany mode, admins can see global and their constantes
$sql .= " WHERE entity IN (0,".$conf->entity.")"; $sql .= " WHERE entity IN (0,".$conf->entity.")";
} } else {
else {
// If multicompany mode, superadmin (user->entity=0) can see everything, admin are limited to their entities. // If multicompany mode, superadmin (user->entity=0) can see everything, admin are limited to their entities.
if ($user->entity) $sql .= " WHERE entity IN (".$user->entity.",".$conf->entity.")"; if ($user->entity) $sql .= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
} }

View File

@@ -61,18 +61,15 @@ if (preg_match('/mysql/i', $conf->db->type))
{ {
$sql = "SHOW TABLE STATUS"; $sql = "SHOW TABLE STATUS";
$base = 1; $base = 1;
} } elseif ($conf->db->type == 'pgsql')
elseif ($conf->db->type == 'pgsql')
{ {
$sql = "SELECT conname, contype FROM pg_constraint;"; $sql = "SELECT conname, contype FROM pg_constraint;";
$base = 2; $base = 2;
} } elseif ($conf->db->type == 'mssql')
elseif ($conf->db->type == 'mssql')
{ {
//$sqls[0] = ""; //$sqls[0] = "";
//$base=3; //$base=3;
} } elseif ($conf->db->type == 'sqlite' || $conf->db->type == 'sqlite3')
elseif ($conf->db->type == 'sqlite' || $conf->db->type == 'sqlite3')
{ {
//$sql = "SELECT name, type FROM sqlite_master"; //$sql = "SELECT name, type FROM sqlite_master";
$base = 4; $base = 4;
@@ -82,8 +79,7 @@ elseif ($conf->db->type == 'sqlite' || $conf->db->type == 'sqlite3')
if (!$base) if (!$base)
{ {
print $langs->trans("FeatureNotAvailableWithThisDatabaseDriver"); print $langs->trans("FeatureNotAvailableWithThisDatabaseDriver");
} } else {
else {
if ($base == 1) if ($base == 1)
{ {
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
@@ -119,8 +115,7 @@ else {
if (isset($obj->Engine) && $obj->Engine == "MyISAM") if (isset($obj->Engine) && $obj->Engine == "MyISAM")
{ {
print '<td><a class="reposition" href="database-tables.php?action=convert&amp;table='.$obj->Name.'">'.$langs->trans("Convert").' InnoDB</a></td>'; print '<td><a class="reposition" href="database-tables.php?action=convert&amp;table='.$obj->Name.'">'.$langs->trans("Convert").' InnoDB</a></td>';
} } else {
else {
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
} }
print '<td>'.$obj->Row_format.'</td>'; print '<td>'.$obj->Row_format.'</td>';

View File

@@ -73,8 +73,7 @@ $arraylist = array('listofvars', 'listofstatus');
if (!count($listofvars) && !count($listofstatus)) if (!count($listofvars) && !count($listofstatus))
{ {
print $langs->trans("FeatureNotAvailableWithThisDatabaseDriver"); print $langs->trans("FeatureNotAvailableWithThisDatabaseDriver");
} } else {
else {
foreach ($arraylist as $listname) foreach ($arraylist as $listname)
{ {
print '<br>'; print '<br>';

View File

@@ -49,8 +49,7 @@ if (preg_match('/mysql/i', $conf->db->type))
{ {
$sql = "SHOW TABLE STATUS LIKE '".$db->escape($table)."'"; $sql = "SHOW TABLE STATUS LIKE '".$db->escape($table)."'";
$base = 1; $base = 1;
} } elseif ($conf->db->type == 'pgsql')
elseif ($conf->db->type == 'pgsql')
{ {
$sql = "SELECT conname,contype FROM pg_constraint"; $sql = "SELECT conname,contype FROM pg_constraint";
$base = 2; $base = 2;
@@ -59,8 +58,7 @@ elseif ($conf->db->type == 'pgsql')
if (!$base) if (!$base)
{ {
print $langs->trans("FeatureNotAvailableWithThisDatabaseDriver"); print $langs->trans("FeatureNotAvailableWithThisDatabaseDriver");
} } else {
else {
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {

View File

@@ -76,8 +76,7 @@ if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE))
{ {
// Compare version with last install database version (upgrades never occured) // Compare version with last install database version (upgrades never occured)
if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_INSTALL) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, $conf->global->MAIN_VERSION_LAST_INSTALL)); if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_INSTALL) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, $conf->global->MAIN_VERSION_LAST_INSTALL));
} } else {
else {
// Compare version with last upgrade database version // Compare version with last upgrade database version
if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, $conf->global->MAIN_VERSION_LAST_UPGRADE)); if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, $conf->global->MAIN_VERSION_LAST_UPGRADE));
} }
@@ -106,12 +105,10 @@ if (function_exists('curl_init'))
// Show version // Show version
print $langs->trans("LastStableVersion").' : <b>'.(($version != '0.0') ? $version : $langs->trans("Unknown")).'</b>'; print $langs->trans("LastStableVersion").' : <b>'.(($version != '0.0') ? $version : $langs->trans("Unknown")).'</b>';
} } else {
else {
print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("UpdateServerOffline").'</b>'; print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("UpdateServerOffline").'</b>';
} }
} } else {
else {
print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion" class="butAction">'.$langs->trans("Check").'</a>'; print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion" class="butAction">'.$langs->trans("Check").'</a>';
} }
} }
@@ -362,8 +359,7 @@ foreach ($configfileparameters as $key => $value)
if (strpos($newkey, 'separator') !== false) if (strpos($newkey, 'separator') !== false)
{ {
print '<td colspan="3">&nbsp;</td>'; print '<td colspan="3">&nbsp;</td>';
} } else {
else {
// Label // Label
print "<td>".$value.'</td>'; print "<td>".$value.'</td>';
// Key // Key
@@ -387,8 +383,7 @@ foreach ($configfileparameters as $key => $value)
} }
++$i; ++$i;
} }
} } elseif ($newkey == 'dolibarr_main_instance_unique_id')
elseif ($newkey == 'dolibarr_main_instance_unique_id')
{ {
//print $conf->file->instance_unique_id; //print $conf->file->instance_unique_id;
global $dolibarr_main_cookie_cryptkey; global $dolibarr_main_cookie_cryptkey;
@@ -398,8 +393,7 @@ foreach ($configfileparameters as $key => $value)
print img_warning("EditConfigFileToAddEntry", 'dolibarr_main_instance_unique_id'); print img_warning("EditConfigFileToAddEntry", 'dolibarr_main_instance_unique_id');
} }
print ' &nbsp; <span class="opacitymedium">('.$langs->trans("HashForPing").'='.md5('dolibarr'.$valuetoshow).')</span>'; print ' &nbsp; <span class="opacitymedium">('.$langs->trans("HashForPing").'='.md5('dolibarr'.$valuetoshow).')</span>';
} } else {
else {
print ${$newkey}; print ${$newkey};
} }
if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')'; if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')';
@@ -436,8 +430,7 @@ if (empty($conf->multicompany->enabled))
{ {
// If no multicompany mode, admins can see global and their constantes // If no multicompany mode, admins can see global and their constantes
$sql .= " WHERE entity IN (0,".$conf->entity.")"; $sql .= " WHERE entity IN (0,".$conf->entity.")";
} } else {
else {
// If multicompany mode, superadmin (user->entity=0) can see everything, admin are limited to their entities. // If multicompany mode, superadmin (user->entity=0) can see everything, admin are limited to their entities.
if ($user->entity) $sql .= " WHERE entity IN (".$user->entity.",".$conf->entity.")"; if ($user->entity) $sql .= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
} }

View File

@@ -98,8 +98,7 @@ if (dol_is_file($xmlfile))
print '<input type="radio" name="target" value="local"'.((!GETPOST('target') || GETPOST('target') == 'local') ? 'checked="checked"' : '').'"> '.$langs->trans("LocalSignature").' = '; print '<input type="radio" name="target" value="local"'.((!GETPOST('target') || GETPOST('target') == 'local') ? 'checked="checked"' : '').'"> '.$langs->trans("LocalSignature").' = ';
print '<input name="xmlshortfile" class="flat minwidth400" value="'.dol_escape_htmltag($xmlshortfile).'">'; print '<input name="xmlshortfile" class="flat minwidth400" value="'.dol_escape_htmltag($xmlshortfile).'">';
print '<br>'; print '<br>';
} } else {
else {
print '<input type="radio" name="target" value="local"> '.$langs->trans("LocalSignature").' = '; print '<input type="radio" name="target" value="local"> '.$langs->trans("LocalSignature").' = ';
print '<input name="xmlshortfile" class="flat minwidth400" value="'.dol_escape_htmltag($xmlshortfile).'">'; print '<input name="xmlshortfile" class="flat minwidth400" value="'.dol_escape_htmltag($xmlshortfile).'">';
print ' <span class="warning">('.$langs->trans("AvailableOnlyOnPackagedVersions").')</span>'; print ' <span class="warning">('.$langs->trans("AvailableOnlyOnPackagedVersions").')</span>';
@@ -110,8 +109,7 @@ if ($enableremotecheck)
{ {
print '<input type="radio" name="target" value="remote"'.(GETPOST('target') == 'remote' ? 'checked="checked"' : '').'> '.$langs->trans("RemoteSignature").' = '; print '<input type="radio" name="target" value="remote"'.(GETPOST('target') == 'remote' ? 'checked="checked"' : '').'> '.$langs->trans("RemoteSignature").' = ';
print '<input name="xmlremote" class="flat minwidth400" value="'.dol_escape_htmltag($xmlremote).'"><br>'; print '<input name="xmlremote" class="flat minwidth400" value="'.dol_escape_htmltag($xmlremote).'"><br>';
} } else {
else {
print '<input type="radio" name="target" value="remote" disabled="disabled"> '.$langs->trans("RemoteSignature").' = '.$xmlremote; print '<input type="radio" name="target" value="remote" disabled="disabled"> '.$langs->trans("RemoteSignature").' = '.$xmlremote;
if (!GETPOST('xmlremote')) print ' <span class="warning">('.$langs->trans("FeatureAvailableOnlyOnStable").')</span>'; if (!GETPOST('xmlremote')) print ' <span class="warning">('.$langs->trans("FeatureAvailableOnlyOnStable").')</span>';
print '<br>'; print '<br>';
@@ -138,8 +136,7 @@ if (GETPOST('target') == 'local')
} }
} }
$xml = simplexml_load_file($xmlfile); $xml = simplexml_load_file($xmlfile);
} } else {
else {
print $langs->trans('XmlNotFound').': '.$xmlfile; print $langs->trans('XmlNotFound').': '.$xmlfile;
$error++; $error++;
} }
@@ -154,8 +151,7 @@ if (GETPOST('target') == 'remote')
$xmlfile = $xmlarray['content']; $xmlfile = $xmlarray['content'];
//print "xmlfilestart".$xmlfile."xmlfileend"; //print "xmlfilestart".$xmlfile."xmlfileend";
$xml = simplexml_load_string($xmlfile); $xml = simplexml_load_string($xmlfile);
} } else {
else {
$errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg']; $errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg'];
setEventMessages($errormsg, null, 'errors'); setEventMessages($errormsg, null, 'errors');
$error++; $error++;
@@ -266,8 +262,7 @@ if (!$error && $xml)
$out .= '<td class="center">'.$file['expectedmd5'].'</td>'."\n"; $out .= '<td class="center">'.$file['expectedmd5'].'</td>'."\n";
$out .= "</tr>\n"; $out .= "</tr>\n";
} }
} } else {
else {
$out .= '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; $out .= '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
} }
$out .= '</table>'; $out .= '</table>';
@@ -320,8 +315,7 @@ if (!$error && $xml)
$out .= '<td class="right">'.dol_print_size($totalsize).'</td>'."\n"; $out .= '<td class="right">'.dol_print_size($totalsize).'</td>'."\n";
$out .= '<td class="right"></td>'."\n"; $out .= '<td class="right"></td>'."\n";
$out .= "</tr>\n"; $out .= "</tr>\n";
} } else {
else {
$out .= '<tr class="oddeven"><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; $out .= '<tr class="oddeven"><td colspan="6" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
} }
$out .= '</table>'; $out .= '</table>';
@@ -374,8 +368,7 @@ if (!$error && $xml)
$out .= '<td class="right">'.dol_print_size($totalsize).'</td>'."\n"; $out .= '<td class="right">'.dol_print_size($totalsize).'</td>'."\n";
$out .= '<td class="right"></td>'."\n"; $out .= '<td class="right"></td>'."\n";
$out .= "</tr>\n"; $out .= "</tr>\n";
} } else {
else {
$out .= '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; $out .= '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
} }
$out .= '</table>'; $out .= '</table>';
@@ -386,12 +379,10 @@ if (!$error && $xml)
if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3)) if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3))
{ {
setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs'); setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'warnings'); setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'warnings');
} }
} } else {
else {
print 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile; print 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile;
$error++; $error++;
} }
@@ -424,14 +415,12 @@ if (!$error && $xml)
$resultcode = 'warning'; $resultcode = 'warning';
$resultcomment = 'FileIntegrityIsOkButFilesWereAdded'; $resultcomment = 'FileIntegrityIsOkButFilesWereAdded';
$outcurrentchecksum = $checksumget.' - <span class="'.$resultcode.'">'.$langs->trans("FileIntegrityIsOkButFilesWereAdded").'</span>'; $outcurrentchecksum = $checksumget.' - <span class="'.$resultcode.'">'.$langs->trans("FileIntegrityIsOkButFilesWereAdded").'</span>';
} } else {
else {
$resultcode = 'ok'; $resultcode = 'ok';
$resultcomment = 'Success'; $resultcomment = 'Success';
$outcurrentchecksum = '<span class="'.$resultcode.'">'.$checksumget.'</span>'; $outcurrentchecksum = '<span class="'.$resultcode.'">'.$checksumget.'</span>';
} }
} } else {
else {
$resultcode = 'error'; $resultcode = 'error';
$resultcomment = 'Error'; $resultcomment = 'Error';
$outcurrentchecksum = '<span class="'.$resultcode.'">'.$checksumget.'</span>'; $outcurrentchecksum = '<span class="'.$resultcode.'">'.$checksumget.'</span>';

View File

@@ -69,8 +69,7 @@ foreach ($modulesdir as $dir)
{ {
// File duplicate // File duplicate
print "Warning duplicate file found : ".$file." (Found ".$dir.$file.", already found ".$modules_fullpath[$file].")<br>"; print "Warning duplicate file found : ".$file." (Found ".$dir.$file.", already found ".$modules_fullpath[$file].")<br>";
} } else {
else {
// File to load // File to load
$res = include_once $dir.$file; $res = include_once $dir.$file;
if (class_exists($modName)) if (class_exists($modName))
@@ -83,13 +82,11 @@ foreach ($modulesdir as $dir)
$modules_files[$objMod->numero] = $file; $modules_files[$objMod->numero] = $file;
$modules_fullpath[$file] = $dir.$file; $modules_fullpath[$file] = $dir.$file;
$picto[$objMod->numero] = (isset($objMod->picto) && $objMod->picto) ? $objMod->picto : 'generic'; $picto[$objMod->numero] = (isset($objMod->picto) && $objMod->picto) ? $objMod->picto : 'generic';
} } catch (Exception $e)
catch (Exception $e)
{ {
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
} }
} } else {
else {
print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>"; print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
} }
} }
@@ -122,8 +119,7 @@ foreach ($sortorder as $numero=>$name)
{ {
if (preg_match('/^\//', $picto[$numero])) print img_picto($alt, $picto[$numero], 'width="14px"', 1); if (preg_match('/^\//', $picto[$numero])) print img_picto($alt, $picto[$numero], 'width="14px"', 1);
else print img_object($alt, $picto[$numero], 'width="14px"'); else print img_object($alt, $picto[$numero], 'width="14px"');
} } else {
else {
print img_object($alt, $picto[$numero], 'width="14px"'); print img_object($alt, $picto[$numero], 'width="14px"');
} }
print ' '.$modules[$numero]->getName(); print ' '.$modules[$numero]->getName();

View File

@@ -101,13 +101,11 @@ if ($test)
{ {
print img_picto('', 'tick.png').' '.$langs->trans("MemcachedAvailableAndSetup"); print img_picto('', 'tick.png').' '.$langs->trans("MemcachedAvailableAndSetup");
print ' '.$langs->trans("MoreInformation").' <a href="'.dol_buildpath('/memcached/admin/memcached.php', 1).'">Memcached module admin page</a>'; print ' '.$langs->trans("MoreInformation").' <a href="'.dol_buildpath('/memcached/admin/memcached.php', 1).'">Memcached module admin page</a>';
} } else {
else {
print img_picto('', 'warning').' '.$langs->trans("MemcachedModuleAvailableButNotSetup"); print img_picto('', 'warning').' '.$langs->trans("MemcachedModuleAvailableButNotSetup");
print ' <a href="'.dol_buildpath('/memcached/admin/memcached.php', 1).'">Memcached module admin page</a>'; print ' <a href="'.dol_buildpath('/memcached/admin/memcached.php', 1).'">Memcached module admin page</a>';
} }
} } else print img_picto('', 'warning').' '.$langs->trans("MemcachedNotAvailable");
else print img_picto('', 'warning').' '.$langs->trans("MemcachedNotAvailable");
print '</br>'; print '</br>';
// OPCode cache // OPCode cache
@@ -143,8 +141,7 @@ if (!$foundcache && $test)
{ {
$foundcache++; $foundcache++;
print img_picto('', 'tick.png').' '.$langs->trans("APCInstalled"); print img_picto('', 'tick.png').' '.$langs->trans("APCInstalled");
} } else {
else {
print img_picto('', 'warning').' '.$langs->trans("APCCacheInstalledButDisabled"); print img_picto('', 'warning').' '.$langs->trans("APCCacheInstalledButDisabled");
} }
} }
@@ -157,8 +154,7 @@ if (ini_get('opcache.preload'))
print '<br>'; print '<br>';
print '<strong>'.$langs->trans("PreloadOPCode").'</strong>: '; print '<strong>'.$langs->trans("PreloadOPCode").'</strong>: ';
print ini_get('opcache.preload'); print ini_get('opcache.preload');
} } else {
else {
print '<br>'; print '<br>';
print '<strong>'.$langs->trans("PreloadOPCode").'</strong>: '; print '<strong>'.$langs->trans("PreloadOPCode").'</strong>: ';
print $langs->trans("No"); print $langs->trans("No");
@@ -462,8 +458,7 @@ if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli')
if ($test) if ($test)
{ {
print img_picto('', 'tick.png').' '.$langs->trans("YouUseBestDriver", $conf->db->type); print img_picto('', 'tick.png').' '.$langs->trans("YouUseBestDriver", $conf->db->type);
} } else {
else {
print img_picto('', 'warning.png').' '.$langs->trans("YouDoNotUseBestDriver", $conf->db->type, 'mysqli'); print img_picto('', 'warning.png').' '.$langs->trans("YouDoNotUseBestDriver", $conf->db->type, 'mysqli');
} }
print '<br>'; print '<br>';
@@ -488,12 +483,10 @@ if ($resql)
if (empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE)) if (empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE))
{ {
print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXObjectUseSearchOptim", $nb, $langs->transnoentitiesnoconv("ProductsOrServices"), 'PRODUCT_DONOTSEARCH_ANYWHERE'); print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXObjectUseSearchOptim", $nb, $langs->transnoentitiesnoconv("ProductsOrServices"), 'PRODUCT_DONOTSEARCH_ANYWHERE');
} } else {
else {
print img_picto('', 'tick.png').' '.$langs->trans("YouHaveXObjectAndSearchOptimOn", $nb, $langs->transnoentitiesnoconv("ProductsOrServices")); print img_picto('', 'tick.png').' '.$langs->trans("YouHaveXObjectAndSearchOptimOn", $nb, $langs->transnoentitiesnoconv("ProductsOrServices"));
} }
} } else {
else {
print img_picto('', 'tick.png').' '.$langs->trans("NbOfObjectIsLowerThanNoPb", $nb, $langs->transnoentitiesnoconv("ProductsOrServices")); print img_picto('', 'tick.png').' '.$langs->trans("NbOfObjectIsLowerThanNoPb", $nb, $langs->transnoentitiesnoconv("ProductsOrServices"));
} }
print '<br>'; print '<br>';
@@ -516,12 +509,10 @@ if ($resql)
if (empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) if (empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE))
{ {
print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXObjectUseSearchOptim", $nb, $langs->transnoentitiesnoconv("ThirdParties"), 'COMPANY_DONOTSEARCH_ANYWHERE'); print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXObjectUseSearchOptim", $nb, $langs->transnoentitiesnoconv("ThirdParties"), 'COMPANY_DONOTSEARCH_ANYWHERE');
} } else {
else {
print img_picto('', 'tick.png').' '.$langs->trans("YouHaveXObjectAndSearchOptimOn", $nb, $langs->transnoentitiesnoconv("ThirdParties")); print img_picto('', 'tick.png').' '.$langs->trans("YouHaveXObjectAndSearchOptimOn", $nb, $langs->transnoentitiesnoconv("ThirdParties"));
} }
} } else {
else {
print img_picto('', 'tick.png').' '.$langs->trans("NbOfObjectIsLowerThanNoPb", $nb, $langs->transnoentitiesnoconv("ThirdParties")); print img_picto('', 'tick.png').' '.$langs->trans("NbOfObjectIsLowerThanNoPb", $nb, $langs->transnoentitiesnoconv("ThirdParties"));
} }
print '<br>'; print '<br>';
@@ -534,8 +525,7 @@ print '<strong>'.$langs->trans("Browser").'</strong>:<br>';
if (!in_array($conf->browser->name, array('chrome', 'opera', 'safari', 'firefox'))) if (!in_array($conf->browser->name, array('chrome', 'opera', 'safari', 'firefox')))
{ {
print img_picto('', 'warning.png').' '.$langs->trans("BrowserIsKO", $conf->browser->name); print img_picto('', 'warning.png').' '.$langs->trans("BrowserIsKO", $conf->browser->name);
} } else {
else {
print img_picto('', 'tick.png').' '.$langs->trans("BrowserIsOK", $conf->browser->name); print img_picto('', 'tick.png').' '.$langs->trans("BrowserIsOK", $conf->browser->name);
} }
print '<br>'; print '<br>';

View File

@@ -85,12 +85,10 @@ $arrayphpminversionwarning = array(5, 6, 0);
if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0)
{ {
print '<img src="'.$ErrorPicturePath.'" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror)); print '<img src="'.$ErrorPicturePath.'" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror));
} } elseif (versioncompare(versionphparray(), $arrayphpminversionwarning) < 0)
elseif (versioncompare(versionphparray(), $arrayphpminversionwarning) < 0)
{ {
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning)); print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning));
} } else {
else {
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.versiontostring(versionphparray()); print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.versiontostring(versionphparray());
} }
@@ -101,8 +99,7 @@ if (!isset($_GET["testget"]) && !isset($_POST["testpost"]) && !isset($_GET["main
{ {
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("PHPSupportPOSTGETKo"); print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("PHPSupportPOSTGETKo");
print ' (<a href="'.$_SERVER["PHP_SELF"].'?testget=ok">'.$langs->trans("Recheck").'</a>)'; print ' (<a href="'.$_SERVER["PHP_SELF"].'?testget=ok">'.$langs->trans("Recheck").'</a>)';
} } else {
else {
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportPOSTGETOk"); print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportPOSTGETOk");
} }
@@ -112,8 +109,7 @@ print '<tr><td>Sessions support</td><td>';
if (!function_exists("session_id")) if (!function_exists("session_id"))
{ {
print '<img src="'.$ErrorPicturePath.'" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportSessions"); print '<img src="'.$ErrorPicturePath.'" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportSessions");
} } else {
else {
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportSessions"); print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportSessions");
} }
@@ -123,8 +119,7 @@ print '<tr><td>UTF-8 support</td><td>';
if (!function_exists("utf8_encode")) if (!function_exists("utf8_encode"))
{ {
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupportUTF8"); print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupportUTF8");
} } else {
else {
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportUTF8"); print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportUTF8");
} }
@@ -224,8 +219,7 @@ foreach ($phparray as $key => $value)
print $valtoshow; print $valtoshow;
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} } else {
else {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$keyparam.'</td>'; print '<td>'.$keyparam.'</td>';
$i = 0; $i = 0;
@@ -340,8 +334,7 @@ function getTableColumn($name, array $list)
if (in_array($name, $list)) if (in_array($name, $list))
{ {
$html .= '<img src="../../theme/eldy/img/tick.png" alt="Ok">'; $html .= '<img src="../../theme/eldy/img/tick.png" alt="Ok">';
} } else {
else {
$html .= '<img src="../../theme/eldy/img/warning.png" alt="Warning">'; $html .= '<img src="../../theme/eldy/img/warning.png" alt="Warning">';
} }
@@ -375,8 +368,7 @@ function getTableColumnFunction(array $functions)
if ($result) if ($result)
{ {
$html .= '<img src="../../theme/eldy/img/tick.png" alt="Ok">'; $html .= '<img src="../../theme/eldy/img/tick.png" alt="Ok">';
} } else {
else {
$html .= '<img src="../../theme/eldy/img/warning.png" alt="Warning">'; $html .= '<img src="../../theme/eldy/img/warning.png" alt="Warning">';
} }

View File

@@ -108,15 +108,13 @@ xdebug.auto_trace=0
XDebug with same port than in php.ini<br> XDebug with same port than in php.ini<br>
Allow Remote debug=yes or prompt<br>'."\n"; Allow Remote debug=yes or prompt<br>'."\n";
print "<br>\n"; print "<br>\n";
} } else {
else {
print socket_strerror(socket_last_error()); print socket_strerror(socket_last_error());
echo "Failed to connect to address=".$address." port=".$port."<br>\n"; echo "Failed to connect to address=".$address." port=".$port."<br>\n";
echo "There is no Remote debug server at this address.\n"; echo "There is no Remote debug server at this address.\n";
} }
socket_close($socket); socket_close($socket);
} } else {
else {
print "Can't test if PHPDebug is OK as PHP socket functions are not enabled."; print "Can't test if PHPDebug is OK as PHP socket functions are not enabled.";
} }

View File

@@ -130,8 +130,7 @@ print load_fiche_titre($langs->trans('TaxSetup'), $linkback, 'title_setup');
if (empty($mysoc->tva_assuj)) if (empty($mysoc->tva_assuj))
{ {
print $langs->trans("YourCompanyDoesNotUseVAT").'<br>'; print $langs->trans("YourCompanyDoesNotUseVAT").'<br>';
} } else {
else {
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
@@ -149,8 +148,7 @@ else {
print '<td class="nowrap right">'; print '<td class="nowrap right">';
print $langs->trans("NotAvailableWhenAjaxDisabled"); print $langs->trans("NotAvailableWhenAjaxDisabled");
print "</td>"; print "</td>";
} } else {
else {
print '<td width="120">'; print '<td width="120">';
$listval = array( $listval = array(
'0'=>$langs->trans(""), '0'=>$langs->trans(""),
@@ -203,8 +201,7 @@ else {
{ {
print $langs->trans("OnPayment"); print $langs->trans("OnPayment");
print ' ('.$langs->trans("SupposedToBePaymentDate").')'; print ' ('.$langs->trans("SupposedToBePaymentDate").')';
} } else {
else {
print $langs->trans("OnDelivery"); print $langs->trans("OnDelivery");
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')'; print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
} }
@@ -214,8 +211,7 @@ else {
{ {
print $langs->trans("OnPayment"); print $langs->trans("OnPayment");
print ' ('.$langs->trans("SupposedToBePaymentDate").')'; print ' ('.$langs->trans("SupposedToBePaymentDate").')';
} } else {
else {
print $langs->trans("OnDelivery"); print $langs->trans("OnDelivery");
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')'; print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
} }
@@ -228,8 +224,7 @@ else {
{ {
print $langs->trans("OnPayment"); print $langs->trans("OnPayment");
print ' ('.$langs->trans("SupposedToBePaymentDate").')'; print ' ('.$langs->trans("SupposedToBePaymentDate").')';
} } else {
else {
print $langs->trans("OnInvoice"); print $langs->trans("OnInvoice");
print ' ('.$langs->trans("InvoiceDateUsed").')'; print ' ('.$langs->trans("InvoiceDateUsed").')';
} }
@@ -239,8 +234,7 @@ else {
{ {
print $langs->trans("OnPayment"); print $langs->trans("OnPayment");
print ' ('.$langs->trans("SupposedToBePaymentDate").')'; print ' ('.$langs->trans("SupposedToBePaymentDate").')';
} } else {
else {
print $langs->trans("OnInvoice"); print $langs->trans("OnInvoice");
print ' ('.$langs->trans("InvoiceDateUsed").')'; print ' ('.$langs->trans("InvoiceDateUsed").')';
} }

View File

@@ -63,8 +63,7 @@ if ($action == 'updateMask') {
if (!$error) if (!$error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} } else {
else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == 'setmod') { } elseif ($action == 'setmod') {

View File

@@ -179,8 +179,7 @@ if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=1'.$param.'">'; $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=1'.$param.'">';
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
$enabledisablehtml .= '</a>'; $enabledisablehtml .= '</a>';
} } else {
else {
// Button on, click to disable // Button on, click to disable
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=0'.$param.'">'; $enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=0'.$param.'">';
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on'); $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');

View File

@@ -56,8 +56,7 @@ if ($action == 'delete')
$ret = dol_delete_file($file, 1); $ret = dol_delete_file($file, 1);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
} } else {
else {
$file = $conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha')); $file = $conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha'));
$ret = dol_delete_file($file, 1); $ret = dol_delete_file($file, 1);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
@@ -186,8 +185,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP)) if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP))
{ {
$fullpathofmysqldump = $db->getPathOfDump(); $fullpathofmysqldump = $db->getPathOfDump();
} } else {
else {
$fullpathofmysqldump = $conf->global->SYSTEMTOOLS_MYSQLDUMP; $fullpathofmysqldump = $conf->global->SYSTEMTOOLS_MYSQLDUMP;
} }
print '<br>'; print '<br>';
@@ -336,8 +334,7 @@ if (in_array($type, array('pgsql'))) {
print '<div class="formelementrow">'.$langs->trans("FullPathToPostgreSQLdumpCommand"); print '<div class="formelementrow">'.$langs->trans("FullPathToPostgreSQLdumpCommand");
if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) { if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) {
$fullpathofpgdump = $db->getPathOfDump(); $fullpathofpgdump = $db->getPathOfDump();
} } else {
else {
$fullpathofpgdump = $conf->global->SYSTEMTOOLS_POSTGRESQLDUMP; $fullpathofpgdump = $conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
} }
print '<br>'; print '<br>';
@@ -430,8 +427,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
'id' => 'radio_compression_none', 'id' => 'radio_compression_none',
'label' => $langs->trans("None") 'label' => $langs->trans("None")
); );
} } else {
else {
$compression['none'] = array( $compression['none'] = array(
'function' => '', 'function' => '',
'id' => 'radio_compression_none', 'id' => 'radio_compression_none',
@@ -459,8 +455,7 @@ foreach ($compression as $key => $val)
if ($key == 'gz') $checked = ' checked'; if ($key == 'gz') $checked = ' checked';
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>'; print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>';
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>'; print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
} } else {
else {
// Disabled export format // Disabled export format
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>'; print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>';
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>'; print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
@@ -578,8 +573,7 @@ foreach ($filecompression as $key => $val)
if ($key == 'gz') $checked = ' checked'; if ($key == 'gz') $checked = ' checked';
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>'; print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>';
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>'; print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
} } else // Disabled export format
else // Disabled export format
{ {
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>'; print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>';
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>'; print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';

View File

@@ -105,8 +105,7 @@ print $langs->trans("RestoreDesc3", $dolibarr_main_db_name).'<br><br>';
<label for="radio_dump_mysql">MySQL (mysql)</label> <label for="radio_dump_mysql">MySQL (mysql)</label>
</div> </div>
<?php <?php
} } elseif (in_array($type, array('pgsql')))
elseif (in_array($type, array('pgsql')))
{ {
?> ?>
<div class="formelementrow"> <div class="formelementrow">
@@ -114,8 +113,7 @@ print $langs->trans("RestoreDesc3", $dolibarr_main_db_name).'<br><br>';
<label for="radio_dump_postgresql">PostgreSQL Restore (pg_restore or psql)</label> <label for="radio_dump_postgresql">PostgreSQL Restore (pg_restore or psql)</label>
</div> </div>
<?php <?php
} } else {
else {
print 'No method available with database '.$label; print 'No method available with database '.$label;
} }
?> ?>
@@ -160,8 +158,7 @@ if (in_array($type, array('mysql', 'mysqli')))
//else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>'; //else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>';
print '</div>'; print '</div>';
print '</fieldset>'; print '</fieldset>';
} } elseif (in_array($type, array('pgsql')))
elseif (in_array($type, array('pgsql')))
{ {
print '<fieldset id="postgresql_options">'; print '<fieldset id="postgresql_options">';
print '<legend>Restore PostgreSQL</legend>'; print '<legend>Restore PostgreSQL</legend>';

View File

@@ -203,8 +203,7 @@ if ($errormsg)
$resultstring .= '<div class="error">'.$langs->trans("Error")." : ".$errormsg.'</div>'; $resultstring .= '<div class="error">'.$langs->trans("Error")." : ".$errormsg.'</div>';
$_SESSION["commandbackupresult"] = $resultstring; $_SESSION["commandbackupresult"] = $resultstring;
} } else {
else {
if ($what) if ($what)
{ {
setEventMessages($langs->trans("BackupFileSuccessfullyCreated").'.<br>'.$langs->trans("YouCanDownloadBackupFile"), null, 'mesgs'); setEventMessages($langs->trans("BackupFileSuccessfullyCreated").'.<br>'.$langs->trans("YouCanDownloadBackupFile"), null, 'mesgs');

Some files were not shown because too many files have changed in this diff Show More