if (copy.circ_lib.shortname == 'OWA') {\r
\r
// permit circulations for the following circ modifiers to all patrons\r
+ var valid_patrons = ['Faculty', 'Graduate', 'Undergraduate', 'Staff members', 'Readers'];\r
var circ_allow_list = ['CIRC', 'CRC MEDIA', 'CRC SPEC', 'CRC TEXT', 'DOC', 'DVD VIDEO', 'MAP (CIRCULATING)', 'MEDIA', 'MFORM', 'REF', 'THESIS'];\r
\r
- // add permissions for patron groups who are not external borrowers\r
- if (patronProfile == 'Faculty' || patronProfile == 'Graduate' || patronProfile == 'Undergraduate' || patronProfile == 'Staff members') {\r
- circ_allow_list = circ_allow_list.concat('CIRC SHORT', 'RSV1', 'RSV2', 'RSV3', 'RSV7');\r
- }\r
+ if (isValidPatron(patronProfile, valid_patrons)) {\r
+ \r
+ // add permissions for patron groups who are not external borrowers\r
+ if (patronProfile == 'Faculty' || patronProfile == 'Graduate' || patronProfile == 'Undergraduate' || patronProfile == 'Staff members') {\r
+ circ_allow_list = circ_allow_list.concat('CIRC SHORT', 'RSV1', 'RSV2', 'RSV3', 'RSV7');\r
+ }\r
\r
- // faculty, grads, and staff can borrow serials\r
- if (patronProfile == 'Faculty' || patronProfile == 'Graduate'|| patronProfile == 'Staff members') {\r
- circ_allow_list = circ_allow_list.concat('SER');\r
- }\r
+ // faculty, grads, and staff can borrow serials\r
+ if (patronProfile == 'Faculty' || patronProfile == 'Graduate'|| patronProfile == 'Staff members') {\r
+ circ_allow_list = circ_allow_list.concat('SER');\r
+ }\r
\r
- // faculty and staff can also borrow music CDs\r
- if (patronProfile == 'Faculty' || patronProfile == 'Staff members') {\r
- circ_allow_list = circ_allow_list.concat('CD MUSIC');\r
- }\r
+ // faculty and staff can also borrow music CDs\r
+ if (patronProfile == 'Faculty' || patronProfile == 'Staff members') {\r
+ circ_allow_list = circ_allow_list.concat('CD MUSIC');\r
+ }\r
\r
- if ( ! testCircAllow(circ_allow_list) ) {\r
+ if ( ! testCircAllow(circ_allow_list) ) {\r
+ result.events.push('COPY_CIRC_NOT_ALLOWED');\r
+ }\r
+\r
+ } else {\r
result.events.push('COPY_CIRC_NOT_ALLOWED');\r
}\r
} // end permissions for Windsor Leddy\r
// set permissions for Windsor Law\r
if (copy.circ_lib.shortname == 'OWAL') {\r
\r
- // only Law external borrowers can borrow Law items\r
- if (patronProfile == 'Readers' && patron.home_ou.shortname <> 'OWAL'){\r
- result.events.push('COPY_CIRC_NOT_ALLOWED');\r
- }\r
+ var valid_patrons = ['Faculty', 'Graduate', 'Undergraduate', 'Staff members', 'Readers'];\r
\r
- // permit circulations for the following circ modifiers to all patrons not excluded above\r
- var circ_allow_list = ['LAW MONO'];\r
+ if (isValidPatron(patronProfile, valid_patrons)) {\r
\r
- // add permissions for patron groups who are not external borrowers\r
- if (patronProfile == 'Faculty' || patronProfile == 'Graduate' || patronProfile == 'Undergraduate' || patronProfile == 'Staff members') {\r
- circ_allow_list = circ_allow_list.concat('LAW RES1D', 'LAW RES3D', 'LAW RES3H', 'LAW RES5H');\r
- }\r
+ // only Law external borrowers can borrow Law items\r
+ if (patronProfile == 'Readers' && patron.home_ou.shortname != 'OWAL') {\r
+ result.events.push('COPY_CIRC_NOT_ALLOWED');\r
+ }\r
\r
- // faculty can borrow non-circulating items and serials\r
- if (patronProfile == 'Faculty') {\r
- circ_allow_list = circ_allow_list.concat('LAW NOCIRC', 'LAW SERIAL');\r
- }\r
+ // permit circulations for the following circ modifiers to all patrons not excluded above\r
+ var circ_allow_list = ['LAW MONO'];\r
+\r
+ // add permissions for patron groups who are not external borrowers\r
+ if (patronProfile == 'Faculty' || patronProfile == 'Graduate' || patronProfile == 'Undergraduate' || patronProfile == 'Staff members') {\r
+ circ_allow_list = circ_allow_list.concat('LAW RES1D', 'LAW RES3D', 'LAW RES3H', 'LAW RES5H');\r
+ }\r
+\r
+ // faculty can borrow non-circulating items and serials\r
+ if (patronProfile == 'Faculty') {\r
+ circ_allow_list = circ_allow_list.concat('LAW NOCIRC', 'LAW SERIAL');\r
+ }\r
\r
- if ( ! testCircAllow(circ_allow_list) ) {\r
+ if ( ! testCircAllow(circ_allow_list) ) {\r
+ result.events.push('COPY_CIRC_NOT_ALLOWED');\r
+ }\r
+\r
+ } else {\r
result.events.push('COPY_CIRC_NOT_ALLOWED');\r
}\r
} // end permissions for Windsor Law\r
return false;\r
}\r
\r
+function isValidPatron(patronProfile, valid_patrons) {\r
+ for (var i = 0; i < valid_patrons.length; i++) {\r
+ if (valid_patrons[i] == patronProfile) {\r
+ return true;\r
+ }\r
+ }\r
+ return false;\r
+}\r
+\r
function testCircAllow(circ_allow_list) {\r
for (var i = 0; i < circ_allow_list.length; i++) {\r
if (circ_allow_list[i] == copy.circ_modifier) {\r