----------------------------------------------------------------------------- */
var marcType = getMARCItemType();
var circMod = copy.circ_modifier;
+var itemForm = extractFixedField(marcXMLDoc,'Form');
+
var config =
( circMod && CIRC_MOD_MAP[circMod] ) ?
CIRC_MOD_MAP[circMod] :
on this copy, fall back on defaults.
----------------------------------------------------------------------------- */
if( config ) {
+
log_debug("circ_duration found a config for the copy");
result.durationRule = config.durationRule;
result.recurringFinesRule = config.recurringFinesRule;
result.maxFine = config.maxFine;
} else {
+
result.durationRule = '14_days_2_renew';
result.recurringFinesRule = "10_cent_per_day";
result.recurringFinesLevel = 'normal';
}
+
+
/* -----------------------------------------------------------------------------
- Add custom rules here.
+ Add custom rules here.
----------------------------------------------------------------------------- */
+/* statelib has some special circ rules */
+
+if( isOrgDescendent('STATELIB', copy.circ_lib.id) ) {
+
+ result.durationRule = '35_days_1_renew';
+ result.recurringFinesRule = "10_cent_per_day";
+ result.recurringFinesLevel = 'normal';
+ result.maxFine = "overdue_mid";
+
+ /* reference, microfiche, microfilm */
+ if( isTrue(copy.ref) ||
+ itemForm == 'a' ||
+ itemForm == 'b' ) {
+
+ result.durationRule = '14_days_2_renew';
+ }
+}
+
} go();
+
function isOrgDescendent( parentName, childId ) {
- var val = environment.__OILS_FUNC_isOrgDescendent(parentName, childId);
+ var key = scratchKey();
+ __OILS_FUNC_isOrgDescendent(scratchPad(key), parentName, childId);
+ var val = getScratch(key);
if( val == '1' ) return true;
return false;
}
my ( $editor, $ctx ) = @_;
my $runner = $ctx->{runner};
-
if(!$ORG_TREE) {
$ORG_TREE = $editor->search_actor_org_unit(
[
flatten_org_tree($ORG_TREE);
}
- $runner->insert("$evt.__OILS_FUNC_isOrgDescendent",
+ $runner->insert(__OILS_FUNC_isOrgDescendent =>
sub {
- my( $sname, $id ) = @_;
+ my( $write_key, $sname, $id ) = @_;
+ $logger->debug("script_builder: org descendent: $sname - $id");
my ($parent) = grep { $_->shortname eq $sname } @ORG_LIST;
my ($child) = grep { $_->id == $id } @ORG_LIST;
- return is_org_descendent( $parent, $child );
+ $logger->debug("script_builder: org descendent: $parent = $child");
+ my $val = is_org_descendent( $parent, $child );
+ $logger->debug("script_builder: ord desc = $val");
+ $runner->insert($write_key, $val);
+ return $val;
}
);
}
1;
+