From 9e2e27bda4a44c0303cea5bc774d566e2e9f40df Mon Sep 17 00:00:00 2001 From: aurynn_cmd Date: Wed, 17 Sep 2008 23:22:02 +0000 Subject: Further fixes to Reconciliation, the new Admin interface, and a small change to Company.sql git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2327 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/DBObject/Admin.pm | 14 ++++++++---- LedgerSMB/DBObject/User.pm | 55 +++++++++++++++++++++++++++++---------------- 2 files changed, 46 insertions(+), 23 deletions(-) (limited to 'LedgerSMB/DBObject') diff --git a/LedgerSMB/DBObject/Admin.pm b/LedgerSMB/DBObject/Admin.pm index 52e1d8b3..e6e519ac 100644 --- a/LedgerSMB/DBObject/Admin.pm +++ b/LedgerSMB/DBObject/Admin.pm @@ -241,9 +241,15 @@ sub get_salutations { sub get_roles { - # These are direct, assignable roles. - my $self = shift; - - return $self->exec_method( procname => "admin__all_roles" ); + my $self = shift @_; +# print STDERR "attempting to get roles"; + my @s_rows = $self->call_procedure(procname=>'admin__get_roles',args=>[$self->{company}]); + my @rows; + for my $role (@s_rows) { + my $rolname = $role->{'admin__get_roles'}; + $rolname =~ s/lsmb_ledgersmb_13__//gi; + push @rows, $rolname; + } + return \@rows; } 1; diff --git a/LedgerSMB/DBObject/User.pm b/LedgerSMB/DBObject/User.pm index af02e7ff..18bfca9a 100644 --- a/LedgerSMB/DBObject/User.pm +++ b/LedgerSMB/DBObject/User.pm @@ -40,36 +40,53 @@ sub get { my $self = shift @_; my $id = shift; - $self->{user} = @{ $self->exec_method( + my @users = $self->exec_method( funcname=>'admin__get_user', args=>[$id] - ) - }[0]; - $self->{pref} = @{ $self->exec_method( + ); + $self->{user} = $users[0]; + my @prefs = $self->exec_method( funcname=>'admin__user_preferences', args=>[$id] - ) - }[0]; - $self->{person} = @{ $self->exec_method( - funcname=>'admin__user_preferences', - args=>[$self->{user}->{entity_id}] - ) - }[0]; - $self->{employee} = @{ $self->exec_method( + ); + $self->{pref} = $prefs[0]; +# $self->{person} = @{ $self->exec_method( +# funcname=>'admin__user_preferences', +# args=>[$self->{user}->{entity_id}] +# ) +# }[0]; + my @emp = $self->exec_method( funcname=>'employee__get', - args=>[$id] - ) - }[0]; - $self->{entity} = @{ $self->exec_method( + args=>[$self->{user}->{entity_id}] + ); + $self->{employee} = $emp[0]; + my @ent = $self->exec_method( funcname=>'entity__get_entity', args=>[ $self->{user}->{entity_id} ] - ) - }[0]; - $self->{roles} = $self->exec_method( + ); + $self->{entity} = $ent[0]; + my @roles = $self->exec_method( funcname=>'admin__get_roles_for_user', args=>[$id] ); + # Now, location and stuff. + my @loc = $self->exec_method( + funcname=>'person__list_locations', + args=>[ $self->{user}->{entity_id} ] + ); + $self->{location} = \@loc; + my @contacts = $self->exec_method( + funcname=>"person__list_contacts", + args=>[$self->{user}->{entity_id} ] + ); + my @rolstore; + + for my $role (@roles) { + push @rolstore, $role->{'admin__get_roles_for_user'}; # Only one key=>value pair + } + $self->{roles} = \@rolstore; + print STDERR "Got all user information"; #$user->{user} = $u->get($id); #$user->{pref} = $u->preferences($id); -- cgit v1.2.3