Prevent renewal of an item which has a hold placed on it
authorDan Scott <dan@coffeecode.net>
Tue, 24 May 2011 21:22:36 +0000 (17:22 -0400)
committerDan Scott <dan@coffeecode.net>
Tue, 24 May 2011 21:22:36 +0000 (17:22 -0400)
Per http://biblio.laurentian.ca/tickets/conifer/wiki/devHolds, we had
this functional in 1.6 but must not have had the updated script checked
into SVN (now git) for the purposes of our upgrade, as the functionality
is not present after our upgrade.

Adding this to the repo so that we can test and hopefully get rid of the
regression.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
circ/circ_permit_renew.js [new file with mode: 0644]

diff --git a/circ/circ_permit_renew.js b/circ/circ_permit_renew.js
new file mode 100644 (file)
index 0000000..d86094e
--- /dev/null
@@ -0,0 +1,17 @@
+function go() {
+
+/* load the lib script */
+load_lib('circ/circ_lib.js');
+load_lib('JSON_v1.js');
+log_vars('circ_permit_renew');
+
+//from Jason Etheridge's suggestion on OPEN-ILS-GENERAL, Dec. 23, 2009
+log_info("permit_renew searching for potential holds for copy " + copy.barcode)
+var hold = copy.fetchBestHold();
+if( hold ) {
+    log_info("hold found for renewal item, checking hold->usr..");
+    if( hold && hold.usr != patron.id )
+        return result.events.push('COPY_NEEDED_FOR_HOLD');
+}
+
+} go();