handle null due_dates
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 7 Aug 2006 19:23:41 +0000 (19:23 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 7 Aug 2006 19:23:41 +0000 (19:23 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5338 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/circ/checkout.js

index ff7b952..e78c2c7 100644 (file)
@@ -500,10 +500,10 @@ circ.checkout.prototype = {
                                                        var my_circ = obj.network.simple_request('FM_CIRC_RETRIEVE_VIA_COPY',[ses(),my_copy.id(),1]);
                                                        if (typeof my_circ.ilsevent != 'undefined') throw(my_copy);
                                                        my_circ = my_circ[0];
-                                                       var due_date = my_circ.due_date().substr(0,10);
+                                                       var due_date = my_circ.due_date() ? my_circ.due_date().substr(0,10) : null;
                                                        JSAN.use('util.date'); var today = util.date.formatted_date(new Date(),'%F');
-                                                       if (today > due_date) msg += '\nThis item was due on ' + due_date + '.\n';
-                                                       var r = obj.error.yns_alert(msg,'Check Out Failed','Cancel','Checkin then Checkout', today > due_date ? 'Forgiving Checkin then Checkout' : null,'Check here to confirm this message');
+                                                       if (due_date) if (today > due_date) msg += '\nThis item was due on ' + due_date + '.\n';
+                                                       var r = obj.error.yns_alert(msg,'Check Out Failed','Cancel','Checkin then Checkout', due_date ? (today > due_date ? 'Forgiving Checkin then Checkout' : null) : null,'Check here to confirm this message');
                                                        JSAN.use('circ.util');
                                                        switch(r) {
                                                                case 1: