[open-ils-commits] [GIT] Evergreen ILS branch rel_2_10 updated. 21b1cb9292a0d3c56e2a6f02d2d9f46b1d4cca1b
Evergreen Git
git at git.evergreen-ils.org
Wed Sep 7 15:38:14 EDT 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, rel_2_10 has been updated
via 21b1cb9292a0d3c56e2a6f02d2d9f46b1d4cca1b (commit)
from 9f095c82b18b71041810a0c7e6753d7a6db47e17 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 21b1cb9292a0d3c56e2a6f02d2d9f46b1d4cca1b
Author: Bill Erickson <berickxx at gmail.com>
Date: Thu Jun 2 15:27:06 2016 -0400
LP#1413352 Brief record price sets lineitem price
Propagate lineitem MARC 'price' attribute value to the lineitem
estimated_unit_price field. This allows users to apply a lineitem
price directly from the ACQ Brief Record interface.
Signed-off-by: Bill Erickson <berickxx at gmail.com>
Signed-off-by: Chris Sharp <csharp at georgialibraries.org>
Signed-off-by: Mike Rylander <mrylander at gmail.com>
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm
index 925fc85..af491b6 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm
@@ -65,6 +65,12 @@ sub create_lineitem {
$li->selector($e->requestor->id);
$li = $e->create_acq_lineitem($li) or return $e->die_event;
+ # if no price is set, see if it can be extracted from the price attribute.
+ if (not defined $li->estimated_unit_price) { # '0' is valid
+ my $evt = set_li_price_from_attr($e, $li);
+ return $evt if $evt;
+ }
+
if ($po) {
# apply the default number of copies for this provider
for (1 .. $po->provider->default_copy_count) {
@@ -79,6 +85,35 @@ sub create_lineitem {
return $li->id;
}
+# See if we have a value for the price attribute. If so, apply the price
+# value to the lineitem.
+# Returns undef on success, Event on error.
+sub set_li_price_from_attr {
+ my ($e, $li) = @_;
+
+ my $attr = $e->search_acq_lineitem_attr({
+ lineitem => $li->id,
+ attr_type => 'lineitem_marc_attr_definition',
+ attr_name => 'price'
+ })->[0];
+
+ return unless $attr;
+
+ my $val = $attr->attr_value;
+
+ return unless defined $val; # '0' is valid
+
+ $li->estimated_unit_price($val);
+
+ if (!$e->update_acq_lineitem($li)) {
+ $e->rollback;
+ return OpenILS::Event->new('BAD_PARAMS',
+ desc => "Invalid lineitem price value: '$val'") ;
+ }
+
+ return undef;
+}
+
__PACKAGE__->register_method(
method => 'retrieve_lineitem',
-----------------------------------------------------------------------
Summary of changes:
.../lib/OpenILS/Application/Acq/Lineitem.pm | 35 ++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list