diff --git a/include/ajax/ajax_user_security.php b/include/ajax/ajax_user_security.php index 1274a1301..4a0636dd1 100644 --- a/include/ajax/ajax_user_security.php +++ b/include/ajax/ajax_user_security.php @@ -30,9 +30,11 @@ if (!defined('ALLOWED')) * */ global $g_user; -if ( $g_user->check_module("C0SEC") == 0) - throw new Exception(_("Non autorisé")); - + if ($g_user->check_module("C0SEC") == 0) { + record_log("UNAUTHORIZED ACCESS"); + return; +} + $n_dossier_id=Dossier::id(); //----------------------------------------------------------------------------- // Manage the user's access to ledgers diff --git a/include/lib/itva_popup.class.php b/include/lib/itva_popup.class.php index 8b373afa6..4a0e20c25 100644 --- a/include/lib/itva_popup.class.php +++ b/include/lib/itva_popup.class.php @@ -216,7 +216,7 @@ list="dl_tva_%s" autocomplete="off">'; public function display() { $cn = Dossier::connect(); - $tva = new Acc_Tva($cn, $this->value); + $tva = Acc_Tva::build($cn, $this->value); $comment = ($tva->load() != "-1") ? $tva->tva_label : ""; $res = sprintf('%s', $this->name, $this->value, $this->name, $comment); diff --git a/include/param_sec.inc.php b/include/param_sec.inc.php index 9daaca5c8..fbcb9b77e 100644 --- a/include/param_sec.inc.php +++ b/include/param_sec.inc.php @@ -193,9 +193,15 @@ if ( $action == "view" ) // Show access for journal //-------------------------------------------------------------------------------- - $Res=$cn->exec_sql("select jrn_def_id,jrn_def_name from jrn_def ". - " order by jrn_def_name"); $sec_User=new Noalyss_user($cn,$user_id); + $Res=$cn->exec_sql(" + select jrn_def_id + ,jrn_def_name + ,coalesce(usr1.uj_priv,'X') priv + from jrn_def jrn1 + left join user_sec_jrn usr1 on (usr1.uj_jrn_id=jrn1.jrn_def_id and usr1.uj_login=$1) + order by jrn_def_name",[$sec_User->login]); + $n_dossier_id=Dossier::id(); $sHref=http_build_query(["act"=>"PDF:sec","user_id"=>$user_id,"gDossier"=>$n_dossier_id]); @@ -269,6 +275,7 @@ if ( $action == "view" ) /* set the widget */ $l_line=Database::fetch_array($Res,$i); $jrn_priv->value=$array; + $jrn_priv->selected=$l_line['priv']; $jrn_priv->id="ledas".uniqid(); $ie_input=new Inplace_Edit($jrn_priv); $ie_input->set_callback("ajax_misc.php"); @@ -276,7 +283,7 @@ if ( $action == "view" ) $ie_input->add_json_param("op", "ledger_access"); $ie_input->add_json_param("gDossier", $n_dossier_id); $ie_input->add_json_param("user_id", $user_id); - $ie_input->set_value($sec_User->get_ledger_access($l_line['jrn_def_id'])); + $ie_input->set_value($l_line['priv']); echo '