[open-ils-commits] r16684 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger (atz)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jun 11 13:10:39 EDT 2010
Author: atz
Date: 2010-06-11 13:10:35 -0400 (Fri, 11 Jun 2010)
New Revision: 16684
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Reactor.pm
Log:
Add helper handling to specify length of field, like: isbn_10 or isbn_13
"isbn" will still just get the first available value.
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Reactor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Reactor.pm 2010-06-11 17:10:34 UTC (rev 16683)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Reactor.pm 2010-06-11 17:10:35 UTC (rev 16684)
@@ -10,8 +10,8 @@
my $U = 'OpenILS::Application::AppUtils';
sub fourty_two { return 42 }
-sub NOOP_True { return 1 }
-sub NOOP_False { return 0 }
+sub NOOP_True { return 1 }
+sub NOOP_False { return 0 }
@@ -75,13 +75,13 @@
]);
if($copy->call_number->id == -1) {
return {
- title => $copy->dummy_title,
+ title => $copy->dummy_title,
author => $copy->dummy_author,
};
} else {
my $mvr = $U->record_to_mvr($copy->call_number->record);
return {
- title => $mvr->title,
+ title => $mvr->title,
author => $mvr->author
};
}
@@ -93,6 +93,7 @@
return $U->ou_ancestor_setting_value($org_id, $setting);
},
+ # helpers.get_li_attr('isbn_13', li.attributes)
# returns matching line item attribute, or undef
get_li_attr => sub {
my $name = shift or return; # the first arg is always the name
@@ -100,8 +101,11 @@
# if the next is the last, it's the attributes, otherwise type
# use Data::Dumper; $logger->warn("get_li_attr: " . Dumper($attr));
($name and @$attr) or return;
+ my $length;
+ $name =~ s/^(\D+)_(\d+)$/$1/ and $length = $2;
foreach (@$attr) {
$_->attr_name eq $name or next;
+ next if $length and $length != length($_->attr_value);
return $_->attr_value if (! $type) or $type eq $_->attr_type;
}
return;
More information about the open-ils-commits
mailing list