Bug 10240: QA follow-up
Address the following issues:
1/ Address minor qa issues with the templates:
FAIL koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline-mf.tt
FAIL forbidden patterns
forbidden pattern: intranet-tmpl should certainly
replaced with [% interface %] (line 24)
[etc.]
OK tt_valid
OK valid_template
FAIL koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt
FAIL forbidden patterns
forbidden pattern: intranet-tmpl should certainly
replaced with [% interface %] (line 509)
[etc.]
FAIL tt_valid
lines 5, 5
2/ Run perltidy on new scripts
3/ download.pl returns data.finished = 1 if number of returned
data < 5000 (avoids 1 ajax call)
4/ Replace qq{} around sql queries with q{}
Also, a race condition existed that resulted in pending transactions
only getting deleted from the local database in certain circumstances
(fast connections under Chrome, mostly). This patch fixes that so that
successfully-uploaded transactions are always deleted.
This patch also addresses Jonathan's suggestion:
3/ add a message on check in (currently the input becomes empty but the
user is not informed).
... and Magnus's suggestion about moving the Synchronize link to the
right on the homepage.
Also, this addresses the further issues Jonathan noted:
- The tab of checkouts always shows "*0* Checkouts"
- If I am not well-educated, I click on the "Check out" link on the
offline home page, I enter a barcode, click on "Check out" and I get a
js error (without user message): "TypeError: curpatron is undefined"
(with chromium I get: Numeric transaction modes are deprecated in
IDBDatabase.transaction. Use "readonly" or "readwrite").
- There is a "border-right" css rule on the h5.patron-title. It is
display when there is no patron selected) [really minor!].
- tables are displayed even if there is no data
- The "Clear screen" link (X) points to an old script:
circ/offline-circulation.pl
- There is a warning when clicking on the "Synchronize" link when the
user is offline, but not for the "Pending offline circulation actions"
link.
- Still exists:
> The "Checked in item." message text never disappear (even if I go on the
> offline home page (circ/offline.pl#offline-home)).
Finally, this patch adds a link to the Pending offline operations page
on the synchronize page for easier navigation.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
44d0ad451f
commit
9db23b8483
|
|
@ -1,10 +1,11 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Copyright 2013 C & P Bibliography Services
|
||||
# This file is part of Koha.
|
||||
#
|
||||
# Koha is free software; you can redistribute it and/or modify it under the
|
||||
# terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option) any later
|
||||
# Foundation; either version 3 of the License, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
|
|
@ -21,14 +22,16 @@ use CGI;
|
|||
use C4::Auth;
|
||||
|
||||
my $query = new CGI;
|
||||
my ($template, $loggedinuser, $cookie, $flags)
|
||||
= get_template_and_user({template_name => "circ/offline-mf.tt",
|
||||
query => $query,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => {circulate => "circulate_remaining_permissions"},
|
||||
});
|
||||
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
|
||||
{
|
||||
template_name => "circ/offline-mf.tt",
|
||||
query => $query,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => { circulate => "circulate_remaining_permissions" },
|
||||
}
|
||||
);
|
||||
|
||||
$template->{'VARS'}->{'cookie'} = $cookie;
|
||||
print $query->header(-type => 'text/cache-manifest', cookie => $cookie);
|
||||
print $query->header( -type => 'text/cache-manifest', cookie => $cookie );
|
||||
print $template->output;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Copyright 2013 C & P Bibliography Services
|
||||
# This file is part of Koha.
|
||||
#
|
||||
# Koha is free software; you can redistribute it and/or modify it under the
|
||||
# terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option) any later
|
||||
# Foundation; either version 3 of the License, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
|
|
@ -23,14 +24,18 @@ use C4::Output;
|
|||
use C4::Context;
|
||||
|
||||
my $query = new CGI;
|
||||
my ($template, $loggedinuser, $cookie, $flags)
|
||||
= get_template_and_user({template_name => "circ/offline.tt",
|
||||
query => $query,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => {circulate => "circulate_remaining_permissions"},
|
||||
});
|
||||
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
|
||||
{
|
||||
template_name => "circ/offline.tt",
|
||||
query => $query,
|
||||
type => "intranet",
|
||||
authnotrequired => 0,
|
||||
flagsrequired => { circulate => "circulate_remaining_permissions" },
|
||||
}
|
||||
);
|
||||
|
||||
$template->{'VARS'}->{'AllowOfflineCirculation'} = C4::Context->preference('AllowOfflineCirculation');
|
||||
$template->{'VARS'}->{'maxoutstanding'} = C4::Context->preference('maxoutstanding') || 0;
|
||||
$template->{'VARS'}->{'AllowOfflineCirculation'} =
|
||||
C4::Context->preference('AllowOfflineCirculation');
|
||||
$template->{'VARS'}->{'maxoutstanding'} =
|
||||
C4::Context->preference('maxoutstanding') || 0;
|
||||
output_html_with_http_headers $query, $cookie, $template->output;
|
||||
|
|
|
|||
|
|
@ -451,6 +451,10 @@ div.patroninfo h5 {
|
|||
padding-bottom : .5em;
|
||||
}
|
||||
|
||||
div.patroninfo h5:empty {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
div.patroninfo ul {
|
||||
border : 0;
|
||||
border-right:1px solid #b9d8d9;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@
|
|||
kohadb.loadSetting = function (key, callback) {
|
||||
$.indexedDB("koha").transaction(["offline_settings"]).then(function(){
|
||||
}, function(err, e){
|
||||
if (typeof callback === 'function') {
|
||||
callback(key, undefined);
|
||||
}
|
||||
}, function(transaction){
|
||||
var settings = transaction.objectStore("offline_settings");
|
||||
settings.get(key).done(function (item, error) {
|
||||
|
|
@ -80,9 +83,10 @@
|
|||
}, function(dbtransaction) {
|
||||
var transactions = dbtransaction.objectStore("transactions");
|
||||
transactions.put(newtrans);
|
||||
kohadb.saveSetting('dirty', true);
|
||||
});
|
||||
};
|
||||
}( window.kohadb = window.bndb || {}, jQuery ));
|
||||
}( window.kohadb = window.kohadb || {}, jQuery ));
|
||||
|
||||
if ( !Date.prototype.toMySQLString ) {
|
||||
( function() {
|
||||
|
|
|
|||
|
|
@ -4,40 +4,38 @@ CACHE MANIFEST
|
|||
# Explicitly cached 'master entries'.
|
||||
CACHE:
|
||||
/cgi-bin/koha/circ/offline.pl
|
||||
/intranet-tmpl/lib/bootstrap/bootstrap.min.css
|
||||
/intranet-tmpl/lib/bootstrap/bootstrap.min.js
|
||||
/intranet-tmpl/lib/jquery/jquery-ui.css
|
||||
/intranet-tmpl/lib/jquery/jquery-ui.js
|
||||
/intranet-tmpl/lib/jquery/jquery.js
|
||||
/intranet-tmpl/lib/jquery/plugins/jquery.cookie.min.js
|
||||
/intranet-tmpl/lib/jquery/plugins/jquery.highlight-3.js
|
||||
/intranet-tmpl/lib/jquery/plugins/jquery.hotkeys.min.js
|
||||
/intranet-tmpl/lib/jquery/plugins/jquery.indexeddb.js
|
||||
/intranet-tmpl/lib/jquery/plugins/jquery.validate.min.js
|
||||
/intranet-tmpl/prog/en/css/print.css
|
||||
/intranet-tmpl/prog/en/css/staff-global.css
|
||||
/intranet-tmpl/prog/en/js/basket.js
|
||||
/intranet-tmpl/prog/en/js/offlinecirc.js
|
||||
/intranet-tmpl/prog/en/js/staff-global.js
|
||||
/intranet-tmpl/prog/en/lib/jquery/plugins/jquery-ui-timepicker-addon.js
|
||||
/intranet-tmpl/prog/en/lib/yui/button/button-min.js
|
||||
/intranet-tmpl/prog/en/lib/yui/container/container_core-min.js
|
||||
/intranet-tmpl/prog/en/lib/yui/menu/menu-min.js
|
||||
/intranet-tmpl/prog/en/lib/yui/reset-fonts-grids.css
|
||||
/intranet-tmpl/prog/en/lib/yui/skin.css
|
||||
/intranet-tmpl/prog/en/lib/yui/utilities/utilities.js
|
||||
/intranet-tmpl/prog/img/cart-small.gif
|
||||
/intranet-tmpl/prog/img/glyphicons-halflings-koha.png
|
||||
/intranet-tmpl/prog/img/koha-logo-medium.gif
|
||||
/intranet-tmpl/prog/img/loading.gif
|
||||
/intranet-tmpl/prog/sound/beep.ogg
|
||||
/intranet-tmpl/prog/sound/critical.ogg
|
||||
[% interface %]/lib/bootstrap/bootstrap.min.css
|
||||
[% interface %]/lib/bootstrap/bootstrap.min.js
|
||||
[% interface %]/lib/jquery/jquery-ui.css
|
||||
[% interface %]/lib/jquery/jquery-ui.js
|
||||
[% interface %]/lib/jquery/jquery.js
|
||||
[% interface %]/lib/jquery/plugins/jquery.cookie.min.js
|
||||
[% interface %]/lib/jquery/plugins/jquery.highlight-3.js
|
||||
[% interface %]/lib/jquery/plugins/jquery.hotkeys.min.js
|
||||
[% interface %]/lib/jquery/plugins/jquery.indexeddb.js
|
||||
[% interface %]/lib/jquery/plugins/jquery.validate.min.js
|
||||
[% themelang %]/css/print.css
|
||||
[% themelang %]/css/staff-global.css
|
||||
[% themelang %]/js/basket.js
|
||||
[% themelang %]/js/offlinecirc.js
|
||||
[% themelang %]/js/staff-global.js
|
||||
[% themelang %]/lib/jquery/plugins/jquery-ui-timepicker-addon.js
|
||||
[% themelang %]/lib/yui/button/button-min.js
|
||||
[% themelang %]/lib/yui/container/container_core-min.js
|
||||
[% themelang %]/lib/yui/menu/menu-min.js
|
||||
[% themelang %]/lib/yui/reset-fonts-grids.css
|
||||
[% themelang %]/lib/yui/skin.css
|
||||
[% themelang %]/lib/yui/utilities/utilities.js
|
||||
[% interface %]/prog/img/cart-small.gif
|
||||
[% interface %]/prog/img/glyphicons-halflings-koha.png
|
||||
[% interface %]/prog/img/koha-logo-medium.gif
|
||||
[% interface %]/prog/img/loading.gif
|
||||
[% interface %]/prog/sound/beep.ogg
|
||||
[% interface %]/prog/sound/critical.ogg
|
||||
|
||||
# Resources that require the user to be online.
|
||||
NETWORK:
|
||||
*
|
||||
|
||||
# static.html will be served if main.py is inaccessible
|
||||
# offline.jpg will be served in place of all images in images/large/
|
||||
# offline.html will be served in place of all other .html files
|
||||
# Resources that can be substituted if the user is offline
|
||||
FALLBACK:
|
||||
|
|
|
|||
|
|
@ -2,22 +2,26 @@
|
|||
[% IF (AllowOfflineCirculation) %]
|
||||
[% SET manifestattr = 'manifest="/cgi-bin/koha/circ/offline-mf.pl"' %]
|
||||
[% END %]
|
||||
[% IF ( bidi ) %]<html lang="[% lang %]" dir="[% bidi %]" [% manifestattr %]>[% ELSE %]<html lang="[% lang %]" [% manifestattr %]>[% END %]
|
||||
[% IF ( bidi && AllowOfflineCirculation ) %]<html lang="[% lang %]" dir="[% bidi %]" manifest="/cgi-bin/koha/circ/offline-mf.pl">
|
||||
[% ELSIF ( bidi ) %]<html lang="[% lang %]" dir="[% bidi %]">
|
||||
[% ELSIF ( AllowOfflineCirculation ) %]<html lang="[% lang %]" manifest="/cgi-bin/koha/circ/offline-mf.pl">
|
||||
[% ELSE %]<html lang="[% lang %]">[% END %]
|
||||
<head>
|
||||
<title>Koha › Circulation</title>
|
||||
[% INCLUDE 'doc-head-close.inc' %]
|
||||
<script type="text/javascript" src="/intranet-tmpl/lib/jquery/plugins/jquery.indexeddb.js"></script>
|
||||
<script type="text/javascript" src="/intranet-tmpl/prog/en/js/offlinecirc.js"></script>
|
||||
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.indexeddb.js"></script>
|
||||
<script type="text/javascript" src="[% interface %]/prog/en/js/offlinecirc.js"></script>
|
||||
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery-ui-timepicker-addon.js"></script>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
var ALERT_SUCCESSFUL_CHECKIN = _("Checked in item.");
|
||||
var ALERT_MATERIALS = _("Note about the accompanying materials: ");
|
||||
var ALERT_RESTRICTED = _("Patron is RESTRICTED");
|
||||
var ALERT_NO_MATCHING_ITEM = _("No item with barcode in offline database (transaction recorded anyway): ");
|
||||
var ALERT_NOT_CHECKED_OUT = _("Item not listed as checked out in offline database (transaction recorded anyway)");
|
||||
var ALERT_ITEM_WITHDRAWN = _("Item has been withdrawn (transaction recorded anyway)");
|
||||
var ALERT_ITEM_RESTRICTED = _("Item is restricted (transaction recorded anyway)");
|
||||
var ALERT_ITEM_LOST = _("Item is has been lost (transaction recorded anyway)");
|
||||
var ALERT_ITEM_LOST = _("Item has been lost (transaction recorded anyway)");
|
||||
var ALERT_NO_MATCHING_PATRON = _("No patron cardnumber in offline database (proceeding anyway): ");
|
||||
var ALERT_PATRON_GONE_NO_ADDRESS = _("Patron's address is in doubt (transaction recorded anyway)");
|
||||
var ALERT_PATRON_CARD_LOST = _("Patron's card is lost");
|
||||
|
|
@ -26,6 +30,8 @@ var ALERT_PATRON_BLOCKED_TEMPORARY = _("Patron has had overdue items and is rest
|
|||
var ALERT_PATRON_RESTRICTED = _("Patron is restricted");
|
||||
var ALERT_PATRON_FINE = _("Patron has outstanding fines: ");
|
||||
var ALERT_PATRON_FINE_OVER_LIMIT = _("Patron fines are over limit: ");
|
||||
var UPLOAD_PENDING_MESSAGE = _("You have transactions in the offline circulation database on this computer that have not been uploaded.");
|
||||
var NO_UPLOAD_PENDING_MESSAGE = _("You do not have any pending transactions in the offline circulation database on this computer.");
|
||||
|
||||
var start;
|
||||
|
||||
|
|
@ -48,17 +54,24 @@ function checkin(barcode, item, error) {
|
|||
"action" : "return"
|
||||
};
|
||||
$('#alerts').empty();
|
||||
$('#offline-home').hide();
|
||||
$('#offline-returns').show();
|
||||
$('.offline-home').hide();
|
||||
$('.offline-sync').hide();
|
||||
$('.offline-circulation').hide();
|
||||
$('.offline-circulation-instructions').hide();
|
||||
$('.offline-returns').show();
|
||||
kohadb.recordTransaction(trans, function () {
|
||||
$('#session-returned').show();
|
||||
$('#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>');
|
||||
if (alerts.length > 0) {
|
||||
$('#alerts').append('<div class="dialog alert"><h3>' + _("Check in message") + '</h3></div>');
|
||||
for (var msg in alerts) {
|
||||
$('#alerts .dialog').append('<p>' + alerts[msg] + '</p');
|
||||
}
|
||||
} else {
|
||||
$('#alerts').append('<div class="dialog"><h3>' + ALERT_SUCCESSFUL_CHECKIN + '</h3></div>');
|
||||
}
|
||||
});
|
||||
setTimeout(function() { $('#checkin-barcode').trigger('focus'), 1 });
|
||||
}
|
||||
|
||||
function checkAlerts(barcode, item) {
|
||||
|
|
@ -73,22 +86,41 @@ function checkAlerts(barcode, item) {
|
|||
return alerts;
|
||||
}
|
||||
|
||||
function synchronize() {
|
||||
kohadb.saveSetting("userid", "[% loggedinusername %]");
|
||||
kohadb.saveSetting("branchcode", "[% LoginBranchcode %]");
|
||||
function showSyncInfo() {
|
||||
kohadb.loadSetting("item-timestamp", showTimestamp);
|
||||
kohadb.loadSetting("patron-timestamp", showTimestamp);
|
||||
kohadb.loadSetting("issue-timestamp", showTimestamp);
|
||||
kohadb.loadSetting("dirty", function (key, val) {
|
||||
if (val) {
|
||||
$('#upload-message').text(UPLOAD_PENDING_MESSAGE);
|
||||
} else {
|
||||
$('#upload-message').text(NO_UPLOAD_PENDING_MESSAGE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function synchronize() {
|
||||
kohadb.saveSetting("userid", "[% loggedinusername %]");
|
||||
kohadb.saveSetting("branchcode", "[% LoginBranchcode %]");
|
||||
showSyncInfo();
|
||||
[% UNLESS (AllowOfflineCirculation) %]
|
||||
reloadRecords();
|
||||
[% END %]
|
||||
showSyncInfo();
|
||||
$('#download-records').click(reloadRecords);
|
||||
$('#upload-transactions').click(function () {
|
||||
$('.loading-overlay div').text(_("Uploading transactions, please wait..."));
|
||||
$('.loading-overlay').show();
|
||||
var uploadIter = $.indexedDB("koha").objectStore("transactions").each(uploadTransaction);
|
||||
uploadIter.done(function() {
|
||||
$.indexedDB("koha").transaction(["transactions"]).then(function(){
|
||||
}, function(err, e){
|
||||
}, function(transaction){
|
||||
transaction.objectStore("transactions").clear();
|
||||
});
|
||||
$('.loading-overlay').hide();
|
||||
kohadb.saveSetting("dirty", false);
|
||||
$('#upload-message').text(NO_UPLOAD_PENDING_MESSAGE);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -122,7 +154,7 @@ function reloadRecords(ev) {
|
|||
|
||||
function uploadTransaction(transaction) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
type: "POST",
|
||||
url: "/cgi-bin/koha/offline_circ/service.pl",
|
||||
data: { "userid" : kohadb.settings.userid,
|
||||
"branchcode" : kohadb.settings.branchcode,
|
||||
|
|
@ -132,9 +164,8 @@ function uploadTransaction(transaction) {
|
|||
"cardnumber" : transaction.value.cardnumber,
|
||||
"pending" : true,
|
||||
},
|
||||
}).done(function () {
|
||||
transaction.delete();
|
||||
});
|
||||
return undefined, true;
|
||||
}
|
||||
|
||||
function finishedLoading() {
|
||||
|
|
@ -160,7 +191,7 @@ function loadRecords(page) {
|
|||
dataType: "json",
|
||||
}).done(function (data) {
|
||||
$.indexedDB("koha").transaction(["patrons", "items", "issues"]).then(function(){
|
||||
if ($.isEmptyObject(data.patrons) && $.isEmptyObject(data.items)) {
|
||||
if (data.finished) {
|
||||
finishedLoading();
|
||||
} else {
|
||||
setTimeout(function () { loadRecords(page + 1); }, 200);
|
||||
|
|
@ -202,7 +233,9 @@ function validate1(date) {
|
|||
function loadPatron(barcode) {
|
||||
$('#oldissues').hide();
|
||||
$('#session-issues').hide();
|
||||
$('#issuest tbody').empty();
|
||||
$('#session-payments').hide();
|
||||
$('.checkout-count').text(0);
|
||||
$.indexedDB("koha").transaction(["patrons", "issues"]).then(function() {
|
||||
}, function(err, e){
|
||||
}, function(transaction){
|
||||
|
|
@ -215,6 +248,7 @@ function loadPatron(barcode) {
|
|||
issuesidx.each(function (item) {
|
||||
$('#oldissues').show();
|
||||
$('#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>");
|
||||
$('.checkout-count').text(parseInt($('.checkout-count').text()) + 1);
|
||||
}, barcode);
|
||||
});
|
||||
}
|
||||
|
|
@ -232,7 +266,7 @@ function checkout(barcode, item, error) {
|
|||
item.itemtype = item.itemtype || "";
|
||||
if ($('#duedatespec').val().length === 0) {
|
||||
alert(_("You must set a due date in order to use offline circulation!"));
|
||||
$('#duedatespec').focus();
|
||||
setTimeout(function() { $('#duedatespec').trigger('focus'), 1 });
|
||||
return;
|
||||
}
|
||||
var date_due = new Date($('#duedatespec').datepicker('getDate'));
|
||||
|
|
@ -246,12 +280,14 @@ function checkout(barcode, item, error) {
|
|||
kohadb.recordTransaction(trans, function () {
|
||||
$('#session-issues').show();
|
||||
$('#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>');
|
||||
$('.checkout-count').text(parseInt($('.checkout-count').text()) + 1);
|
||||
if (alerts.length > 0) {
|
||||
$('#alerts').append('<div class="dialog alert"><h3>' + _("Check out message") + '</h3></div>');
|
||||
for (var msg in alerts) {
|
||||
$('#alerts .dialog').append('<p>' + alerts[msg] + '</p');
|
||||
}
|
||||
}
|
||||
$('#checkout-barcode').val('');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -265,6 +301,7 @@ function recordFine(amount) {
|
|||
kohadb.recordTransaction(trans, function () {
|
||||
$('#session-payments').show();
|
||||
$('#session-payments tbody').prepend('<tr><td>' + amount + '</td><td>' + $.datepicker.formatDate(dateformat, timestamp) + timestamp.toTimeString() + '</td></tr>');
|
||||
$('.fine-amount').text(parseInt($('.fine-amount').text) - amount);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -364,12 +401,12 @@ function showPatron(barcode, patron, error) {
|
|||
if (alerts.length > 0) {
|
||||
$('#alerts').append('<div class="dialog alert"><h3>' + _("Check out message") + '</h3></div>');
|
||||
for (var msg in alerts) {
|
||||
$('#alerts .dialog').append('<p>' + alerts[msg] + '</p');
|
||||
$('#alerts .dialog').append('<p>' + alerts[msg] + '</p>');
|
||||
}
|
||||
}
|
||||
curpatron = patron;
|
||||
$('#yui-main').show();
|
||||
$('#barcode').focus();
|
||||
setTimeout(function() { $('#checkout-barcode').trigger('focus'), 1 });
|
||||
}
|
||||
|
||||
// This next bit of code is to deal with the updated session issue
|
||||
|
|
@ -408,30 +445,38 @@ $(document).ready(function () {
|
|||
});
|
||||
|
||||
$('#go-to-home').click(function () {
|
||||
$('#alerts').empty();
|
||||
$('.offline-sync').hide();
|
||||
$('.offline-circulation').hide();
|
||||
$('.offline-returns').hide();
|
||||
$('.offline-circulation-instructions').hide();
|
||||
$('.offline-home').show();
|
||||
});
|
||||
|
||||
$('#go-to-returns').click(function () {
|
||||
$('#alerts').empty();
|
||||
$('.offline-home').hide();
|
||||
$('.offline-sync').hide();
|
||||
$('.offline-circulation').hide();
|
||||
$('.offline-circulation-instructions').hide();
|
||||
$('.offline-returns').show();
|
||||
$('#checkin-form input[name="barcode"]').focus();
|
||||
setTimeout(function() { $('#checkin-form input[name="barcode"]').trigger('focus'), 1 });
|
||||
});
|
||||
|
||||
$('#go-to-circ').click(function () {
|
||||
$('#alerts').empty();
|
||||
$('.offline-home').hide();
|
||||
$('.offline-sync').hide();
|
||||
$('.offline-returns').hide();
|
||||
$('.offline-circulation').hide();
|
||||
$('.offline-circulation-instructions').show();
|
||||
$('#header_search').tabs("option", "active", 0);
|
||||
$('#circ_search input[name="findborrower"]').focus();
|
||||
setTimeout(function() { $('#circ_search input[name="findborrower"]').trigger('focus'), 1 });
|
||||
});
|
||||
|
||||
$('#go-to-sync').click(function () {
|
||||
$('#alerts').empty();
|
||||
showSyncInfo();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/cgi-bin/koha/offline_circ/list.pl",
|
||||
|
|
@ -439,6 +484,7 @@ $(document).ready(function () {
|
|||
$('.offline-home').hide();
|
||||
$('.offline-returns').hide();
|
||||
$('.offline-circulation').hide();
|
||||
$('.offline-circulation-instructions').hide();
|
||||
$('.offline-sync').show();
|
||||
synchronize();
|
||||
},
|
||||
|
|
@ -448,15 +494,31 @@ $(document).ready(function () {
|
|||
});
|
||||
});
|
||||
|
||||
$('#go-to-pending').click(function (ev) {
|
||||
$('#alerts').empty();
|
||||
ev.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/cgi-bin/koha/offline_circ/list.pl",
|
||||
success: function () {
|
||||
window.location = '/cgi-bin/koha/offline_circ/list.pl';
|
||||
},
|
||||
error: function () {
|
||||
alert(_("You are offline and therefore cannot process pending operations"));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#patronsearch').submit(function (event) {
|
||||
event.preventDefault();
|
||||
loadPatron($('#findborrower').val());
|
||||
$('.offline-home').hide();
|
||||
$('.offline-returns').hide();
|
||||
$('.offline-sync').hide();
|
||||
$('.offline-circulation-instructions').hide();
|
||||
$('.offline-circulation').show();
|
||||
$('#findborrower').val('');
|
||||
$('#barcode').focus();
|
||||
setTimeout(function() { $('#checkout-barcode').trigger('focus'), 1 });
|
||||
});
|
||||
|
||||
$('#pay-fine').click(function (event) {
|
||||
|
|
@ -472,13 +534,13 @@ $(document).ready(function () {
|
|||
minute: 59
|
||||
});
|
||||
$("#duedatespec").datetimepicker({
|
||||
onClose: function(dateText, inst) { $("#barcode").focus(); },
|
||||
onClose: function(dateText, inst) { setTimeout(function() { $('#checkout-barcode').trigger('focus'), 1 }); },
|
||||
hour: 23,
|
||||
minute: 59
|
||||
});
|
||||
$('#mainform').submit(function (event) {
|
||||
event.preventDefault();
|
||||
var barcode = $('#barcode').val();
|
||||
var barcode = $('#checkout-barcode').val();
|
||||
$.indexedDB("koha").transaction(["items"]).then(function() {
|
||||
}, function(err, e){
|
||||
}, function(transaction){
|
||||
|
|
@ -505,8 +567,8 @@ $(document).ready(function () {
|
|||
|
||||
<div id="bd">
|
||||
<div id="yui-main">
|
||||
<audio id="alert_sound" src="/intranet-tmpl/prog/sound/critical.ogg" autobuffer="autobuffer"></audio>
|
||||
<audio id="success_sound" src="/intranet-tmpl/prog/sound/beep.ogg" autobuffer="autobuffer"></audio>
|
||||
<audio id="alert_sound" src="[% interface %]/prog/sound/critical.ogg" autobuffer="autobuffer"></audio>
|
||||
<audio id="success_sound" src="[% interface %]/prog/sound/beep.ogg" autobuffer="autobuffer"></audio>
|
||||
|
||||
<div id="alerts" class="yui-b">
|
||||
</div>
|
||||
|
|
@ -523,14 +585,14 @@ $(document).ready(function () {
|
|||
<ul>
|
||||
<li><a id="go-to-circ" href="#offline-circulation">Check out</a></li>
|
||||
<li><a id="go-to-returns" href="#offline-returns">Check in</a></li>
|
||||
<li><a id="go-to-sync" href="#offline-sync">Synchronize (must be online)</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="yui-u">
|
||||
<p><strong>Note:</strong> You must be online to use these options.</p>
|
||||
<ul>
|
||||
<li><a href="/cgi-bin/koha/offline_circ/list.pl">Pending offline circulation actions</a>
|
||||
<li><a id="go-to-sync" href="#offline-sync">Synchronize</a></li>
|
||||
<li><a id="go-to-pending" href="/cgi-bin/koha/offline_circ/list.pl">Pending offline circulation actions</a>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -547,8 +609,8 @@ $(document).ready(function () {
|
|||
<h1>Offline circulation</h1>
|
||||
<div class="yui-u first">
|
||||
<div id="download-message">
|
||||
You have records in the offline circulation database on this
|
||||
computer, but they may not be current:
|
||||
In order for offline circulation to work on this computer,
|
||||
your library's records must be up-to-date on this computer:
|
||||
<ul>
|
||||
<li>Patron records were last synced on: <span id="patron-timestamp">(checking)</span></li>
|
||||
<li>Item records were last synced on: <span id="item-timestamp">(checking)</span></li>
|
||||
|
|
@ -558,10 +620,9 @@ $(document).ready(function () {
|
|||
</div>
|
||||
|
||||
<div class="yui-u">
|
||||
<div id="upload-message">You have transactions in the offline
|
||||
circulation database on this computer that have not been
|
||||
uploaded.
|
||||
<div id="upload-message">
|
||||
</div>
|
||||
<div>View <a href="/cgi-bin/koha/offline_circ/list.pl">pending offline circulation actions</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -572,8 +633,8 @@ $(document).ready(function () {
|
|||
<div class="yui-u first">
|
||||
<fieldset>
|
||||
<legend>Check In</legend>
|
||||
<label for="barcode">Enter item barcode: </label>
|
||||
<input name="barcode" id="barcode" size="14" class="focus"/>
|
||||
<label for="checkin-barcode">Enter item barcode: </label>
|
||||
<input name="barcode" id="checkin-barcode" size="14" class="focus"/>
|
||||
<input type="submit" class="submit" value="Submit" />
|
||||
</fieldset>
|
||||
</div>
|
||||
|
|
@ -592,14 +653,20 @@ $(document).ready(function () {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display: none;" class="yui-b offline-circulation-instructions">
|
||||
<div class="yui-g">
|
||||
Scan a patron barcode to start.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="offline-circulation" style="display: none;" class="yui-b offline-circulation">
|
||||
<div class="yui-g">
|
||||
<form method="post" action="/cgi-bin/koha/circ/offline-circulation.pl" id="mainform" name="mainform" autocomplete="off">
|
||||
<form method="post" action="/cgi-bin/koha/circ/offline.pl" id="mainform" name="mainform" autocomplete="off">
|
||||
<fieldset id="circ_circulation_issue">
|
||||
<span id="clearscreen"><a href="/cgi-bin/koha/circ/offline-circulation.pl" title="Clear screen">x</a></span>
|
||||
<label for="barcode">Checking out to <span class="patron-title"></span></label>
|
||||
<span id="clearscreen"><a href="/cgi-bin/koha/circ/offline.pl" title="Clear screen">x</a></span>
|
||||
<label for="checkout-barcode">Checking out to <span class="patron-title"></span></label>
|
||||
<div class="hint">Enter item barcode:</div>
|
||||
<input type="text" name="barcode" id="barcode" class="barcode focus" size="14" />
|
||||
<input type="text" name="barcode" id="checkout-barcode" class="barcode focus" size="14" />
|
||||
<input type="submit" value="Check Out" />
|
||||
|
||||
<div class="date-select">
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ my $page = $query->param('page') || 0;
|
|||
my $startrec = int($page) * 5000;
|
||||
my $req_data = $query->param('data') || '';
|
||||
|
||||
my $patrons_query = qq{SELECT
|
||||
my $patrons_query = q{SELECT
|
||||
borrowers.borrowernumber, cardnumber, surname, firstname, title,
|
||||
othernames, initials, streetnumber, streettype, address, address2, city,
|
||||
state, zipcode, country, email, phone, mobile, fax, dateofbirth, branchcode,
|
||||
|
|
@ -43,12 +43,13 @@ my $patrons_query = qq{SELECT
|
|||
debarredcomment, SUM(accountlines.amountoutstanding) AS fine
|
||||
FROM borrowers
|
||||
LEFT JOIN accountlines ON borrowers.borrowernumber=accountlines.borrowernumber
|
||||
WHERE cardnumber IS NOT NULL
|
||||
GROUP BY borrowers.borrowernumber
|
||||
LIMIT $startrec, 5000;
|
||||
LIMIT ?, 5000;
|
||||
};
|
||||
|
||||
# NOTE: we can't fit very long titles on the interface so there isn't really any point in transferring them
|
||||
my $items_query = qq{SELECT
|
||||
my $items_query = q{SELECT
|
||||
items.barcode AS barcode, items.itemnumber AS itemnumber,
|
||||
items.itemcallnumber AS callnumber, items.homebranch AS homebranch,
|
||||
items.holdingbranch AS holdingbranch, items.itype AS itemtype,
|
||||
|
|
@ -56,10 +57,11 @@ my $items_query = qq{SELECT
|
|||
biblio.author AS author, biblio.biblionumber AS biblionumber
|
||||
FROM items
|
||||
JOIN biblio ON biblio.biblionumber = items.biblionumber
|
||||
LIMIT $startrec, 5000;
|
||||
WHERE barcode IS NOT NULL
|
||||
LIMIT ?, 5000;
|
||||
};
|
||||
|
||||
my $issues_query = qq{SELECT
|
||||
my $issues_query = q{SELECT
|
||||
biblio.title AS title,
|
||||
items.barcode AS barcode,
|
||||
items.itemcallnumber AS callnumber,
|
||||
|
|
@ -72,36 +74,35 @@ my $issues_query = qq{SELECT
|
|||
JOIN items ON items.itemnumber = issues.itemnumber
|
||||
JOIN biblio ON biblio.biblionumber = items.biblionumber
|
||||
JOIN borrowers ON borrowers.borrowernumber = issues.borrowernumber
|
||||
LIMIT $startrec, 5000;
|
||||
WHERE barcode IS NOT NULL
|
||||
LIMIT ?, 5000;
|
||||
};
|
||||
|
||||
if ( $req_data eq 'all' ) {
|
||||
print $query->header( -type => 'application/json', -charset => 'utf-8' );
|
||||
print to_json(
|
||||
{
|
||||
'patrons' => get_data( $patrons_query, 'cardnumber' ),
|
||||
'items' => get_data( $items_query, 'barcode' ),
|
||||
'issues' => get_data( $issues_query, 'barcode' ),
|
||||
}
|
||||
);
|
||||
my %results;
|
||||
my $finished = 1;
|
||||
if ( $req_data eq 'patrons' || $req_data eq 'all' ) {
|
||||
$results{'patrons'} = get_data( $patrons_query, 'cardnumber', $startrec );
|
||||
}
|
||||
elsif ( $req_data eq 'patrons' ) {
|
||||
print $query->header( -type => 'application/json', -charset => 'utf-8' );
|
||||
print to_json( { 'patrons' => get_data( $patrons_query, 'cardnumber' ), } );
|
||||
if ( $req_data eq 'items' || $req_data eq 'all' ) {
|
||||
$results{'items'} = get_data( $items_query, 'barcode', $startrec );
|
||||
}
|
||||
elsif ( $req_data eq 'items' ) {
|
||||
print $query->header( -type => 'application/json', -charset => 'utf-8' );
|
||||
print to_json( { 'items' => get_data( $items_query, 'barcode' ), } );
|
||||
}
|
||||
elsif ( $req_data eq 'issues' ) {
|
||||
print $query->header( -type => 'application/json', -charset => 'utf-8' );
|
||||
print to_json( { 'issues' => get_data( $issues_query, 'barcode' ), } );
|
||||
if ( $req_data eq 'issues' || $req_data eq 'all' ) {
|
||||
$results{'issues'} = get_data( $issues_query, 'barcode', $startrec );
|
||||
}
|
||||
|
||||
foreach my $key ( keys %results ) {
|
||||
$finished = 0 if keys %{ $results{$key} } == 5000;
|
||||
}
|
||||
$results{'finished'} = $finished;
|
||||
|
||||
print $query->header( -type => 'application/json', -charset => 'utf-8' );
|
||||
print to_json( \%results );
|
||||
|
||||
sub get_data {
|
||||
my ( $sql, $key ) = @_;
|
||||
my ( $sql, $key, $start ) = @_;
|
||||
$start ||= 0;
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $sth = $dbh->prepare($sql);
|
||||
$sth->execute();
|
||||
$sth->execute($start);
|
||||
return $sth->fetchall_hashref($key);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue