+++ /dev/null
-function go() {
-
-log_debug('Checking permit circ on ' +
- ' Copy: ' + copy.id +
- ' Patron:' + patron.id +
- ' Patron Profile: ' + patron.profile +
- ' Patron Standing: ' + patron.standing +
- ' Patron copies: ' + patron_info.items_out +
- ' Patron fines: ' + patron_info.fines +
- ' Copy status: ' + copy.status +
- ' Copy location: ' + copy.location.name +
- '');
-
-
-
-/* Patron checks --------------------------------------------- */
-if( ! patron.standing.match(/good/i) )
- return result.event = 'PATRON_BAD_STANDING';
-
-if( patron.profile.match(/patrons/i) && patron_info.items_out > 10 )
- return result.event = 'PATRON_EXCEEDS_CHECKOUT_COUNT';
-
-if( patron.profile.match(/staff/i) && patron_info.items_out > 30 )
- return result.event = 'PATRON_EXCEEDS_CHECKOUT_COUNT';
-
-
-
-/* Copy checks ------------------------------------------------ */
-if( is_false( copy.circulate ) )
- return result.event = 'COPY_CIRC_NOT_ALLOWED';
-
-if( is_true( copy.ref ) )
- return result.event = 'COPY_IS_REFERENCE';
-
-if( !copy.status.match(/available/i) && !copy.status.match(/on holds shelf/i) )
- return result.event = 'COPY_NOT_AVAILABLE';
-
-
-/* check for holds -------------------------------------------- */
-fetch_hold_by_copy( copy.id );
-if( hold && hold.usr != patron.id )
- return result.event = 'COPY_NEEDED_FOR_HOLD';
-
-
-} go();
-
-
+++ /dev/null
-/* pre-define all global circ vars. This way, any vars not fetched and
- defined by the circ code won't throw exceptions when accessed */
-
-var hold = null; /* most recently retrieve hold object */
-var copy = null; /* the current copy object */
-var title = null; /* the current title (biblio record entry) object */
-var patron = null; /* the current patron object */
-var patron_info = null; /* additional info on the current patron */
-
-
-
-
-/* Utility function ----------------------------------------------------- */
-
-function is_true(item) { return !is_false(item); }
-
-function is_false(item) {
- if( ! item ) return true;
- if( item.match(/0/) ) return true;
- return false;
-}
-