[open-ils-commits] r17271 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Aug 19 17:00:36 EDT 2010
Author: erickson
Date: 2010-08-19 17:00:30 -0400 (Thu, 19 Aug 2010)
New Revision: 17271
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm
Log:
circ_modifier codes could be defined, but non-true (i.e. '0'). test for defined instead of truthiness when analyzing LID circ modifiers. repaired (invisible) bug that unnecessarily lead to using circ mod objects instead of codes, depending on context
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm 2010-08-19 20:00:14 UTC (rev 17270)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm 2010-08-19 21:00:30 UTC (rev 17271)
@@ -482,9 +482,8 @@
$lid->location($loc);
}
- if(!$lid->circ_modifier and my $mod = get_default_circ_modifier($mgr, $lid->owning_lib)) {
- $lid->circ_modifier($mod);
- }
+ $lid->circ_modifier(get_default_circ_modifier($mgr, $lid->owning_lib))
+ unless defined $lid->circ_modifier;
$mgr->editor->update_acq_lineitem_detail($lid) or return 0;
return $lid;
@@ -492,10 +491,9 @@
sub get_default_circ_modifier {
my($mgr, $org) = @_;
- my $mod = $mgr->cache($org, 'def_circ_mod');
- return $mod if $mod;
- $mod = $U->ou_ancestor_setting_value($org, 'acq.default_circ_modifier');
- return $mgr->cache($org, 'def_circ_mod', $mod) if $mod;
+ my $code = $mgr->cache($org, 'def_circ_mod');
+ $code = $U->ou_ancestor_setting_value($org, 'acq.default_circ_modifier') unless defined $code;
+ return $mgr->cache($org, 'def_circ_mod', $code) if defined $code;
return undef;
}
@@ -1386,23 +1384,22 @@
# ---------------------------------------------------------------------
# Circ Modifier
my $code = $compiled{circ_modifier};
- my $mod;
- if($code) {
+ if(defined $code) {
- $mod = $mgr->cache($base_org, "mod.$code") ||
+ # verify this is a valid circ modifier
+ return $killme->("invlalid circ_modifier $code") unless
+ defined $mgr->cache($base_org, "mod.$code") or
$mgr->editor->retrieve_config_circ_modifier($code);
- return $killme->("invlalid circ_modifier $code") unless $mod;
- $mgr->cache($base_org, "mod.$code", $mod);
+ # if valid, cache for future tests
+ $mgr->cache($base_org, "mod.$code", $code);
+
} else {
- # try the default
- $mod = get_default_circ_modifier($mgr, $base_org);
+ $compiled{circ_modifier} = get_default_circ_modifier($mgr, $base_org);
}
- $compiled{circ_modifier} = $mod if $mod;
-
# ---------------------------------------------------------------------
# Shelving Location
if( my $name = $compiled{copy_location}) {
More information about the open-ils-commits
mailing list