diff options
author | aurynn_cmd <aurynn_cmd@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-09-22 21:45:11 +0000 |
---|---|---|
committer | aurynn_cmd <aurynn_cmd@4979c152-3d1c-0410-bac9-87ea11338e46> | 2008-09-22 21:45:11 +0000 |
commit | 61ea910a5ba61a7c5eed2d679d1f25c431c449a8 (patch) | |
tree | d9fc1f2f34dde7d8d742258671ad66999b2c375a /LedgerSMB | |
parent | 081b2af1a72788c4c3bd9e769d90155ad72e26cb (diff) |
Major changes to the Admin interface for Edit User. Minor tweaks to Person, Location and Employee.sql as needed.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2331 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rw-r--r-- | LedgerSMB/DBObject/Admin.pm | 15 | ||||
-rw-r--r-- | LedgerSMB/DBObject/Location.pm | 73 | ||||
-rw-r--r-- | LedgerSMB/DBObject/User.pm | 8 |
3 files changed, 92 insertions, 4 deletions
diff --git a/LedgerSMB/DBObject/Admin.pm b/LedgerSMB/DBObject/Admin.pm index e6e519ac..061cbd72 100644 --- a/LedgerSMB/DBObject/Admin.pm +++ b/LedgerSMB/DBObject/Admin.pm @@ -247,9 +247,20 @@ sub get_roles { my @rows; for my $role (@s_rows) { my $rolname = $role->{'admin__get_roles'}; - $rolname =~ s/lsmb_ledgersmb_13__//gi; + my $company = $self->{company}; + $rolname =~ s/lsmb_${company}__//gi; push @rows, $rolname; } return \@rows; } -1; + +sub get_countries { + + my $self = shift @_; + + my $sth = $self->{dbh}->prepare("SELECT id, name FROM country"); + my $code = $sth->execute(); + + return $sth->fetchall_arrayref( {} ); # returns an array of hashrefs. +} +1;
\ No newline at end of file diff --git a/LedgerSMB/DBObject/Location.pm b/LedgerSMB/DBObject/Location.pm new file mode 100644 index 00000000..3deb967f --- /dev/null +++ b/LedgerSMB/DBObject/Location.pm @@ -0,0 +1,73 @@ +package LedgerSMB::DBObject::Location; + +use base LedgerSMB::DBObject; + +sub create { + + my $self = shift @_; +} + +sub save { + + my $self = shift @_; + my $type = shift @_; + + # assumes all the parameters are present... + + my ($ret) = $self->exec_method(funcname=>$type."__save_location", args=>[ + $self->{user_id}, # entity_id + $self->{location_id}, # location_id + $self->{address1}, + $self->{address2}, + $self->{address3}, # address info + $self->{city}, # city + $self->{state}, # state/province + $self->{zipcode}, + $self->{country} # obviously, country. + ]); + $self->{id} = $ret->[0]; + return $self->{id}; +} + +sub delete { + + my $self = shift @_; + my $id = shift @_; + my $e_id = shift @_; + my $type = shift @_; + + + # e_id is an entity of some variety + + + if (!$id && !$self->{location_id}) { + $self->error("Must call delete with an ID..."); + } + unless ($id) { + $id = $self->{location_id}; + } + + my ($res) = $self->exec_method(funcname=>$type."__delete_location", args=>[$e_id,$id]); + + return $res->[0]; +} + +sub get { + + my $self = shift @_; + my $id = shift @_; + + my ($ret) = $self->exec_method(funcname=>"location__get", args=>[$id]); + + return $ret->[0]; +} + +sub get_all { + + my $self = shift @_; + my $user_id = shift @_; + my $type = shift @_; + + my @locations = $self->exec_method(funcname=>$type."__all_locations", args=>[$user_id]); +} +1;
\ No newline at end of file diff --git a/LedgerSMB/DBObject/User.pm b/LedgerSMB/DBObject/User.pm index 18bfca9a..7682acbe 100644 --- a/LedgerSMB/DBObject/User.pm +++ b/LedgerSMB/DBObject/User.pm @@ -74,15 +74,19 @@ sub get { funcname=>'person__list_locations', args=>[ $self->{user}->{entity_id} ] ); - $self->{location} = \@loc; + $self->{locations} = \@loc; my @contacts = $self->exec_method( funcname=>"person__list_contacts", args=>[$self->{user}->{entity_id} ] ); + $self->{contacts} = \@contacts; my @rolstore; for my $role (@roles) { - push @rolstore, $role->{'admin__get_roles_for_user'}; # Only one key=>value pair + my $rolname = $role->{'admin__get_roles_for_user'}; + my $company = $self->{company}; + $rolname =~ s/lsmb_${company}__//gi; + push @rolstore, $rolname; # Only one key=>value pair } $self->{roles} = \@rolstore; |