projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SL::Controller::CustomerVendor::action_new in action_add umbenannt
[kivitendo-erp.git]
/
SL
/
DB
/
Helper
/
Manager.pm
diff --git
a/SL/DB/Helper/Manager.pm
b/SL/DB/Helper/Manager.pm
index
5290533
..
b4d66da
100644
(file)
--- a/
SL/DB/Helper/Manager.pm
+++ b/
SL/DB/Helper/Manager.pm
@@
-18,8
+18,17
@@
sub find_by {
return $class->get_all(query => [ @_ ], limit => 1)->[0];
}
return $class->get_all(query => [ @_ ], limit => 1)->[0];
}
+sub find_by_or_create {
+ my $class = shift;
+
+ my $found;
+ eval { $found = $class->find_by(@_); };
+ return defined $found ? $found : $class->object_class->new;
+}
+
sub get_first {
shift->get_all(
sub get_first {
shift->get_all(
+ @_,
limit => 1,
)->[0];
}
limit => 1,
)->[0];
}