[open-ils-commits] r623 - conifer/trunk/circ (pzed)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Aug 18 11:31:46 EDT 2009
Author: pzed
Date: 2009-08-18 11:31:43 -0400 (Tue, 18 Aug 2009)
New Revision: 623
Modified:
conifer/trunk/circ/circ_duration.js
conifer/trunk/circ/circ_duration_OWA.js
Log:
updated to include circ logging developed by Art
Modified: conifer/trunk/circ/circ_duration.js
===================================================================
--- conifer/trunk/circ/circ_duration.js 2009-08-18 14:32:26 UTC (rev 622)
+++ conifer/trunk/circ/circ_duration.js 2009-08-18 15:31:43 UTC (rev 623)
@@ -1,77 +1,84 @@
-function go(){
-
-load_lib('circ/circ_item_config.js');
-load_lib('JSON_v1.js');
-log_vars('circ_duration');
-
-try {
- /* load circ rules for specific institutions */
- var circ_duration_institution_file = 'circ/circ_duration_' + currentLocation.shortname + '.js';
- load_lib(circ_duration_institution_file);
-
- log_error(circ_duration_institution_file);
-
- /* if an institution specific script was loaded, then stop */
- if (result.durationRule) return;
-} catch (e) {
- // fall through to system-wide defaults
-}
-
-/* treat pre-cat copies like vanilla books */
-if( isTrue(isPrecat) ) {
- log_info("pre-cat copy getting duration defaults...");
- result.durationRule = 'default';
- result.recurringFinesRule = 'default';
- result.maxFine = 'default'
- return;
-}
-
-
-/* grab the config from the config script */
-var config = getItemConfig();
-var itemForm = (marcXMLDoc) ? extractFixedField(marcXMLDoc,'Form') : "";
-
-
-/* -----------------------------------------------------------------------------
- Now set the rule values based on the config. If there is no configured info
- 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 = 'default';
- result.recurringFinesRule = 'default';
- result.maxFine = 'default';
-}
-
-if (patronProfile == 'Faculty') {
- result.durationRule = '120_days_2_renew';
-}
-if (patronProfile == 'Graduate') {
- result.durationRule = '120_days_2_renew';
-}
-if (patronProfile == 'Undergraduate') {
- result.durationRule = '3_weeks_2_renew';
-}
-if (patronProfile == 'Staff members') {
- result.durationRule = '3_weeks_2_renew';
-}
-if (patronProfile == 'Readers') {
- result.durationRule = '3_weeks_2_renew';
-}
-
-
-log_info('final duration results: ' +
- result.durationRule + ' : ' + result.recurringFinesRule + ' : ' + result.maxFine );
-
-} go();
-
-
-
-
+function go(){
+
+load_lib('circ/circ_item_config.js');
+load_lib('JSON_v1.js');
+log_vars('circ_duration');
+
+var currentTime = new Date();
+var debugStamp = "circ" + (currentTime.getMonth() + 1) + "" +
+ "" + currentTime.getDate() + "" + currentTime.getFullYear() +
+ ": ";
+
+
+log_info(debugStamp + "location identified as " + currentLocation.shortname);
+
+try {
+ /* load circ rules for specific institutions */
+ var circ_duration_institution_file = 'circ/circ_duration_' + currentLocation.shortname + '.js';
+ load_lib(circ_duration_institution_file);
+
+ log_error(circ_duration_institution_file);
+
+ /* if an institution specific script was loaded, then stop */
+ if (result.durationRule) return;
+} catch (e) {
+ // fall through to system-wide defaults
+ log_info("circ0814: error loading " + e);
+}
+
+/* treat pre-cat copies like vanilla books */
+if( isTrue(isPrecat) ) {
+ log_info("pre-cat copy getting duration defaults...");
+ result.durationRule = 'default';
+ result.recurringFinesRule = 'default';
+ result.maxFine = 'default'
+ return;
+}
+
+
+/* grab the config from the config script */
+var config = getItemConfig();
+var itemForm = (marcXMLDoc) ? extractFixedField(marcXMLDoc,'Form') : "";
+
+
+/* -----------------------------------------------------------------------------
+ Now set the rule values based on the config. If there is no configured info
+ on this copy, fall back on defaults.
+ ----------------------------------------------------------------------------- */
+if( config ) {
+
+ log_info("config exists");
+ log_debug("circ_duration found a config for the copy");
+ result.durationRule = config.durationRule;
+ result.recurringFinesRule = config.recurringFinesRule;
+ result.maxFine = config.maxFine;
+
+} else {
+ log_info("falling back to default");
+
+ result.durationRule = 'default';
+ result.recurringFinesRule = 'default';
+ result.maxFine = 'default';
+}
+
+if (patronProfile == 'Faculty') {
+ result.durationRule = '120_days_2_renew';
+}
+if (patronProfile == 'Graduate') {
+ result.durationRule = '120_days_2_renew';
+}
+if (patronProfile == 'Undergraduate') {
+ result.durationRule = '3_weeks_2_renew';
+}
+if (patronProfile == 'Staff members') {
+ result.durationRule = '3_weeks_2_renew';
+}
+if (patronProfile == 'Readers') {
+ result.durationRule = '3_weeks_2_renew';
+}
+
+
+log_info('final duration results: ' +
+ result.durationRule + ' : ' + result.recurringFinesRule + ' : ' + result.maxFine );
+
+} go();
Modified: conifer/trunk/circ/circ_duration_OWA.js
===================================================================
--- conifer/trunk/circ/circ_duration_OWA.js 2009-08-18 14:32:26 UTC (rev 622)
+++ conifer/trunk/circ/circ_duration_OWA.js 2009-08-18 15:31:43 UTC (rev 623)
@@ -1,5 +1,12 @@
// circ duration rules for Windsor Leddy (OWA)
+/* we use a date based identifier to pick up values in the log
+*/
+var currentTime = new Date();
+var debugStamp = "circ" + (currentTime.getMonth() + 1) + "" +
+ "" + currentTime.getDate() + "" + currentTime.getFullYear() +
+ ": ";
+
/* set item type defaults - if the either the patron group or the circ modifier
is missing or invalid, these settings will be used */
@@ -17,6 +24,8 @@
/* adjust rules by patron group and circ modifier */
+log_info(debugStamp + 'patronProfile is ' + patronProfile + ' - modifier ' + copy.circ_modifier);
+
switch(patronProfile) {
// currently, Patrons group is not used; rules are the same as Readers group
@@ -373,4 +382,6 @@
break;
}
break;
+
}
+log_info("circ0814 - results: " + result.durationRule);
More information about the open-ils-commits
mailing list