diff --git a/html/admin_repo.php b/html/admin_repo.php index 9f9356134..57fbd3002 100644 --- a/html/admin_repo.php +++ b/html/admin_repo.php @@ -23,16 +23,16 @@ include_once("ac_common.php"); include_once("postgres.php"); include_once("debug.php"); include_once("user_menu.php"); - - -html_page_start($g_UserProperty['use_theme']); -echo_debug(__FILE__,__LINE__,"entering admin_repo"); - $rep=DbConnect(); include_once ("class_user.php"); $User=new cl_user($rep); $User->Check(); -if ($g_UserProperty['use_admin'] != 1) { + + +html_page_start($User->theme); +echo_debug(__FILE__,__LINE__,"entering admin_repo"); + +if ($User->admin != 1) { html_page_stop(); return; } @@ -221,8 +221,8 @@ if ( $count == 0 ) { $Res=ExecSql($cn_mod,"update parm_periode set p_closed='t'"); // Reset Sequence $a_seq=array('s_jrn','s_jrn_op','s_centralized','s_stock_goods'); - foreach ($seq as $a_seq ) { - $sql=sprintf("select nextval('%s',1,false)",$seq); + foreach ($a_seq as $seq ) { + $sql=sprintf("select setval('%s',1,false)",$seq); $Res=ExecSql($cn_mod,$sql); } $sql="select jrn_def_id from jrn_def "; @@ -230,7 +230,7 @@ if ( $count == 0 ) { $Max=pg_NumRows($Res); for ($seq=0;$seq<$Max;$seq++) { $row=pg_fetch_array($Res,$seq); - $sql=sprintf ("select setval('s_jrn_%d,1,false)",$row['jrn_def_id']); + $sql=sprintf ("select setval('s_jrn_%d',1,false)",$row['jrn_def_id']); ExecSql($cn_mod,$sql); } diff --git a/html/annulation.php b/html/annulation.php index cc11778ab..49c368029 100644 --- a/html/annulation.php +++ b/html/annulation.php @@ -25,12 +25,6 @@ include_once("central_inc.php"); include_once("user_common.php"); include_once("form_input.php"); include_once("check_priv.php"); - -html_page_start($g_UserProperty['use_theme']); -if ( ! isset ( $g_dossier ) ) { - echo "You must choose a Dossier "; - exit -2; -} include_once ("postgres.php"); include_once("jrn.php"); /* Admin. Dossier */ @@ -39,15 +33,22 @@ include_once ("class_user.php"); $User=new cl_user($rep); $User->Check(); +html_page_start($User->theme); +if ( ! isset ( $_SESSION['g_dossier'] ) ) { + echo "You must choose a Dossier "; + exit -2; +} + if ( isset( $p_jrn )) { - session_register("g_jrn"); $g_jrn=$p_jrn; + $_SESSION["g_jrn"]=$g_jrn; + } // Check privilege // CheckJrn verify that the user is not an admin // an admin has all right - if ( CheckJrn($g_dossier,$g_user,$g_jrn) != 2 ) { + if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_SESSION['g_jrn']) != 2 ) { NoAccess(); exit -1; } @@ -65,7 +66,7 @@ foreach ($l_array as $key=>$element) { if ( isset ($annul) ) { if ( isset ($_POST['p_id'])) { // Get the current periode - $period=GetUserPeriode($cn,$g_user); + $period=GetUserPeriode($cn,$User->id); $p_id=$_POST['p_id']; // Get the date $e_op_date=$_POST['op_date']; @@ -79,7 +80,7 @@ if ( isset ($annul) ) { $p_id=-1; } // userPref contient la periode par default - $userPref=GetUserPeriode($cn,$g_user); + $userPref=GetUserPeriode($cn,$User->id); list ($l_date_start,$l_date_end)=GetPeriode($cn,$userPref); // Date dans la periode active @@ -152,13 +153,13 @@ if ( isset ($e_ech) ) { echo "
Echeance $e_ech
"; } for ( $i = 0; $i < $max_deb;$i++) { - $lib=GetPosteLibelle($g_dossier,${"e_class_deb$i"}); + $lib=GetPosteLibelle($_SESSION['g_dossier'],${"e_class_deb$i"}); echo '
'; echo ${"e_class_deb$i"}." $lib "."".${"e_mont_deb$i"}.""; echo "
"; } for ( $i = 0; $i < $max_cred;$i++) { - $lib=GetPosteLibelle($g_dossier,${"e_class_cred$i"}); + $lib=GetPosteLibelle($_SESSION['g_dossier'],${"e_class_cred$i"}); echo '
'; echo ${"e_class_cred$i"}." $lib "."".${"e_mont_cred$i"}.""; echo '
'; diff --git a/html/bal_csv.php b/html/bal_csv.php index f4442c9e7..15ad88352 100644 --- a/html/bal_csv.php +++ b/html/bal_csv.php @@ -25,7 +25,7 @@ include_once("class_balance.php"); include_once ("postgres.php"); include("class_jrn.php"); -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); include ('class_user.php'); diff --git a/html/central.php b/html/central.php index 5c9bcdfc5..19be195ca 100644 --- a/html/central.php +++ b/html/central.php @@ -21,9 +21,9 @@ /* $Revision$ */ include_once ("ac_common.php"); -html_page_start($g_UserProperty['use_theme']); +html_page_start($_SESSION['use_theme']); -if ( ! isset ( $g_dossier ) ) { +if ( ! isset ( $_SESSION['g_dossier'] ) ) { echo "You must choose a Dossier "; exit -2; } @@ -38,10 +38,10 @@ include_once("preference.php"); include_once ("top_menu_compta.php"); -ShowMenuCompta($g_dossier,$g_UserProperty); +ShowMenuCompta($_SESSION['g_dossier']); -if ( $g_UserProperty['use_admin']==0 ) { - $r=CheckAction($g_dossier,$g_user,CENTRALIZE); +if ( $_SESSION['use_admin']==0 ) { + $r=CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],CENTRALIZE); if ($r == 0 ){ /* Cannot Access */ NoAccess(); @@ -49,7 +49,7 @@ if ( $g_UserProperty['use_admin']==0 ) { } include_once("central_inc.php"); -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); echo '
'; echo '

Centralise


'; diff --git a/html/compta.php b/html/compta.php deleted file mode 100644 index 6714ffdb3..000000000 --- a/html/compta.php +++ /dev/null @@ -1,69 +0,0 @@ -Check(); -$rep=DbConnect(); -include_once ("class_user.php"); -$User=new cl_user($rep); -$User->Check(); - - -echo_debug(__FILE__,__LINE__,"theme ".$g_UserProperty['use_theme']); - -if ( $g_UserProperty['use_admin'] == 0 ) { - - $r=GetPriv($g_dossier,$g_user); - if ($r == 0 ){ - /* Cannot Access */ - NoAccess(); - } -} -SyncRight($g_dossier,$g_user); - - -include ("top_menu_compta.php"); - -// Show Top Menu -ShowMenuCompta($g_dossier,$g_UserProperty); - -// Show Menu on the right side -ShowMenuComptaRight($g_dossier,$g_UserProperty); - - -html_page_stop(); - -?> diff --git a/html/compta_login.php b/html/compta_login.php deleted file mode 100644 index 961fa49f9..000000000 --- a/html/compta_login.php +++ /dev/null @@ -1,106 +0,0 @@ - Dossier '; -echo ""; - -if ( $r_database != null ) { - $row=0; - foreach ( $r_database as $l_db ) { - $row++; - if ( $l_db['priv_priv'] == "W") { - $action="Encoder"; - } else { - $action="Lire"; - } - - if ( $row %2 == 0 ) { - $tr=''; - $td=''; - $td=' $td %s", - $tr, - $l_db['dos_name'], - $l_db['dos_description'], - $priv, - $l_db['dos_id'], - $action); - - - } - - echo "
'; - } else { - $tr='
'; - } - printf("%s $td %s %s %s
"; - $db_debut=15+$db_page; - if ($db_debut < $l_MaxLine) { - printf ("Suivant",$db_debut); - } - if ( $db_page !=0 ) { - $db_debut=$db_page-15; - printf ("Précédent",$db_debut); - } - -} -?> - - - diff --git a/html/dossier_prefs.php b/html/dossier_prefs.php index b1a124dc5..e017ac054 100644 --- a/html/dossier_prefs.php +++ b/html/dossier_prefs.php @@ -20,10 +20,9 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr /* $Revision$ */ include_once ("ac_common.php"); -html_page_start($g_UserProperty['use_theme']); -if ( ! isset ( $g_dossier ) ) { +html_page_start($_SESSION['use_theme']); +if ( ! isset ( $_SESSION['g_dossier'] ) ) { echo "You must choose a Dossier "; - phpinfo(); exit -2; } include_once ("postgres.php"); @@ -37,12 +36,12 @@ include("preference.php"); include_once ("top_menu_compta.php"); -ShowMenuCompta($g_dossier,$g_UserProperty); -// ShowMenuComptaRight($g_dossier,$g_UserProperty); +ShowMenuCompta($_SESSION['g_dossier']); + include_once ("check_priv.php"); -if ( $g_UserProperty['use_admin'] == 0 ) { - $r=CheckAction($g_dossier,$g_user,PARM); +if ( $User->admin == 0 ) { + $r=CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],PARM); if ($r == 0 ){ /* Cannot Access */ NoAccess(); @@ -52,7 +51,7 @@ if ( $g_UserProperty['use_admin'] == 0 ) { } echo ShowMenuParam(); $p_action=""; -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); if ( isset($_GET["p_action"]) ) { $p_action=$_GET["p_action"]; } diff --git a/html/enc_jrn.php b/html/enc_jrn.php index 92aa774cd..28d685fe9 100644 --- a/html/enc_jrn.php +++ b/html/enc_jrn.php @@ -39,7 +39,7 @@ include_once ("class_user.php"); $User=new cl_user($rep); $User->Check(); if ( isset( $p_jrn )) { - session_register("g_jrn"); + $_SESSION["g_jrn"]; $g_jrn=$p_jrn; } $cn=DbConnect($g_dossier); diff --git a/html/fiche.php b/html/fiche.php index 6b79bd0fb..0f129e86c 100644 --- a/html/fiche.php +++ b/html/fiche.php @@ -21,9 +21,9 @@ include_once ("ac_common.php"); //phpinfo(); -html_page_start($g_UserProperty['use_theme']); +html_page_start($_SESSION['use_theme']); -if ( ! isset ( $g_dossier ) ) { +if ( ! isset ( $_SESSION['g_dossier'] ) ) { echo "You must choose a Dossier "; exit -2; } @@ -36,7 +36,7 @@ include_once ("class_user.php"); $User=new cl_user($rep); $User->Check(); include ("check_priv.php"); -ShowMenuCompta($g_dossier,$g_UserProperty); +ShowMenuCompta($_SESSION['g_dossier']); if ( isset($_POST["PHPSESSID"] )) { @@ -49,16 +49,16 @@ $search='admin == 0 ) { + $read=CheckAction($_SESSION['g_dossier'],$User->id,FICHE_READ); + $write=CheckAction($_SESSION['g_dossier'],$User->id,FICHE_WRITE); if ($read+$write == 0 ){ /* Cannot Access */ NoAccess(); @@ -73,7 +73,7 @@ if ( isset($_POST['add_modele']) and $write != 0) { AddModele($cn,$HTTP_POST_VARS); } -ShowMenuFiche($g_dossier); +ShowMenuFiche($_SESSION['g_dossier']); if ( isset ( $_GET["action"]) ) { $action=$_GET["action"]; diff --git a/html/fiche_csv.php b/html/fiche_csv.php index 3fff4f65f..c6665e290 100644 --- a/html/fiche_csv.php +++ b/html/fiche_csv.php @@ -23,16 +23,16 @@ header('Content-Disposition: attachment;filename="fiche.csv"',FALSE); include_once ("ac_common.php"); include_once('class_fiche.php'); include_once ("postgres.php"); +include_once("check_priv.php"); - -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); include ('class_user.php'); $User=new cl_user($cn); $User->Check(); -if ( $g_UserProperty['use_admin'] == 0 ) { - if (CheckAction($g_dossier,$g_user,FICHE_READ) == 0 ) +if ( $_SESSION['use_admin'] == 0 ) { + if (CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],FICHE_READ) == 0 ) { /* Cannot Access */ NoAccess(); diff --git a/html/fiche_new.php b/html/fiche_new.php index 4f005e965..d4644fef1 100644 --- a/html/fiche_new.php +++ b/html/fiche_new.php @@ -18,27 +18,27 @@ */ // Auteur Dany De Bontridder ddebontridder@yahoo.fr include_once ("ac_common.php"); -/* $Revision$ */ - -html_page_start($g_UserProperty['use_theme']); - -if ( ! isset ( $g_dossier ) ) { - echo "You must choose a Dossier "; - phpinfo(); - exit -2; -} include_once ("postgres.php"); include_once ("check_priv.php"); +/* $Revision$ */ /* Admin. Dossier */ $rep=DbConnect(); include_once ("class_user.php"); $User=new cl_user($rep); $User->Check(); + +html_page_start($User->theme); + +if ( ! isset ( $_SESSION['g_dossier'] ) ) { + echo "You must choose a Dossier "; + exit -2; +} + // TODO add security here // Get The priv on the selected folder -if ( $g_UserProperty['use_admin'] == 0 ) { - $r=CheckAction($g_dossier,$g_user,FICHE_WRITE); +if ( $User->admin == 0 ) { + $r=CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],FICHE_WRITE); if ($r == 0 ){ /* Cannot Access */ echo '

Vous ne pouvez pas ajouter de fiche

'; @@ -46,7 +46,7 @@ if ( $g_UserProperty['use_admin'] == 0 ) { } } include_once("fiche_inc.php"); -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); foreach ($HTTP_GET_VARS as $key=>$element) { // The value are e_name e_type e_PHPSESSID ${"e_$key"}=$element; @@ -134,11 +134,11 @@ if ( isset($_POST['add_fiche'])) { } else { // We have to find it from the database if ( $e_type == 'deb' ) { $get='jrn_def_fiche_deb'; - $sql="select $get as fiche from jrn_def where jrn_def_id=$g_jrn"; + $sql="select $get as fiche from jrn_def where jrn_def_id=".$_SESSION['g_jrn']; } if ( $e_type == 'cred' ) { $get='jrn_def_fiche_cred'; - $sql="select $get as fiche from jrn_def where jrn_def_id=$g_jrn"; + $sql="select $get as fiche from jrn_def where jrn_def_id=".$_SESSION['g_jrn']; } diff --git a/html/fiche_search.php b/html/fiche_search.php index ce7b84c39..a47d16902 100644 --- a/html/fiche_search.php +++ b/html/fiche_search.php @@ -20,13 +20,6 @@ /* $Revision$ */ include_once ("ac_common.php"); include_once ("poste.php"); -html_page_start($g_UserProperty['use_theme']); - -if ( ! isset ( $g_dossier ) ) { - echo "You must choose a Dossier "; - phpinfo(); - exit -2; -} include_once ("postgres.php"); include_once("jrn.php"); /* Admin. Dossier */ @@ -35,10 +28,18 @@ include_once ("class_user.php"); $User=new cl_user($rep); $User->Check(); +html_page_start($User->theme); + +if ( ! isset ( $_SESSION['g_dossier'] ) ) { + echo "You must choose a Dossier "; + phpinfo(); + exit -2; +} + include_once ("check_priv.php"); // Get The priv on the selected folder -if ( $g_UserProperty['use_admin'] == 0 ) { - $r=CheckAction($g_dossier,$g_user,FICHE_READ); +if ( $User->admin == 0 ) { + $r=CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],FICHE_READ); if ($r == 0 ){ /* Cannot Access */ echo '

Vous n\' avez pas accès

'; @@ -74,7 +75,7 @@ function SetData (name_ctl,value,value_2,value_3,value_4,value_5,value_6) { } $element) { @@ -99,12 +100,12 @@ if ( isset ( $_POST['search']) ) { // Get the field from database if ( $e_type == 'deb' ) { $get='jrn_def_fiche_deb'; - $list_fiche=get_list_fiche($cn,$get,$g_jrn); + $list_fiche=get_list_fiche($cn,$get,$_SESSION['g_jrn']); $sql="select * from vw_fiche_attr where fd_id in ( $list_fiche )"; } if ( $e_type == 'cred' ) { $get='jrn_def_fiche_cred'; - $list_fiche=get_list_fiche($cn,$get,$g_jrn); + $list_fiche=get_list_fiche($cn,$get,$_SESSION['g_jrn']); $sql="select * from vw_fiche_attr where fd_id in ( $list_fiche )"; } diff --git a/html/impress.php b/html/impress.php deleted file mode 100644 index 778cdeea4..000000000 --- a/html/impress.php +++ /dev/null @@ -1,134 +0,0 @@ -Check(); -include ("check_priv.php"); -include_once ("top_menu_compta.php"); -ShowMenuCompta($g_dossier,$g_UserProperty); - -// $_GET['direct'] if we want to print from -// the advanced menu in the user interface -if ( isset ($_GET['direct'])) { - if ( isset ($g_jrn) ) { - echo_debug("g_jrn is set --> come from user_profile"); - $p_id=$g_jrn; - } else { - if (isset ($_GET["p_id"]) ) { - $p_id=$_GET["p_id"]; - } - } -} - -include_once("impress_inc.php"); -ShowMenuComptaRight($g_dossier,$g_UserProperty); -if ( $g_UserProperty['use_admin'] == 0 ) { - $r=CheckAction($g_dossier,$g_user,IMP); - if ($r == 0 ){ - /* Cannot Access */ - NoAccess(); - } - if ( isset ($_GET["type"])) { - if ( $type=="jrn") { - $right=CheckJrn($g_dossier,$g_user,$p_id); - if ($right == 0 ){ - /* Cannot Access */ - NoAccess(); - exit -1; - } - } - } -} - -$cn=DbConnect($g_dossier); - -// if the user has the profile compta show the left menu -if ( $g_UserProperty['use_usertype'] == 'compta' or - ! isset ($_GET['direct'])) - ShowMenuJrnUserImp($cn,$g_user,$g_dossier); - -// if the user has the profile compta show the left menu -if ( $g_UserProperty['use_usertype'] == 'user') { - if ( isset ($_GET['direct'])){ - // Get the jrn_type_id - include_once('jrn.php'); - $JrnProp=GetJrnProp($g_dossier,$g_jrn); - $jrn_type=$JrnProp['jrn_def_type']; - - // Display available menus - ShowMenuJrnUser($g_dossier,$g_UserProperty,$jrn_type,$g_jrn); - - // display jrn's menu - include_once('user_menu.php'); - $menu_jrn=u_ShowMenuJrn($cn,$jrn_type); - echo '
'; - echo $menu_jrn; - echo '
'; - } -} // Menu for user's profile when printing from user_jrn - -// Ask the period -if ( isset ( $_GET["action"]) ) { - echo_debug(" action is set "); - $a_print=$HTTP_GET_VARS; - // p_id come from the user interface - if ( isset($p_id) and isset ( $_GET['direct'])) { - $a_print['p_id']=$p_id; - } - echo '
'; - echo '

Choississez la période

'; - ViewImp($a_print,$cn); - echo '
'; -}//if ( isset ( $_GET["action"] )) - -// The period is given, now show the result -if ( isset ( $_POST["print"]) ) { - echo '
'; - $result=Imp($HTTP_POST_VARS,$cn); - if ($result== NO_PERIOD_SELECTED) { - echo ""; - return; - } - if ($result== NO_POST_SELECTED) { - echo ""; - return; - } - - if ( $_POST["action"]=="viewhtml") { - echo ""; - echo $result; - echo "
"; - } - - echo ''; -}//if ( isset ( $_GET["action"] )) - -html_page_stop(); -?> diff --git a/html/jrn_add.php b/html/jrn_add.php index 14e3498bb..e0453e7d4 100644 --- a/html/jrn_add.php +++ b/html/jrn_add.php @@ -21,8 +21,8 @@ /* $Revision$ */ include_once ("ac_common.php"); include_once("jrn.php"); -html_page_start($g_UserProperty['use_theme']); -if ( ! isset ( $g_dossier ) ) { +html_page_start($_SESSION['use_theme']); +if ( ! isset ( $_SESSION['g_dossier'] ) ) { echo "You must choose a Dossier "; exit -2; } @@ -34,11 +34,11 @@ $User=new cl_user($rep); $User->Check(); include_once("check_priv.php"); include_once ("top_menu_compta.php"); -ShowMenuCompta($g_dossier,$g_UserProperty); +ShowMenuCompta($_SESSION['g_dossier']); -if ( $g_UserProperty['use_admin'] == 0 ) { - $r=CheckAction($g_dossier,$g_user,SECU); +if ( $User->admin == 0 ) { + $r=CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],SECU); if ($r == 0 ){ /* Cannot Access */ NoAccess(); @@ -50,7 +50,7 @@ if ( $g_UserProperty['use_admin'] == 0 ) { //echo ''; echo JS_SEARCH_POSTE; -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); If ( isset ($_POST["JRN_ADD"]) ) { if ( !isset($_POST["p_jrn_name"]) || ! isset($_POST["p_jrn_type"] )) { @@ -105,7 +105,7 @@ echo_debug(__FILE__,__LINE__,"nom journal $p_jrn_name"); $Res=ExecSql($cn,$Sql); } } -ShowMenuJrn($g_dossier); +ShowMenuJrn($_SESSION['g_dossier']); if ( isset ($_GET["PHPSESSID"]) ) { $sessid=$_GET["PHPSESSID"]; }else { diff --git a/html/jrn_csv.php b/html/jrn_csv.php index f5060a787..3953a765b 100644 --- a/html/jrn_csv.php +++ b/html/jrn_csv.php @@ -23,16 +23,16 @@ header('Content-Disposition: attachment;filename="jrn.csv"',FALSE); include_once ("ac_common.php"); include_once ("postgres.php"); - +include_once("check_priv.php"); include("class_jrn.php"); -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); include ('class_user.php'); $User=new cl_user($cn); $User->Check(); -if ( $g_UserProperty['use_admin'] == 0 ) { - if (CheckAction($g_dossier,$g_user,IMP) == 0 || +if ( $User->admin == 0 ) { + if (CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],IMP) == 0 || $User->AccessJrn($_POST['jrn_id']) == false){ /* Cannot Access */ NoAccess(); diff --git a/html/jrn_detail.php b/html/jrn_detail.php index b6456c0b4..20ca6f635 100644 --- a/html/jrn_detail.php +++ b/html/jrn_detail.php @@ -19,8 +19,8 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr /* $Revision$ */ include_once ("ac_common.php"); -html_page_start($g_UserProperty['use_theme']); -if ( ! isset ( $g_dossier ) ) { +html_page_start($_SESSION['use_theme']); +if ( ! isset ( $_SESSION['g_dossier'] ) ) { echo "You must choose a Dossier "; exit -2; } @@ -32,14 +32,14 @@ $User=new cl_user($rep); $User->Check(); include_once ("top_menu_compta.php"); -ShowMenuCompta($g_dossier,$g_UserProperty); +ShowMenuCompta($_SESSION['g_dossier']); include_once("check_priv.php"); -if ( $g_UserProperty['use_admin'] == 0 ) { +if ( $_SESSION['use_admin'] == 0 ) { include_once("check_priv.php"); - $r=CheckAction($g_dossier,$g_user,SECU); + $r=CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],SECU); if ($r == 0 ){ /* Cannot Access */ NoAccess(); @@ -50,12 +50,13 @@ if ( $g_UserProperty['use_admin'] == 0 ) { // Javascript echo JS_SEARCH_POSTE; if ( isset( $_GET['p_jrn'] )) { - session_register("g_jrn"); $g_jrn=$p_jrn; + $_SESSION["g_jrn"]=$p_jrn; + } -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); If ( isset ($_POST["JRN_UPD"] )) { if ( !isset($_POST["p_jrn_name"]) ) { @@ -100,19 +101,19 @@ If ( isset ($_POST["JRN_UPD"] )) { $l_deb_max_line,$l_cred_max_line, $p_ech,$p_ech_lib, $p_jrn_fiche_deb,$p_jrn_fiche_cred, - $g_jrn + $_SESSION['g_jrn'] ); echo_debug($Sql); $Res=ExecSql($cn,$Sql); } } -ShowMenuJrn($g_dossier); +ShowMenuJrn($_SESSION['g_dossier']); $Res=ExecSql($cn,"select jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,". "jrn_deb_max_line,jrn_cred_max_line,jrn_def_code". ",jrn_def_type,jrn_def_ech, jrn_def_ech_lib,jrn_def_fiche_deb,jrn_def_fiche_cred". " from jrn_def where". - " jrn_def_id=".$g_jrn); + " jrn_def_id=".$_SESSION['g_jrn']); $l_line=pg_fetch_array($Res,0); if ( isset ($_GET["PHPSESSID"] ) ) { $sessid=$_GET["PHPSESSID"]; diff --git a/html/jrn_op_detail.php b/html/jrn_op_detail.php index e80e1e4f0..12ab7106d 100644 --- a/html/jrn_op_detail.php +++ b/html/jrn_op_detail.php @@ -21,8 +21,8 @@ include_once ("ac_common.php"); include_once ("poste.php"); include_once ("user_common.php"); -html_page_start($g_UserProperty['use_theme']); -if ( ! isset ( $g_dossier ) ) { +html_page_start($_SESSION['use_theme']); +if ( ! isset ( $_SESSION['g_dossier'] ) ) { echo "You must choose a Dossier "; // phpinfo(); exit -2; @@ -35,11 +35,12 @@ include_once ("class_user.php"); $User=new cl_user($rep); $User->Check(); -if ( isset( $p_jrn )) { - session_register("g_jrn"); - $g_jrn=$p_jrn; +if ( isset( $_GET['$p_jrn'] )) { + $g_jrn=$_GE['p_jrn']; + $_SESSION[ "g_jrn"]=$g_jrn; + } -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); $jrn_op=$_GET['jrn_op']; list ($l_array,$max_deb,$max_cred)=GetData($cn,$jrn_op); foreach ($l_array as $key=>$element) { @@ -60,14 +61,14 @@ if ( isset ($e_ech) ) { echo '
'; for ( $i = 0; $i < $max_deb;$i++) { - $lib=GetPosteLibelle($g_dossier,${"e_class_deb$i"}); + $lib=GetPosteLibelle($_SESSION['g_dossier'],${"e_class_deb$i"}); echo ${"e_class_deb$i"}." $lib "."".${"e_mont_deb$i"}.".
"; } echo "
"; echo '
'; for ( $i = 0; $i < $max_cred;$i++) { - $lib=GetPosteLibelle($g_dossier,${"e_class_cred$i"}); + $lib=GetPosteLibelle($_SESSION['g_dossier'],${"e_class_cred$i"}); echo ${"e_class_cred$i"}." $lib "."".${"e_mont_cred$i"}."
"; } diff --git a/html/jrn_pdf.php b/html/jrn_pdf.php index 70d3e1b47..e0413cb4a 100644 --- a/html/jrn_pdf.php +++ b/html/jrn_pdf.php @@ -22,7 +22,7 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr // $Revision$ -if ( ! isset($g_dossier) ) { +if ( ! isset($_SESSION['g_dossier']) ) { echo "INVALID G_DOSSIER UNKNOWN !!! "; exit(); } @@ -34,8 +34,10 @@ include_once("class.ezpdf.php"); include_once("impress_inc.php"); include_once("preference.php"); include_once("class_jrn.php"); +include_once("check_priv.php"); + echo_debug(__FILE__,__LINE__,"imp pdf journaux"); -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); $l_type="JRN"; $centr=" Non centralisé"; $l_centr=0; @@ -48,8 +50,8 @@ $Jrn=new jrn($cn,$_POST['jrn_id']); $Jrn->GetName(); $User=new cl_user($cn); $User->Check(); -if ( $g_UserProperty['use_admin'] == 0 ) { - if (CheckAction($g_dossier,$g_user,IMP) == 0 || +if ( $User->admin == 0 ) { + if (CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],IMP) == 0 || $User->AccessJrn($_POST['jrn_id']) == false){ /* Cannot Access */ NoAccess(); diff --git a/html/jrn_search.php b/html/jrn_search.php index 934a7fd78..0b21fa654 100644 --- a/html/jrn_search.php +++ b/html/jrn_search.php @@ -19,23 +19,25 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr /* $Revision$ */ include_once ("ac_common.php"); -html_page_start($g_UserProperty['use_theme']); -if ( ! isset ( $g_dossier ) ) { - echo "You must choose a Dossier "; - phpinfo(); - exit -2; -} include_once ("postgres.php"); /* Admin. Dossier */ $rep=DbConnect(); include_once ("class_user.php"); $User=new cl_user($rep); $User->Check(); + +html_page_start($User->theme); +if ( ! isset ( $_SESSION['g_dossier'] ) ) { + echo "You must choose a Dossier "; + phpinfo(); + exit -2; +} // Javascript echo JS_CONCERNED_OP; if ( isset( $p_jrn )) { - session_register("g_jrn"); $g_jrn=$p_jrn; + $_SESSION[ "g_jrn"]=$g_jrn; + } if (isset ($_GET['p_ctl'])) $p_ctl=$_GET['p_ctl']; if (isset($_POST['p_ctl'])) $p_ctl=$_POST['p_ctl']; @@ -52,7 +54,7 @@ $c_internal=""; $c_date=""; $condition=""; $part=" where "; -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); // if search then build the condition if ( isset ($_POST["search"]) ) { $c1=0; @@ -89,10 +91,10 @@ echo_debug(__FILE__,__LINE__,"condition = $condition"); $condition=$condition." ".$part; // If the usr is admin he has all right -if ( $g_UserProperty['use_admin'] != 1 ) { - $condition.=" uj_priv in ('W','R') and uj_login='".$g_user."'" ; +if ( $User->admin != 1 ) { + $condition.=" uj_priv in ('W','R') and uj_login='".$User->id."'" ; } else { - $condition.=" uj_login='$g_user' "; + $condition.=" uj_login='".$User->id."' "; } ?>
diff --git a/html/jrn_update.php b/html/jrn_update.php index 9c3e8da27..1d6b8a75f 100644 --- a/html/jrn_update.php +++ b/html/jrn_update.php @@ -19,8 +19,8 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr /* $Revision$ */ include_once ("ac_common.php"); -html_page_start($g_UserProperty['use_theme']); -if ( ! isset ( $g_dossier ) ) { +html_page_start($_SESSION['use_theme']); +if ( ! isset ( $_SESSION['g_dossier'] ) ) { echo "You must choose a Dossier "; phpinfo(); exit -2; @@ -35,10 +35,10 @@ $User->Check(); include_once ("check_priv.php"); include_once ("top_menu_compta.php"); -ShowMenuCompta($g_dossier,$g_UserProperty); +ShowMenuCompta($_SESSION['g_dossier']); -if ( $g_UserProperty['use_admin'] == 0 ) { - $r=CheckAction($g_dossier,$g_user,GJRN); +if ( $User->admin == 0 ) { + $r=CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],GJRN); if ($r == 0 ){ /* Cannot Access */ NoAccess(); @@ -47,9 +47,9 @@ if ( $g_UserProperty['use_admin'] == 0 ) { } } -ShowMenuJrn($g_dossier); +ShowMenuJrn($_SESSION['g_dossier']); -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); echo '
'; echo "
"; diff --git a/html/line_update.php b/html/line_update.php index 230bbfee3..f7efb8a2d 100644 --- a/html/line_update.php +++ b/html/line_update.php @@ -19,8 +19,8 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr // $Revision$ include_once ("ac_common.php"); -html_page_start($g_UserProperty['use_theme']); -if ( !isset ($g_dossier)) { +html_page_start($_SESSION['use_theme']); +if ( !isset ($_SESSION['g_dossier'])) { echo "You must choose a Dossier "; phpinfo(); exit -2; @@ -34,8 +34,8 @@ include_once ("class_user.php"); $User=new cl_user($rep); $User->Check(); -if ( $g_UserProperty['use_admin'] == 0 ) { - $r=CheckAction($g_dossier,$g_user,SECU); +if ( $User->admin == 0 ) { + $r=CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],SECU); if ($r == 0 ){ /* Cannot Access */ NoAccess(); @@ -46,8 +46,8 @@ if ( $g_UserProperty['use_admin'] == 0 ) { } include ("top_menu_compta.php"); -ShowMenuComptaRight($g_dossier,$g_UserProperty); -$l_Db=sprintf("dossier%d",$g_dossier); +ShowMenuComptaRight($_SESSION['g_dossier'],$User->admin); +$l_Db=sprintf("dossier%d",$_SESSION['g_dossier']); echo '
'; ?> diff --git a/html/login.php b/html/login.php index ebe4f2aa0..22cca30e8 100644 --- a/html/login.php +++ b/html/login.php @@ -18,8 +18,6 @@ */ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr include_once ("ac_common.php"); -//phpinfo(); -//exit(); /* $Revision$ */ @@ -31,37 +29,28 @@ if ( isset ($_POST["p_user"] ) ) { echo_debug(__FILE__,__LINE__,"user is set"); $g_user=$_POST["p_user"]; $g_pass=$_POST["p_pass"]; - session_register("g_user"); - session_register("g_pass"); + $_SESSION['g_user']=$g_user; + $_SESSION['g_pass']=$g_pass; //$cn=pg_connect("dbname=account_repository user='phpcompta' "); - $cn=DbConnect(); + // Verif if User and Pass match DB // if no, then redirect to the login page $rep=DbConnect(); include_once ("class_user.php"); $User=new cl_user($rep); $User->Check(); - $g_UserProperty=GetUserProperty($cn,$g_user); - session_register("g_UserProperty"); - if ( isset ( $_GET["PHPSESSID"]) ) - $p_sessid= $_GET["PHPSESSID"]; - else - $p_sessid= $_POST["PHPSESSID"]; - - -// TODO bug ???? - Redirect($g_UserProperty['use_usertype'],$_REQUEST["PHPSESSID"]); + + Redirect($User->type,$_REQUEST["PHPSESSID"]); } else { - if (isset ($g_UserProperty['use_usertype'])) { - if ( isset ( $_GET["PHPSESSID"]) ) - $p_sessid= $_GET["PHPSESSID"]; - else - $p_sessid= $_POST["PHPSESSID"]; -// TODO bug ???? - Redirect($g_UserProperty['use_usertype'],$_REQUEST["PHPSESSID"]); - } + $rep=DbConnect(); + include_once ("class_user.php"); + $User=new cl_user($rep); + $User->Check(); + + Redirect($User->type,$_REQUEST["PHPSESSID"]); + // } } html_page_stop(); ?> diff --git a/html/modify_op.php b/html/modify_op.php index a01695f90..4bd0a87e9 100644 --- a/html/modify_op.php +++ b/html/modify_op.php @@ -24,32 +24,36 @@ include_once("preference.php"); include_once("central_inc.php"); include_once("check_priv.php"); include_once("user_common.php"); - -html_page_start($g_UserProperty['use_theme']); -if ( ! isset ( $g_dossier ) ) { - echo "You must choose a Dossier "; - exit -2; -} include_once ("postgres.php"); include_once("jrn.php"); + /* Admin. Dossier */ $rep=DbConnect(); include_once ("class_user.php"); $User=new cl_user($rep); $User->Check(); -$cn=DbConnect($g_dossier); +html_page_start($User->theme); +if ( ! isset ( $_SESSION['g_dossier'] ) ) { + echo "You must choose a Dossier "; + exit -2; +} -if ( isset( $p_jrn )) { - session_register("g_jrn"); - $g_jrn=$p_jrn; +$cn=DbConnect($_SESSION['g_dossier']); + +if ( isset( $_GET['p_jrn'] )) { + $g_jrn=$_GET['p_jrn']; } else { - if ( ! isset ( $g_jrn)) + if ( ! isset ( $_SESSION['g_jrn']) ) $g_jrn=0; + else + $g_jrn=$_SESSION['g_jrn']; } if ( isset ( $_GET['action'] ) ) { $action=$_GET['action']; } +$_SESSION["g_jrn"]=$g_jrn; + if ( isset ( $_POST['action'] ) ) { $action=$_POST['action']; @@ -63,7 +67,7 @@ if ( ! isset ( $action )) { echo JS_VIEW_JRN_MODIFY; if ( $action == 'update' ) { - if ( ($priv=CheckJrn($g_dossier,$g_user,$g_jrn)) < 1 ) { + if ( ($priv=CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_SESSION['g_jrn'])) < 1 ) { NoAccess(); exit -1; @@ -90,7 +94,7 @@ if ( $action == 'update' ) { // echo '
'; } if ( isset($_POST['update_record']) ) { - if ( ($priv=CheckJrn($g_dossier,$g_user,$g_jrn)) !=2 ) { + if ( ($priv=CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$g_jrn)) !=2 ) { NoAccess(); exit -1; diff --git a/html/pcmn_update.php b/html/pcmn_update.php index ea3dd5312..81ba968fe 100644 --- a/html/pcmn_update.php +++ b/html/pcmn_update.php @@ -19,8 +19,8 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr /* $Revision$ */ include_once ("ac_common.php"); -html_page_start($g_UserProperty['use_theme']); -if ( ! isset ( $g_dossier ) ) { +html_page_start($_SESSION['use_theme']); +if ( ! isset ( $_SESSION['g_dossier'] ) ) { echo "You must choose a Dossier "; phpinfo(); exit -2; @@ -36,10 +36,10 @@ $User->Check(); include_once ("top_menu_compta.php"); include_once ("check_priv.php"); -ShowMenuCompta($g_dossier,$g_UserProperty); +ShowMenuCompta($_SESSION['g_dossier']); -if ( $g_UserProperty['use_admin'] == 0 ) { - $r=CheckAction($g_dossier,$g_user,MPCMN); +if ( $User->admin == 0 ) { + $r=CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],MPCMN); if ($r == 0 ){ /* Cannot Access */ NoAccess(); @@ -50,21 +50,18 @@ if ( $g_UserProperty['use_admin'] == 0 ) { } /* Store the p_start parameter */ -if ( isset ($g_start) ) { - echo_debug(__FILE__,__LINE__,"g_start is defined [ $g_start ]"); +if ( ! isset ( $_SESSION['g_start']) ) { + $_SESSION['g_start']=""; + } -if ( ! isset ( $g_start) ) { - $g_start=""; -} -if ( isset ($p_start)) { - echo_debug(__FILE__,__LINE__,"PCMN p_start : $p_start"); - echo_debug(__FILE__,__LINE__,"p_start[$p_start] and g_start don't exist"); - session_register("g_start"); - $g_start=$p_start; +if ( isset ($_GET['p_start'])) { + $g_start=$_GET['p_start']; + $_SESSION["g_start"]=$g_start; + } -ShowMenuPcmn($g_start); -$cn=DbConnect($g_dossier); +ShowMenuPcmn($_SESSION['g_start']); +$cn=DbConnect($_SESSION['g_dossier']); echo '
'; /* Analyse ce qui est demandé */ /* Effacement d'une ligne */ @@ -149,7 +146,7 @@ if ( isset ($_POST["update"] ) ) { } -$Ret=ExecSql($cn,"select pcm_val,pcm_lib,pcm_val_parent from tmp_pcmn where substr(pcm_val::text,1,1)='$g_start' order by pcm_val::text"); +$Ret=ExecSql($cn,"select pcm_val,pcm_lib,pcm_val_parent from tmp_pcmn where substr(pcm_val::text,1,1)='".$_SESSION['g_start']."' order by pcm_val::text"); $MaxRow=pg_NumRows($Ret); ?> diff --git a/html/poste_csv.php b/html/poste_csv.php index bd7811038..85dab3d71 100644 --- a/html/poste_csv.php +++ b/html/poste_csv.php @@ -26,7 +26,7 @@ header('Content-type: application/csv'); header('Content-Disposition: attachment;filename="poste.csv"',FALSE); /* Admin. Dossier */ -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); $User=new cl_user($cn); diff --git a/html/poste_pdf.php b/html/poste_pdf.php index cf058f35b..91a4f44d1 100644 --- a/html/poste_pdf.php +++ b/html/poste_pdf.php @@ -28,7 +28,7 @@ include_once("class.ezpdf.php"); include_once("impress_inc.php"); include("poste.php"); - $cn=DbConnect($g_dossier); + $cn=DbConnect($_SESSION['g_dossier']); foreach ($HTTP_POST_VARS as $key=>$element) { ${"$key"}=$element; } diff --git a/html/poste_search.php b/html/poste_search.php index 027778098..6a910bb01 100644 --- a/html/poste_search.php +++ b/html/poste_search.php @@ -20,7 +20,7 @@ /* $Revision$ */ include_once ("ac_common.php"); -html_page_start($g_UserProperty['use_theme']); +html_page_start($_SESSION['use_theme']); include_once ("postgres.php"); include_once("jrn.php"); /* Admin. Dossier */ @@ -28,10 +28,10 @@ $rep=DbConnect(); include_once ("class_user.php"); $User=new cl_user($rep); $User->Check(); -//echo ''; + echo JS_SEARCH_POSTE; -if ( ! isset ( $g_dossier ) ) { +if ( ! isset ( $_SESSION['g_dossier'] ) ) { echo "You must choose a Dossier "; exit -2; } @@ -40,7 +40,7 @@ $c_comment=""; $c_class=""; $condition=""; -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); if ( isset($_POST['search']) ) { $c1=0; foreach( $HTTP_POST_VARS as $key=>$element){ @@ -71,7 +71,7 @@ if ( isset($_GET['filter'])) { // have to find what account are available $SqlCred=""; // Load the property - $l_line=GetJrnProperty($cn,$g_jrn); + $l_line=GetJrnProperty($cn,$_SESSION['g_jrn']); if ( strlen(trim ($l_line['jrn_def_class_cred']) ) > 0 ) { $valid_cred=split(" ",$l_line['jrn_def_class_cred']); diff --git a/html/print_balance.php b/html/print_balance.php index 474e8be4e..8a7b4581d 100644 --- a/html/print_balance.php +++ b/html/print_balance.php @@ -37,7 +37,7 @@ include_once("poste.php"); include_once("class_balance.php"); include_once("preference.php"); -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); $bal=new Balance($cn); diff --git a/html/priv_user.php b/html/priv_user.php index cf5147062..de5314608 100644 --- a/html/priv_user.php +++ b/html/priv_user.php @@ -21,7 +21,7 @@ include_once("ac_common.php"); include_once("postgres.php"); include_once("debug.php"); include_once("user_menu.php"); -html_page_start($g_UserProperty['use_theme']); +html_page_start($_SESSION['use_theme']); echo_debug(__FILE__,__LINE__,"entering priv_users"); @@ -29,11 +29,12 @@ $rep=DbConnect(); include_once ("class_user.php"); $User=new cl_user($rep); $User->Check(); -if ($g_UserProperty['use_admin'] != 1) { + +if ($User->admin != 1) { html_page_stop(); return; } -if (! isset ($UID) ) { +if (! isset ($_GET['UID']) ) { //Message d'erreur si UID non positionné echo_debug(__FILE__,__LINE__,"UID NOT DEFINED"); html_page_stop(); @@ -41,7 +42,7 @@ if (! isset ($UID) ) { } echo_debug(__FILE__,__LINE__,"UID IS DEFINED"); -$r_UID=GetUid($UID); +$r_UID=GetUid($_GET['UID']); if ( $r_UID == false ) { echo_debug(__FILE__,__LINE__,"UID NOT VALID"); // Message d'erreur @@ -116,11 +117,11 @@ if ( isset ($SAVE) ){ return; } } -$r_UID=GetUid($UID); +$r_UID=GetUid($_GET['UID']); ?>
-',$UID); ?> +',$_GET['UID']); ?>
",$rDossier['dos_name']); if ( $priv==0 ) diff --git a/html/recherche.php b/html/recherche.php index 1ef36f5d0..b9a19a114 100644 --- a/html/recherche.php +++ b/html/recherche.php @@ -24,8 +24,8 @@ include_once ("constant.php"); include_once("jrn.php"); include_once("user_common.php"); -html_page_start($g_UserProperty['use_theme']); -if ( ! isset ( $g_dossier ) ) { +html_page_start($_SESSION['use_theme']); +if ( ! isset ( $_SESSION['g_dossier'] ) ) { echo "You must choose a Dossier "; exit -2; } @@ -35,17 +35,17 @@ include_once ("check_priv.php"); -$l_Db=sprintf("dossier%d",$g_dossier); +$l_Db=sprintf("dossier%d",$_SESSION['g_dossier']); $cn=DbConnect($g_dossier); include ('class_user.php'); $User=new cl_user($cn); $User->Check(); -ShowMenuCompta($g_dossier,$g_UserProperty); +ShowMenuCompta($_SESSION['g_dossier']); -if ( $g_UserProperty['use_admin'] == 0 ) { +if ( $User->admin == 0 ) { // check if user can access - if (CheckAction($g_dossier,$g_user,ENCJRN) == 0 ){ + if (CheckAction($_SESSION['g_dossier'],$User->id,ENCJRN) == 0 ){ /* Cannot Access */ NoAccess(); } diff --git a/html/show_tva.php b/html/show_tva.php index 80013007e..32eaabbcc 100644 --- a/html/show_tva.php +++ b/html/show_tva.php @@ -20,7 +20,6 @@ /* $Revision$ */ include_once ("ac_common.php"); -html_page_start($g_UserProperty['use_theme']); include_once ("postgres.php"); /* Admin. Dossier */ $rep=DbConnect(); @@ -28,7 +27,9 @@ include_once ("class_user.php"); $User=new cl_user($rep); $User->Check(); -if ( ! isset ( $g_dossier ) ) { +html_page_start($User->theme); + +if ( ! isset ( $_SESSION['g_dossier'] ) ) { echo "You must choose a Dossier "; phpinfo(); exit -2; @@ -43,7 +44,7 @@ function GetIt(ctl,tva_id) { "; diff --git a/html/stock.php b/html/stock.php index ead20e211..49693429a 100644 --- a/html/stock.php +++ b/html/stock.php @@ -25,9 +25,9 @@ include_once("postgres.php"); include_once("stock_inc.php"); include_once("check_priv.php"); -html_page_start($g_UserProperty['use_theme']); +html_page_start($_SESSION['use_theme']); -if ( ! isset ( $g_dossier ) ) { +if ( ! isset ( $_SESSION['g_dossier'] ) ) { echo "You must choose a Dossier "; phpinfo(); exit -2; @@ -40,24 +40,24 @@ $User=new cl_user($rep); $User->Check(); // Synchronize rights -SyncRight($g_dossier,$g_user); +SyncRight($_SESSION['g_dossier'],$_SESSION['g_user']); // Get The priv on the selected folder -if ( $g_UserProperty['use_admin'] == 0 ) { +if ( $User->admin == 0 ) { - $r=GetPriv($g_dossier,$g_user); + $r=GetPriv($_SESSION['g_dossier'],$_SESSION['g_user']); if ($r == 0 ){ /* Cannot Access */ NoAccess(); } } -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); //Show the top menu include_once ("user_menu.php"); include_once ("top_menu_compta.php"); -ShowMenuCompta($g_dossier,$g_UserProperty); +ShowMenuCompta($_SESSION['g_dossier']); // Show Menu Left $left_menu=ShowMenuAdvanced(); @@ -114,7 +114,7 @@ if ( isset ($_POST['sub_change'])) { // if year is not set then use the year of the user's periode if ( ! isset ($_GET['year']) ) { // get defaut periode - $a=GetUserPeriode($cn,$g_user); + $a=GetUserPeriode($cn,$_SESSION['g_user']); // get exercice of periode $year=GetExercice($cn,$a); } else @@ -125,7 +125,7 @@ if ( ! isset ($_GET['year']) ) { // View details if ( $action == 'detail' ) { // Check if User Can see the stock - if ( CheckAction($g_dossier,$g_user,STOCK_READ) == 0 ) { + if ( CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],STOCK_READ) == 0 ) { NoAccess(); exit (-1); } @@ -156,7 +156,7 @@ for ( $i = 0; $i < pg_NumRows($Res);$i++) { } // Check if User Can see the stock -if ( CheckAction($g_dossier,$g_user,STOCK_READ) == 0 ) { +if ( CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],STOCK_READ) == 0 ) { NoAccess(); exit (-1); } diff --git a/html/user_advanced.php b/html/user_advanced.php index 590196d94..354dfe46b 100644 --- a/html/user_advanced.php +++ b/html/user_advanced.php @@ -20,8 +20,8 @@ include_once ("ac_common.php"); /* $Revision$ */ -html_page_start($g_UserProperty['use_theme']); -if ( ! isset ( $g_dossier ) ) { +html_page_start($_SESSION['use_theme']); +if ( ! isset ( $_SESSION['g_dossier'] ) ) { echo "You must choose a Dossier "; phpinfo(); exit -2; @@ -34,7 +34,7 @@ $User=new cl_user($rep); $User->Check(); include_once ("postgres.php"); -echo_debug(__FILE__,__LINE__,"user is $g_user"); +echo_debug(__FILE__,__LINE__,"user is ".$_SESSION['g_user']); $rep=DbConnect(); include_once ("class_user.php"); $User=new cl_user($rep); @@ -50,10 +50,9 @@ $User->Check(); // Show the top menus include_once ("user_menu.php"); include_once ("top_menu_compta.php"); -ShowMenuCompta($g_dossier,$g_UserProperty); +ShowMenuCompta($_SESSION['g_dossier']); // Show the right menus -// ShowMenuComptaRight($g_dossier,$g_UserProperty); $left_menu=ShowMenuAdvanced(); diff --git a/html/user_compta.php b/html/user_compta.php index b979527cd..540969438 100644 --- a/html/user_compta.php +++ b/html/user_compta.php @@ -19,34 +19,36 @@ // Auteur Dany De Bontridder ddebontridder@yahoo.fr include_once ("ac_common.php"); /* $Revision$ */ +include_once ("class_user.php"); +include_once ("postgres.php"); -html_page_start($g_UserProperty['use_theme']); +$rep=DbConnect(); -if ( isset ( $dos ) ) { - $g_dossier=$dos; - session_register("g_dossier"); +$User=new cl_user($rep); +$User->Check(); + +html_page_start($User->theme); + +if ( isset ( $_GET['dos'] ) ) { + $g_dossier=$_GET['dos']; + $_SESSION[ "g_dossier"]=$g_dossier; echo_debug(__FILE__,__LINE__,"admin_dossier = $g_dossier "); $g_name=GetDossierName($g_dossier); - session_register("g_name"); + $_SESSION["g_name"]=$g_name; } else { echo "You must choose a Dossier "; exit -2; } -include_once ("postgres.php"); -echo_debug(__FILE__,__LINE__,"user is $g_user"); -$rep=DbConnect(); -include_once ("class_user.php"); -$User=new cl_user($rep); -$User->Check(); +echo_debug(__FILE__,__LINE__,"user is ".$_SESSION['g_user']); // Synchronize rights -SyncRight($g_dossier,$g_user); +SyncRight($_SESSION['g_dossier'],$_SESSION['g_user']); // Get The priv on the selected folder -if ( $g_UserProperty['use_admin'] == 0 ) { +if ( $User->admin == 0 ) { - $r=GetPriv($g_dossier,$g_user); + $r=GetPriv($_SESSION['g_dossier'],$_SESSION['g_user']); if ($r == 0 ){ /* Cannot Access */ NoAccess(); @@ -58,7 +60,7 @@ if ( $g_UserProperty['use_admin'] == 0 ) { include_once ("user_menu.php"); include_once ("top_menu_compta.php"); -ShowMenuCompta($g_dossier,$g_UserProperty); +ShowMenuCompta($g_dossier); html_page_stop(); diff --git a/html/user_impress.php b/html/user_impress.php index 6ac7a0b98..721037091 100644 --- a/html/user_impress.php +++ b/html/user_impress.php @@ -19,14 +19,14 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr /* $Revision$ */ include_once ("ac_common.php"); -html_page_start($g_UserProperty['use_theme']); -if ( ! isset ( $g_dossier ) ) { +html_page_start($_SESSION['use_theme']); +if ( ! isset ( $_SESSION['g_dossier'] ) ) { echo "You must choose a Dossier "; exit -2; } include_once ("postgres.php"); /* Admin. Dossier */ -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); include ('class_user.php'); @@ -35,7 +35,7 @@ $User->Check(); include ("check_priv.php"); include_once ("top_menu_compta.php"); -ShowMenuCompta($g_dossier,$g_UserProperty); +ShowMenuCompta($_SESSION['g_dossier']); // show sub menu @@ -57,8 +57,8 @@ echo ""; include_once("impress_inc.php"); -if ( $g_UserProperty['use_admin'] == 0 ) { - if (CheckAction($g_dossier,$g_user,IMP) == 0 ){ +if ( $User->admin == 0 ) { + if (CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],IMP) == 0 ){ /* Cannot Access */ NoAccess(); } diff --git a/html/user_jrn.php b/html/user_jrn.php index d22a9d808..762fcf37c 100644 --- a/html/user_jrn.php +++ b/html/user_jrn.php @@ -21,42 +21,46 @@ include_once("ac_common.php"); include("top_menu_compta.php"); include_once ("constant.php"); - -html_page_start($g_UserProperty['use_theme']); -if ( ! isset ( $g_dossier ) ) { - echo "You must choose a Dossier "; - exit -2; -} include_once ("postgres.php"); include_once ("check_priv.php"); -/* Admin. Dossier */ - -if ( isset( $_GET['p_jrn'] )) { - session_register("g_jrn"); - $g_jrn=$_GET['p_jrn']; -} else { - if ( ! isset ($g_jrn) ) $g_jrn=-1; -} -if ( isset ($_GET['JRN_TYPE'] ) ) { - $g_jrn=-1; -} - -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); include ('class_user.php'); $User=new cl_user($cn); $User->Check(); -ShowMenuCompta($g_dossier,$g_UserProperty); +html_page_start($User->theme); +if ( ! isset ( $_SESSION['g_dossier'] ) ) { + echo "You must choose a Dossier "; + exit -2; +} +/* Admin. Dossier */ -if ( $g_UserProperty['use_admin'] == 0 ) { + +if ( isset( $_GET['p_jrn'] )) { + $g_jrn=$_GET['p_jrn']; +} else { + if ( ! isset ($_SESSION['g_jrn']) ) + $g_jrn=-1; + else + $g_jrn=$_SESSION['g_jrn']; +} +if ( isset ($_GET['JRN_TYPE'] ) ) { + $g_jrn=-1; +} +$_SESSION["g_jrn"]=$g_jrn; + + +ShowMenuCompta($_SESSION['g_dossier']); + +if ( $User->admin == 0 ) { // check if user can access - if (CheckAction($g_dossier,$g_user,ENCJRN) == 0 ){ + if (CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],ENCJRN) == 0 ){ /* Cannot Access */ NoAccess(); } if ( isset ($g_jrn)) { - if (CheckJrn($g_dossier,$g_user,$g_jrn) == 0 ){ + if (CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_SESSION['g_jrn']) == 0 ){ /* Cannot Access */ NoAccess(); exit -1; @@ -79,16 +83,16 @@ if ( isset ($_GET['JRN_TYPE'] ) ) { $result=ShowJrn("user_jrn.php?JRN_TYPE=".$jrn_type); echo "
"; echo $result; - ShowMenuJrnUser($g_dossier,$g_UserProperty,$_GET['JRN_TYPE'],$g_jrn); + ShowMenuJrnUser($_SESSION['g_dossier'],$_GET['JRN_TYPE'],$_SESSION['g_jrn']); echo "
"; if ( $jrn_type=='NONE' ) include('user_action_gl.php'); } else { - echo_debug("Selected is $g_jrn"); + echo_debug("Selected is ".$_SESSION['g_jrn']); // Get the jrn_type_id include_once('jrn.php'); - $JrnProp=GetJrnProp($g_dossier,$g_jrn); + $JrnProp=GetJrnProp($_SESSION['g_dossier'],$_SESSION['g_jrn']); $jrn_type=$JrnProp['jrn_def_type']; echo_debug("Type is $jrn_type"); echo_debug("Jrn_def_type = $jrn_type"); @@ -96,16 +100,16 @@ if ( isset ($_GET['JRN_TYPE'] ) ) { $result=ShowJrn("user_jrn.php?JRN_TYPE=".$jrn_type); echo '
'; echo $result; - ShowMenuJrnUser($g_dossier,$g_UserProperty,$jrn_type,$g_jrn); + ShowMenuJrnUser($_SESSION['g_dossier'],$jrn_type,$_SESSION['g_jrn']); echo '
'; } // if a journal is selected show the journal's menu -if ( $g_jrn != -1 ) { +if ( $_SESSION['g_jrn'] != -1 ) { $result=ShowJrn( "user_jrn.php?JRN_TYPE=".$jrn_type); // Get the jrn_type_id include_once('jrn.php'); - $JrnProp=GetJrnProp($g_dossier,$g_jrn); + $JrnProp=GetJrnProp($_SESSION['g_dossier'],$_SESSION['g_jrn']); $jrn_type=$JrnProp['jrn_def_type']; // display jrn's menu include_once('user_menu.php'); diff --git a/html/user_login.php b/html/user_login.php index daedbfcc0..11a0fb214 100644 --- a/html/user_login.php +++ b/html/user_login.php @@ -25,19 +25,19 @@ include_once("postgres.php"); $rep=DbConnect(); include_once ("class_user.php"); $User=new cl_user($rep); -//phpinfo(); + $User->Check(); -html_page_start($g_UserProperty['use_theme']); +html_page_start($_SESSION['use_theme']); include_once("user_menu.php"); -$priv=($g_UserProperty['use_admin']==1)?"Administrator":"User"; +$priv=($User->admin==1)?"Administrator":"User"; -echo '
Welcome '.$g_UserProperty['use_first_name'].' '. - $g_UserProperty['use_name'].',

your are an '. $priv.'
Please Select your folder

'; +echo '
Welcome '.$User->first_name.' '. + $User->name.',

your are an '. $priv.'
Please Select your folder

'; // Show default menu (preference,...) // If admin show everything otherwise only the available dossier -$res=u_ShowDossier($g_user,$g_UserProperty['use_admin']); +$res=u_ShowDossier($_SESSION['g_user'],$User->admin); echo $res; ?>

diff --git a/html/user_pref.php b/html/user_pref.php index 38b485d70..9cc70b267 100644 --- a/html/user_pref.php +++ b/html/user_pref.php @@ -21,48 +21,38 @@ /* $Revision$ */ include_once ("ac_common.php"); include_once ("postgres.php"); - -// Met a jour le theme utilisateur (style) -if ( isset ( $_POST['style_user']) ) { - $CnRepo=DbConnect(); - $Res=ExecSql($CnRepo, - "update ac_users set use_theme='".$_POST['style_user']. - "' where use_login='$g_user'"); - // echo '

Theme utilisateur changé

'; - $g_UserProperty['use_theme']=$_POST['style_user']; - -} -// // Met à jour le profil -if ( isset ( $_POST['profile_user']) ) { - $g_UserProperty['use_usertype']=$_POST['profile_user']; -} - -html_page_start($g_UserProperty['use_theme']); - -// // clean session variable from user interface (make prob. with compta interfac) -// // -// if ( isset ($g_jrn) ) { -// session_unregister("g_jrn"); -// } - /* Admin. Dossier */ $rep=DbConnect(); include_once ("class_user.php"); $User=new cl_user($rep); $User->Check(); +// Met a jour le theme utilisateur (style) +if ( isset ( $_POST['style_user']) ) { + $CnRepo=DbConnect(); + $Res=ExecSql($CnRepo, + "update ac_users set use_theme='".$_POST['style_user']. + "' where use_login='".$_SESSION['g_user']."'"); + // echo '

Theme utilisateur changé

'; + $_SESSION['use_theme']=$_POST['style_user']; + +} +// // Met à jour le profil +if ( isset ( $_POST['profile_user']) ) { + $_SESSION['use_usertype']=$_POST['profile_user']; +} + +html_page_start($_SESSION['use_theme']); + // show the top menu depending of the use_style // comta style include_once ("top_menu_compta.php"); -if ( isset ($g_dossier) ) { - if ( $g_dossier != 0 ) ShowMenuCompta($g_dossier,$g_UserProperty); - // ShowMenuComptaRight($g_dossier,$g_UserProperty); - } else { - // ShowMenuComptaRight(0,$g_UserProperty); +if ( isset ($_SESSION['g_dossier']) ) { + if ( $_SESSION['g_dossier'] != 0 ) + ShowMenuCompta($_SESSION['g_dossier']); } - echo '
'; if ( isset ($spass) ) { @@ -76,9 +66,9 @@ if ( isset ($spass) ) { else { $Cn=DbConnect(); $l_pass=md5($pass_1); - $Res=ExecSql($Cn,"update ac_users set use_pass='$l_pass' where use_login='$g_user'"); + $Res=ExecSql($Cn,"update ac_users set use_pass='$l_pass' where use_login='".$_SESSION['g_user']."'"); $pass=$pass_1; - $g_UserProperty['g_pass']=$pass_1; + $_SESSION['g_pass']=$pass_1; $g_pass=$pass_1; } } @@ -87,9 +77,9 @@ if ( isset ( $_POST['style_user']) ) { $CnRepo=DbConnect(); $Res=ExecSql($CnRepo, "update ac_users set use_theme='".$_POST['style_user']. - "' where use_login='$g_user'"); + "' where use_login='".$_SESSION['g_user']."'"); // echo '

Theme utilisateur changé

'; - $g_UserProperty['use_theme']=$_POST['style_user']; + $_SESSION['use_theme']=$_POST['style_user']; } @@ -114,7 +104,7 @@ for ($i=0;$i < pg_NumRows($res);$i++){ // Formatte le display $disp_style=""; // Si utilise un dossier alors propose de changer // la periode par defaut -if ( isset ($g_dossier) ) { +if ( isset ($_SESSION['g_dossier']) ) { include_once("preference.php"); - $cn=DbConnect($g_dossier); + $cn=DbConnect($_SESSION['g_dossier']); if ( isset ($_POST["sub_periode"] ) ) { $periode=$_POST["periode"]; - SetUserPeriode($cn,$periode,$g_user); + SetUserPeriode($cn,$periode,$_SESSION['g_user']); } - $l_user_per=GetUserPeriode($cn,$g_user); + $l_user_per=GetUserPeriode($cn,$_SESSION['g_user']); $l_form_per=FormPeriode($cn,$l_user_per); ?> diff --git a/html/user_sec.php b/html/user_sec.php index dc8877124..ae96d14fc 100644 --- a/html/user_sec.php +++ b/html/user_sec.php @@ -21,8 +21,8 @@ include_once ("ac_common.php"); include_once("check_priv.php"); -html_page_start($g_UserProperty['use_theme']); -if ( ! isset ( $g_dossier ) ) { +html_page_start($_SESSION['use_theme']); +if ( ! isset ( $_SESSION['g_dossier'] ) ) { echo "You must choose a Dossier "; exit -2; } @@ -34,10 +34,10 @@ $User=new cl_user($rep); $User->Check(); include_once ("top_menu_compta.php"); -ShowMenuCompta($g_dossier,$g_UserProperty); +ShowMenuCompta($_SESSION['g_dossier']); -if ( $g_UserProperty['use_admin']== 0 ) { - $r=CheckAction($g_dossier,$g_user,SECU); +if ( $User->admin== 0 ) { + $r=CheckAction($_SESSION['g_dossier'],$_SESSION['g_user'],SECU); if ($r == 0 ){ /* Cannot Access */ NoAccess(); @@ -79,15 +79,17 @@ if ( isset ($_GET["action"] )) { } if ( $action == "change_jrn" ) { // Check if the user can access that folder - if ( CheckDossier($login,$g_dossier) == 0 ) { + if ( CheckDossier($_GET['login'],$_SESSION['g_dossier']) == 0 ) { echo "

he cannot access this folder

"; $action=""; return; } - - $l_Db=sprintf("dossier%d",$g_dossier); + $login=$_GET['login']; + $jrn=$_GET['jrn']; + $access=$_GET['access']; + $l_Db=sprintf("dossier%d",$_SESSION['g_dossier']); echo_debug(__FILE__,__LINE__,"select * from user_sec_jrn where uj_login='$login' and uj_jrn_id=$jrn"); - $cn_dossier=DbConnect($g_dossier); + $cn_dossier=DbConnect($_SESSION['g_dossier']); $l2_Res=ExecSql($cn_dossier, "select * from user_sec_jrn where uj_login='$login' and uj_jrn_id=$jrn"); $l2_count=pg_NumRows($l2_Res); @@ -101,13 +103,13 @@ if ( $action == "change_jrn" ) { } if ( $action == "change_act" ) { // Check if the user can access that folder - if ( CheckDossier($login,$g_dossier) == 0 ) { + if ( CheckDossier($User->id,$_SESSION['g_dossier']) == 0 ) { echo "

he cannot access this folder

"; $action=""; return; } - $l_Db=sprintf("dossier%d",$g_dossier); - $cn_dossier=DbConnect($g_dossier); + $l_Db=sprintf("dossier%d",$_SESSION['g_dossier']); + $cn_dossier=DbConnect($_SESSION['g_dossier']); if ( $access==0) { echo_debug(__FILE__,__LINE__,"delete right"); $Res=ExecSql($cn_dossier, @@ -121,12 +123,12 @@ if ( $action == "change_act" ) { } if ( $action == "view" ) { - $l_Db=sprintf("dossier%d",$g_dossier); - $cn_dossier=DbConnect($g_dossier); + $l_Db=sprintf("dossier%d",$_SESSION['g_dossier']); + $cn_dossier=DbConnect($_SESSION['g_dossier']); $cn=DbConnect(); $User=ExecSql($cn, "select use_id,use_first_name,use_name,use_login - from ac_users where use_id=$user_id"); + from ac_users where use_id=".$_GET['user_id']); $MaxUser=pg_NumRows($User); if ( $MaxUser == 0 ) return; $l2_line=pg_fetch_array($User,0); @@ -136,7 +138,7 @@ if ( $action == "view" ) { $l2_line['use_name'], $l2_line['use_login']); // Check if the user can access that folder - if ( CheckDossier($l2_line['use_login'],$g_dossier) == 0 ) { + if ( CheckDossier($l2_line['use_login'],$_SESSION['g_dossier']) == 0 ) { echo "

he cannot access this folder

"; $action=""; return; @@ -162,7 +164,7 @@ if ( $action == "view" ) { $l_change="action=change_jrn&jrn=$l_line[jrn_def_id]&login=$l2_line[use_login]&user_id=$l2_line[use_id]"; if ( $admin == 0) { - $right= CheckJrn($g_dossier,$l2_line['use_login'],$l_line['jrn_def_id'] ); + $right= CheckJrn($_SESSION['g_dossier'],$l2_line['use_login'],$l_line['jrn_def_id'] ); echo_debug(__FILE__,__LINE__,"Privilege is $right"); } else $right = 3; if ( $right == 0 ) { @@ -217,7 +219,7 @@ if ( $action == "view" ) { $l_change="action=change_act&act=".$l_line['ac_id']."&login=".$l2_line['use_login']."&user_id=".$l2_line['use_id']; if ( $admin ==0 ) { - $right=CheckAction($g_dossier,$l2_line['use_login'],$l_line['ac_id']); + $right=CheckAction($_SESSION['g_dossier'],$l2_line['use_login'],$l_line['ac_id']); } else { $right = 2; } diff --git a/include/balance.php b/include/balance.php index 1ebc70730..a86a3863e 100644 --- a/include/balance.php +++ b/include/balance.php @@ -97,8 +97,8 @@ if ( isset($_POST['view'] ) ) { $row=$bal->GetRow($_POST['from_periode'], $_POST['to_periode']); - $a=GetPeriode($cn,$from_periode); - $b=GetPeriode($cn,$to_periode); + $a=GetPeriode($cn,$_POST['from_periode']); + $b=GetPeriode($cn,$_POST['to_periode']); echo "

période du ".$a['p_start']." au ".$b['p_end']."

"; echo '
',$r_UID[0]['use_first_name']); ?> @@ -132,7 +133,7 @@ $r_UID=GetUid($UID); ',$r_UID[0]['use_login']); ?> -Reset Password',$UID); ?> +Reset Password',$_GET['UID']); ?>
@@ -178,7 +179,7 @@ $Dossier=ShowDossier('all',1,0); foreach ( $Dossier as $rDossier) { $NORIGHT="";$Write="";$Read=""; echo_debug(__FILE__,__LINE__,"Dossier : ".$rDossier['dos_id']); - $login_name=GetLogin($UID); + $login_name=GetLogin($_GET['UID']); $priv=GetPriv($rDossier['dos_id'],$login_name); printf("
Dossier : %s
'; diff --git a/include/class_user.php b/include/class_user.php index 382953244..b4f125a47 100644 --- a/include/class_user.php +++ b/include/class_user.php @@ -36,6 +36,17 @@ class cl_user { $this->pass=$_SESSION['g_pass']; $this->valid=(isset ($_SESSION['isValid']))?1:0; $this->db=$p_cn; + if ( isset($_SESSION['use_usertype']) ) + $this->type=$_SESSION['use_usertype']; + if ( isset($_SESSION['use_theme']) ) + $this->theme=$_SESSION['use_theme']; + if ( isset($_SESSION['use_admin']) ) + $this->admin=$_SESSION['use_admin']; + if ( isset($_SESSION['use_name']) ) + $this->name=$_SESSION['use_name']; + if ( isset($_SESSION['use_first_name']) ) + $this->first_name=$_SESSION['use_first_name']; + } /*++ * function : CheckUser @@ -52,10 +63,11 @@ class cl_user { $res=0; $pass5=md5($this->pass); - if ( $this->valid == 1 ) { return; } + //if ( $this->valid == 1 ) { return; } $cn=DbConnect(); if ( $cn != false ) { - $sql="select ac_users.use_login,ac_users.use_active, ac_users.use_pass + $sql="select ac_users.use_login,ac_users.use_active, ac_users.use_pass, + use_usertype,use_theme,use_admin,use_first_name,use_name from ac_users where ac_users.use_login='$this->id' and ac_users.use_active=1 @@ -64,6 +76,20 @@ class cl_user { $ret=pg_exec($cn,$sql); $res=pg_NumRows($ret); echo_debug(__FILE__,__LINE__,"Number of found rows : $res"); + if ( $res >0 ) { + $r=pg_fetch_array($ret,0); + $_SESSION['use_usertype']=$r['use_usertype']; + $_SESSION['use_theme']=$r['use_theme']; + $_SESSION['use_admin']=$r['use_admin']; + $_SESSION['use_name']=$r['use_name']; + $_SESSION['use_first_name']=$r['use_first_name']; + + $this->type=$_SESSION['use_usertype']; + $this->theme=$_SESSION['use_theme']; + $this->admin=$_SESSION['use_admin']; + $this->name=$_SESSION['use_name']; + $this->first_name=$_SESSION['use_first_name']; + } } if ( $res == 0 ) { @@ -119,7 +145,7 @@ class cl_user { where uj_priv in ('R','W') and uj_jrn_id=".$p_jrn_id. - "and uj_login = ".$this->id); + "and uj_login = '".$this->id."'"); if ( $sql != 0 ) return true; return false; diff --git a/include/impress_fiche.php b/include/impress_fiche.php index 6b2178e7d..66281b48b 100644 --- a/include/impress_fiche.php +++ b/include/impress_fiche.php @@ -23,7 +23,7 @@ include_once('postgres.php'); include_once('class_fiche.php'); include_once("class_widget.php"); -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); $fiche_def=new fiche_def($cn); @@ -61,15 +61,15 @@ if ( isset ($_GET['fd_id'])) { foreach ($fiche_def->attribut as $attribut) echo ""; echo ""; - - foreach ($e as $detail) { - echo ""; - foreach ( $detail->attribut as $dattribut ) { - echo ""; + if ( count($e) != 0 ) { + foreach ($e as $detail) { + echo ""; + foreach ( $detail->attribut as $dattribut ) { + echo ""; + } + echo ""; } - echo ""; } - echo "
".$attribut->ad_text."
".$dattribut->av_text."
".$dattribut->av_text."
"; echo "
"; } diff --git a/include/top_menu_compta.php b/include/top_menu_compta.php index 27afdf224..96a852831 100644 --- a/include/top_menu_compta.php +++ b/include/top_menu_compta.php @@ -69,19 +69,10 @@ * */ -function ShowMenuCompta($p_dossier,$pa_user) +function ShowMenuCompta($p_dossier) { - if ( ! isset ( $pa_user ) ) { - exit (1); - } - if ( $pa_user['use_usertype'] == 'compta' ) { - include_once ("compta_menu.php"); - c_ShowMenuCompta($p_dossier); - } else - if ( $pa_user['use_usertype']=='user') { include_once ("user_menu.php"); u_ShowMenuCompta($p_dossier); - } } /* function * Purpose : @@ -240,18 +231,10 @@ function ShowMenuJrn($p_dossier) * */ -function ShowMenuJrnUser($p_dossier,$p_auser,$p_type=-1,$p_jrn=-1) +function ShowMenuJrnUser($p_dossier,$p_type,$p_jrn=-1) { - if ( ! isset ($p_auser['use_usertype'] ) ) exit (-1); - if ($p_auser['use_usertype'] == 'compta' ) { - include_once("compta_menu.php"); - c_ShowMenuJrnUser($p_dossier,$p_auser['use_login']); - } - if ($p_auser['use_usertype'] == 'user' ) { include_once("user_menu.php"); - u_ShowMenuJrnUser($p_dossier,$p_auser['use_login'],$p_type,$p_jrn); - } - + u_ShowMenuJrnUser($p_dossier,$p_type,$p_jrn); } /* function ShowMenuRecherche * Purpose : diff --git a/include/user_action_ach.php b/include/user_action_ach.php index 9751fdbdb..ee558c5d7 100644 --- a/include/user_action_ach.php +++ b/include/user_action_ach.php @@ -23,7 +23,7 @@ include_once("form_input.php"); include_once ("preference.php"); include_once ("user_common.php"); include_once("class_widget.php"); -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); // phpinfo(); if ( ! isset ($_GET['action']) && ! isset ($_POST["action"]) ) { @@ -37,7 +37,7 @@ $action=(isset($_GET['action']))?$_GET['action']:$_POST['action']; if ( $action == 'new' ) { // We request a new form // Check privilege - if ( CheckJrn($g_dossier,$g_user,$g_jrn) != 2 ) { + if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_SESSION['g_jrn']) != 2 ) { NoAccess(); exit -1; } @@ -49,7 +49,7 @@ if ( $action == 'new' ) { // add a one-line calculator - $r=FormAch($cn,$g_jrn,$g_user,$submit,null,false); + $r=FormAch($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,null,false); echo '
'; echo $r; echo "

On-line calculator

".JS_CALC_LINE."
"; @@ -68,7 +68,7 @@ if ( $action == 'new' ) { $submit=' '; - $r=FormAch($cn,$g_jrn,$g_user,$submit,$HTTP_POST_VARS,false, $nb_number); + $r=FormAch($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,false, $nb_number); echo '
'; echo $r; echo "

On-line calculator

".JS_CALC_LINE."
"; @@ -83,7 +83,7 @@ if ( $action == 'new' ) { $submit=' '; - $r=FormAch($cn,$g_jrn,$g_user,$submit,$HTTP_POST_VARS,false, $nb_number); + $r=FormAch($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,false, $nb_number); echo '
'; echo $r; echo "

On-line calculator

".JS_CALC_LINE."
"; @@ -97,13 +97,13 @@ if ( $action == 'new' ) { $submit=''; $submit.=''; - $r=FormAch($cn,$g_jrn,$g_user,$submit,$HTTP_POST_VARS,true,$nb_number); + $r=FormAch($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,true,$nb_number); // if something goes wrong, correct it if ( $r == null ) { $submit=' '; - $r=FormAch($cn,$g_jrn,$g_user,$submit,$HTTP_POST_VARS,false, $nb_number); + $r=FormAch($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,false, $nb_number); } echo '
'; echo $r; @@ -112,14 +112,14 @@ if ( $action == 'new' ) { } // Save the charge into database if ( isset($_POST['save'] )) { - $r=RecordAchat($cn,$HTTP_POST_VARS,$g_user,$g_jrn); + $r=RecordAchat($cn,$HTTP_POST_VARS,$_SESSION['g_user'],$_SESSION['g_jrn']); // Get number of lines $nb_number=$_POST["nb_item"]; // submit button in the form $submit='

Recorded

'; - $r.=FormAch($cn,$g_jrn,$g_user,$submit,$HTTP_POST_VARS,true, $nb_number); + $r.=FormAch($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,true, $nb_number); echo '
'; echo $r; echo "
"; @@ -130,7 +130,7 @@ if ( $action == 'new' ) { } if ( $action == 'voir_jrn' ) { // Check privilege - if ( CheckJrn($g_dossier,$g_user,$g_jrn) < 1 ) { + if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_SESSION['g_jrn']) < 1 ) { NoAccess(); exit -1; } @@ -153,25 +153,25 @@ echo 'P // Show list of sell echo_debug ("user_action_ach.php"); // Date - date of payment - Customer - amount - $sql=SQL_LIST_ALL_INVOICE." and jr_tech_per=".$current." and jr_def_id=$g_jrn"; - $list=ListJrn($cn,$g_jrn,$sql); + $sql=SQL_LIST_ALL_INVOICE." and jr_tech_per=".$current." and jr_def_id=".$_SESSION['g_jrn']; + $list=ListJrn($cn,$_SESSION['g_jrn'],$sql); echo $list; echo '
'; } if ( $action == 'voir_jrn_non_paye' ) { // Check privilege - if ( CheckJrn($g_dossier,$g_user,$g_jrn) < 1 ) { + if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_SESSION['g_jrn']) < 1 ) { NoAccess(); exit -1; } // Show list of unpaid sell // Date - date of payment - Customer - amount - $sql=SQL_LIST_UNPAID_INVOICE_DATE_LIMIT." and jr_def_id=$g_jrn " ; - $list=ListJrn($cn,$g_jrn,$sql); - $sql=SQL_LIST_UNPAID_INVOICE." and jr_def_id=$g_jrn " ; - $list2=ListJrn($cn,$g_jrn,$sql); + $sql=SQL_LIST_UNPAID_INVOICE_DATE_LIMIT." and jr_def_id=".$_SESSION['g_jrn'] ; + $list=ListJrn($cn,$_SESSION['g_jrn'],$sql); + $sql=SQL_LIST_UNPAID_INVOICE." and jr_def_id=".$_SESSION['g_jrn'] ; + $list2=ListJrn($cn,$_SESSION['g_jrn'],$sql); echo '
'; echo '

Echeance dépassée

'; echo $list; @@ -183,7 +183,7 @@ if ( $action == 'voir_jrn_non_paye' ) { //Search if ( $action == 'search' ) { // Check privilege - if ( CheckJrn($g_dossier,$g_user,$g_jrn) < 1 ) { + if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_SESSION['g_jrn']) < 1 ) { NoAccess(); exit -1; } @@ -192,12 +192,12 @@ if ( $action == 'search' ) { $sessid=(isset ($_POST['PHPSESSID']))?$_POST['PHPSESSID']:$_GET['PHPSESSID']; // display a search box - $search_box=u_ShowMenuRecherche($cn,$g_jrn,$sessid,$HTTP_POST_VARS); + $search_box=u_ShowMenuRecherche($cn,$_SESSION['g_jrn'],$sessid,$HTTP_POST_VARS); echo '
'; echo $search_box; // if nofirst is set then show result if ( isset ($_GET['nofirst'] ) ) { - $a=ListJrn($cn,$g_jrn,"",$HTTP_POST_VARS); + $a=ListJrn($cn,$_SESSION['g_jrn'],"",$HTTP_POST_VARS); echo $a; } echo '
'; diff --git a/include/user_action_fin.php b/include/user_action_fin.php index d7da734d2..d9e601702 100644 --- a/include/user_action_fin.php +++ b/include/user_action_fin.php @@ -23,7 +23,7 @@ include_once("form_input.php"); include_once("class_widget.php"); // phpinfo(); -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); if ( ! isset ($_GET['action']) && ! isset ($_POST["action"]) ) { // echo u_ShowMenuJrn($cn,$jrn_type); @@ -39,7 +39,7 @@ $action=(isset($_GET['action']))?$_GET['action']:$_POST['action']; // action = new if ( $action == 'new' ) { // Check privilege - if ( CheckJrn($g_dossier,$g_user,$g_jrn) != 2 ) { + if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_SESSION['g_jrn']) != 2 ) { NoAccess(); exit -1; } @@ -52,7 +52,7 @@ if ( $action == 'new' ) { // add a one-line calculator - $r=FormFin($cn,$g_jrn,$g_user,$submit,null,false); + $r=FormFin($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,null,false); echo '
'; echo $r; echo "

On-line calculator

".JS_CALC_LINE."
"; @@ -72,7 +72,7 @@ if ( $action == 'new' ) { $submit=' '; - $r=FormFin($cn,$g_jrn,$g_user,$submit,$HTTP_POST_VARS,false, $nb_number); + $r=FormFin($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,false, $nb_number); echo '
'; echo $r; echo "

On-line calculator

".JS_CALC_LINE."
"; @@ -88,7 +88,7 @@ if ( $action == 'new' ) { $submit=' '; - $r=FormFin($cn,$g_jrn,$g_user,$submit,$HTTP_POST_VARS,false, $nb_number); + $r=FormFin($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,false, $nb_number); echo '
'; echo $r; echo "

On-line calculator

".JS_CALC_LINE."
"; @@ -103,7 +103,7 @@ if ( $action == 'new' ) { $submit=''; $submit.=''; - $r=FormFin($cn,$g_jrn,$g_user,$submit,$HTTP_POST_VARS,true,$nb_number); + $r=FormFin($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,true,$nb_number); // if something goes wrong correct it if ( $r == null ) { @@ -111,7 +111,7 @@ if ( $action == 'new' ) { $submit=' '; - $r=FormFin($cn,$g_jrn,$g_user,$submit,$HTTP_POST_VARS,false, $nb_number); + $r=FormFin($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,false, $nb_number); } echo '
'; @@ -121,14 +121,14 @@ if ( $action == 'new' ) { } // Save the charge into database if ( isset($_POST['save'] )) { - $r=RecordFin($cn,$HTTP_POST_VARS,$g_user,$g_jrn); + $r=RecordFin($cn,$HTTP_POST_VARS,$_SESSION['g_user'],$_SESSION['g_jrn']); // Get number of lines $nb_number=$_POST["nb_item"]; // submit button in the form $submit='

Recorded

'; - $r.=FormFin($cn,$g_jrn,$g_user,$submit,$HTTP_POST_VARS,true, $nb_number,true); + $r.=FormFin($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,true, $nb_number,true); echo '
'; echo $r; echo "
"; @@ -139,7 +139,7 @@ if ( $action == 'new' ) { } if ( $action == 'voir_jrn' ) { // Check privilege - if ( CheckJrn($g_dossier,$g_user,$g_jrn) < 1 ) { + if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_SESSION['g_jrn']) < 1 ) { NoAccess(); exit -1; } @@ -162,8 +162,8 @@ echo 'P // Show list of sell echo_debug ("user_action_jrn.php"); // Date - date of payment - Customer - amount - $sql=SQL_LIST_ALL_INVOICE." and jr_tech_per=".$current." and jr_def_id=$g_jrn"; - $list=ListJrn($cn,$g_jrn,$sql); + $sql=SQL_LIST_ALL_INVOICE." and jr_tech_per=".$current." and jr_def_id=".$_SESSION['g_jrn']; + $list=ListJrn($cn,$_SESSION['g_jrn'],$sql); echo $list; echo '
'; } @@ -171,7 +171,7 @@ echo 'P //Search if ( $action == 'search' ) { // Check privilege - if ( CheckJrn($g_dossier,$g_user,$g_jrn) < 1 ) { + if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_SESSION['g_jrn']) < 1 ) { NoAccess(); exit -1; } @@ -180,12 +180,12 @@ if ( $action == 'search' ) { $sessid=(isset ($_POST['PHPSESSID']))?$_POST['PHPSESSID']:$_GET['PHPSESSID']; // display a search box - $search_box=u_ShowMenuRecherche($cn,$g_jrn,$sessid,$HTTP_POST_VARS); + $search_box=u_ShowMenuRecherche($cn,$_SESSION['g_jrn'],$sessid,$HTTP_POST_VARS); echo '
'; echo $search_box; // if nofirst is set then show result if ( isset ($_GET['nofirst'] ) ) { - $a=ListJrn($cn,$g_jrn,"",$HTTP_POST_VARS); + $a=ListJrn($cn,$_SESSION['g_jrn'],"",$HTTP_POST_VARS); echo $a; } diff --git a/include/user_action_gl.php b/include/user_action_gl.php index af2988c24..700222e55 100644 --- a/include/user_action_gl.php +++ b/include/user_action_gl.php @@ -26,8 +26,8 @@ include_once ("class_widget.php"); include_once("class_user.php"); include("jrn.php"); -$cn=DbConnect($g_dossier); -if (CheckJrn($g_dossier,$g_user,0) < 1 ) +$cn=DbConnect($_SESSION['g_dossier']); +if (CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],0) < 1 ) {NoAccess();exit -1;} ?> diff --git a/include/user_action_ods.php b/include/user_action_ods.php index f4b180437..e2480f365 100644 --- a/include/user_action_ods.php +++ b/include/user_action_ods.php @@ -22,10 +22,9 @@ echo_debug(__FILE__,__LINE__,"include user_action_ods.php"); include_once("form_input.php"); include_once("class_widget.php"); -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); if ( ! isset ($_GET['action']) && ! isset ($_POST["action"]) ) { - // echo u_ShowMenuJrn($cn,$jrn_type); exit; } @@ -37,7 +36,7 @@ $action=(isset($_GET['action']))?$_GET['action']:$_POST['action']; // action = new if ( $action == 'new' ) { // Check privilege - if ( CheckJrn($g_dossier,$g_user,$g_jrn) != 2 ) { + if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_SESSION['g_jrn']) != 2 ) { NoAccess(); exit -1; } @@ -50,7 +49,7 @@ if ( $action == 'new' ) { // add a one-line calculator - $r=FormODS($cn,$g_jrn,$g_user,$submit,null,false); + $r=FormODS($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,null,false); echo '
'; echo $r; echo "

On-line calculator

".JS_CALC_LINE."
"; @@ -69,7 +68,7 @@ if ( $action == 'new' ) { $submit=' '; - $r=FormODS($cn,$g_jrn,$g_user,$submit,$HTTP_POST_VARS,false, $nb_number); + $r=FormODS($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,false, $nb_number); echo '
'; echo $r; echo "

On-line calculator

".JS_CALC_LINE."
"; @@ -84,7 +83,7 @@ if ( $action == 'new' ) { $submit=' '; - $r=FormODS($cn,$g_jrn,$g_user,$submit,$HTTP_POST_VARS,false, $nb_number); + $r=FormODS($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,false, $nb_number); echo '
'; echo $r; echo "

On-line calculator

".JS_CALC_LINE."
"; @@ -98,7 +97,7 @@ if ( $action == 'new' ) { $submit=''; $submit.=''; - $r=FormODS($cn,$g_jrn,$g_user,$submit,$HTTP_POST_VARS,true,$nb_number); + $r=FormODS($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,true,$nb_number); // if something goes wrong, correct it if ( $r == null ) { @@ -106,7 +105,7 @@ if ( $action == 'new' ) { $submit=' '; - $r=FormODS($cn,$g_jrn,$g_user,$submit,$HTTP_POST_VARS,false, $nb_number); + $r=FormODS($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,false, $nb_number); } echo '
'; echo $r; @@ -115,14 +114,14 @@ if ( $action == 'new' ) { } // Save the charge into database if ( isset($_POST['save'] )) { - $r=RecordODS($cn,$HTTP_POST_VARS,$g_user,$g_jrn); + $r=RecordODS($cn,$HTTP_POST_VARS,$_SESSION['g_user'],$_SESSION['g_jrn']); // Get number of lines $nb_number=$_POST["nb_item"]; // submit button in the form $submit='

Recorded

'; - $r.=FormODS($cn,$g_jrn,$g_user,$submit,$HTTP_POST_VARS,true, $nb_number); + $r.=FormODS($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$submit,$HTTP_POST_VARS,true, $nb_number); echo '
'; echo $r; echo "
"; @@ -133,7 +132,7 @@ if ( $action == 'new' ) { } if ( $action == 'voir_jrn' ) { // Check privilege - if ( CheckJrn($g_dossier,$g_user,$g_jrn) < 1 ) { + if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_SESSION['g_jrn']) < 1 ) { NoAccess(); exit -1; } @@ -156,8 +155,8 @@ echo 'P ?> '; echo $search_box; // if nofirst is set then show result if ( isset ($_GET['nofirst'] ) ) { - $a=ListJrn($cn,$g_jrn,"",$HTTP_POST_VARS); + $a=ListJrn($cn,$_SESSION['g_jrn'],"",$HTTP_POST_VARS); echo $a; } echo '
'; diff --git a/include/user_action_ven.php b/include/user_action_ven.php index 8a5f1cc62..49fa3552c 100644 --- a/include/user_action_ven.php +++ b/include/user_action_ven.php @@ -21,7 +21,7 @@ echo_debug(__FILE__,__LINE__,"include user_action_ven.php"); include_once("form_input.php"); include_once("class_widget.php"); -$cn=DbConnect($g_dossier); +$cn=DbConnect($_SESSION['g_dossier']); // default action is insert_vente if ( ! isset ($_GET['action']) && ! isset ($_POST["action"]) ) { // echo u_ShowMenuJrn($cn,$jrn_type); @@ -39,7 +39,7 @@ if ( $action == 'insert_vente' ) { $nb_number=$_POST["nb_item"]; $nb_number++; - $form=FormVente($cn,$g_jrn,$g_user,$HTTP_POST_VARS,false,$nb_number); + $form=FormVente($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$HTTP_POST_VARS,false,$nb_number); echo '
'; echo "here". $form; echo '
'; @@ -49,11 +49,11 @@ if ( $action == 'insert_vente' ) { // We want to see the encoded invoice if ( isset ($_POST["view_invoice"])) { $nb_number=$_POST["nb_item"]; - $form=FormVenteView($cn,$g_jrn,$g_user,$HTTP_POST_VARS,$nb_number); + $form=FormVenteView($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$HTTP_POST_VARS,$nb_number); // Check failed : invalid date or quantity if ( $form== null) { echo_error("Cannot validate "); - $form=FormVente($cn,$g_jrn,$g_user,$HTTP_POST_VARS,false,$nb_number); + $form=FormVente($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$HTTP_POST_VARS,false,$nb_number); } echo '
'; echo $form; @@ -66,7 +66,7 @@ if ( $action == 'insert_vente' ) { { echo_debug(__FILE__,__LINE__,"Blank form"); // Show an empty form of invoice - $form=FormVente($cn,$g_jrn,$g_user,null,false); + $form=FormVente($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],null,false); echo '
'; echo $form; echo '
'; @@ -78,23 +78,23 @@ if ( $action == 'insert_vente' ) { // Save the invoice if ( isset($_POST["record_invoice"])) { // Check privilege - if ( CheckJrn($g_dossier,$g_user,$g_jrn) != 2 ) { + if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_SESSION['g_jrn']) != 2 ) { NoAccess(); exit -1; } // echo "RECORD INVOICE"; - RecordInvoice($cn,$HTTP_POST_VARS,$g_user,$g_jrn); + RecordInvoice($cn,$HTTP_POST_VARS,$_SESSION['g_user'],$_SESSION['g_jrn']); } if (isset ($_POST['correct_new_invoice'])) { // Check privilege - if ( CheckJrn($g_dossier,$g_user,$g_jrn) != 2 ) { + if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_SESSION['g_jrn']) != 2 ) { NoAccess(); exit -1; } $nb=$_POST['nb_item']; - $form=FormVente($cn,$g_jrn,$g_user,$HTTP_POST_VARS,false,$nb); + $form=FormVente($cn,$_SESSION['g_jrn'],$_SESSION['g_user'],$HTTP_POST_VARS,false,$nb); echo '
'; echo $form; echo '
'; @@ -102,13 +102,13 @@ if (isset ($_POST['correct_new_invoice'])) { // Save and print the invoice if ( isset($_POST["record_and_print_invoice"])) { // Check privilege - if ( CheckJrn($g_dossier,$g_user,$g_jrn) != 2 ) { + if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_SESSION['g_jrn']) != 2 ) { NoAccess(); exit -1; } // echo "RECORD AND PRINT INVOICE"; - $comment=RecordInvoice($cn,$HTTP_POST_VARS,$g_user,$g_jrn); + $comment=RecordInvoice($cn,$HTTP_POST_VARS,$_SESSION['g_user'],$_SESSION['g_jrn']); $nb_number=$_POST["nb_item"]; $form=FormVenteView($cn,$g_jrn,$g_user,$HTTP_POST_VARS,$nb_number,'noform',$comment); @@ -120,7 +120,7 @@ if ( isset($_POST["record_and_print_invoice"])) { if ( $action == 'voir_jrn' ) { // Check privilege - if ( CheckJrn($g_dossier,$g_user,$g_jrn) < 1 ) { + if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_SESSION['g_jrn']) < 1 ) { NoAccess(); exit -1; } @@ -141,24 +141,24 @@ echo 'P '; } if ( $action == 'voir_jrn_non_paye' ) { // Check privilege - if ( CheckJrn($g_dossier,$g_user,$g_jrn) < 1 ) { + if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_SESSION['g_jrn']) < 1 ) { NoAccess(); exit -1; } // Show list of unpaid sell // Date - date of payment - Customer - amount - $sql=SQL_LIST_UNPAID_INVOICE_DATE_LIMIT." and jr_def_id=$g_jrn "; - $list=ListJrn($cn,$g_jrn,$sql); - $sql=SQL_LIST_UNPAID_INVOICE." and jr_def_id=$g_jrn "; - $list2=ListJrn($cn,$g_jrn,$sql); + $sql=SQL_LIST_UNPAID_INVOICE_DATE_LIMIT." and jr_def_id=".$_SESSION['g_jrn'] ; + $list=ListJrn($cn,$_SESSION['g_jrn'],$sql); + $sql=SQL_LIST_UNPAID_INVOICE." and jr_def_id=".$_SESSION['g_jrn'] ; + $list2=ListJrn($cn,$_SESSION['g_jrn'],$sql); echo '
'; echo '

Echeance dépassée

'; echo $list; diff --git a/include/user_menu.php b/include/user_menu.php index 8c55cc2e8..942cea701 100644 --- a/include/user_menu.php +++ b/include/user_menu.php @@ -196,7 +196,7 @@ function u_ShowMenuCompta($p_dossier) * - string containing the html menu * */ -function u_ShowMenuComptaRight($p_dossier=0,$p_admin,$p_more="") +function u_ShowMenuComptaRight($p_dossier=0,$p_admin=0) { include_once("ac_common.php"); $i=0; @@ -228,7 +228,7 @@ function u_ShowMenuComptaRight($p_dossier=0,$p_admin,$p_more="") * */ -function u_ShowMenuJrnUser($p_dossier,$p_user,$p_type,$p_jrn) +function u_ShowMenuJrnUser($p_dossier,$p_type,$p_jrn) { include_once ("debug.php"); include_once("constant.php"); @@ -242,13 +242,14 @@ function u_ShowMenuJrnUser($p_dossier,$p_user,$p_type,$p_jrn) $Cn=DbConnect($p_dossier); $User=new cl_user($Cn); + $User->Check(); if ( $User->Admin() ==0) { $Ret=ExecSql($Cn,"select jrn_def_id,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc,uj_priv, jrn_deb_max_line,jrn_cred_max_line from jrn_def join jrn_type on jrn_def_type=jrn_type_id join user_sec_jrn on uj_jrn_id=jrn_def_id where - uj_login='$p_user' + uj_login='".$User->id."' and uj_priv !='X' and jrn_def_type='$p_type' "); @@ -266,7 +267,7 @@ function u_ShowMenuJrnUser($p_dossier,$p_user,$p_type,$p_jrn) $l_line=pg_fetch_array($Ret,$i); // Admin have always rights if ( $User->Admin() == 0 ){ - $right=CheckJrn($p_dossier,$p_user,$l_line['jrn_def_id']); + $right=CheckJrn($p_dossier,$_SESSION['g_user'],$l_line['jrn_def_id']); }else { $right=3; }