From a44648ee2e81a965024e3036ce586aba9b852b38 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Mon, 31 Dec 2007 20:30:08 +0000 Subject: * Committed Tony Brummett's patch for last/avg costs * Committing fix for User.pm error handling (1860699) git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@2025 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/IR.pm | 2 +- LedgerSMB/User.pm | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/LedgerSMB/IR.pm b/LedgerSMB/IR.pm index 69b20aea..35a0a07e 100755 --- a/LedgerSMB/IR.pm +++ b/LedgerSMB/IR.pm @@ -798,7 +798,7 @@ sub post_invoice { SET avgcost = avgcost($item), lastcost = lastcost($item) WHERE id = $item|; - $dbh->prepare($query) || $form->dberror($query); + $dbh->do($query) || $form->dberror($query); } my $rc = $dbh->commit; diff --git a/LedgerSMB/User.pm b/LedgerSMB/User.pm index 7ef25547..e935583d 100755 --- a/LedgerSMB/User.pm +++ b/LedgerSMB/User.pm @@ -35,6 +35,7 @@ package LedgerSMB::User; use LedgerSMB::Sysconfig; use LedgerSMB::Session; use Data::Dumper; +use LedgerSMB::Form; sub new { @@ -825,8 +826,11 @@ sub save_member { } else { - my ($employeenumber) = - Form::update_defaults( "", \%$self, "employeenumber", $dbh ); + my $form = {dbh => $dbh}; + bless($form, 'Form'); + + my ($employeenumber) = $form->update_defaults(\%$self, "employeenumber"); + $query = qq| INSERT INTO employee (login, employeenumber, name, -- cgit v1.2.3