summaryrefslogtreecommitdiff
path: root/LedgerSMB
diff options
context:
space:
mode:
Diffstat (limited to 'LedgerSMB')
-rw-r--r--LedgerSMB/Admin.pm42
-rw-r--r--LedgerSMB/DBObject/Reconciliation.pm25
-rw-r--r--LedgerSMB/DBObject/User.pm20
3 files changed, 61 insertions, 26 deletions
diff --git a/LedgerSMB/Admin.pm b/LedgerSMB/Admin.pm
index 8e6c5dfd..34acecb3 100644
--- a/LedgerSMB/Admin.pm
+++ b/LedgerSMB/Admin.pm
@@ -10,7 +10,7 @@ sub save_user {
my $self = shift @_;
- my $entity_id = shift @{ $self->exec_method( procname => "save_user" ) };
+ my $entity_id = shift @{ $self->exec_method( funcname => "save_user" ) };
$self->merge($entity_id);
my $employee = LedgerSMB::DBObject::Employee->new(base=>$self, copy=>'list',
@@ -52,8 +52,8 @@ sub save_user {
$contact->save_workphone(person=>$employee);
$contact->save_email(person=>$employee);
- my $roles = $self->exec_method( procname => "all_roles" );
- my $user_roles = $self->exec_method(procname => "get_user_roles", args=>[ $self->{ modifying_user } ] );
+ my $roles = $self->exec_method( funcname => "all_roles" );
+ my $user_roles = $self->exec_method(funcname => "get_user_roles", args=>[ $self->{ modifying_user } ] );
my %active_roles;
for my $role (@{$user_roles}) {
@@ -76,13 +76,13 @@ sub save_user {
elsif ($active_roles{$role} && !($self->{incoming_roles}->{$role} )) {
# do remove function
- $status = $self->exec_method(procname => "remove_user_from_role",
+ $status = $self->exec_method(funcname => "remove_user_from_role",
args=>[ $self->{ modifying_user }, $role ]
}
elsif ($self->{incoming_roles}->{$role} and !($active_roles{$role} )) {
# do add function
- $status = $self->exec_method(procname => "add_user_to_role",
+ $status = $self->exec_method(funcname => "add_user_to_role",
args=>[ $self->{ modifying_user }, $role ]
);
}
@@ -93,14 +93,14 @@ sub save_group {
my $self = shift @_;
- my $existant = shift @{ $self->exec_method (procname=> "is_group", args=>[$self->{modifying_group}]) };
+ my $existant = shift @{ $self->exec_method (funcname=> "is_group", args=>[$self->{modifying_group}]) };
- my $group = shift @{ $self->exec_method (procname=> "save_group") };
+ my $group = shift @{ $self->exec_method (funcname=> "save_group") };
# first we grab all roles
- my $roles = $self->exec_method( procname => "all_roles" );
- my $user_roles = $self->exec_method(procname => "get_user_roles",
+ my $roles = $self->exec_method( funcname => "all_roles" );
+ my $user_roles = $self->exec_method(funcname => "get_user_roles",
args=>[ $self->{ group_name } ]
);
@@ -126,7 +126,7 @@ sub save_group {
# do remove function
$status = $self->exec_method(
- procname => "remove_group_from_role",
+ funcname => "remove_group_from_role",
args=>[ $self->{ modifying_user }, $role ]
);
}
@@ -134,7 +134,7 @@ sub save_group {
# do add function
$status = $self->exec_method(
- procname => "add_group_to_role",
+ funcname => "add_group_to_role",
args=>[ $self->{ modifying_user }, $role ]
);
}
@@ -146,7 +146,7 @@ sub delete_user {
my $self = shift @_;
- my $status = shift @{ $self->exec_method(procname=>'delete_user', args=>[$self->{modifying_user}]) };
+ my $status = shift @{ $self->exec_method(funcname=>'delete_user', args=>[$self->{modifying_user}]) };
if ($status) {
@@ -163,7 +163,7 @@ sub delete_group {
my $self = shift @_;
- my $status = shift @{ $self->exec_method(procname=>'delete_group', args=>[$self->{groupname}])};
+ my $status = shift @{ $self->exec_method(funcname=>'delete_group', args=>[$self->{groupname}])};
if ($status) {
@@ -176,4 +176,20 @@ sub delete_group {
}
}
+sub get_entire_user {
+
+ my $self = shift @_;
+ my $id = shift @_;
+ my $user = LedgerSMB::DBObject::User->new(base=>$self,copy=>'all');
+ $user->get($id);
+
+}
+
+sub get_roles {
+
+ my $self = shift @_;
+
+ return $self->exec_method(funcname=>'get_roles',args=>[$self->{company}]);
+}
+
1; \ No newline at end of file
diff --git a/LedgerSMB/DBObject/Reconciliation.pm b/LedgerSMB/DBObject/Reconciliation.pm
index 7a7ba313..1b5e9b97 100644
--- a/LedgerSMB/DBObject/Reconciliation.pm
+++ b/LedgerSMB/DBObject/Reconciliation.pm
@@ -160,15 +160,24 @@ sub new_report {
# 0 is success
# 1 is found, but mismatch
# 2 is not found
+
+ # in_scn INT,
+ #in_amount INT,
+ #in_account INT,
+ #in_user TEXT,
+ #in_date TIMESTAMP
$code = $self->exec_method(
funcname=>'reconciliation__add_entry',
args=>[
$report_id,
+ $entry->{scn},
+ $entry->{amount}, # needs leading 0's trimmed.
+ $entry->{account},
+ $self->{user},
+ $self->{date}
]
);
- $entry{report_id} = $report_id;
- $entry{code} = $self->add_entry( $entry );
-
+ $entry{report_id} = $report_id;
}
$self->exec_method(funcname=>'reconciliation__pending_transactions', args=>[$report_id, $date]);
@@ -221,7 +230,7 @@ sub entry {
sub search {
my $self = shift @_;
-
+ my $type = shift;
return $self->exec_method(
funcname=>'reconciliation__search',
args=>[$self->{date_begin}, $self->{date_end}, $self->{account}, $self->{status}]
@@ -246,4 +255,12 @@ sub get_report_list {
args=>[$self->{account},$self->{report}]
);
}
+
+sub get_accounts {
+
+ my $self = shift @_;
+ return $self->exec_method(
+ funcname=>'reconciliation__account_list',
+ );
+}
1; \ No newline at end of file
diff --git a/LedgerSMB/DBObject/User.pm b/LedgerSMB/DBObject/User.pm
index c84c6336..b09951a9 100644
--- a/LedgerSMB/DBObject/User.pm
+++ b/LedgerSMB/DBObject/User.pm
@@ -1,6 +1,7 @@
package LedgerSMB::DBObject::User;
use base qw/LedgerSMB::DBObject/;
+use Data::Dumper;
sub save {
@@ -11,7 +12,7 @@ sub save {
if ( $user->{id} && $self->{is_a_user} ) {
# doesn't check for the password - that's done in the sproc.
- $self->{id} = shift @{ $self->exec_method(procname=>'admin__save_user',
+ $self->{id} = shift @{ $self->exec_method(funcname=>'admin__save_user',
args=>[$user->{id}, $self->{username}, $self->{password}] ) };
if (!$self->{id}) {
@@ -29,7 +30,7 @@ sub save {
elsif ($self->{is_a_user}) {
# No user ID, meaning, creating a new one.
- $self->{id} = shift @{ $self->exec_method(procname=>'admin__save_user',
+ $self->{id} = shift @{ $self->exec_method(funcname=>'admin__save_user',
args=>[undef, $self->{username}, $self->{password}] ) };
}
return 1;
@@ -38,18 +39,18 @@ sub save {
sub get {
my $self = shift @_;
-
- my ($user_id, $username) = @{ $self->exec_method(procname=>'admin__get_user',
- args=>[$self->{id}])};
+ my $id = shift;
+ my $user = @{ $self->exec_method(funcname=>'admin__get_user',
+ args=>[$id])}[0];
- return {id=>$user_id, username=>$username};
+ return $user;
}
sub remove {
my $self = shift;
- my $code = $self->exec_method(procname=>"admin__delete_user", args=>[$self->{id}, $self->{username}]);
+ my $code = $self->exec_method(funcname=>"admin__delete_user", args=>[$self->{id}, $self->{username}]);
$self->{id} = undef; # never existed..
return $code->[0];
@@ -59,7 +60,7 @@ sub save_prefs {
my $self = shift @_;
- my $pref_id = $self->exec_method(procname=>"admin__save_preferences",
+ my $pref_id = $self->exec_method(funcname=>"admin__save_preferences",
args=>[
'language',
'stylesheet',
@@ -74,7 +75,8 @@ sub get_all_users {
my $self = shift @_;
- $self->{users} = $self->exec_method( procname=>"user__get_all_users" );
+ my @ret = $self->exec_method( funcname=>"user__get_all_users" );
+ $self->{users} = \@ret;
}
1;