Fix: Removed warnings

This commit is contained in:
Laurent Destailleur 2011-09-21 13:16:13 +00:00
parent aff43ea24f
commit 8398c093c7
8 changed files with 335 additions and 330 deletions

View File

@ -30,10 +30,13 @@ $langs->load("admin");
$langs->load("users"); $langs->load("users");
$langs->load("other"); $langs->load("other");
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
/*
* Actions
*/
if ($_GET["action"] == 'add') if ($_GET["action"] == 'add')
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."rights_def SET bydefault=1"; $sql = "UPDATE ".MAIN_DB_PREFIX."rights_def SET bydefault=1";
@ -79,56 +82,56 @@ $modulesdir = array();
foreach ($conf->file->dol_document_root as $type => $dirroot) foreach ($conf->file->dol_document_root as $type => $dirroot)
{ {
$modulesdir[] = $dirroot . "/includes/modules/"; $modulesdir[] = $dirroot . "/includes/modules/";
if ($type == 'alt') if ($type == 'alt')
{ {
$handle=@opendir($dirroot); $handle=@opendir($dirroot);
if (is_resource($handle)) if (is_resource($handle))
{ {
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (is_dir($dirroot.'/'.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && $file != 'includes') if (is_dir($dirroot.'/'.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && $file != 'includes')
{ {
if (is_dir($dirroot . '/' . $file . '/includes/modules/')) if (is_dir($dirroot . '/' . $file . '/includes/modules/'))
{ {
$modulesdir[] = $dirroot . '/' . $file . '/includes/modules/'; $modulesdir[] = $dirroot . '/' . $file . '/includes/modules/';
} }
} }
} }
closedir($handle); closedir($handle);
} }
} }
} }
foreach ($modulesdir as $dir) foreach ($modulesdir as $dir)
{ {
// Load modules attributes in arrays (name, numero, orders) from dir directory // Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>"; //print $dir."\n<br>";
$handle=@opendir($dir); $handle=@opendir($dir);
if (is_resource($handle)) if (is_resource($handle))
{ {
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{ {
$modName = substr($file, 0, dol_strlen($file) - 10); $modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName) if ($modName)
{ {
include_once($dir."/".$file); include_once($dir."/".$file);
$objMod = new $modName($db); $objMod = new $modName($db);
if ($objMod->rights_class) { if ($objMod->rights_class) {
$ret=$objMod->insert_permissions(0); $ret=$objMod->insert_permissions(0);
$modules[$objMod->rights_class]=$objMod; $modules[$objMod->rights_class]=$objMod;
//print "modules[".$objMod->rights_class."]=$objMod;"; //print "modules[".$objMod->rights_class."]=$objMod;";
} }
} }
} }
} }
} }
} }
$db->commit(); $db->commit();

View File

@ -33,74 +33,79 @@ $langs->load("admin");
$langs->load("withdrawals"); $langs->load("withdrawals");
// Security check // Security check
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
$action = GETPOST("action"); $action = GETPOST("action");
/*
* Actions
*/
if ($action == "set") if ($action == "set")
{ {
$db->begin(); $db->begin();
for ($i = 0 ; $i < 2 ; $i++) for ($i = 0 ; $i < 2 ; $i++)
{
$res = dolibarr_set_const($db, $_POST["nom$i"], $_POST["value$i"],'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
$id=$_POST["PRELEVEMENT_ID_BANKACCOUNT"];
$account = new Account($db, $id);
if($account->fetch($id)>0)
{
$res = dolibarr_set_const($db, "PRELEVEMENT_ID_BANKACCOUNT", $id,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_GUICHET", $account->code_guichet,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_NUMERO_COMPTE", $account->number,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_NUMBER_KEY", $account->cle_rib,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_IBAN", $account->iban,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_BIC", $account->bic,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
else $error++;
if (! $error)
{ {
$db->commit(); $res = dolibarr_set_const($db, $_POST["nom$i"], $_POST["value$i"],'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
$id=$_POST["PRELEVEMENT_ID_BANKACCOUNT"];
$account = new Account($db, $id);
if($account->fetch($id)>0)
{
$res = dolibarr_set_const($db, "PRELEVEMENT_ID_BANKACCOUNT", $id,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_GUICHET", $account->code_guichet,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_NUMERO_COMPTE", $account->number,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_NUMBER_KEY", $account->cle_rib,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_IBAN", $account->iban,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_BIC", $account->bic,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
else $error++;
if (! $error)
{
$db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
} }
else else
{ {
$db->rollback(); $db->rollback();
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
} }
} }
if ($action == "addnotif") if ($action == "addnotif")
{ {
$bon = new BonPrelevement($db); $bon = new BonPrelevement($db);
$bon->AddNotification($db,$_POST["user"],$_POST["action"]); $bon->AddNotification($db,$_POST["user"],$_POST["action"]);
Header("Location: prelevement.php"); Header("Location: prelevement.php");
exit; exit;
} }
if ($action == "deletenotif") if ($action == "deletenotif")
{ {
$bon = new BonPrelevement($db); $bon = new BonPrelevement($db);
$bon->DeleteNotificationById($_GET["notif"]); $bon->DeleteNotificationById($_GET["notif"]);
Header("Location: prelevement.php"); Header("Location: prelevement.php");
exit; exit;
} }
/* /*
* View * View
*/ */
@ -157,35 +162,35 @@ print '<br>';
if ($conf->global->MAIN_MODULE_NOTIFICATION) if ($conf->global->MAIN_MODULE_NOTIFICATION)
{ {
$langs->load("mails"); $langs->load("mails");
print_titre($langs->trans("Notifications")); print_titre($langs->trans("Notifications"));
$sql = "SELECT rowid, name, firstname, fk_societe, email"; $sql = "SELECT rowid, name, firstname, fk_societe, email";
$sql.= " FROM ".MAIN_DB_PREFIX."user"; $sql.= " FROM ".MAIN_DB_PREFIX."user";
$sql.= " WHERE entity IN (0,".$conf->entity.")"; $sql.= " WHERE entity IN (0,".$conf->entity.")";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$var = true; $var = true;
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$var=!$var; $var=!$var;
if (!$obj->fk_societe) if (!$obj->fk_societe)
{ {
$username= $obj->firstname.' '.$obj->name; $username= $obj->firstname.' '.$obj->name;
$internalusers[$obj->rowid] = $username; $internalusers[$obj->rowid] = $username;
} }
$i++; $i++;
} }
$db->free($resql); $db->free($resql);
} }
$sql = "SELECT rowid, code, label"; $sql = "SELECT rowid, code, label";
$sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger"; $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger";
$sql.= " WHERE elementtype = 'withdraw'"; $sql.= " WHERE elementtype = 'withdraw'";
$sql.= " ORDER BY rang ASC"; $sql.= " ORDER BY rang ASC";
@ -207,24 +212,24 @@ if ($conf->global->MAIN_MODULE_NOTIFICATION)
} }
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=addnotif">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=addnotif">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("User").'</td>'; print '<td>'.$langs->trans("User").'</td>';
print '<td>'.$langs->trans("Value").'</td>'; print '<td>'.$langs->trans("Value").'</td>';
print '<td align="right">'.$langs->trans("Action").'</td>'; print '<td align="right">'.$langs->trans("Action").'</td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="impair"><td align="left">'; print '<tr class="impair"><td align="left">';
print $html->selectarray('user',$internalusers);// select_users(0,'user',0); print $html->selectarray('user',$internalusers);// select_users(0,'user',0);
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print $html->selectarray('action',$actions);// select_users(0,'user',0); print $html->selectarray('action',$actions);// select_users(0,'user',0);
print '</td>'; print '</td>';
print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>'; print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>';
} }
// List of current notifications for objet_type='withdraw' // List of current notifications for objet_type='withdraw'
$sql = "SELECT u.name, u.firstname"; $sql = "SELECT u.name, u.firstname";
@ -239,23 +244,23 @@ $sql.= " AND u.entity IN (0,".$conf->entity.")";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
$var = false; $var = false;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td>'.$obj->firstname." ".$obj->name.'</td>'; print '<td>'.$obj->firstname." ".$obj->name.'</td>';
$label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label); $label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label);
print '<td>'.$label.'</td>'; print '<td>'.$label.'</td>';
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=deletenotif&amp;notif='.$obj->rowid.'">'.img_delete().'</a></td>'; print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=deletenotif&amp;notif='.$obj->rowid.'">'.img_delete().'</a></td>';
print '</tr>'; print '</tr>';
$i++; $i++;
} }
$db->free($resql); $db->free($resql);
} }
print '</table>'; print '</table>';

View File

@ -41,96 +41,96 @@ $upload_dir=$conf->admin->dir_temp;
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
$result=create_exdir($upload_dir); // Create dir if not exists $result=create_exdir($upload_dir); // Create dir if not exists
if ($result >= 0) if ($result >= 0)
{ {
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],1,0,$_FILES['userfile']['error']); $resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],1,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0) if (is_numeric($resupload) && $resupload > 0)
{ {
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php');
$formmail = new FormMail($db); $formmail = new FormMail($db);
$formmail->add_attached_files($upload_dir . "/" . $_FILES['addedfile']['name'],$_FILES['addedfile']['name'],$_FILES['addedfile']['type']); $formmail->add_attached_files($upload_dir . "/" . $_FILES['addedfile']['name'],$_FILES['addedfile']['name'],$_FILES['addedfile']['type']);
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; $mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus.(.*)/',$resupload,$reg)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus.(.*)/',$resupload,$reg)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus"); $mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus");
$mesg.= '<br>'.$langs->trans("Information").': '.$langs->trans($reg[1]); $mesg.= '<br>'.$langs->trans("Information").': '.$langs->trans($reg[1]);
$mesg.= '</div>'; $mesg.= '</div>';
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; $mesg = '<div class="error">'.$langs->trans($resupload).'</div>';
} }
} }
} }
} }
if ($_GET["action"] == 'activate_captcha') if ($_GET["action"] == 'activate_captcha')
{ {
dolibarr_set_const($db, "MAIN_SECURITY_ENABLECAPTCHA", '1','chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SECURITY_ENABLECAPTCHA", '1','chaine',0,'',$conf->entity);
Header("Location: security_other.php"); Header("Location: security_other.php");
exit; exit;
} }
else if ($_GET["action"] == 'disable_captcha') else if ($_GET["action"] == 'disable_captcha')
{ {
dolibarr_del_const($db, "MAIN_SECURITY_ENABLECAPTCHA",$conf->entity); dolibarr_del_const($db, "MAIN_SECURITY_ENABLECAPTCHA",$conf->entity);
Header("Location: security_other.php"); Header("Location: security_other.php");
exit; exit;
} }
if ($_GET["action"] == 'activate_advancedperms') if ($_GET["action"] == 'activate_advancedperms')
{ {
dolibarr_set_const($db, "MAIN_USE_ADVANCED_PERMS", '1','chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_USE_ADVANCED_PERMS", '1','chaine',0,'',$conf->entity);
Header("Location: security_other.php"); Header("Location: security_other.php");
exit; exit;
} }
else if ($_GET["action"] == 'disable_advancedperms') else if ($_GET["action"] == 'disable_advancedperms')
{ {
dolibarr_del_const($db, "MAIN_USE_ADVANCED_PERMS",$conf->entity); dolibarr_del_const($db, "MAIN_USE_ADVANCED_PERMS",$conf->entity);
Header("Location: security_other.php"); Header("Location: security_other.php");
exit; exit;
} }
if ($_GET["action"] == 'MAIN_SESSION_TIMEOUT') if ($_GET["action"] == 'MAIN_SESSION_TIMEOUT')
{ {
if (! dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db); if (! dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully"); else $mesg=$langs->trans("RecordModifiedSuccessfully");
} }
if ($_GET["action"] == 'MAIN_UPLOAD_DOC') if ($_GET["action"] == 'MAIN_UPLOAD_DOC')
{ {
if (! dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity)) dol_print_error($db); if (! dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully"); else $mesg=$langs->trans("RecordModifiedSuccessfully");
} }
if ($_GET["action"] == 'MAIN_UMASK') if ($_GET["action"] == 'MAIN_UMASK')
{ {
if (! dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity)) dol_print_error($db); if (! dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully"); else $mesg=$langs->trans("RecordModifiedSuccessfully");
} }
if ($_GET["action"] == 'MAIN_ANTIVIRUS_COMMAND') if ($_GET["action"] == 'MAIN_ANTIVIRUS_COMMAND')
{ {
if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity)) dol_print_error($db); if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully"); else $mesg=$langs->trans("RecordModifiedSuccessfully");
} }
if ($_GET["action"] == 'MAIN_ANTIVIRUS_PARAM') if ($_GET["action"] == 'MAIN_ANTIVIRUS_PARAM')
{ {
if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity)) dol_print_error($db); if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully"); else $mesg=$langs->trans("RecordModifiedSuccessfully");
} }
@ -199,20 +199,20 @@ print '<td colspan="3">'.$langs->trans("UseCaptchaCode").'</td>';
print '<td align="right">'; print '<td align="right">';
if (function_exists("imagecreatefrompng")) if (function_exists("imagecreatefrompng"))
{ {
if ($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 0) if ($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 0)
{ {
print '<a href="security_other.php?action=activate_captcha">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="security_other.php?action=activate_captcha">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
} }
if($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 1) if($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 1)
{ {
print '<a href="security_other.php?action=disable_captcha">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>'; print '<a href="security_other.php?action=disable_captcha">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
} }
} }
else else
{ {
$html = new Form($db); $html = new Form($db);
$desc = $html->textwithpicto('',$langs->transnoentities("EnableGDLibraryDesc"),1,'warning'); $desc = $html->textwithpicto('',$langs->transnoentities("EnableGDLibraryDesc"),1,'warning');
print $desc; print $desc;
} }
print "</td>"; print "</td>";
@ -226,11 +226,11 @@ print '<td colspan="3">'.$langs->trans("UseAdvancedPerms").'</td>';
print '<td align="right">'; print '<td align="right">';
if ($conf->global->MAIN_USE_ADVANCED_PERMS == 0) if ($conf->global->MAIN_USE_ADVANCED_PERMS == 0)
{ {
print '<a href="security_other.php?action=activate_advancedperms">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="security_other.php?action=activate_advancedperms">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
} }
if($conf->global->MAIN_USE_ADVANCED_PERMS == 1) if($conf->global->MAIN_USE_ADVANCED_PERMS == 1)
{ {
print '<a href="security_other.php?action=disable_advancedperms">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>'; print '<a href="security_other.php?action=disable_advancedperms">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
} }
print "</td>"; print "</td>";
@ -296,14 +296,14 @@ print '</td>';
print '<td>'; print '<td>';
if (ini_get('safe_mode') && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) if (ini_get('safe_mode') && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND))
{ {
$langs->load("errors"); $langs->load("errors");
$basedir=preg_replace('/"/','',dirname($conf->global->MAIN_ANTIVIRUS_COMMAND)); $basedir=preg_replace('/"/','',dirname($conf->global->MAIN_ANTIVIRUS_COMMAND));
$listdir=explode(';',ini_get('safe_mode_exec_dir')); $listdir=explode(';',ini_get('safe_mode_exec_dir'));
if (! in_array($basedir,$listdir)) if (! in_array($basedir,$listdir))
{ {
print img_warning($langs->trans('WarningSafeModeOnCheckExecDir')); print img_warning($langs->trans('WarningSafeModeOnCheckExecDir'));
dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING); dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING);
} }
} }
print '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" size="72" value="'.htmlentities($conf->global->MAIN_ANTIVIRUS_COMMAND).'">'; print '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" size="72" value="'.htmlentities($conf->global->MAIN_ANTIVIRUS_COMMAND).'">';
print "</td>"; print "</td>";

View File

@ -31,11 +31,10 @@ require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
$langs->load("admin"); $langs->load("admin");
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
$action=GETPOST("action"); $action=GETPOST("action");
$value = GETPOST("value"); $value=GETPOST("value");
/* /*

View File

@ -29,10 +29,9 @@ $langs->load("admin");
$langs->load("stocks"); $langs->load("stocks");
// Securit check // Securit check
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
$action = getpost("action"); $action = GETPOST("action");
/* /*

View File

@ -26,8 +26,7 @@
require("../main.inc.php"); require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
$langs->load("admin"); $langs->load("admin");
$langs->load("other"); $langs->load("other");
@ -37,6 +36,7 @@ $action = GETPOST("action");
/* /*
* Actions * Actions
*/ */
if ($action== 'setlevel') if ($action== 'setlevel')
{ {
$level = GETPOST("level"); $level = GETPOST("level");

View File

@ -29,8 +29,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
$langs->load('admin'); $langs->load('admin');
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
$action = GETPOST("action"); $action = GETPOST("action");
@ -54,40 +53,40 @@ $tax_mode = empty($conf->global->TAX_MODE)?0:$conf->global->TAX_MODE;
if ($action == 'settaxmode') if ($action == 'settaxmode')
{ {
$tax_mode = GETPOST("tax_mode"); $tax_mode = GETPOST("tax_mode");
$db->begin(); $db->begin();
$res = dolibarr_set_const($db, 'TAX_MODE', $tax_mode,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, 'TAX_MODE', $tax_mode,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
switch ($tax_mode) switch ($tax_mode)
{
case 0:
$value = 'payment';
break;
case 1:
$value = 'invoice';
break;
}
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_PRODUCT', 'invoice','chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_PRODUCT', 'invoice','chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_SERVICE', $value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_SERVICE', $value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{ {
$db->commit(); case 0:
$value = 'payment';
break;
case 1:
$value = 'invoice';
break;
}
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_PRODUCT', 'invoice','chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_PRODUCT', 'invoice','chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_SERVICE', $value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_SERVICE', $value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
} }
else else
{ {
$db->rollback(); $db->rollback();
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
} }
@ -95,22 +94,22 @@ if ($action == 'settaxmode')
} }
/* /*
if ($_POST['action'] == 'update' || $_POST['action'] == 'add') if ($_POST['action'] == 'update' || $_POST['action'] == 'add')
{ {
if (! dolibarr_set_const($db, $_POST['constname'], $_POST['constvalue'], $typeconst[$_POST['consttype']], 0, isset($_POST['constnote']) ? $_POST['constnote'] : '',$conf->entity)); if (! dolibarr_set_const($db, $_POST['constname'], $_POST['constvalue'], $typeconst[$_POST['consttype']], 0, isset($_POST['constnote']) ? $_POST['constnote'] : '',$conf->entity));
{ {
print $db->error(); print $db->error();
} }
} }
if ($_GET['action'] == 'delete') if ($_GET['action'] == 'delete')
{ {
if (! dolibarr_del_const($db, $_GET['constname'],$conf->entity)); if (! dolibarr_del_const($db, $_GET['constname'],$conf->entity));
{ {
print $db->error(); print $db->error();
} }
} }
*/ */
/* /*
@ -127,50 +126,50 @@ print_fiche_titre($langs->trans('TaxSetup'),$linkback,'setup');
print '<br>'; print '<br>';
if (empty($mysoc->tva_assuj)) if (empty($mysoc->tva_assuj))
{ {
print $langs->trans("YourCompanyDoesNotUseVAT").'<br>'; print $langs->trans("YourCompanyDoesNotUseVAT").'<br>';
} }
else else
{ {
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
// Cas des parametres TAX_MODE_SELL/BUY_SERVICE/PRODUCT // Cas des parametres TAX_MODE_SELL/BUY_SERVICE/PRODUCT
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="settaxmode">'; print '<input type="hidden" name="action" value="settaxmode">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans('OptionVatMode').'</td><td>'.$langs->trans('Description').'</td>'; print '<td>'.$langs->trans('OptionVatMode').'</td><td>'.$langs->trans('Description').'</td>';
print '<td align="right"><input class="button" type="submit" value="'.$langs->trans('Modify').'"></td>'; print '<td align="right"><input class="button" type="submit" value="'.$langs->trans('Modify').'"></td>';
print "</tr>\n"; print "</tr>\n";
print '<tr '.$bc[false].'><td width="200"><input type="radio" name="tax_mode" value="0"'.($tax_mode != 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDefault').'</td>'; print '<tr '.$bc[false].'><td width="200"><input type="radio" name="tax_mode" value="0"'.($tax_mode != 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDefault').'</td>';
print '<td colspan="2">'.nl2br($langs->trans('OptionVatDefaultDesc')); print '<td colspan="2">'.nl2br($langs->trans('OptionVatDefaultDesc'));
print "</td></tr>\n"; print "</td></tr>\n";
print '<tr '.$bc[true].'><td width="200"><input type="radio" name="tax_mode" value="1"'.($tax_mode == 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDebitOption').'</td>'; print '<tr '.$bc[true].'><td width="200"><input type="radio" name="tax_mode" value="1"'.($tax_mode == 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDebitOption').'</td>';
print '<td colspan="2">'.nl2br($langs->trans('OptionVatDebitOptionDesc'))."</td></tr>\n"; print '<td colspan="2">'.nl2br($langs->trans('OptionVatDebitOptionDesc'))."</td></tr>\n";
print '</form>'; print '</form>';
print "</table>\n"; print "</table>\n";
print '<br><br>'; print '<br><br>';
print_fiche_titre($langs->trans("SummaryOfVatExigibilityUsedByDefault"),'',''); print_fiche_titre($langs->trans("SummaryOfVatExigibilityUsedByDefault"),'','');
//print ' ('.$langs->trans("CanBeChangedWhenMakingInvoice").')'; //print ' ('.$langs->trans("CanBeChangedWhenMakingInvoice").')';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td>&nbsp;</td><td>'.$langs->trans("Buy").'</td><td>'.$langs->trans("Sell").'</td></tr>'; print '<tr><td>&nbsp;</td><td>'.$langs->trans("Buy").'</td><td>'.$langs->trans("Sell").'</td></tr>';
// Products // Products
print '<tr><td>'.$langs->trans("Product").'</td>'; print '<tr><td>'.$langs->trans("Product").'</td>';
print '<td>'; print '<td>';
print $langs->trans("OnDelivery"); print $langs->trans("OnDelivery");
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')'; print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print $langs->trans("OnDelivery"); print $langs->trans("OnDelivery");
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')'; print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
print '</td></tr>'; print '</td></tr>';
// Services // Services
print '<tr><td>'.$langs->trans("Services").'</td>'; print '<tr><td>'.$langs->trans("Services").'</td>';
print '<td>'; print '<td>';
if ($tax_mode == 0) if ($tax_mode == 0)
{ {
print $langs->trans("OnPayment"); print $langs->trans("OnPayment");
@ -181,21 +180,21 @@ else
print $langs->trans("OnInvoice"); print $langs->trans("OnInvoice");
print ' ('.$langs->trans("InvoiceDateUsed").')'; print ' ('.$langs->trans("InvoiceDateUsed").')';
} }
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if ($tax_mode == 0) if ($tax_mode == 0)
{ {
print $langs->trans("OnPayment"); print $langs->trans("OnPayment");
print ' ('.$langs->trans("SupposedToBePaymentDate").')'; print ' ('.$langs->trans("SupposedToBePaymentDate").')';
} }
if ($tax_mode == 1) if ($tax_mode == 1)
{ {
print $langs->trans("OnInvoice"); print $langs->trans("OnInvoice");
print ' ('.$langs->trans("InvoiceDateUsed").')'; print ' ('.$langs->trans("InvoiceDateUsed").')';
} }
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
} }
dol_htmloutput_mesg($mesg); dol_htmloutput_mesg($mesg);

View File

@ -422,7 +422,7 @@ else // Open and return file
$original_file_osencoded=dol_osencode($original_file); $original_file_osencoded=dol_osencode($original_file);
// This test if file exists should be useless. We keep it to find bug more easily // This test if file exists should be useless. We keep it to find bug more easily
if (! dol_is_file($original_file_osencoded)) if (! dol_is_file($original_file_osencoded))
{ {
$error='Error: File '.$_GET["file"].' does not exists or filesystems permissions are not allowed'; $error='Error: File '.$_GET["file"].' does not exists or filesystems permissions are not allowed';
dol_print_error(0,$error); dol_print_error(0,$error);