| 
      
            Lines 2-23
          
      
      
        Link Here
      
     | 
  
        
          | 2 | 
          [% IF (AllowOfflineCirculation) %]  | 
          2 | 
          [% IF (AllowOfflineCirculation) %]  | 
        
        
          | 3 | 
          [% SET manifestattr = 'manifest="/cgi-bin/koha/circ/offline-mf.pl"' %]  | 
          3 | 
          [% SET manifestattr = 'manifest="/cgi-bin/koha/circ/offline-mf.pl"' %]  | 
        
        
          | 4 | 
          [% END %]  | 
          4 | 
          [% END %]  | 
        
          
            
              | 5 | 
              [% IF ( bidi ) %]<html lang="[% lang %]" dir="[% bidi %]" [% manifestattr %]>[% ELSE %]<html lang="[% lang %]" [% manifestattr %]>[% END %]  | 
              5 | 
              [% IF ( bidi && AllowOfflineCirculation ) %]<html lang="[% lang %]" dir="[% bidi %]" manifest="/cgi-bin/koha/circ/offline-mf.pl">  | 
            
            
               | 
               | 
              6 | 
              [% ELSIF ( bidi ) %]<html lang="[% lang %]" dir="[% bidi %]">  | 
            
            
              | 7 | 
              [% ELSIF ( AllowOfflineCirculation ) %]<html lang="[% lang %]" manifest="/cgi-bin/koha/circ/offline-mf.pl">  | 
            
            
              | 8 | 
              [% ELSE %]<html lang="[% lang %]">[% END %]  | 
            
        
          | 6 | 
          <head>  | 
          9 | 
          <head>  | 
        
        
          | 7 | 
          <title>Koha › Circulation</title>  | 
          10 | 
          <title>Koha › Circulation</title>  | 
        
        
          | 8 | 
          [% INCLUDE 'doc-head-close.inc' %]  | 
          11 | 
          [% INCLUDE 'doc-head-close.inc' %]  | 
        
          
            
              | 9 | 
              <script type="text/javascript" src="/intranet-tmpl/lib/jquery/plugins/jquery.indexeddb.js"></script>  | 
              12 | 
              <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.indexeddb.js"></script>  | 
            
            
              | 10 | 
              <script type="text/javascript" src="/intranet-tmpl/prog/en/js/offlinecirc.js"></script>  | 
              13 | 
              <script type="text/javascript" src="[% interface %]/prog/en/js/offlinecirc.js"></script>  | 
            
        
          | 11 | 
          <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery-ui-timepicker-addon.js"></script>  | 
          14 | 
          <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery-ui-timepicker-addon.js"></script>  | 
        
        
          | 12 | 
          <script type="text/javascript">  | 
          15 | 
          <script type="text/javascript">  | 
        
        
          | 13 | 
          //<![CDATA[  | 
          16 | 
          //<![CDATA[  | 
        
            
               | 
               | 
              17 | 
              var ALERT_SUCCESSFUL_CHECKIN = _("Checked in item."); | 
            
        
          | 14 | 
          var ALERT_MATERIALS = _("Note about the accompanying materials: "); | 
          18 | 
          var ALERT_MATERIALS = _("Note about the accompanying materials: "); | 
        
        
          | 15 | 
          var ALERT_RESTRICTED = _("Patron is RESTRICTED"); | 
          19 | 
          var ALERT_RESTRICTED = _("Patron is RESTRICTED"); | 
        
        
          | 16 | 
          var ALERT_NO_MATCHING_ITEM = _("No item with barcode in offline database (transaction recorded anyway): "); | 
          20 | 
          var ALERT_NO_MATCHING_ITEM = _("No item with barcode in offline database (transaction recorded anyway): "); | 
        
        
          | 17 | 
          var ALERT_NOT_CHECKED_OUT = _("Item not listed as checked out in offline database (transaction recorded anyway)"); | 
          21 | 
          var ALERT_NOT_CHECKED_OUT = _("Item not listed as checked out in offline database (transaction recorded anyway)"); | 
        
        
          | 18 | 
          var ALERT_ITEM_WITHDRAWN = _("Item has been withdrawn (transaction recorded anyway)"); | 
          22 | 
          var ALERT_ITEM_WITHDRAWN = _("Item has been withdrawn (transaction recorded anyway)"); | 
        
        
          | 19 | 
          var ALERT_ITEM_RESTRICTED = _("Item is restricted (transaction recorded anyway)"); | 
          23 | 
          var ALERT_ITEM_RESTRICTED = _("Item is restricted (transaction recorded anyway)"); | 
        
          
            
              | 20 | 
              var ALERT_ITEM_LOST = _("Item is has been lost (transaction recorded anyway)"); | 
              24 | 
              var ALERT_ITEM_LOST = _("Item has been lost (transaction recorded anyway)"); | 
            
        
          | 21 | 
          var ALERT_NO_MATCHING_PATRON = _("No patron cardnumber in offline database (proceeding anyway): "); | 
          25 | 
          var ALERT_NO_MATCHING_PATRON = _("No patron cardnumber in offline database (proceeding anyway): "); | 
        
        
          | 22 | 
          var ALERT_PATRON_GONE_NO_ADDRESS = _("Patron's address is in doubt (transaction recorded anyway)"); | 
          26 | 
          var ALERT_PATRON_GONE_NO_ADDRESS = _("Patron's address is in doubt (transaction recorded anyway)"); | 
        
        
          | 23 | 
          var ALERT_PATRON_CARD_LOST = _("Patron's card is lost"); | 
          27 | 
          var ALERT_PATRON_CARD_LOST = _("Patron's card is lost"); | 
        
  
    | 
      
            Lines 26-31
          var ALERT_PATRON_BLOCKED_TEMPORARY = _("Patron has had overdue items and is rest
      
      
        Link Here
      
     | 
  
        
          | 26 | 
          var ALERT_PATRON_RESTRICTED = _("Patron is restricted"); | 
          30 | 
          var ALERT_PATRON_RESTRICTED = _("Patron is restricted"); | 
        
        
          | 27 | 
          var ALERT_PATRON_FINE = _("Patron has outstanding fines: "); | 
          31 | 
          var ALERT_PATRON_FINE = _("Patron has outstanding fines: "); | 
        
        
          | 28 | 
          var ALERT_PATRON_FINE_OVER_LIMIT = _("Patron fines are over limit: "); | 
          32 | 
          var ALERT_PATRON_FINE_OVER_LIMIT = _("Patron fines are over limit: "); | 
        
            
               | 
               | 
              33 | 
              var UPLOAD_PENDING_MESSAGE = _("You have transactions in the offline circulation database on this computer that have not been uploaded."); | 
            
            
              | 34 | 
              var NO_UPLOAD_PENDING_MESSAGE = _("You do not have any pending transactions in the offline circulation database on this computer."); | 
            
        
          | 29 | 
           | 
          35 | 
           | 
        
        
          | 30 | 
          var start;  | 
          36 | 
          var start;  | 
        
        
          | 31 | 
           | 
          37 | 
           | 
        
  
    | 
      
            Lines 48-64
          function checkin(barcode, item, error) {
      
      
        Link Here
      
     | 
  
        
          | 48 | 
                            "action" : "return"  | 
          54 | 
                            "action" : "return"  | 
        
        
          | 49 | 
                          };  | 
          55 | 
                          };  | 
        
        
          | 50 | 
              $('#alerts').empty(); | 
          56 | 
              $('#alerts').empty(); | 
        
          
            
              | 51 | 
                  $('#offline-home').hide(); | 
              57 | 
                  $('.offline-home').hide(); | 
            
            
              | 52 | 
                  $('#offline-returns').show(); | 
              58 | 
                  $('.offline-sync').hide(); | 
            
            
               | 
               | 
              59 | 
                  $('.offline-circulation').hide(); | 
            
            
              | 60 | 
                  $('.offline-circulation-instructions').hide(); | 
            
            
              | 61 | 
                  $('.offline-returns').show(); | 
            
        
          | 53 | 
              kohadb.recordTransaction(trans, function () { | 
          62 | 
              kohadb.recordTransaction(trans, function () { | 
        
            
               | 
               | 
              63 | 
                      $('#session-returned').show(); | 
            
        
          | 54 | 
                  $('#already-checked-in tbody').prepend('<tr><td>' + item.title + '</td><td>' + item.author + '</td><td>' + barcode + '</td><td>' + item.homebranch + '</td><td>' + item.holdingbranch + '</td><td></td><td>' + item.callnumber + '</td><td>' + item.itemtype + '</td></tr>'); | 
          64 | 
                  $('#already-checked-in tbody').prepend('<tr><td>' + item.title + '</td><td>' + item.author + '</td><td>' + barcode + '</td><td>' + item.homebranch + '</td><td>' + item.holdingbranch + '</td><td></td><td>' + item.callnumber + '</td><td>' + item.itemtype + '</td></tr>'); | 
        
        
          | 55 | 
                  if (alerts.length > 0) { | 
          65 | 
                  if (alerts.length > 0) { | 
        
        
          | 56 | 
                      $('#alerts').append('<div class="dialog alert"><h3>' + _("Check in message") + '</h3></div>'); | 
          66 | 
                      $('#alerts').append('<div class="dialog alert"><h3>' + _("Check in message") + '</h3></div>'); | 
        
        
          | 57 | 
                      for (var msg in alerts) { | 
          67 | 
                      for (var msg in alerts) { | 
        
        
          | 58 | 
                          $('#alerts .dialog').append('<p>' + alerts[msg] + '</p'); | 
          68 | 
                          $('#alerts .dialog').append('<p>' + alerts[msg] + '</p'); | 
        
        
          | 59 | 
                      }  | 
          69 | 
                      }  | 
        
            
               | 
               | 
              70 | 
                      } else { | 
            
            
              | 71 | 
                          $('#alerts').append('<div class="dialog"><h3>' + ALERT_SUCCESSFUL_CHECKIN + '</h3></div>'); | 
            
        
          | 60 | 
                  }  | 
          72 | 
                  }  | 
        
        
          | 61 | 
              });  | 
          73 | 
              });  | 
        
            
               | 
               | 
              74 | 
                  setTimeout(function() { $('#checkin-barcode').trigger('focus'), 1 }); | 
            
        
          | 62 | 
          }  | 
          75 | 
          }  | 
        
        
          | 63 | 
           | 
          76 | 
           | 
        
        
          | 64 | 
          function checkAlerts(barcode, item) { | 
          77 | 
          function checkAlerts(barcode, item) { | 
        
  
    | 
      
            Lines 73-94
          function checkAlerts(barcode, item) {
      
      
        Link Here
      
     | 
  
        
          | 73 | 
              return alerts;  | 
          86 | 
              return alerts;  | 
        
        
          | 74 | 
          }  | 
          87 | 
          }  | 
        
        
          | 75 | 
           | 
          88 | 
           | 
        
          
            
              | 76 | 
              function synchronize() { | 
              89 | 
              function showSyncInfo() { | 
            
            
              | 77 | 
                  kohadb.saveSetting("userid", "[% loggedinusername %]"); | 
               | 
               | 
            
            
              | 78 | 
                  kohadb.saveSetting("branchcode", "[% LoginBranchcode %]"); | 
            
        
          | 79 | 
              kohadb.loadSetting("item-timestamp", showTimestamp); | 
          90 | 
              kohadb.loadSetting("item-timestamp", showTimestamp); | 
        
        
          | 80 | 
              kohadb.loadSetting("patron-timestamp", showTimestamp); | 
          91 | 
              kohadb.loadSetting("patron-timestamp", showTimestamp); | 
        
        
          | 81 | 
              kohadb.loadSetting("issue-timestamp", showTimestamp); | 
          92 | 
              kohadb.loadSetting("issue-timestamp", showTimestamp); | 
        
            
               | 
               | 
              93 | 
                  kohadb.loadSetting("dirty", function (key, val) { | 
            
            
              | 94 | 
                      if (val) { | 
            
            
              | 95 | 
                          $('#upload-message').text(UPLOAD_PENDING_MESSAGE); | 
            
            
              | 96 | 
                      } else { | 
            
            
              | 97 | 
                          $('#upload-message').text(NO_UPLOAD_PENDING_MESSAGE); | 
            
            
              | 98 | 
                      }  | 
            
            
              | 99 | 
                  });  | 
            
            
              | 100 | 
              }  | 
            
            
              | 101 | 
               | 
            
            
              | 102 | 
              function synchronize() { | 
            
            
              | 103 | 
                  kohadb.saveSetting("userid", "[% loggedinusername %]"); | 
            
            
              | 104 | 
                  kohadb.saveSetting("branchcode", "[% LoginBranchcode %]"); | 
            
            
              | 105 | 
                  showSyncInfo();  | 
            
        
          | 82 | 
              [% UNLESS (AllowOfflineCirculation) %]  | 
          106 | 
              [% UNLESS (AllowOfflineCirculation) %]  | 
        
        
          | 83 | 
                  reloadRecords();  | 
          107 | 
                  reloadRecords();  | 
        
        
          | 84 | 
              [% END %]  | 
          108 | 
              [% END %]  | 
        
            
               | 
               | 
              109 | 
                  showSyncInfo();  | 
            
        
          | 85 | 
              $('#download-records').click(reloadRecords); | 
          110 | 
              $('#download-records').click(reloadRecords); | 
        
        
          | 86 | 
              $('#upload-transactions').click(function () { | 
          111 | 
              $('#upload-transactions').click(function () { | 
        
        
          | 87 | 
                  $('.loading-overlay div').text(_("Uploading transactions, please wait...")); | 
          112 | 
                  $('.loading-overlay div').text(_("Uploading transactions, please wait...")); | 
        
        
          | 88 | 
                  $('.loading-overlay').show(); | 
          113 | 
                  $('.loading-overlay').show(); | 
        
        
          | 89 | 
                  var uploadIter = $.indexedDB("koha").objectStore("transactions").each(uploadTransaction); | 
          114 | 
                  var uploadIter = $.indexedDB("koha").objectStore("transactions").each(uploadTransaction); | 
        
        
          | 90 | 
                  uploadIter.done(function() { | 
          115 | 
                  uploadIter.done(function() { | 
        
            
               | 
               | 
              116 | 
                          $.indexedDB("koha").transaction(["transactions"]).then(function(){ | 
            
            
              | 117 | 
                          }, function(err, e){ | 
            
            
              | 118 | 
                          }, function(transaction){ | 
            
            
              | 119 | 
                              transaction.objectStore("transactions").clear(); | 
            
            
              | 120 | 
                          });  | 
            
        
          | 91 | 
                      $('.loading-overlay').hide(); | 
          121 | 
                      $('.loading-overlay').hide(); | 
        
            
               | 
               | 
              122 | 
                          kohadb.saveSetting("dirty", false); | 
            
            
              | 123 | 
                          $('#upload-message').text(NO_UPLOAD_PENDING_MESSAGE); | 
            
        
          | 92 | 
                  });  | 
          124 | 
                  });  | 
        
        
          | 93 | 
              });  | 
          125 | 
              });  | 
        
        
          | 94 | 
           | 
          126 | 
           | 
        
  
    | 
      
            Lines 122-128
          function reloadRecords(ev) {
      
      
        Link Here
      
     | 
  
        
          | 122 | 
           | 
          154 | 
           | 
        
        
          | 123 | 
          function uploadTransaction(transaction) { | 
          155 | 
          function uploadTransaction(transaction) { | 
        
        
          | 124 | 
              $.ajax({ | 
          156 | 
              $.ajax({ | 
        
          
            
              | 125 | 
                      type: "GET",  | 
              157 | 
                      type: "POST",  | 
            
        
          | 126 | 
                  url: "/cgi-bin/koha/offline_circ/service.pl",  | 
          158 | 
                  url: "/cgi-bin/koha/offline_circ/service.pl",  | 
        
        
          | 127 | 
                  data: { "userid" : kohadb.settings.userid, | 
          159 | 
                  data: { "userid" : kohadb.settings.userid, | 
        
        
          | 128 | 
                          "branchcode" : kohadb.settings.branchcode,  | 
          160 | 
                          "branchcode" : kohadb.settings.branchcode,  | 
        
  
    | 
      
            Lines 132-140
          function uploadTransaction(transaction) {
      
      
        Link Here
      
     | 
  
        
          | 132 | 
                          "cardnumber" : transaction.value.cardnumber,  | 
          164 | 
                          "cardnumber" : transaction.value.cardnumber,  | 
        
        
          | 133 | 
                          "pending" : true,  | 
          165 | 
                          "pending" : true,  | 
        
        
          | 134 | 
                        },  | 
          166 | 
                        },  | 
        
            
              | 135 | 
                  }).done(function () { | 
               | 
               | 
            
            
              | 136 | 
                      transaction.delete();  | 
            
        
          | 137 | 
              });  | 
          167 | 
              });  | 
        
            
               | 
               | 
              168 | 
                  return undefined, true;  | 
            
        
          | 138 | 
          }  | 
          169 | 
          }  | 
        
        
          | 139 | 
           | 
          170 | 
           | 
        
        
          | 140 | 
          function finishedLoading() { | 
          171 | 
          function finishedLoading() { | 
        
  
    | 
      
            Lines 160-166
          function loadRecords(page) {
      
      
        Link Here
      
     | 
  
        
          | 160 | 
                  dataType: "json",  | 
          191 | 
                  dataType: "json",  | 
        
        
          | 161 | 
              }).done(function (data) { | 
          192 | 
              }).done(function (data) { | 
        
        
          | 162 | 
                  $.indexedDB("koha").transaction(["patrons", "items", "issues"]).then(function(){ | 
          193 | 
                  $.indexedDB("koha").transaction(["patrons", "items", "issues"]).then(function(){ | 
        
          
            
              | 163 | 
                          if ($.isEmptyObject(data.patrons) && $.isEmptyObject(data.items)) { | 
              194 | 
                          if (data.finished) { | 
            
        
          | 164 | 
                          finishedLoading();  | 
          195 | 
                          finishedLoading();  | 
        
        
          | 165 | 
                      } else { | 
          196 | 
                      } else { | 
        
        
          | 166 | 
                          setTimeout(function () { loadRecords(page + 1); }, 200); | 
          197 | 
                          setTimeout(function () { loadRecords(page + 1); }, 200); | 
        
  
    | 
      
            Lines 202-208
          function validate1(date) {
      
      
        Link Here
      
     | 
  
        
          | 202 | 
          function loadPatron(barcode) { | 
          233 | 
          function loadPatron(barcode) { | 
        
        
          | 203 | 
              $('#oldissues').hide(); | 
          234 | 
              $('#oldissues').hide(); | 
        
        
          | 204 | 
              $('#session-issues').hide(); | 
          235 | 
              $('#session-issues').hide(); | 
        
            
               | 
               | 
              236 | 
                  $('#issuest tbody').empty(); | 
            
        
          | 205 | 
              $('#session-payments').hide(); | 
          237 | 
              $('#session-payments').hide(); | 
        
            
               | 
               | 
              238 | 
                  $('.checkout-count').text(0); | 
            
        
          | 206 | 
              $.indexedDB("koha").transaction(["patrons", "issues"]).then(function() { | 
          239 | 
              $.indexedDB("koha").transaction(["patrons", "issues"]).then(function() { | 
        
        
          | 207 | 
              }, function(err, e){ | 
          240 | 
              }, function(err, e){ | 
        
        
          | 208 | 
              }, function(transaction){ | 
          241 | 
              }, function(transaction){ | 
        
  
    | 
      
            Lines 215-220
          function loadPatron(barcode) {
      
      
        Link Here
      
     | 
  
        
          | 215 | 
                  issuesidx.each(function (item) { | 
          248 | 
                  issuesidx.each(function (item) { | 
        
        
          | 216 | 
                      $('#oldissues').show(); | 
          249 | 
                      $('#oldissues').show(); | 
        
        
          | 217 | 
                      $('#oldissuest tbody').append("<tr><td>" + item.value.date_due + "</td><td>" + item.value.barcode + "</td><td>" + item.value.title + "</td><td>" + item.value.itype + "</td><td>" + item.value.issuedate + "</td><td>" + item.value.issuebranch + "</td><td>" + item.value.callnumber + "</td><td>" + "" + "</td></tr>"); | 
          250 | 
                      $('#oldissuest tbody').append("<tr><td>" + item.value.date_due + "</td><td>" + item.value.barcode + "</td><td>" + item.value.title + "</td><td>" + item.value.itype + "</td><td>" + item.value.issuedate + "</td><td>" + item.value.issuebranch + "</td><td>" + item.value.callnumber + "</td><td>" + "" + "</td></tr>"); | 
        
            
               | 
               | 
              251 | 
                          $('.checkout-count').text(parseInt($('.checkout-count').text()) + 1); | 
            
        
          | 218 | 
                  }, barcode);  | 
          252 | 
                  }, barcode);  | 
        
        
          | 219 | 
              });  | 
          253 | 
              });  | 
        
        
          | 220 | 
          }  | 
          254 | 
          }  | 
        
  
    | 
      
            Lines 232-238
          function checkout(barcode, item, error) {
      
      
        Link Here
      
     | 
  
        
          | 232 | 
              item.itemtype = item.itemtype || "";  | 
          266 | 
              item.itemtype = item.itemtype || "";  | 
        
        
          | 233 | 
              if ($('#duedatespec').val().length === 0) { | 
          267 | 
              if ($('#duedatespec').val().length === 0) { | 
        
        
          | 234 | 
                  alert(_("You must set a due date in order to use offline circulation!")); | 
          268 | 
                  alert(_("You must set a due date in order to use offline circulation!")); | 
        
          
            
              | 235 | 
                      $('#duedatespec').focus(); | 
              269 | 
                      setTimeout(function() { $('#duedatespec').trigger('focus'), 1 }); | 
            
        
          | 236 | 
                  return;  | 
          270 | 
                  return;  | 
        
        
          | 237 | 
              }  | 
          271 | 
              }  | 
        
        
          | 238 | 
              var date_due = new Date($('#duedatespec').datepicker('getDate')); | 
          272 | 
              var date_due = new Date($('#duedatespec').datepicker('getDate')); | 
        
  
    | 
      
            Lines 246-257
          function checkout(barcode, item, error) {
      
      
        Link Here
      
     | 
  
        
          | 246 | 
              kohadb.recordTransaction(trans, function () { | 
          280 | 
              kohadb.recordTransaction(trans, function () { | 
        
        
          | 247 | 
                  $('#session-issues').show(); | 
          281 | 
                  $('#session-issues').show(); | 
        
        
          | 248 | 
                  $('#issuest tbody').prepend('<tr><td>' + $.datepicker.formatDate(dateformat, date_due) + date_due.toTimeString() + '</td><td>' + item.title + '</td><td>' + barcode + '</td><td>' + item.itemtype + '</td><td>' + $.datepicker.formatDate(dateformat, new Date()) + '</td><td>' + kohadb.settings.branchcode + '</td><td>' + item.callnumber + '</td><td></td></tr>'); | 
          282 | 
                  $('#issuest tbody').prepend('<tr><td>' + $.datepicker.formatDate(dateformat, date_due) + date_due.toTimeString() + '</td><td>' + item.title + '</td><td>' + barcode + '</td><td>' + item.itemtype + '</td><td>' + $.datepicker.formatDate(dateformat, new Date()) + '</td><td>' + kohadb.settings.branchcode + '</td><td>' + item.callnumber + '</td><td></td></tr>'); | 
        
            
               | 
               | 
              283 | 
                      $('.checkout-count').text(parseInt($('.checkout-count').text()) + 1); | 
            
        
          | 249 | 
                  if (alerts.length > 0) { | 
          284 | 
                  if (alerts.length > 0) { | 
        
        
          | 250 | 
                      $('#alerts').append('<div class="dialog alert"><h3>' + _("Check out message") + '</h3></div>'); | 
          285 | 
                      $('#alerts').append('<div class="dialog alert"><h3>' + _("Check out message") + '</h3></div>'); | 
        
        
          | 251 | 
                      for (var msg in alerts) { | 
          286 | 
                      for (var msg in alerts) { | 
        
        
          | 252 | 
                          $('#alerts .dialog').append('<p>' + alerts[msg] + '</p'); | 
          287 | 
                          $('#alerts .dialog').append('<p>' + alerts[msg] + '</p'); | 
        
        
          | 253 | 
                      }  | 
          288 | 
                      }  | 
        
        
          | 254 | 
                  }  | 
          289 | 
                  }  | 
        
            
               | 
               | 
              290 | 
                      $('#checkout-barcode').val(''); | 
            
        
          | 255 | 
              });  | 
          291 | 
              });  | 
        
        
          | 256 | 
          }  | 
          292 | 
          }  | 
        
        
          | 257 | 
           | 
          293 | 
           | 
        
  
    | 
      
            Lines 265-270
          function recordFine(amount) {
      
      
        Link Here
      
     | 
  
        
          | 265 | 
              kohadb.recordTransaction(trans, function () { | 
          301 | 
              kohadb.recordTransaction(trans, function () { | 
        
        
          | 266 | 
                  $('#session-payments').show(); | 
          302 | 
                  $('#session-payments').show(); | 
        
        
          | 267 | 
                  $('#session-payments tbody').prepend('<tr><td>' + amount + '</td><td>' + $.datepicker.formatDate(dateformat, timestamp) + timestamp.toTimeString() + '</td></tr>'); | 
          303 | 
                  $('#session-payments tbody').prepend('<tr><td>' + amount + '</td><td>' + $.datepicker.formatDate(dateformat, timestamp) + timestamp.toTimeString() + '</td></tr>'); | 
        
            
               | 
               | 
              304 | 
                      $('.fine-amount').text(parseInt($('.fine-amount').text) - amount); | 
            
        
          | 268 | 
              });  | 
          305 | 
              });  | 
        
        
          | 269 | 
          }  | 
          306 | 
          }  | 
        
        
          | 270 | 
           | 
          307 | 
           | 
        
  
    | 
      
            Lines 364-375
          function showPatron(barcode, patron, error) {
      
      
        Link Here
      
     | 
  
        
          | 364 | 
              if (alerts.length > 0) { | 
          401 | 
              if (alerts.length > 0) { | 
        
        
          | 365 | 
                  $('#alerts').append('<div class="dialog alert"><h3>' + _("Check out message") + '</h3></div>'); | 
          402 | 
                  $('#alerts').append('<div class="dialog alert"><h3>' + _("Check out message") + '</h3></div>'); | 
        
        
          | 366 | 
                  for (var msg in alerts) { | 
          403 | 
                  for (var msg in alerts) { | 
        
          
            
              | 367 | 
                          $('#alerts .dialog').append('<p>' + alerts[msg] + '</p'); | 
              404 | 
                          $('#alerts .dialog').append('<p>' + alerts[msg] + '</p>'); | 
            
        
          | 368 | 
                  }  | 
          405 | 
                  }  | 
        
        
          | 369 | 
              }  | 
          406 | 
              }  | 
        
        
          | 370 | 
              curpatron = patron;  | 
          407 | 
              curpatron = patron;  | 
        
        
          | 371 | 
              $('#yui-main').show(); | 
          408 | 
              $('#yui-main').show(); | 
        
          
            
              | 372 | 
                  $('#barcode').focus(); | 
              409 | 
                  setTimeout(function() { $('#checkout-barcode').trigger('focus'), 1 }); | 
            
        
          | 373 | 
          }  | 
          410 | 
          }  | 
        
        
          | 374 | 
           | 
          411 | 
           | 
        
        
          | 375 | 
          // This next bit of code is to deal with the updated session issue  | 
          412 | 
          // This next bit of code is to deal with the updated session issue  | 
        
  
    | 
      
            Lines 408-437
          $(document).ready(function () {
      
      
        Link Here
      
     | 
  
        
          | 408 | 
              });  | 
          445 | 
              });  | 
        
        
          | 409 | 
           | 
          446 | 
           | 
        
        
          | 410 | 
              $('#go-to-home').click(function () { | 
          447 | 
              $('#go-to-home').click(function () { | 
        
            
               | 
               | 
              448 | 
                      $('#alerts').empty(); | 
            
        
          | 411 | 
                  $('.offline-sync').hide(); | 
          449 | 
                  $('.offline-sync').hide(); | 
        
        
          | 412 | 
                  $('.offline-circulation').hide(); | 
          450 | 
                  $('.offline-circulation').hide(); | 
        
        
          | 413 | 
                  $('.offline-returns').hide(); | 
          451 | 
                  $('.offline-returns').hide(); | 
        
            
               | 
               | 
              452 | 
                      $('.offline-circulation-instructions').hide(); | 
            
        
          | 414 | 
                  $('.offline-home').show(); | 
          453 | 
                  $('.offline-home').show(); | 
        
        
          | 415 | 
              });  | 
          454 | 
              });  | 
        
        
          | 416 | 
           | 
          455 | 
           | 
        
        
          | 417 | 
              $('#go-to-returns').click(function () { | 
          456 | 
              $('#go-to-returns').click(function () { | 
        
            
               | 
               | 
              457 | 
                      $('#alerts').empty(); | 
            
        
          | 418 | 
                  $('.offline-home').hide(); | 
          458 | 
                  $('.offline-home').hide(); | 
        
        
          | 419 | 
                  $('.offline-sync').hide(); | 
          459 | 
                  $('.offline-sync').hide(); | 
        
        
          | 420 | 
                  $('.offline-circulation').hide(); | 
          460 | 
                  $('.offline-circulation').hide(); | 
        
            
               | 
               | 
              461 | 
                      $('.offline-circulation-instructions').hide(); | 
            
        
          | 421 | 
                  $('.offline-returns').show(); | 
          462 | 
                  $('.offline-returns').show(); | 
        
          
            
              | 422 | 
                      $('#checkin-form input[name="barcode"]').focus(); | 
              463 | 
                      setTimeout(function() { $('#checkin-form input[name="barcode"]').trigger('focus'), 1 }); | 
            
        
          | 423 | 
              });  | 
          464 | 
              });  | 
        
        
          | 424 | 
           | 
          465 | 
           | 
        
        
          | 425 | 
              $('#go-to-circ').click(function () { | 
          466 | 
              $('#go-to-circ').click(function () { | 
        
            
               | 
               | 
              467 | 
                      $('#alerts').empty(); | 
            
        
          | 426 | 
                  $('.offline-home').hide(); | 
          468 | 
                  $('.offline-home').hide(); | 
        
        
          | 427 | 
                  $('.offline-sync').hide(); | 
          469 | 
                  $('.offline-sync').hide(); | 
        
        
          | 428 | 
                  $('.offline-returns').hide(); | 
          470 | 
                  $('.offline-returns').hide(); | 
        
        
          | 429 | 
                  $('.offline-circulation').hide(); | 
          471 | 
                  $('.offline-circulation').hide(); | 
        
            
               | 
               | 
              472 | 
                      $('.offline-circulation-instructions').show(); | 
            
        
          | 430 | 
                  $('#header_search').tabs("option", "active", 0); | 
          473 | 
                  $('#header_search').tabs("option", "active", 0); | 
        
          
            
              | 431 | 
                      $('#circ_search input[name="findborrower"]').focus(); | 
              474 | 
                      setTimeout(function() { $('#circ_search input[name="findborrower"]').trigger('focus'), 1 }); | 
            
        
          | 432 | 
              });  | 
          475 | 
              });  | 
        
        
          | 433 | 
           | 
          476 | 
           | 
        
        
          | 434 | 
              $('#go-to-sync').click(function () { | 
          477 | 
              $('#go-to-sync').click(function () { | 
        
            
               | 
               | 
              478 | 
                      $('#alerts').empty(); | 
            
            
              | 479 | 
                      showSyncInfo();  | 
            
        
          | 435 | 
                  $.ajax({ | 
          480 | 
                  $.ajax({ | 
        
        
          | 436 | 
                      type: "GET",  | 
          481 | 
                      type: "GET",  | 
        
        
          | 437 | 
                      url: "/cgi-bin/koha/offline_circ/list.pl",  | 
          482 | 
                      url: "/cgi-bin/koha/offline_circ/list.pl",  | 
        
  
    | 
      
            Lines 439-444
          $(document).ready(function () {
      
      
        Link Here
      
     | 
  
        
          | 439 | 
                          $('.offline-home').hide(); | 
          484 | 
                          $('.offline-home').hide(); | 
        
        
          | 440 | 
                          $('.offline-returns').hide(); | 
          485 | 
                          $('.offline-returns').hide(); | 
        
        
          | 441 | 
                          $('.offline-circulation').hide(); | 
          486 | 
                          $('.offline-circulation').hide(); | 
        
            
               | 
               | 
              487 | 
                              $('.offline-circulation-instructions').hide(); | 
            
        
          | 442 | 
                          $('.offline-sync').show(); | 
          488 | 
                          $('.offline-sync').show(); | 
        
        
          | 443 | 
                          synchronize();  | 
          489 | 
                          synchronize();  | 
        
        
          | 444 | 
                      },  | 
          490 | 
                      },  | 
        
  
    | 
      
            Lines 448-462
          $(document).ready(function () {
      
      
        Link Here
      
     | 
  
        
          | 448 | 
                  });  | 
          494 | 
                  });  | 
        
        
          | 449 | 
              });  | 
          495 | 
              });  | 
        
        
          | 450 | 
           | 
          496 | 
           | 
        
            
               | 
               | 
              497 | 
                  $('#go-to-pending').click(function (ev) { | 
            
            
              | 498 | 
                      $('#alerts').empty(); | 
            
            
              | 499 | 
                      ev.preventDefault();  | 
            
            
              | 500 | 
                      $.ajax({ | 
            
            
              | 501 | 
                          type: "GET",  | 
            
            
              | 502 | 
                          url: "/cgi-bin/koha/offline_circ/list.pl",  | 
            
            
              | 503 | 
                          success: function () { | 
            
            
              | 504 | 
                              window.location = '/cgi-bin/koha/offline_circ/list.pl';  | 
            
            
              | 505 | 
                          },  | 
            
            
              | 506 | 
                          error: function () { | 
            
            
              | 507 | 
                              alert(_("You are offline and therefore cannot process pending operations")); | 
            
            
              | 508 | 
                          }  | 
            
            
              | 509 | 
                      });  | 
            
            
              | 510 | 
                  });  | 
            
            
              | 511 | 
               | 
            
        
          | 451 | 
              $('#patronsearch').submit(function (event) { | 
          512 | 
              $('#patronsearch').submit(function (event) { | 
        
        
          | 452 | 
                  event.preventDefault();  | 
          513 | 
                  event.preventDefault();  | 
        
        
          | 453 | 
                  loadPatron($('#findborrower').val()); | 
          514 | 
                  loadPatron($('#findborrower').val()); | 
        
        
          | 454 | 
                  $('.offline-home').hide(); | 
          515 | 
                  $('.offline-home').hide(); | 
        
        
          | 455 | 
                  $('.offline-returns').hide(); | 
          516 | 
                  $('.offline-returns').hide(); | 
        
        
          | 456 | 
                  $('.offline-sync').hide(); | 
          517 | 
                  $('.offline-sync').hide(); | 
        
            
               | 
               | 
              518 | 
                      $('.offline-circulation-instructions').hide(); | 
            
        
          | 457 | 
                  $('.offline-circulation').show(); | 
          519 | 
                  $('.offline-circulation').show(); | 
        
        
          | 458 | 
                  $('#findborrower').val(''); | 
          520 | 
                  $('#findborrower').val(''); | 
        
          
            
              | 459 | 
                      $('#barcode').focus(); | 
              521 | 
                      setTimeout(function() { $('#checkout-barcode').trigger('focus'), 1 }); | 
            
        
          | 460 | 
              });  | 
          522 | 
              });  | 
        
        
          | 461 | 
           | 
          523 | 
           | 
        
        
          | 462 | 
              $('#pay-fine').click(function (event) { | 
          524 | 
              $('#pay-fine').click(function (event) { | 
        
  
    | 
      
            Lines 472-484
          $(document).ready(function () {
      
      
        Link Here
      
     | 
  
        
          | 472 | 
                  minute: 59  | 
          534 | 
                  minute: 59  | 
        
        
          | 473 | 
              });  | 
          535 | 
              });  | 
        
        
          | 474 | 
              $("#duedatespec").datetimepicker({ | 
          536 | 
              $("#duedatespec").datetimepicker({ | 
        
          
            
              | 475 | 
                      onClose: function(dateText, inst) { $("#barcode").focus(); }, | 
              537 | 
                      onClose: function(dateText, inst) { setTimeout(function() { $('#checkout-barcode').trigger('focus'), 1 }); }, | 
            
        
          | 476 | 
                  hour: 23,  | 
          538 | 
                  hour: 23,  | 
        
        
          | 477 | 
                  minute: 59  | 
          539 | 
                  minute: 59  | 
        
        
          | 478 | 
              });  | 
          540 | 
              });  | 
        
        
          | 479 | 
              $('#mainform').submit(function (event) { | 
          541 | 
              $('#mainform').submit(function (event) { | 
        
        
          | 480 | 
                  event.preventDefault();  | 
          542 | 
                  event.preventDefault();  | 
        
          
            
              | 481 | 
                      var barcode = $('#barcode').val(); | 
              543 | 
                      var barcode = $('#checkout-barcode').val(); | 
            
        
          | 482 | 
                  $.indexedDB("koha").transaction(["items"]).then(function() { | 
          544 | 
                  $.indexedDB("koha").transaction(["items"]).then(function() { | 
        
        
          | 483 | 
                  }, function(err, e){ | 
          545 | 
                  }, function(err, e){ | 
        
        
          | 484 | 
                  }, function(transaction){ | 
          546 | 
                  }, function(transaction){ | 
        
  
    | 
      
            Lines 505-512
          $(document).ready(function () {
      
      
        Link Here
      
     | 
  
        
          | 505 | 
           | 
          567 | 
           | 
        
        
          | 506 | 
              <div id="bd">  | 
          568 | 
              <div id="bd">  | 
        
        
          | 507 | 
                  <div id="yui-main">  | 
          569 | 
                  <div id="yui-main">  | 
        
          
            
              | 508 | 
                          <audio id="alert_sound" src="/intranet-tmpl/prog/sound/critical.ogg" autobuffer="autobuffer"></audio>  | 
              570 | 
                          <audio id="alert_sound" src="[% interface %]/prog/sound/critical.ogg" autobuffer="autobuffer"></audio>  | 
            
            
              | 509 | 
                          <audio id="success_sound" src="/intranet-tmpl/prog/sound/beep.ogg" autobuffer="autobuffer"></audio>  | 
              571 | 
                          <audio id="success_sound" src="[% interface %]/prog/sound/beep.ogg" autobuffer="autobuffer"></audio>  | 
            
        
          | 510 | 
           | 
          572 | 
           | 
        
        
          | 511 | 
                      <div id="alerts" class="yui-b">  | 
          573 | 
                      <div id="alerts" class="yui-b">  | 
        
        
          | 512 | 
                      </div>  | 
          574 | 
                      </div>  | 
        
  
    | 
      
            Lines 523-536
          $(document).ready(function () {
      
      
        Link Here
      
     | 
  
        
          | 523 | 
                                  <ul>  | 
          585 | 
                                  <ul>  | 
        
        
          | 524 | 
                                      <li><a id="go-to-circ" href="#offline-circulation">Check out</a></li>  | 
          586 | 
                                      <li><a id="go-to-circ" href="#offline-circulation">Check out</a></li>  | 
        
        
          | 525 | 
                                      <li><a id="go-to-returns" href="#offline-returns">Check in</a></li>  | 
          587 | 
                                      <li><a id="go-to-returns" href="#offline-returns">Check in</a></li>  | 
        
            
              | 526 | 
                                          <li><a id="go-to-sync" href="#offline-sync">Synchronize (must be online)</a></li>  | 
               | 
               | 
            
        
          | 527 | 
                                  </ul>  | 
          588 | 
                                  </ul>  | 
        
        
          | 528 | 
                              </div>  | 
          589 | 
                              </div>  | 
        
        
          | 529 | 
           | 
          590 | 
           | 
        
        
          | 530 | 
                              <div class="yui-u">  | 
          591 | 
                              <div class="yui-u">  | 
        
        
          | 531 | 
                                  <p><strong>Note:</strong> You must be online to use these options.</p>  | 
          592 | 
                                  <p><strong>Note:</strong> You must be online to use these options.</p>  | 
        
        
          | 532 | 
                                  <ul>  | 
          593 | 
                                  <ul>  | 
        
          
            
              | 533 | 
                                          <li><a href="/cgi-bin/koha/offline_circ/list.pl">Pending offline circulation actions</a>  | 
              594 | 
                                          <li><a id="go-to-sync" href="#offline-sync">Synchronize</a></li>  | 
            
            
               | 
               | 
              595 | 
                                          <li><a id="go-to-pending" href="/cgi-bin/koha/offline_circ/list.pl">Pending offline circulation actions</a>  | 
            
        
          | 534 | 
                                  </ul>  | 
          596 | 
                                  </ul>  | 
        
        
          | 535 | 
                              </div>  | 
          597 | 
                              </div>  | 
        
        
          | 536 | 
                          </div>  | 
          598 | 
                          </div>  | 
        
  
    | 
      
            Lines 547-554
          $(document).ready(function () {
      
      
        Link Here
      
     | 
  
        
          | 547 | 
                              <h1>Offline circulation</h1>  | 
          609 | 
                              <h1>Offline circulation</h1>  | 
        
        
          | 548 | 
                              <div class="yui-u first">  | 
          610 | 
                              <div class="yui-u first">  | 
        
        
          | 549 | 
                                  <div id="download-message">  | 
          611 | 
                                  <div id="download-message">  | 
        
          
            
              | 550 | 
                                          You have records in the offline circulation database on this  | 
              612 | 
                                          In order for offline circulation to work on this computer,  | 
            
            
              | 551 | 
                                          computer, but they may not be current:  | 
              613 | 
                                          your library's records must be up-to-date on this computer:  | 
            
        
          | 552 | 
                                      <ul>  | 
          614 | 
                                      <ul>  | 
        
        
          | 553 | 
                                          <li>Patron records were last synced on: <span id="patron-timestamp">(checking)</span></li>  | 
          615 | 
                                          <li>Patron records were last synced on: <span id="patron-timestamp">(checking)</span></li>  | 
        
        
          | 554 | 
                                          <li>Item records were last synced on: <span id="item-timestamp">(checking)</span></li>  | 
          616 | 
                                          <li>Item records were last synced on: <span id="item-timestamp">(checking)</span></li>  | 
        
  
    | 
      
            Lines 558-567
          $(document).ready(function () {
      
      
        Link Here
      
     | 
  
        
          | 558 | 
                              </div>  | 
          620 | 
                              </div>  | 
        
        
          | 559 | 
           | 
          621 | 
           | 
        
        
          | 560 | 
                              <div class="yui-u">  | 
          622 | 
                              <div class="yui-u">  | 
        
          
            
              | 561 | 
                                      <div id="upload-message">You have transactions in the offline  | 
              623 | 
                                      <div id="upload-message">  | 
            
            
              | 562 | 
                                          circulation database on this computer that have not been  | 
               | 
               | 
            
            
              | 563 | 
                                          uploaded.  | 
            
        
          | 564 | 
                                  </div>  | 
          624 | 
                                  </div>  | 
        
            
               | 
               | 
              625 | 
                                      <div>View <a href="/cgi-bin/koha/offline_circ/list.pl">pending offline circulation actions</a></div>  | 
            
        
          | 565 | 
                              </div>  | 
          626 | 
                              </div>  | 
        
        
          | 566 | 
                          </div>  | 
          627 | 
                          </div>  | 
        
        
          | 567 | 
                      </div>  | 
          628 | 
                      </div>  | 
        
  
    | 
      
            Lines 572-579
          $(document).ready(function () {
      
      
        Link Here
      
     | 
  
        
          | 572 | 
                                  <div class="yui-u first">  | 
          633 | 
                                  <div class="yui-u first">  | 
        
        
          | 573 | 
                                      <fieldset>  | 
          634 | 
                                      <fieldset>  | 
        
        
          | 574 | 
                                          <legend>Check In</legend>  | 
          635 | 
                                          <legend>Check In</legend>  | 
        
          
            
              | 575 | 
                                              <label for="barcode">Enter item barcode: </label>  | 
              636 | 
                                              <label for="checkin-barcode">Enter item barcode: </label>  | 
            
            
              | 576 | 
                                              <input name="barcode" id="barcode" size="14" class="focus"/>  | 
              637 | 
                                              <input name="barcode" id="checkin-barcode" size="14" class="focus"/>  | 
            
        
          | 577 | 
                                          <input type="submit" class="submit" value="Submit" />  | 
          638 | 
                                          <input type="submit" class="submit" value="Submit" />  | 
        
        
          | 578 | 
                                      </fieldset>  | 
          639 | 
                                      </fieldset>  | 
        
        
          | 579 | 
                                  </div>  | 
          640 | 
                                  </div>  | 
        
  
    | 
      
            Lines 592-605
          $(document).ready(function () {
      
      
        Link Here
      
     | 
  
        
          | 592 | 
                          </div>  | 
          653 | 
                          </div>  | 
        
        
          | 593 | 
                      </div>  | 
          654 | 
                      </div>  | 
        
        
          | 594 | 
           | 
          655 | 
           | 
        
            
               | 
               | 
              656 | 
                          <div style="display: none;" class="yui-b offline-circulation-instructions">  | 
            
            
              | 657 | 
                              <div class="yui-g">  | 
            
            
              | 658 | 
                                  Scan a patron barcode to start.  | 
            
            
              | 659 | 
                              </div>  | 
            
            
              | 660 | 
                          </div>  | 
            
            
              | 661 | 
               | 
            
        
          | 595 | 
                      <div id="offline-circulation" style="display: none;" class="yui-b offline-circulation">  | 
          662 | 
                      <div id="offline-circulation" style="display: none;" class="yui-b offline-circulation">  | 
        
        
          | 596 | 
                          <div class="yui-g">  | 
          663 | 
                          <div class="yui-g">  | 
        
          
            
              | 597 | 
                                  <form method="post" action="/cgi-bin/koha/circ/offline-circulation.pl" id="mainform" name="mainform" autocomplete="off">  | 
              664 | 
                                  <form method="post" action="/cgi-bin/koha/circ/offline.pl" id="mainform" name="mainform" autocomplete="off">  | 
            
        
          | 598 | 
                                  <fieldset id="circ_circulation_issue">  | 
          665 | 
                                  <fieldset id="circ_circulation_issue">  | 
        
          
            
              | 599 | 
                                          <span id="clearscreen"><a href="/cgi-bin/koha/circ/offline-circulation.pl" title="Clear screen">x</a></span>  | 
              666 | 
                                          <span id="clearscreen"><a href="/cgi-bin/koha/circ/offline.pl" title="Clear screen">x</a></span>  | 
            
            
              | 600 | 
                                          <label for="barcode">Checking out to <span class="patron-title"></span></label>  | 
              667 | 
                                          <label for="checkout-barcode">Checking out to <span class="patron-title"></span></label>  | 
            
        
          | 601 | 
                                      <div class="hint">Enter item barcode:</div>  | 
          668 | 
                                      <div class="hint">Enter item barcode:</div>  | 
        
          
            
              | 602 | 
                                          <input type="text" name="barcode" id="barcode" class="barcode focus" size="14" />  | 
              669 | 
                                          <input type="text" name="barcode" id="checkout-barcode" class="barcode focus" size="14" />  | 
            
        
          | 603 | 
                                      <input type="submit" value="Check Out" />  | 
          670 | 
                                      <input type="submit" value="Check Out" />  | 
        
        
          | 604 | 
           | 
          671 | 
           | 
        
        
          | 605 | 
                                      <div class="date-select">  | 
          672 | 
                                      <div class="date-select">  |