From 239d0b4543ab8fff845fc422e32f1e7692dfac59 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Tue, 25 Oct 2005 09:58:03 +0000 Subject: [PATCH] remove column ac_users.use_usertype from account_repository --- html/admin/setup.php | 3 +++ html/admin/sql/patch/ac-upgrade6.sql | 16 ++++++++++++++++ include/ac_common.php | 20 -------------------- include/class_user.php | 6 +----- include/user_form_ach.php | 4 ++-- include/user_form_ven.php | 4 ++-- 6 files changed, 24 insertions(+), 29 deletions(-) create mode 100644 html/admin/sql/patch/ac-upgrade6.sql diff --git a/html/admin/setup.php b/html/admin/setup.php index 15a44ff42..87f840cc7 100644 --- a/html/admin/setup.php +++ b/html/admin/setup.php @@ -400,3 +400,6 @@ if ( GetVersion($cn) <= 4 ) { if ( GetVersion($cn) == 5 ) { ExecuteScript($cn,'sql/patch/ac-upgrade5.sql'); } +if ( GetVersion($cn) == 6 ) { + ExecuteScript($cn,'sql/patch/ac-upgrade7.sql'); + } diff --git a/html/admin/sql/patch/ac-upgrade6.sql b/html/admin/sql/patch/ac-upgrade6.sql new file mode 100644 index 000000000..a7ab3ee74 --- /dev/null +++ b/html/admin/sql/patch/ac-upgrade6.sql @@ -0,0 +1,16 @@ + +create table user_global_pref ( + user_id text, + parameter_type text, + parameter_value text +); +comment on table user_global_pref is 'The user''s global parameter '; +comment on column user_global_pref.user_id is 'user''s login '; +comment on column user_global_pref.parameter_type is 'the type of parameter '; +comment on column user_global_pref.parameter_value is 'the value of parameter '; + +alter table user_global_pref add constraint pk_user_global_pref primary key (user_id,parameter_type); + +insert into user_global_pref select use_login,'PAGESIZE','50' from ac_users; +update version set val=7; + diff --git a/include/ac_common.php b/include/ac_common.php index 21cbe2181..10c828429 100644 --- a/include/ac_common.php +++ b/include/ac_common.php @@ -215,8 +215,6 @@ function NoAccess() { * - * return: */ - - function FormatString($p_string) { if ( !isset ($p_string) ) { @@ -230,24 +228,6 @@ function FormatString($p_string) $p_string=str_replace("'","\'",$p_string); return $p_string; } -/* function GetUserType - * Purpose : get the type of an user (compta,developper or user) - * - * parm : - * - param $p_user user_login - * gen : - * - none - * return: the type of the user - */ -function GetUserType($p_user) -{ - $cn=DbConnect(); - $Res=ExecSql($cn,"select use_usertype from ac_users - where use_login='".$p_user."'"); - if ( pg_NumRows($Res) == 0 ) return null; - $Ret=pg_fetch_row($Res,0); - return $Ret[0]; -} /* function ShowItem($p_array) */ /* purpose : store the string which print */ diff --git a/include/class_user.php b/include/class_user.php index c266b95e6..969e80045 100644 --- a/include/class_user.php +++ b/include/class_user.php @@ -40,8 +40,6 @@ 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']; @@ -93,7 +91,7 @@ class cl_user { $cn=DbConnect(); if ( $cn != false ) { $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 + 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 @@ -104,13 +102,11 @@ class cl_user { 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']; diff --git a/include/user_form_ach.php b/include/user_form_ach.php index 789a9f9f4..a20cbf842 100644 --- a/include/user_form_ach.php +++ b/include/user_form_ach.php @@ -454,7 +454,7 @@ function FormAchView ($p_cn,$p_jrn,$p_periode,$p_array,$p_submit,$p_number,$p_pi // vat rate $a_vat=GetTvaRate($p_cn,$vat); if ( $a_vat == null ) { - $vat_label="unknown"; + $vat_label=""; $vat_rate=0.0; } else { $vat_label=$a_vat['tva_label']; @@ -642,4 +642,4 @@ function RecordSell($p_cn,$p_array,$p_user,$p_jrn) return $comment; } -?> \ No newline at end of file +?> diff --git a/include/user_form_ven.php b/include/user_form_ven.php index fed321caf..d539a7a34 100644 --- a/include/user_form_ven.php +++ b/include/user_form_ven.php @@ -459,7 +459,7 @@ function FormVenteView ($p_cn,$p_jrn,$p_periode,$p_array,$p_number,$p_doc='form' // vat rate $a_vat=GetTvaRate($p_cn,$vat); if ( $a_vat == null ) { - $vat_label="unknown"; + $vat_label=""; $vat_rate=0.0; } else { $vat_label=$a_vat['tva_label']; @@ -650,4 +650,4 @@ function RecordInvoice($p_cn,$p_array,$p_user,$p_jrn) return $comment; } -?> \ No newline at end of file +?>