From 0a1573bd053a30b3ba2690fcf3545be02cb2eaa8 Mon Sep 17 00:00:00 2001 From: aurynn_cmd Date: Tue, 23 Sep 2008 23:23:03 +0000 Subject: Lots of fixes for editing users. Minor changes to Person.sql, specifically person__save_contact. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@2339 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/DBObject/Admin.pm | 9 ++++++++- LedgerSMB/DBObject/Location.pm | 1 + LedgerSMB/DBObject/User.pm | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) (limited to 'LedgerSMB/DBObject') diff --git a/LedgerSMB/DBObject/Admin.pm b/LedgerSMB/DBObject/Admin.pm index 5ab869b0..e16e5dea 100644 --- a/LedgerSMB/DBObject/Admin.pm +++ b/LedgerSMB/DBObject/Admin.pm @@ -264,4 +264,11 @@ sub get_countries { $self->debug({file => '/tmp/user'}); return $self->{countries}; } -1; +sub get_contact_classes { + + my $self = shift @_; + my $sth = $self->{dbh}->prepare("select id, class as classname from contact_class"); + my $code = $sth->execute(); + return $sth->fetchall_arrayref({}); +} +1; \ No newline at end of file diff --git a/LedgerSMB/DBObject/Location.pm b/LedgerSMB/DBObject/Location.pm index 3deb967f..1b7e2699 100644 --- a/LedgerSMB/DBObject/Location.pm +++ b/LedgerSMB/DBObject/Location.pm @@ -69,5 +69,6 @@ sub get_all { my $type = shift @_; my @locations = $self->exec_method(funcname=>$type."__all_locations", args=>[$user_id]); + return \@locations; } 1; \ No newline at end of file diff --git a/LedgerSMB/DBObject/User.pm b/LedgerSMB/DBObject/User.pm index 7682acbe..0ca6bcfc 100644 --- a/LedgerSMB/DBObject/User.pm +++ b/LedgerSMB/DBObject/User.pm @@ -141,4 +141,20 @@ sub roles { } +sub save_contact { + + my $self = shift @_; + my $id = shift @_; + my $contact = shift @_; + + my @ret = $self->exec_method(funcname=>"person__save_contact", + args=>[ + $self->{entity_id}, + $self->{contacts}->[$id]->{contact_class}, + $self->{contacts}->[$id]->{contact}, + $contact + ] + ); +} + 1; -- cgit v1.2.3