9db23b8483
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>
108 lines
3.7 KiB
Perl
Executable file
108 lines
3.7 KiB
Perl
Executable file
#!/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 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
|
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License along with
|
|
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
|
|
# Suite 330, Boston, MA 02111-1307 USA
|
|
#
|
|
|
|
use Modern::Perl;
|
|
use CGI;
|
|
use JSON;
|
|
use C4::Auth;
|
|
use C4::Output;
|
|
use C4::Context;
|
|
use C4::Koha;
|
|
|
|
my $query = new CGI;
|
|
my ( $template, $loggedinuser, $cookie, $flags ) =
|
|
checkauth( $query, undef, { circulate => "circulate_remaining_permissions" },
|
|
"intranet" );
|
|
|
|
my $page = $query->param('page') || 0;
|
|
my $startrec = int($page) * 5000;
|
|
my $req_data = $query->param('data') || '';
|
|
|
|
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,
|
|
categorycode, dateenrolled, dateexpiry, gonenoaddress, lost, debarred,
|
|
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 ?, 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 = 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,
|
|
items.materials AS materials, LEFT(biblio.title, 60) AS title,
|
|
biblio.author AS author, biblio.biblionumber AS biblionumber
|
|
FROM items
|
|
JOIN biblio ON biblio.biblionumber = items.biblionumber
|
|
WHERE barcode IS NOT NULL
|
|
LIMIT ?, 5000;
|
|
};
|
|
|
|
my $issues_query = q{SELECT
|
|
biblio.title AS title,
|
|
items.barcode AS barcode,
|
|
items.itemcallnumber AS callnumber,
|
|
issues.date_due AS date_due,
|
|
issues.issuedate AS issuedate,
|
|
issues.renewals AS renewals,
|
|
borrowers.cardnumber AS cardnumber,
|
|
CONCAT(borrowers.surname, ', ', borrowers.firstname) AS borrower_name
|
|
FROM issues
|
|
JOIN items ON items.itemnumber = issues.itemnumber
|
|
JOIN biblio ON biblio.biblionumber = items.biblionumber
|
|
JOIN borrowers ON borrowers.borrowernumber = issues.borrowernumber
|
|
WHERE barcode IS NOT NULL
|
|
LIMIT ?, 5000;
|
|
};
|
|
|
|
my %results;
|
|
my $finished = 1;
|
|
if ( $req_data eq 'patrons' || $req_data eq 'all' ) {
|
|
$results{'patrons'} = get_data( $patrons_query, 'cardnumber', $startrec );
|
|
}
|
|
if ( $req_data eq 'items' || $req_data eq 'all' ) {
|
|
$results{'items'} = get_data( $items_query, 'barcode', $startrec );
|
|
}
|
|
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, $start ) = @_;
|
|
$start ||= 0;
|
|
my $dbh = C4::Context->dbh;
|
|
my $sth = $dbh->prepare($sql);
|
|
$sth->execute($start);
|
|
return $sth->fetchall_hashref($key);
|
|
}
|