From 3248afdc1256928cef749f927166e90e4ed5e4e3 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 8 Jun 2023 17:00:31 +0200 Subject: [PATCH] Bug 33961: Remove built-in offline circ tool The tool has not been updated and is no longer working with modern browser. It should either be rewritten/adjusted or removed. Given that we didn't get complains its non-functional status, bugs related to this tool didn't get attention, and the community is lacking resources, I am suggesting to remove it and redirect users to the koct FF plugin that is known to be working. Test plan: See bug 10240 and use `git grep` to confirm that we are removing all tracks of this feature. Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- C4/UsageStats.pm | 1 - circ/circulation-home.pl | 2 - circ/offline-mf.pl | 35 - circ/offline.pl | 39 - .../data/mysql/atomicupdate/bug_33961.pl | 15 + installer/data/mysql/mandatory/sysprefs.sql | 1 - .../lib/jquery/plugins/jquery.indexeddb.js | 517 ------------ .../prog/css/src/staff-global.scss | 25 - .../admin/preferences/circulation.pref | 6 - .../prog/en/modules/circ/circulation-home.tt | 3 - .../prog/en/modules/circ/offline-mf.tt | 33 - .../prog/en/modules/circ/offline.tt | 788 ------------------ .../intranet-tmpl/prog/js/offlinecirc.js | 113 --- offline_circ/download.pl | 108 --- 14 files changed, 15 insertions(+), 1671 deletions(-) delete mode 100755 circ/offline-mf.pl delete mode 100755 circ/offline.pl create mode 100755 installer/data/mysql/atomicupdate/bug_33961.pl delete mode 100644 koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.indexeddb.js delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline-mf.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt delete mode 100644 koha-tmpl/intranet-tmpl/prog/js/offlinecirc.js delete mode 100755 offline_circ/download.pl diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm index 89d45959c1..56877dd8af 100644 --- a/C4/UsageStats.pm +++ b/C4/UsageStats.pm @@ -225,7 +225,6 @@ sub _shared_preferences { SuspendHoldsOpac TransferWhenCancelAllWaitingHolds AllowAllMessageDeletion - AllowOfflineCirculation PatronAutoComplete CircAutoPrintQuickSlip DisplayClearScreenButton diff --git a/circ/circulation-home.pl b/circ/circulation-home.pl index 239051d850..e134907de4 100755 --- a/circ/circulation-home.pl +++ b/circ/circulation-home.pl @@ -37,6 +37,4 @@ my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( # Checking if there is a Fast Cataloging Framework $template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' ); -$template->{'VARS'}->{'AllowOfflineCirculation'} = C4::Context->preference('AllowOfflineCirculation'); - output_html_with_http_headers $query, $cookie, $template->output; diff --git a/circ/offline-mf.pl b/circ/offline-mf.pl deleted file mode 100755 index 19eb644f9e..0000000000 --- a/circ/offline-mf.pl +++ /dev/null @@ -1,35 +0,0 @@ -#!/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, see . - -use Modern::Perl; -use CGI qw ( -utf8 ); -use C4::Auth qw( get_template_and_user ); - -my $query = CGI->new; -my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( - { - template_name => "circ/offline-mf.tt", - query => $query, - type => "intranet", - flagsrequired => { circulate => "circulate_remaining_permissions" }, - } -); - -$template->{'VARS'}->{'cookie'} = $cookie; -print $query->header( -type => 'text/cache-manifest', cookie => $cookie ); -print $template->output; diff --git a/circ/offline.pl b/circ/offline.pl deleted file mode 100755 index 3843cb7243..0000000000 --- a/circ/offline.pl +++ /dev/null @@ -1,39 +0,0 @@ -#!/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, see . - -use Modern::Perl; -use CGI qw ( -utf8 ); -use C4::Auth qw( get_template_and_user ); -use C4::Output qw( output_html_with_http_headers ); -use C4::Context; - -my $query = CGI->new; -my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( - { - template_name => "circ/offline.tt", - query => $query, - type => "intranet", - flagsrequired => { circulate => "circulate_remaining_permissions" }, - } -); - -$template->{'VARS'}->{'AllowOfflineCirculation'} = - C4::Context->preference('AllowOfflineCirculation'); -$template->{'VARS'}->{'maxoutstanding'} = - C4::Context->preference('maxoutstanding') || 0; -output_html_with_http_headers $query, $cookie, $template->output; diff --git a/installer/data/mysql/atomicupdate/bug_33961.pl b/installer/data/mysql/atomicupdate/bug_33961.pl new file mode 100755 index 0000000000..9bc269a97d --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_33961.pl @@ -0,0 +1,15 @@ +use Modern::Perl; + +return { + bug_number => "33961", + description => "Remove Offline circulation tool", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + $dbh->do(q{ + DELETE FROM systempreferences + WHERE variable="AllowOfflineCirculation" + }); + say $out "Removed system preference 'AllowOfflineCirculation'"; + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 8fa1d86120..b224c147fe 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -35,7 +35,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('AllowMultipleCovers','0','1','Allow multiple cover images to be attached to each bibliographic record.','YesNo'), ('AllowMultipleIssuesOnABiblio',1,'Allow/Don\'t allow patrons to check out multiple items from one biblio','','YesNo'), ('AllowNotForLoanOverride','0','','If ON, Koha will allow the librarian to loan a not for loan item.','YesNo'), -('AllowOfflineCirculation','0','','If on, enables HTML5 offline circulation functionality.','YesNo'), ('AllowPatronToControlAutorenewal','0',NULL,'If enabled, patrons will have a field in their account to choose whether their checkouts are auto renewed or not','YesNo'), ('AllowPatronToSetCheckoutsVisibilityForGuarantor', '0', NULL, 'If enabled, the patron can set checkouts to be visible to their guarantor', 'YesNo'), ('AllowPatronToSetFinesVisibilityForGuarantor', '0', NULL, 'If enabled, the patron can set fines to be visible to their guarantor', 'YesNo'), diff --git a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.indexeddb.js b/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.indexeddb.js deleted file mode 100644 index e75a2a5875..0000000000 --- a/koha-tmpl/intranet-tmpl/lib/jquery/plugins/jquery.indexeddb.js +++ /dev/null @@ -1,517 +0,0 @@ -(function($, undefined) { - var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; - var IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange; - var IDBCursor = window.IDBCursor || window.webkitIDBCursor; - IDBCursor.PREV = IDBCursor.PREV || "prev"; - IDBCursor.NEXT = IDBCursor.NEXT || "next"; - - /** - * Best to use the constant IDBTransaction since older version support numeric types while the latest spec - * supports strings - */ - var IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction; - - function getDefaultTransaction(mode) { - var result = null; - switch (mode) { - case 0: - case 1: - case "readwrite": - case "readonly": - result = mode; - break; - default: - result = IDBTransaction.READ_WRITE || "readwrite"; - } - return result; - } - - $.extend({ - /** - * The IndexedDB object used to open databases - * @param {Object} dbName - name of the database - * @param {Object} config - version, onupgradeneeded, onversionchange, schema - */ - "indexedDB": function(dbName, config) { - if (config) { - // Parse the config argument - if (typeof config === "number") config = { - "version": config - }; - - var version = config.version; - if (config.schema && !version) { - var max = -1; - for (key in config.schema) { - max = max > key ? max : key; - } - version = config.version || max; - } - } - - - var wrap = { - "request": function(req, args) { - return $.Deferred(function(dfd) { - try { - var idbRequest = typeof req === "function" ? req(args) : req; - idbRequest.onsuccess = function(e) { - - dfd.resolveWith(idbRequest, [idbRequest.result, e]); - }; - idbRequest.onerror = function(e) { - - dfd.rejectWith(idbRequest, [idbRequest.error, e]); - }; - if (typeof idbRequest.onblocked !== "undefined" && idbRequest.onblocked === null) { - idbRequest.onblocked = function(e) { - - var res; - try { - res = idbRequest.result; - } catch (e) { - res = null; // Required for Older Chrome versions, accessing result causes error - } - dfd.notifyWith(idbRequest, [res, e]); - }; - } - if (typeof idbRequest.onupgradeneeded !== "undefined" && idbRequest.onupgradeneeded === null) { - idbRequest.onupgradeneeded = function(e) { - - dfd.notifyWith(idbRequest, [idbRequest.result, e]); - }; - } - } catch (e) { - e.name = "exception"; - dfd.rejectWith(idbRequest, ["exception", e]); - } - }); - }, - // Wraps the IDBTransaction to return promises, and other dependent methods - "transaction": function(idbTransaction) { - return { - "objectStore": function(storeName) { - try { - return wrap.objectStore(idbTransaction.objectStore(storeName)); - } catch (e) { - idbTransaction.readyState !== idbTransaction.DONE && idbTransaction.abort(); - return wrap.objectStore(null); - } - }, - "createObjectStore": function(storeName, storeParams) { - try { - return wrap.objectStore(idbTransaction.db.createObjectStore(storeName, storeParams)); - } catch (e) { - idbTransaction.readyState !== idbTransaction.DONE && idbTransaction.abort(); - } - }, - "deleteObjectStore": function(storeName) { - try { - idbTransaction.db.deleteObjectStore(storeName); - } catch (e) { - idbTransaction.readyState !== idbTransaction.DONE && idbTransaction.abort(); - } - }, - "abort": function() { - idbTransaction.abort(); - } - }; - }, - "objectStore": function(idbObjectStore) { - var result = {}; - // Define CRUD operations - var crudOps = ["add", "put", "get", "delete", "clear", "count"]; - for (var i = 0; i < crudOps.length; i++) { - result[crudOps[i]] = (function(op) { - return function() { - return wrap.request(function(args) { - return idbObjectStore[op].apply(idbObjectStore, args); - }, arguments); - }; - })(crudOps[i]); - } - - result.each = function(callback, range, direction) { - return wrap.cursor(function() { - if (direction) { - return idbObjectStore.openCursor(wrap.range(range), direction); - } else { - return idbObjectStore.openCursor(wrap.range(range)); - } - }, callback); - }; - - result.index = function(name) { - return wrap.index(function() { - return idbObjectStore.index(name); - }); - }; - - result.createIndex = function(prop, options, indexName) { - if (arguments.length === 2 && typeof options === "string") { - indexName = arguments[1]; - options = null; - } - if (!indexName) { - indexName = prop; - } - return wrap.index(function() { - return idbObjectStore.createIndex(indexName, prop, options); - }); - }; - - result.deleteIndex = function(indexName) { - return idbObjectStore.deleteIndex(indexName); - }; - - return result; - }, - - "range": function(r) { - if ($.isArray(r)) { - if (r.length === 1) { - return IDBKeyRange.only(r[0]); - } else { - return IDBKeyRange.bound(r[0], r[1], (typeof r[2] === 'undefined') ? true : r[2], (typeof r[3] === 'undefined') ? true : r[3]); - } - } else if (typeof r === "undefined") { - return null; - } else { - return r; - } - }, - - "cursor": function(idbCursor, callback) { - return $.Deferred(function(dfd) { - try { - - var cursorReq = typeof idbCursor === "function" ? idbCursor() : idbCursor; - cursorReq.onsuccess = function(e) { - - if (!cursorReq.result) { - dfd.resolveWith(cursorReq, [null, e]); - return; - } - var elem = { - // Delete, update do not move - "delete": function() { - return wrap.request(function() { - return cursorReq.result["delete"](); - }); - }, - "update": function(data) { - return wrap.request(function() { - return cursorReq.result["update"](data); - }); - }, - "next": function(key) { - this.data = key; - }, - "key": cursorReq.result.key, - "value": cursorReq.result.value - }; - - dfd.notifyWith(cursorReq, [elem, e]); - var result = callback.apply(cursorReq, [elem]); - - try { - if (result === false) { - dfd.resolveWith(cursorReq, [null, e]); - } else if (typeof result === "number") { - cursorReq.result["advance"].apply(cursorReq.result, [result]); - } else { - if (elem.data) cursorReq.result["continue"].apply(cursorReq.result, [elem.data]); - else cursorReq.result["continue"](); - } - } catch (e) { - - dfd.rejectWith(cursorReq, [cursorReq.result, e]); - } - }; - cursorReq.onerror = function(e) { - - dfd.rejectWith(cursorReq, [cursorReq.result, e]); - }; - } catch (e) { - - e.type = "exception"; - dfd.rejectWith(cursorReq, [null, e]); - } - }); - }, - - "index": function(index) { - try { - var idbIndex = (typeof index === "function" ? index() : index); - } catch (e) { - idbIndex = null; - } - - return { - "each": function(callback, range, direction) { - return wrap.cursor(function() { - if (direction) { - return idbIndex.openCursor(wrap.range(range), direction); - } else { - return idbIndex.openCursor(wrap.range(range)); - } - - }, callback); - }, - "eachKey": function(callback, range, direction) { - return wrap.cursor(function() { - if (direction) { - return idbIndex.openKeyCursor(wrap.range(range), direction); - } else { - return idbIndex.openKeyCursor(wrap.range(range)); - } - }, callback); - }, - "get": function(key) { - if (typeof idbIndex.get === "function") { - return wrap.request(idbIndex.get(key)); - } else { - return idbIndex.openCursor(wrap.range(key)); - } - }, - "count": function() { - if (typeof idbIndex.count === "function") { - return wrap.request(idbIndex.count()); - } else { - throw "Count not implemented for cursors"; - } - }, - "getKey": function(key) { - if (typeof idbIndex.getKey === "function") { - return wrap.request(idbIndex.getKey(key)); - } else { - return idbIndex.openKeyCursor(wrap.range(key)); - } - } - }; - } - }; - - - // Start with opening the database - var dbPromise = wrap.request(function() { - - return version ? indexedDB.open(dbName, parseInt(version)) : indexedDB.open(dbName); - }); - dbPromise.then(function(db, e) { - - db.onversionchange = function() { - // Try to automatically close the database if there is a version change request - if (!(config && config.onversionchange && config.onversionchange() !== false)) { - db.close(); - } - }; - }, function(error, e) { - - // Nothing much to do if an error occurs - }, function(db, e) { - if (e && e.type === "upgradeneeded") { - if (config && config.schema) { - // Assuming that version is always an integer - - for (var i = e.oldVersion + 1; i <= e.newVersion; i++) { - typeof config.schema[i] === "function" && config.schema[i].call(this, wrap.transaction(this.transaction)); - } - } - if (config && typeof config.upgrade === "function") { - config.upgrade.call(this, wrap.transaction(this.transaction)); - } - } - }); - - return $.extend(dbPromise, { - "cmp": function(key1, key2) { - return indexedDB.cmp(key1, key2); - }, - "deleteDatabase": function() { - // Kinda looks ugly coz DB is opened before it needs to be deleted. - // Blame it on the API - return $.Deferred(function(dfd) { - dbPromise.then(function(db, e) { - db.close(); - wrap.request(function() { - return indexedDB.deleteDatabase(dbName); - }).then(function(result, e) { - dfd.resolveWith(this, [result, e]); - }, function(error, e) { - dfd.rejectWith(this, [error, e]); - }, function(db, e) { - dfd.notifyWith(this, [db, e]); - }); - }, function(error, e) { - dfd.rejectWith(this, [error, e]); - }, function(db, e) { - dfd.notifyWith(this, [db, e]); - }); - }); - }, - "transaction": function(storeNames, mode) { - !$.isArray(storeNames) && (storeNames = [storeNames]); - mode = getDefaultTransaction(mode); - return $.Deferred(function(dfd) { - dbPromise.then(function(db, e) { - var idbTransaction; - try { - - idbTransaction = db.transaction(storeNames, mode); - - idbTransaction.onabort = idbTransaction.onerror = function(e) { - dfd.rejectWith(idbTransaction, [e]); - }; - idbTransaction.oncomplete = function(e) { - dfd.resolveWith(idbTransaction, [e]); - }; - } catch (e) { - - e.type = "exception"; - dfd.rejectWith(this, [e]); - return; - } - try { - dfd.notifyWith(idbTransaction, [wrap.transaction(idbTransaction)]); - } catch (e) { - e.type = "exception"; - dfd.rejectWith(this, [e]); - } - }, function(err, e) { - dfd.rejectWith(this, [e, err]); - }, function(res, e) { - - //dfd.notifyWith(this, ["", e]); - }); - - }); - }, - "objectStore": function(storeName, mode) { - var me = this, - result = {}; - - function op(callback) { - return $.Deferred(function(dfd) { - function onTransactionProgress(trans, callback) { - try { - - callback(trans.objectStore(storeName)).then(function(result, e) { - dfd.resolveWith(this, [result, e]); - }, function(err, e) { - dfd.rejectWith(this, [err, e]); - }); - } catch (e) { - - e.name = "exception"; - dfd.rejectWith(trans, [e, e]); - } - } - me.transaction(storeName, getDefaultTransaction(mode)).then(function() { - - // Nothing to do when transaction is complete - }, function(err, e) { - // If transaction fails, CrudOp fails - if (err.code === err.NOT_FOUND_ERR && (mode === true || typeof mode === "object")) { - - var db = this.result; - db.close(); - dbPromise = wrap.request(function() { - - return indexedDB.open(dbName, (parseInt(db.version, 10) || 1) + 1); - }); - dbPromise.then(function(db, e) { - - db.onversionchange = function() { - // Try to automatically close the database if there is a version change request - if (!(config && config.onversionchange && config.onversionchange() !== false)) { - db.close(); - } - }; - me.transaction(storeName, getDefaultTransaction(mode)).then(function() { - - // Nothing much to do - }, function(err, e) { - dfd.rejectWith(this, [err, e]); - }, function(trans, e) { - - onTransactionProgress(trans, callback); - }); - }, function(err, e) { - dfd.rejectWith(this, [err, e]); - }, function(db, e) { - if (e.type === "upgradeneeded") { - try { - - db.createObjectStore(storeName, mode === true ? { - "autoIncrement": true - } : mode); - - } catch (ex) { - - dfd.rejectWith(this, [ex, e]); - } - } - }); - } else { - dfd.rejectWith(this, [err, e]); - } - }, function(trans) { - - onTransactionProgress(trans, callback); - }); - }); - } - - function crudOp(opName, args) { - return op(function(wrappedObjectStore) { - return wrappedObjectStore[opName].apply(wrappedObjectStore, args); - }); - } - - function indexOp(opName, indexName, args) { - return op(function(wrappedObjectStore) { - var index = wrappedObjectStore.index(indexName); - return index[opName].apply(index[opName], args); - }); - } - - var crud = ["add", "delete", "get", "put", "clear", "count", "each"]; - for (var i = 0; i < crud.length; i++) { - result[crud[i]] = (function(op) { - return function() { - return crudOp(op, arguments); - }; - })(crud[i]); - } - - result.index = function(indexName) { - return { - "each": function(callback, range, direction) { - return indexOp("each", indexName, [callback, range, direction]); - }, - "eachKey": function(callback, range, direction) { - return indexOp("eachKey", indexName, [callback, range, direction]); - }, - "get": function(key) { - return indexOp("get", indexName, [key]); - }, - "count": function() { - return indexOp("count", indexName, []); - }, - "getKey": function(key) { - return indexOp("getKey", indexName, [key]); - } - }; - }; - - return result; - } - }); - } - }); - - $.indexedDB.IDBCursor = IDBCursor; - $.indexedDB.IDBTransaction = IDBTransaction; - $.idb = $.indexedDB; -})(jQuery); \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index b5f9739de7..de8c27a434 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -3549,31 +3549,6 @@ span { border-bottom-left-radius: 5px; } -.loading-overlay { - background-color: #FFFFFF; - cursor: wait; - height: 100%; - left: 0; - opacity: .7; - position: fixed; - top: 0; - width: 100%; - z-index: 1000; - - div { - background: transparent url("../img/loading.gif") top left no-repeat; - font-size: 175%; - font-weight: bold; - height: 2em; - left: 50%; - margin: -1em 0 0 -2.5em; - padding-left: 50px; - position: absolute; - top: 50%; - width: 15em; - } -} - #merge_invoices { display: none; margin: 1em auto; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index 6090f855c9..ffe8481869 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -145,12 +145,6 @@ Circulation: - "The following fields should be excluded from the patron checkout history CSV or MARC (ISO 2709) export:" - pref: ExportRemoveFields - (separate fields with space, e.g. 100a 200b 300c). - - - - pref: AllowOfflineCirculation - choices: - 1: Enable - 0: "Don't enable" - - "offline circulation on regular circulation computers. (NOTE: This system preference does not affect the Firefox add-on or the desktop application)." - - pref: ShowAllCheckins choices: diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt index 68e33d2dcd..0dbae92f2f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt @@ -164,9 +164,6 @@

Offline circulation

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline-mf.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline-mf.tt deleted file mode 100644 index b937207c3c..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline-mf.tt +++ /dev/null @@ -1,33 +0,0 @@ -CACHE MANIFEST -# [% cookie | html %] - -# Explicitly cached 'master entries'. -CACHE: -/cgi-bin/koha/circ/offline.pl -[% interface | html %]/lib/bootstrap/bootstrap.min.css -[% interface | html %]/lib/bootstrap/bootstrap-theme.min.css -[% interface | html %]/lib/bootstrap/bootstrap.min.js -[% interface | html %]/lib/jquery/jquery-ui-1.13.1.min.css -[% interface | html %]/lib/jquery/jquery-ui-1.13.1.min.js -[% interface | html %]/lib/jquery/jquery-3.6.0.min.js -[% interface | html %]/lib/jquery/jquery-migrate-3.3.2.min.js -[% interface | html %]/lib/jquery/plugins/jquery.highlight-3.js -[% interface | html %]/lib/shortcut/shortcut.js -[% interface | html %]/lib/jquery/plugins/jquery.indexeddb.js -[% interface | html %]/lib/jquery/plugins/jquery.validate.min.js -[% interface | html %]/[% theme | html %]/css/print.css -[% interface | html %]/[% theme | html %]/css/staff-global.css -[% interface | html %]/[% theme | html %]/js/basket.js -[% interface | html %]/[% theme | html %]/js/offlinecirc.js -[% interface | html %]/[% theme | html %]/js/staff-global.js -[% interface | html %]/prog/img/koha-logo-medium.png -[% interface | html %]/prog/img/loading.gif -[% interface | html %]/prog/sound/beep.ogg -[% interface | html %]/prog/sound/critical.ogg - -# Resources that require the user to be online. -NETWORK: -* - -# Resources that can be substituted if the user is offline -FALLBACK: diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt deleted file mode 100644 index 5016d005c1..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt +++ /dev/null @@ -1,788 +0,0 @@ -[% USE raw %] -[% USE Asset %] -[% USE Branches %] -[% SET footerjs = 1 %] - -[% IF (AllowOfflineCirculation) %] -[% SET manifestattr = 'manifest="/cgi-bin/koha/circ/offline-mf.pl"' %] -[% END %] -[% IF ( bidi && AllowOfflineCirculation ) %] -[% ELSIF ( bidi ) %] -[% ELSIF ( AllowOfflineCirculation ) %] -[% ELSE %][% END %] - -Circulation › Koha -[% INCLUDE 'doc-head-close.inc' %] - - - -[% WRAPPER 'header.inc' %] - [% INCLUDE 'circ-search.inc' %] -[% END %] - - -[% WRAPPER 'sub-header.inc' %] - [% WRAPPER breadcrumbs %] - [% WRAPPER breadcrumb_item %] - Offline circulation - [% END %] - [% END #/ WRAPPER breadcrumbs %] -[% END #/ WRAPPER sub-header.inc %] - -
-
-
-
-

Offline circulation

- - - - -
- - [% UNLESS (AllowOfflineCirculation) %] -
-

Warning: Offline circulation has been disabled. You may continue and record transactions, but patron and item information will not be available.

-
- [% END %] - -
-
-
- -
- -
-

Note: You must be online to use these options.

- -
-
-
- - - - - - - - -
- - - -
- - -
- -[% MACRO jsinclude BLOCK %] - [% INCLUDE 'calendar.inc' %] - [% Asset.js("lib/jquery/plugins/jquery.indexeddb.js") | $raw %] - [% Asset.js("js/offlinecirc.js") | $raw %] - -[% END %] - -[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/offlinecirc.js b/koha-tmpl/intranet-tmpl/prog/js/offlinecirc.js deleted file mode 100644 index 55c8af773c..0000000000 --- a/koha-tmpl/intranet-tmpl/prog/js/offlinecirc.js +++ /dev/null @@ -1,113 +0,0 @@ -/* 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, see . - */ - -(function( kohadb, $, undefined ) { - kohadb.settings = kohadb.settings || {}; - kohadb.initialize = function (callback) { - $.indexedDB("koha", { - "version": 1, - "schema": { - "1": function(versionTransaction){ - var patrons = versionTransaction.createObjectStore("patrons", { - "keyPath": "cardnumber" - }); - var items = versionTransaction.createObjectStore("items", { - "keyPath": "barcode" - }); - var issues = versionTransaction.createObjectStore("issues", { - "keyPath": "barcode" - }); - issues.createIndex("cardnumber", { "multiEntry": true }); - var transactions = versionTransaction.createObjectStore("transactions", { - "keyPath": "timestamp" - }); - var settings = versionTransaction.createObjectStore("offline_settings", { - "keyPath": "key" - }); - }, - } - }).done(function(){ - if (typeof callback === 'function') { - callback(); - kohadb.loadSetting('userid'); - kohadb.loadSetting('branchcode'); - } - }); - }; - 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) { - if (typeof item !== 'undefined') { - kohadb.settings[key] = item.value; - } - if (typeof callback === 'function') { - callback(key, kohadb.settings[key]); - } - }); - }); - }; - kohadb.saveSetting = function (key, value) { - $.indexedDB("koha").transaction(["offline_settings"]).then(function(){ - }, function(err, e){ - }, function(transaction){ - var settings = transaction.objectStore("offline_settings"); - settings.put({ "key" : key, "value" : value }); - kohadb.settings[key] = value; - }); - }; - kohadb.recordTransaction = function (newtrans, callback) { - $.indexedDB("koha").transaction(["transactions"]).then(function(){ - callback(newtrans); - }, function(err, e){ - }, function(dbtransaction) { - var transactions = dbtransaction.objectStore("transactions"); - transactions.put(newtrans); - kohadb.saveSetting('dirty', true); - }); - }; -}( window.kohadb = window.kohadb || {}, jQuery )); - -if ( !Date.prototype.toMySQLString ) { - ( function() { - - function pad(number) { - var r = String(number); - if ( r.length === 1 ) { - r = '0' + r; - } - return r; - } - - Date.prototype.toMySQLString = function() { - return this.getFullYear() - + '-' + pad( this.getMonth() + 1 ) - + '-' + pad( this.getDate() ) - + ' ' + pad( this.getHours() ) - + ':' + pad( this.getMinutes() ) - + ':' + pad( this.getSeconds() ) - + '.' + String( (this.getMilliseconds()/1000).toFixed(3) ).slice( 2, 5 ); - }; - - }() ); -} diff --git a/offline_circ/download.pl b/offline_circ/download.pl deleted file mode 100755 index ad120fd766..0000000000 --- a/offline_circ/download.pl +++ /dev/null @@ -1,108 +0,0 @@ -#!/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, see . - -use Modern::Perl; -use CGI qw ( -utf8 ); -use JSON qw( to_json ); -use C4::Auth qw( checkauth ); -use C4::Output; -use C4::Context; -use C4::Koha; - -my $query = CGI->new; -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, borrowers.branchcode, - categorycode, dateenrolled, dateexpiry, COALESCE(gonenoaddress, 0) AS gonenoaddress, - COALESCE(lost, 0) AS 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_count AS renewals, - issues.unseen_renewals AS unseen_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); -} -- 2.39.5