From: Moritz Bunkus Date: Thu, 25 Nov 2010 14:17:35 +0000 (+0100) Subject: Bei save/delete das richtige Ergebnis zurückgeben X-Git-Tag: release-2.6.3~25^2~51 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=d49485e0704b04de63cdbb316d4ff4c4a299b27e;p=kivitendo-erp.git Bei save/delete das richtige Ergebnis zurückgeben Und zwar das von RDBO::save/delete, und nicht das von do_transaction. --- diff --git a/SL/DB/Object.pm b/SL/DB/Object.pm index 4e6e15c4c..a80640cad 100755 --- a/SL/DB/Object.pm +++ b/SL/DB/Object.pm @@ -110,24 +110,30 @@ sub load { sub save { my ($self, @args) = @_; - my $worker = sub { + + my $result; + my $worker = sub { SL::DB::Object::Hooks::run_hooks($self, 'before_save'); - my $result = $self->SUPER::save(@args); + $result = $self->SUPER::save(@args); SL::DB::Object::Hooks::run_hooks($self, 'after_save', $result); }; - return $self->db->in_transaction ? $worker->() : $self->db->do_transaction($worker); + $self->db->in_transaction ? $worker->() : $self->db->do_transaction($worker); + return $result; } sub delete { my ($self, @args) = @_; - my $worker = sub { + + my $result; + my $worker = sub { SL::DB::Object::Hooks::run_hooks($self, 'before_delete'); - my $result = $self->SUPER::delete(@args); + $result = $self->SUPER::delete(@args); SL::DB::Object::Hooks::run_hooks($self, 'after_delete', $result); }; - return $self->db->in_transaction ? $worker->() : $self->db->do_transaction($worker); + $self->db->in_transaction ? $worker->() : $self->db->do_transaction($worker); + return $result; } 1;