From: erickson Date: Fri, 7 Jul 2006 20:12:04 +0000 (+0000) Subject: getting closer to the real thing X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a356d21789e99fbd7892d1cd0864f41b02b83c2f;p=Evergreen.git getting closer to the real thing git-svn-id: svn://svn.open-ils.org/ILS/trunk@4937 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/javascript/backend/circ/circ_duration.js b/Open-ILS/src/javascript/backend/circ/circ_duration.js index 5c61aa69b3..478efc7dc7 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_duration.js +++ b/Open-ILS/src/javascript/backend/circ/circ_duration.js @@ -263,6 +263,8 @@ result.durationLevel = copy.loan_duration; ----------------------------------------------------------------------------- */ var marcType = getMARCItemType(); var circMod = copy.circ_modifier; +var itemForm = extractFixedField(marcXMLDoc,'Form'); + var config = ( circMod && CIRC_MOD_MAP[circMod] ) ? CIRC_MOD_MAP[circMod] : @@ -286,6 +288,7 @@ log_debug("Copy circ modifier = " + circMod + " and item type = " + marcType ); 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; @@ -293,6 +296,7 @@ if( config ) { result.maxFine = config.maxFine; } else { + result.durationRule = '14_days_2_renew'; result.recurringFinesRule = "10_cent_per_day"; result.recurringFinesLevel = 'normal'; @@ -300,10 +304,31 @@ if( config ) { } + + /* ----------------------------------------------------------------------------- - 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(); + diff --git a/Open-ILS/src/javascript/backend/circ/circ_lib.js b/Open-ILS/src/javascript/backend/circ/circ_lib.js index 8b80cb68b3..080d4484f6 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_lib.js +++ b/Open-ILS/src/javascript/backend/circ/circ_lib.js @@ -159,7 +159,9 @@ function getMARCItemType() { 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; } diff --git a/Open-ILS/src/javascript/backend/circ/circ_max_fines.js b/Open-ILS/src/javascript/backend/circ/circ_max_fines.js index e931fd4260..c5d8d67d8e 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_max_fines.js +++ b/Open-ILS/src/javascript/backend/circ/circ_max_fines.js @@ -1,3 +1,4 @@ +/** XXX DEPRECATED */ function go() { diff --git a/Open-ILS/src/javascript/backend/circ/circ_permit_copy.js b/Open-ILS/src/javascript/backend/circ/circ_permit_copy.js index 178e144597..2d7cb9c99f 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_permit_copy.js +++ b/Open-ILS/src/javascript/backend/circ/circ_permit_copy.js @@ -8,8 +8,11 @@ log_vars('circ_permit_copy'); if( ! isTrue(copy.circulate) ) result.events.push('COPY_CIRC_NOT_ALLOWED'); -if( isTrue(copy.ref) ) - result.events.push('COPY_IS_REFERENCE'); + +if( ! isOrgDescendent( 'STATELIB', copy.circ_lib.id ) ) { + if( isTrue(copy.ref) ) + result.events.push('COPY_IS_REFERENCE'); +} diff --git a/Open-ILS/src/javascript/backend/circ/circ_recurring_fines.js b/Open-ILS/src/javascript/backend/circ/circ_recurring_fines.js index 73a38c31f8..ad7d24d3c8 100644 --- a/Open-ILS/src/javascript/backend/circ/circ_recurring_fines.js +++ b/Open-ILS/src/javascript/backend/circ/circ_recurring_fines.js @@ -1,3 +1,5 @@ +/** XXX DEPRECATED */ + function go() { diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/ScriptBuilder.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/ScriptBuilder.pm index d7e1a82cdf..92bd00dc7b 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/ScriptBuilder.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/ScriptBuilder.pm @@ -241,7 +241,6 @@ sub insert_org_methods { my ( $editor, $ctx ) = @_; my $runner = $ctx->{runner}; - if(!$ORG_TREE) { $ORG_TREE = $editor->search_actor_org_unit( [ @@ -256,12 +255,17 @@ sub insert_org_methods { 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; } ); } @@ -279,3 +283,4 @@ sub is_org_descendent { 1; +