[open-ils-commits] r582 - conifer/trunk/circ (pzed)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jul 16 14:40:59 EDT 2009


Author: pzed
Date: 2009-07-16 14:40:56 -0400 (Thu, 16 Jul 2009)
New Revision: 582

Modified:
   conifer/trunk/circ/circ_permit_copy.js
Log:
added circ_modifier permissions for Windsor Leddy

Modified: conifer/trunk/circ/circ_permit_copy.js
===================================================================
--- conifer/trunk/circ/circ_permit_copy.js	2009-07-15 20:23:09 UTC (rev 581)
+++ conifer/trunk/circ/circ_permit_copy.js	2009-07-16 18:40:56 UTC (rev 582)
@@ -1,71 +1,106 @@
-function go() {
-
-/* load the lib script */
-load_lib('circ/circ_lib.js');
-load_lib('JSON_v1.js');
-log_vars('circ_permit_copy');
-
-var lusys = ['LUSYS', 'CRC', 'HUNTINGTON', 'LDCR', 'MRC', 'OSUL', 'MEDIACEN', 'SUDBURY'];
-var hearstsys = ['HEARSTSYS', 'HEARST', 'KAP', 'TIMMINS'];
-var nosmsys = ['OSM', 'NOSME', 'NOSMW'];
-var winsys = ['OWA', 'OWAL'];
-
-/* In theory, isOrgDescendent would work - but it isn't, for some reason */
-if (patron.home_ou.id != copy.circ_lib.id) {
-        /* Laurentian campus patrons can borrow from one another */
-        if (isOrgDescendent('LUSYS', patron.home_ou.id) && isOrgDescendent('LUSYS', copy.circ_lib.id)) {
-                // go in peace
-        } else if (isAMember(patron.home_ou.shortname, lusys) && (
-			isAMember(copy.circ_lib.shortname, lusys) || isAMember(copy.circ_lib.shortname, nosmsys) 
-		))
-	{
-                // No problemo
-        } else if (isOrgDescendent('HEARSTSYS', patron.home_ou.id) && isOrgDescendent('LUSYS', copy.circ_lib.id)) {
-                // go in peace
-        } else if (isAMember(patron.home_ou.shortname, hearstsys) && isAMember(copy.circ_lib.shortname, hearstsys)) {
-                // No problemo
-        } else if (isAMember(patron.home_ou.shortname, winsys) && isAMember(copy.circ_lib.shortname, winsys)) {
-                // No problemo
-        } else if (isOrgDescendent('OSM', patron.home_ou.id) && isOrgDescendent('OSM', copy.circ_lib.id)) {
-                // go in peace
-        } else if (isAMember(patron.home_ou.shortname, nosmsys) && (
-			isAMember(copy.circ_lib.shortname, lusys) || isAMember(copy.circ_lib.shortname, nosmsys) 
-		))
-	{
-                // No problemo
-        } else {
-                result.events.push('CIRC_EXCEEDS_COPY_RANGE');
-        }
-}
-
-if( ! isTrue(copy.circulate) || 
-	!isTrue(copy.location.circulate) ||
-	(copy.circ_lib.shortname == 'OSUL' && copy.circ_modifier == 'DEPOSIT') ||
-	(copy.circ_lib.shortname == 'OSUL' && copy.circ_modifier == 'DOCUMENTS') ||
-	(copy.circ_lib.shortname == 'OSUL' && copy.circ_modifier == 'PERIODICAL') ||
-	(copy.circ_lib.shortname == 'OSUL' && copy.circ_modifier == 'REFERENCE')
-) {
-	result.events.push('COPY_CIRC_NOT_ALLOWED');
-}
-
-
-if( ! isTrue(isRenewal) ) {
-	if(copyStatus != 'Available' && 
-		copyStatus != 'On holds shelf' && copyStatus != 'Reshelving' ) {
-			result.events.push('COPY_NOT_AVAILABLE');
-	} 
-}
-
-}
-
-function isAMember(shortname, group) {
-	for (var i = 0; i < group.length; i++) {
-		if (group[i] == shortname) {
-			return true;
-		}
-	}
-	return false;
-}
-
-go();
-
+function go() {
+
+/* load the lib script */
+load_lib('circ/circ_lib.js');
+load_lib('JSON_v1.js');
+log_vars('circ_permit_copy');
+
+var lusys = ['LUSYS', 'CRC', 'HUNTINGTON', 'LDCR', 'MRC', 'OSUL', 'MEDIACEN', 'SUDBURY'];
+var hearstsys = ['HEARSTSYS', 'HEARST', 'KAP', 'TIMMINS'];
+var nosmsys = ['OSM', 'NOSME', 'NOSMW'];
+var winsys = ['OWA', 'OWAL'];
+
+/* In theory, isOrgDescendent would work - but it isn't, for some reason */
+if (patron.home_ou.id != copy.circ_lib.id) {
+        /* Laurentian campus patrons can borrow from one another */
+        if (isOrgDescendent('LUSYS', patron.home_ou.id) && isOrgDescendent('LUSYS', copy.circ_lib.id)) {
+                // go in peace
+        } else if (isAMember(patron.home_ou.shortname, lusys) && (
+			isAMember(copy.circ_lib.shortname, lusys) || isAMember(copy.circ_lib.shortname, nosmsys) 
+		))
+	{
+                // No problemo
+        } else if (isOrgDescendent('HEARSTSYS', patron.home_ou.id) && isOrgDescendent('LUSYS', copy.circ_lib.id)) {
+                // go in peace
+        } else if (isAMember(patron.home_ou.shortname, hearstsys) && isAMember(copy.circ_lib.shortname, hearstsys)) {
+                // No problemo
+        } else if (isAMember(patron.home_ou.shortname, winsys) && isAMember(copy.circ_lib.shortname, winsys)) {
+                // No problemo
+        } else if (isOrgDescendent('OSM', patron.home_ou.id) && isOrgDescendent('OSM', copy.circ_lib.id)) {
+                // go in peace
+        } else if (isAMember(patron.home_ou.shortname, nosmsys) && (
+			isAMember(copy.circ_lib.shortname, lusys) || isAMember(copy.circ_lib.shortname, nosmsys) 
+		))
+	{
+                // No problemo
+        } else {
+                result.events.push('CIRC_EXCEEDS_COPY_RANGE');
+        }
+}
+
+if( ! isTrue(copy.circulate) || 
+	!isTrue(copy.location.circulate) ||
+	(copy.circ_lib.shortname == 'OSUL' && copy.circ_modifier == 'DEPOSIT') ||
+	(copy.circ_lib.shortname == 'OSUL' && copy.circ_modifier == 'DOCUMENTS') ||
+	(copy.circ_lib.shortname == 'OSUL' && copy.circ_modifier == 'PERIODICAL') ||
+	(copy.circ_lib.shortname == 'OSUL' && copy.circ_modifier == 'REFERENCE')
+) {
+	result.events.push('COPY_CIRC_NOT_ALLOWED');
+}
+
+// set permissions for Windsor Leddy
+if (copy.circ_lib.shortname == 'OWA') {
+
+	// permit circulations for the following circ modifiers to all patrons
+	var circ_allow_list['CIRC', 'CRC MEDIA', 'CRC SPEC', 'CRC TEXT', 'DOC', 'DVD VIDEO', 'MAP (CIRCULATING)', 'MEDIA', 'MFORM', 'REF', 'THESIS'];
+
+	// add permissions for patron groups who are not external borrowers
+	if (patronProfile == 'Faculty' || patronProfile == 'Graduate' || patronProfile == 'Undergraduate' || patronProfile == 'Staff members') {
+		circ_allow_list = circ_allow_list.concat('CIRC SHORT', 'RSV1', 'RSV2', 'RSV3', 'RSV7');
+	}
+
+	// faculty, grads, and staff can borrow serials
+	if (patronProfile == 'Faculty' || patronProfile == 'Graduate'|| patronProfile == 'Staff members') {
+		circ_allow_list = circ_allow_list.concat('SER');
+	}
+
+	// faculty and staff can also borrow music CDs
+	if (patronProfile == 'Faculty' || patronProfile == 'Staff members') {
+		circ_allow_list = circ_allow_list.concat('CD MUSIC');
+	}
+
+	if ( ! testCircAllow(circ_allow_list) ) {
+		result.events.push('COPY_CIRC_NOT_ALLOWED');
+	}
+} // end permissions for Windsor Leddy
+
+
+if( ! isTrue(isRenewal) ) {
+	if(copyStatus != 'Available' && 
+		copyStatus != 'On holds shelf' && copyStatus != 'Reshelving' ) {
+			result.events.push('COPY_NOT_AVAILABLE');
+	} 
+}
+
+}
+
+function isAMember(shortname, group) {
+	for (var i = 0; i < group.length; i++) {
+		if (group[i] == shortname) {
+			return true;
+		}
+	}
+	return false;
+}
+
+function testCircAllow(circ_allow_list) {
+	for (var i = 0; i < circ_allow_list.length; i++) {
+		if (circ_allow_list[i] == copy.circ_modifier) {
+			return true;
+		}
+	}
+	return false;
+}
+
+go();
+



More information about the open-ils-commits mailing list