Modern web standards make it possible to make a stripped down version of Koha's circulation module function even when offline, and to seamlessly switch to offline functionality if the server or connection goes out. We should take advantage of this!
Created attachment 18406 [details] [review] Work-in-progress patch for: Bug 10240: Offline circulation using HTML5 and IndexedDB This patch adds an HTML5-based offline mode to Koha's existing circulation module, allowing librarians to check out items using a basically familiar interface. The feature will be implemented using the Application Cache and IndexedDB features of the HTML5 specification, both of which are fully supported on Firefox 10+ and Chrome 23+, with limited support going back to Firefox 4 and Chrome 11. The basic workflow enabled by this patch is as follows: Part 1: While connected to the Internet 1. Enable offline functionality by turning on the "AllowOfflineCirculation" system preference. 2. Sync the offline circulation database on the computer that will be used for offline circulation by following the "Offline circulation interface" link on the Circulation home page, choosing "Synchronize (must be online)", and clicking the "Download records" button. This process may take a while. 3. Bookmark /cgi-bin/koha/circ/offline.pl (the page you are currently on) for easy access when offline. Part 2: While disconnected from the Internet 4. Navigate to /cgi-bin/koha/circ/offline.pl using the bookmark you created while online. 5. Start checking books in by scanning the barcode of an item that has been returned into the box in the "Check in" tab. 6. Scan the barcodes of any additional items that have been returned. 7. Start checking out books to a patron by scanning the patron's barcode in the box in the "Check out" tab. 8. Set a due date (the "Remember for session" box will be checked by default, since circulation rules are not computed during offline transactions and therefore a due date must be specified by the librarian). 9. Scan an item barcode (if you did not set a due date, it will prompt you) to check the item out to the patron. 10. If a patron has a fine you can see the total amount (current to when the offline module was synced), and record a payment. Unlike when in online mode, there will be no breakdown of what item(s) fines are for, and you will only be able to record the payment amount and not associate it with a particular item. Part 3: While connected to the Internet 11. Click the "Synchronize" link and choose "Upload transactions" to upload the transactions recorded during the offline circulation session. 12. Navigate to /cgi-bin/koha/offline_circ/list.pl (there will be a link from the Offline circulation page) and review the transactions, as described in the documentation for the Firefox Offline circulation plugin: http://wiki.koha-community.org/wiki/Offline_circulation_firefox_plugin
Created attachment 18448 [details] [review] Bug 10240: Offline circulation using HTML5 and IndexedDB This patch adds an HTML5-based offline mode to Koha's existing circulation module, allowing librarians to check out items using a basically familiar interface. The feature will be implemented using the Application Cache and IndexedDB features of the HTML5 specification, both of which are fully supported on Firefox 10+ and Chrome 23+, with limited support going back to Firefox 4 and Chrome 11. The basic workflow enabled by this patch is as follows: Part 1: While connected to the Internet 1. Enable offline functionality by turning on the "AllowOfflineCirculation" system preference. 2. Sync the offline circulation database on the computer that will be used for offline circulation by following the "Offline circulation interface" link on the Circulation home page, choosing "Synchronize (must be online)", and clicking the "Download records" button. This process may take a while. 3. Bookmark /cgi-bin/koha/circ/offline.pl (the page you are currently on) for easy access when offline. Part 2: While disconnected from the Internet 4. Navigate to /cgi-bin/koha/circ/offline.pl using the bookmark you created while online. 5. Start checking books in by scanning the barcode of an item that has been returned into the box in the "Check in" tab. 6. Scan the barcodes of any additional items that have been returned. 7. Start checking out books to a patron by scanning the patron's barcode in the box in the "Check out" tab. 8. Set a due date (the "Remember for session" box will be checked by default, since circulation rules are not computed during offline transactions and therefore a due date must be specified by the librarian). 9. Scan an item barcode (if you did not set a due date, it will prompt you) to check the item out to the patron. 10. If a patron has a fine you can see the total amount (current to when the offline module was synced), and record a payment. Unlike when in online mode, there will be no breakdown of what item(s) fines are for, and you will only be able to record the payment amount and not associate it with a particular item. Part 3: While connected to the Internet 11. Click the "Synchronize" link and choose "Upload transactions" to upload the transactions recorded during the offline circulation session. 12. Navigate to /cgi-bin/koha/offline_circ/list.pl (there will be a link from the Offline circulation page) and review the transactions, as described in the documentation for the Firefox Offline circulation plugin: http://wiki.koha-community.org/wiki/Offline_circulation_firefox_plugin
I'm getting stuck on step 4. I've tried both stopping apache on my dev server, and physically unplugging my ethernet cable. Either way, I get standard browser error messages in both Chrome and Firefox. Any suggestions?
(In reply to comment #3) > I'm getting stuck on step 4. I've tried both stopping apache on my dev > server, and physically unplugging my ethernet cable. Either way, I get > standard browser error messages in both Chrome and Firefox. Any suggestions? Magnus reported having problems as well. I will test, and make sure I didn't miss adding a file to the patch.
Created attachment 19005 [details] [review] Bug 10240: Offline circulation using HTML5 and IndexedDB This patch adds an HTML5-based offline mode to Koha's existing circulation module, allowing librarians to check out items using a basically familiar interface. The feature will be implemented using the Application Cache and IndexedDB features of the HTML5 specification, both of which are fully supported on Firefox 10+ and Chrome 23+, with limited support going back to Firefox 4 and Chrome 11. The basic workflow enabled by this patch is as follows: This is an updated patch which includes the correct permissions on scripts. Part 1: While connected to the Internet 1. Enable offline functionality by turning on the "AllowOfflineCirculation" system preference. 2. Sync the offline circulation database on the computer that will be used for offline circulation by following the "Offline circulation interface" link on the Circulation home page, choosing "Synchronize (must be online)", and clicking the "Download records" button. This process may take a while. 3. Bookmark /cgi-bin/koha/circ/offline.pl (the page you are currently on) for easy access when offline. Part 2: While disconnected from the Internet 4. Navigate to /cgi-bin/koha/circ/offline.pl using the bookmark you created while online. 5. Start checking books in by scanning the barcode of an item that has been returned into the box in the "Check in" tab. 6. Scan the barcodes of any additional items that have been returned. 7. Start checking out books to a patron by scanning the patron's barcode in the box in the "Check out" tab. 8. Set a due date (the "Remember for session" box will be checked by default, since circulation rules are not computed during offline transactions and therefore a due date must be specified by the librarian). 9. Scan an item barcode (if you did not set a due date, it will prompt you) to check the item out to the patron. 10. If a patron has a fine you can see the total amount (current to when the offline module was synced), and record a payment. Unlike when in online mode, there will be no breakdown of what item(s) fines are for, and you will only be able to record the payment amount and not associate it with a particular item. Part 3: While connected to the Internet 11. Click the "Synchronize" link and choose "Upload transactions" to upload the transactions recorded during the offline circulation session. 12. Navigate to /cgi-bin/koha/offline_circ/list.pl (there will be a link from the Offline circulation page) and review the transactions, as described in the documentation for the Firefox Offline circulation plugin: http://wiki.koha-community.org/wiki/Offline_circulation_firefox_plugin
Great idea and implementation! The patch doesn't apply anymore on HEAD. Their is a conflict on staff-global.css. Reading the code, I have one question and one remark: (1) How does IndexedDB scale? Your synchronization stores locally patrons and issues (if I understand correctly). So is there a limit to the borrowers and issues Koha tables size? (2) Few lines in offline.tt won't be translatable: item.title = item.title || "(Unknown)"; item.author = item.author || "(Unknown)"; $('#alerts').append('<div class="dialog alert"><h3>Check in message</h3></div>'); $(".loading-overlay div").text(_("Loading page " + page + ", please wait...")); $('#alerts').append('<div class="dialog alert"><h3>Check out message</h3></div>'); alert("You are offline and therefore cannot sync your database");
Created attachment 19065 [details] [review] Bug 10240: Offline circulation using HTML5 and IndexedDB This patch adds an HTML5-based offline mode to Koha's existing circulation module, allowing librarians to check out items using a basically familiar interface. The feature will be implemented using the Application Cache and IndexedDB features of the HTML5 specification, both of which are fully supported on Firefox 10+ and Chrome 23+, with limited support going back to Firefox 4 and Chrome 11. The basic workflow enabled by this patch is as follows: Part 1: While connected to the Internet 1. Enable offline functionality by turning on the "AllowOfflineCirculation" system preference. 2. Sync the offline circulation database on the computer that will be used for offline circulation by following the "Offline circulation interface" link on the Circulation home page, choosing "Synchronize (must be online)", and clicking the "Download records" button. This process may take a while. 3. Bookmark /cgi-bin/koha/circ/offline.pl (the page you are currently on) for easy access when offline. Part 2: While disconnected from the Internet 4. Navigate to /cgi-bin/koha/circ/offline.pl using the bookmark you created while online. 5. Start checking books in by scanning the barcode of an item that has been returned into the box in the "Check in" tab. 6. Scan the barcodes of any additional items that have been returned. 7. Start checking out books to a patron by scanning the patron's barcode in the box in the "Check out" tab. 8. Set a due date (the "Remember for session" box will be checked by default, since circulation rules are not computed during offline transactions and therefore a due date must be specified by the librarian). 9. Scan an item barcode (if you did not set a due date, it will prompt you) to check the item out to the patron. 10. If a patron has a fine you can see the total amount (current to when the offline module was synced), and record a payment. Unlike when in online mode, there will be no breakdown of what item(s) fines are for, and you will only be able to record the payment amount and not associate it with a particular item. Part 3: While connected to the Internet 11. Click the "Synchronize" link and choose "Upload transactions" to upload the transactions recorded during the offline circulation session. 12. Navigate to /cgi-bin/koha/offline_circ/list.pl (there will be a link from the Offline circulation page) and review the transactions, as described in the documentation for the Firefox Offline circulation plugin: http://wiki.koha-community.org/wiki/Offline_circulation_firefox_plugin
(In reply to comment #6) > Great idea and implementation! > > The patch doesn't apply anymore on HEAD. Their is a conflict on > staff-global.css. Rebased on latest master. > Reading the code, I have one question and one remark: > > (1) How does IndexedDB scale? Your synchronization stores locally > patrons and issues (if I understand correctly). So is there a limit to > the borrowers and issues Koha tables size? There is not really a limit that I was able to identify. Downloading naturally takes longer the more records you have, but modern web browsers will just ask the user if they are willing to allow the application to increase the size of the IndexedDB database for that particular site, and the consensus online is that you can easily store a few million records in IndexedDB without it showing any performance issues. > (2) Few lines in offline.tt won't be translatable: I fixed those (and a couple others). Thanks for spotting that.
Interesting! I'm not skilled enough to apply the patch to a test server of my own, but I'll give some input for the wishlist. It would be useful if it was possible for the offline module to poll the remote server in the background and signal when the system gets up online again.
Viktor, (In reply to comment #9) > Interesting! I'm not skilled enough to apply the patch to a test server of > my own, but I'll give some input for the wishlist. It would be useful if it > was possible for the offline module to poll the remote server in the > background and signal when the system gets up online again. I'll be doing at least one follow-up bug after this gets in, and I like that idea, so I'll plan to include it in the follow-up.
(In reply to comment #10) > I'll be doing at least one follow-up bug after this gets in, and I like that > idea, so I'll plan to include it in the follow-up. Yay! Glad to hear. Thanks for the work you put in.
Created attachment 19204 [details] [review] Bug 10240: Offline circulation using HTML5 and IndexedDB This patch adds an HTML5-based offline mode to Koha's existing circulation module, allowing librarians to check out items using a basically familiar interface. The feature will be implemented using the Application Cache and IndexedDB features of the HTML5 specification, both of which are fully supported on Firefox 10+ and Chrome 23+, with limited support going back to Firefox 4 and Chrome 11. The basic workflow enabled by this patch is as follows: Part 1: While connected to the Internet 1. Enable offline functionality by turning on the "AllowOfflineCirculation" system preference. 2. Sync the offline circulation database on the computer that will be used for offline circulation by following the "Offline circulation interface" link on the Circulation home page, choosing "Synchronize (must be online)", and clicking the "Download records" button. This process may take a while. 3. Bookmark /cgi-bin/koha/circ/offline.pl (the page you are currently on) for easy access when offline. Part 2: While disconnected from the Internet 4. Navigate to /cgi-bin/koha/circ/offline.pl using the bookmark you created while online. 5. Start checking books in by scanning the barcode of an item that has been returned into the box in the "Check in" tab. 6. Scan the barcodes of any additional items that have been returned. 7. Start checking out books to a patron by scanning the patron's barcode in the box in the "Check out" tab. 8. Set a due date (the "Remember for session" box will be checked by default, since circulation rules are not computed during offline transactions and therefore a due date must be specified by the librarian). 9. Scan an item barcode (if you did not set a due date, it will prompt you) to check the item out to the patron. 10. If a patron has a fine you can see the total amount (current to when the offline module was synced), and record a payment. Unlike when in online mode, there will be no breakdown of what item(s) fines are for, and you will only be able to record the payment amount and not associate it with a particular item. Part 3: While connected to the Internet 11. Click the "Synchronize" link and choose "Upload transactions" to upload the transactions recorded during the offline circulation session. 12. Navigate to /cgi-bin/koha/offline_circ/list.pl (there will be a link from the Offline circulation page) and review the transactions, as described in the documentation for the Firefox Offline circulation plugin: http://wiki.koha-community.org/wiki/Offline_circulation_firefox_plugin Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
QA comment: I did not completely test this feature, but I have some comments: As Kyle said (in comment 3), I stop Apache but the browser redirects me to a standard error page after clicking on the bookmark. So I tested with a page which has been loaded when the service was running. I think I found a bug but it is weird that Chris did not raise that: When back to online, I upload transactions and delete all of them (or process them - the problem appears in both cases). Back to offline, check in 1 item and go online. I upload the transaction. I expect to have 1 pending offline action, but I get back all previous ones (Though I deleted them). What did I miss? Regarding at the code: 1/ there are minor qa issues: 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) [...] forbidden pattern: intranet-tmpl should certainly replaced with [% interface %] (line 25) 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) forbidden pattern: intranet-tmpl should certainly replaced with [% interface %] (line 508) forbidden pattern: intranet-tmpl should certainly replaced with [% interface %] (line 10) forbidden pattern: intranet-tmpl should certainly replaced with [% interface %] (line 9) FAIL tt_valid lines 5, 5 2/ Maybe it could be great to pass perltidy on new scripts. 3/ download.pl could return data.finished = 1 if number of returned data < 5000 (avoid 1 ajax call) 4/ qq{} around sql queries should be replaced with q{} Possible improvements: 1/ it seems it is not possible to show local actions. 2/ add datatable on the tables. 3/ add a message on check in (currently the input becomes empty but the user is not informed). 4/ maybe a menu on the left with all links could help users (this would avoid to go back on the offline home page). I don't switch to Failed QA, like that another QAer could test deeper.
I'd like to implement some of Jonathan's suggestions in the follow-up, so I am setting this back to assigned for the moment.
I started testing this, but never got very far. Here are a couple of observations, though: - After clicking on "Built-in offline circulation interface" for the very first time I get: You have records in the offline circulation database on this computer, but they may not be current: Patron records were last synced on: (never) Item records were last synced on: (never) Circulation records were last synced on: (never) You have transactions in the offline circulation database on this computer that have not been uploaded. which seems to indicate I have used these features before, which I have not. - Should the "Synchronize (must be online)" link be on the right of the screen, under a heading called "online actions" or similar? Now there are online actions in both columns, and the "heading" "Note: You must be online to use these options." seems potentially confusing.
(In reply to Magnus Enger from comment #15) > I started testing this, but never got very far. Here are a couple of > observations, though: > > - After clicking on "Built-in offline circulation interface" for the very > first time I get: > > You have records in the offline circulation database on this computer, but > they may not be current: > Patron records were last synced on: (never) > Item records were last synced on: (never) > Circulation records were last synced on: (never) > You have transactions in the offline circulation database on this computer > that have not been uploaded. > > which seems to indicate I have used these features before, which I have not. I confirm I got this message for the first time too!
Created attachment 19328 [details] [review] 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. Finally, this patch adds a link to the Pending offline operations page on the synchronize page for easier navigation.
I addressed the five QA issues Jonathan described in comment 13, and implemented suggested improvement 3. The other three: > 1/ it seems it is not possible to show local actions. That's a good point, and something I think I would like to add, but I will need to think about how to do it. > 2/ add datatable on the tables. I thought about doing this, but was concerned about the size of the app cache. I think the total size is still under 5MB, but I am not 100% certain, so I decided to leave this for the future. > 4/ maybe a menu on the left with all links could help users (this would avoid to go back on the offline home page). I wasn't happy with the result when I tried this. I added a link to the pending circulation actions from the synchronize page, which I presume is what you had in mind, particularly.
Jared, I get a blank page on the check out page (circ/offline.pl#offline-circulation). The "Checked in item." message text never disappear (even if I go on the offline home page (circ/offline.pl#offline-home)). Marked as Failed QA.
Jonathan, I forgot to post one part of the test plan, sorry. It turns out that in Firefox you have to *empty* the app cache and system cache when the code is updated frequently in a short period of time because shift-refresh does not reload pages that have an HTML5 manifest, and Firefox does not seem to follow the Application Cache specification's instruction that the web browser is supposed to check for new versions of pages whenever the manifest changes. Could you try again after clearing the cache and then shift-refreshing?
I removed all my browsing data (clear cache and clear data from hosted apps), shift-refresh, used another browser, etc. But I still get a "blank" page (with "blank" I mean there is no content into the id="doc3" div element).
Created attachment 19346 [details] [review] 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. Finally, this patch adds a link to the Pending offline operations page on the synchronize page for easier navigation.
Created attachment 19347 [details] [review] 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. Finally, this patch adds a link to the Pending offline operations page on the synchronize page for easier navigation.
> I get a blank page on the check out page > (circ/offline.pl#offline-circulation). The last patch fixes that, switch back to Needs Signoff I found some others small problems: - The tab of checkouts always shows "*0* Checkouts" - If I try to check in a nonexistent barcode, I get a warning message but the line is added to the table (maybe not a bug but a feature?) - 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)). No blocker for testing.
Created attachment 19353 [details] [review] 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.
Created attachment 19528 [details] [review] Bug 10240 follow-up: don't delete transactions if auth fails When uploading transactions, we were not checking that authentication had succeeded before deleting the transactions from the local database. That was bad. With this patch, we check. That is good.
Created attachment 20554 [details] [review] Bug 10240: Offline circulation using HTML5 and IndexedDB This patch adds an HTML5-based offline mode to Koha's existing circulation module, allowing librarians to check out items using a basically familiar interface. The feature will be implemented using the Application Cache and IndexedDB features of the HTML5 specification, both of which are fully supported on Firefox 10+ and Chrome 23+, with limited support going back to Firefox 4 and Chrome 11. The basic workflow enabled by this patch is as follows: Part 1: While connected to the Internet 1. Enable offline functionality by turning on the "AllowOfflineCirculation" system preference. 2. Sync the offline circulation database on the computer that will be used for offline circulation by following the "Offline circulation interface" link on the Circulation home page, choosing "Synchronize (must be online)", and clicking the "Download records" button. This process may take a while. 3. Bookmark /cgi-bin/koha/circ/offline.pl (the page you are currently on) for easy access when offline. Part 2: While disconnected from the Internet 4. Navigate to /cgi-bin/koha/circ/offline.pl using the bookmark you created while online. 5. Start checking books in by scanning the barcode of an item that has been returned into the box in the "Check in" tab. 6. Scan the barcodes of any additional items that have been returned. 7. Start checking out books to a patron by scanning the patron's barcode in the box in the "Check out" tab. 8. Set a due date (the "Remember for session" box will be checked by default, since circulation rules are not computed during offline transactions and therefore a due date must be specified by the librarian). 9. Scan an item barcode (if you did not set a due date, it will prompt you) to check the item out to the patron. 10. If a patron has a fine you can see the total amount (current to when the offline module was synced), and record a payment. Unlike when in online mode, there will be no breakdown of what item(s) fines are for, and you will only be able to record the payment amount and not associate it with a particular item. Part 3: While connected to the Internet 11. Click the "Synchronize" link and choose "Upload transactions" to upload the transactions recorded during the offline circulation session. 12. Navigate to /cgi-bin/koha/offline_circ/list.pl (there will be a link from the Offline circulation page) and review the transactions, as described in the documentation for the Firefox Offline circulation plugin: http://wiki.koha-community.org/wiki/Offline_circulation_firefox_plugin Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Created attachment 20555 [details] [review] 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.
Created attachment 20556 [details] [review] Bug 10240 follow-up: don't delete transactions if auth fails When uploading transactions, we were not checking that authentication had succeeded before deleting the transactions from the local database. That was bad. With this patch, we check. That is good. Rebased on latest master.
Some Problems i have found. 1) After paying a fine when offline the fine amount becomes NaN. 2) For previous checkouts for a pratron the title and barcode fields have the wrong infomation in them (ie they have been swapped.)
Created attachment 20762 [details] [review] Bug 10240 follow-up: fix display Fix the following two issues: 1) After paying a fine when offline the fine amount becomes NaN. 2) For previous checkouts for a pratron the title and barcode fields have the wrong infomation in them (i.e. they have been swapped)
Created attachment 20995 [details] [review] Bug 10240 follow-up: disable logout/set library Logging out/setting the library does not work while using offline mode, so it makes no sense to present those options to the user. Much better is some sort of explanatory message informing them that those two links don't work.
Applying: Bug 10240: Offline circulation using HTML5 and IndexedDB Using index info to reconstruct a base tree... M installer/data/mysql/sysprefs.sql M installer/data/mysql/updatedatabase.pl M koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css M koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref Falling back to patching base and 3-way merge... Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref Auto-merging koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css Auto-merging installer/data/mysql/updatedatabase.pl CONFLICT (content): Merge conflict in installer/data/mysql/updatedatabase.pl Auto-merging installer/data/mysql/sysprefs.sql Patch failed at 0001 Bug 10240: Offline circulation using HTML5 and IndexedDB The copy of the patch that failed is found in: /home/christopher/git/koha/.git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
Created attachment 21157 [details] [review] Bug 10240: Offline circulation using HTML5 and IndexedDB This patch adds an HTML5-based offline mode to Koha's existing circulation module, allowing librarians to check out items using a basically familiar interface. The feature will be implemented using the Application Cache and IndexedDB features of the HTML5 specification, both of which are fully supported on Firefox 10+ and Chrome 23+, with limited support going back to Firefox 4 and Chrome 11. The basic workflow enabled by this patch is as follows: Part 1: While connected to the Internet 1. Enable offline functionality by turning on the "AllowOfflineCirculation" system preference. 2. Sync the offline circulation database on the computer that will be used for offline circulation by following the "Offline circulation interface" link on the Circulation home page, choosing "Synchronize (must be online)", and clicking the "Download records" button. This process may take a while. 3. Bookmark /cgi-bin/koha/circ/offline.pl (the page you are currently on) for easy access when offline. Part 2: While disconnected from the Internet 4. Navigate to /cgi-bin/koha/circ/offline.pl using the bookmark you created while online. 5. Start checking books in by scanning the barcode of an item that has been returned into the box in the "Check in" tab. 6. Scan the barcodes of any additional items that have been returned. 7. Start checking out books to a patron by scanning the patron's barcode in the box in the "Check out" tab. 8. Set a due date (the "Remember for session" box will be checked by default, since circulation rules are not computed during offline transactions and therefore a due date must be specified by the librarian). 9. Scan an item barcode (if you did not set a due date, it will prompt you) to check the item out to the patron. 10. If a patron has a fine you can see the total amount (current to when the offline module was synced), and record a payment. Unlike when in online mode, there will be no breakdown of what item(s) fines are for, and you will only be able to record the payment amount and not associate it with a particular item. Part 3: While connected to the Internet 11. Click the "Synchronize" link and choose "Upload transactions" to upload the transactions recorded during the offline circulation session. 12. Navigate to /cgi-bin/koha/offline_circ/list.pl (there will be a link from the Offline circulation page) and review the transactions, as described in the documentation for the Firefox Offline circulation plugin: http://wiki.koha-community.org/wiki/Offline_circulation_firefox_plugin Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Created attachment 21158 [details] [review] 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.
Created attachment 21159 [details] [review] Bug 10240 follow-up: don't delete transactions if auth fails When uploading transactions, we were not checking that authentication had succeeded before deleting the transactions from the local database. That was bad. With this patch, we check. That is good.
Created attachment 21160 [details] [review] Bug 10240 follow-up: fix display Fix the following two issues: 1) After paying a fine when offline the fine amount becomes NaN. 2) For previous checkouts for a pratron the title and barcode fields have the wrong infomation in them (i.e. they have been swapped)
Created attachment 21161 [details] [review] Bug 10240 follow-up: disable logout/set library Logging out/setting the library does not work while using offline mode, so it makes no sense to present those options to the user. Much better is some sort of explanatory message informing them that those two links don't work.
Created attachment 21495 [details] [review] Bug 10240: Offline circulation using HTML5 and IndexedDB This patch adds an HTML5-based offline mode to Koha's existing circulation module, allowing librarians to check out items using a basically familiar interface. The feature will be implemented using the Application Cache and IndexedDB features of the HTML5 specification, both of which are fully supported on Firefox 10+ and Chrome 23+, with limited support going back to Firefox 4 and Chrome 11. The basic workflow enabled by this patch is as follows: Part 1: While connected to the Internet 1. Enable offline functionality by turning on the "AllowOfflineCirculation" system preference. 2. Sync the offline circulation database on the computer that will be used for offline circulation by following the "Offline circulation interface" link on the Circulation home page, choosing "Synchronize (must be online)", and clicking the "Download records" button. This process may take a while. 3. Bookmark /cgi-bin/koha/circ/offline.pl (the page you are currently on) for easy access when offline. Part 2: While disconnected from the Internet 4. Navigate to /cgi-bin/koha/circ/offline.pl using the bookmark you created while online. 5. Start checking books in by scanning the barcode of an item that has been returned into the box in the "Check in" tab. 6. Scan the barcodes of any additional items that have been returned. 7. Start checking out books to a patron by scanning the patron's barcode in the box in the "Check out" tab. 8. Set a due date (the "Remember for session" box will be checked by default, since circulation rules are not computed during offline transactions and therefore a due date must be specified by the librarian). 9. Scan an item barcode (if you did not set a due date, it will prompt you) to check the item out to the patron. 10. If a patron has a fine you can see the total amount (current to when the offline module was synced), and record a payment. Unlike when in online mode, there will be no breakdown of what item(s) fines are for, and you will only be able to record the payment amount and not associate it with a particular item. Part 3: While connected to the Internet 11. Click the "Synchronize" link and choose "Upload transactions" to upload the transactions recorded during the offline circulation session. 12. Navigate to /cgi-bin/koha/offline_circ/list.pl (there will be a link from the Offline circulation page) and review the transactions, as described in the documentation for the Firefox Offline circulation plugin: http://wiki.koha-community.org/wiki/Offline_circulation_firefox_plugin Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Created attachment 21496 [details] [review] 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.
Created attachment 21497 [details] [review] Bug 10240 follow-up: don't delete transactions if auth fails When uploading transactions, we were not checking that authentication had succeeded before deleting the transactions from the local database. That was bad. With this patch, we check. That is good.
Created attachment 21498 [details] [review] Bug 10240 follow-up: fix display Fix the following two issues: 1) After paying a fine when offline the fine amount becomes NaN. 2) For previous checkouts for a pratron the title and barcode fields have the wrong infomation in them (i.e. they have been swapped)
Created attachment 21499 [details] [review] Bug 10240 follow-up: disable logout/set library Logging out/setting the library does not work while using offline mode, so it makes no sense to present those options to the user. Much better is some sort of explanatory message informing them that those two links don't work.
Created attachment 21500 [details] [review] Bug 10240: warn when patron's card is expired This patch improves the alert messages to be slightly better English and warns the librarian if a patron's card has expired. Like all alerts, this is non-fatal since in the case of network failure there is no particular reason to expect that the offline database is current. To test this particular patch you can try checking something out to an expired patron, otherwise test plan remains the same as above.
Tested and works, with Firefox 24.0. Questions 1) At first I have problems with diacritics, title an author showed funny chars in position of accented letters on checkout/in pages. To test more I loaded arabic records and then all was fine. Don't know how that was fixed. I have screen captures 2) I can checkin many times one title, that was no problem un re-sycronize, only states that the item is not checked-out 3) I can checkout many times a title to the same patron. On synchronization all seems fine, but fines/charges are computed for every checkout, so I ended up owing for more than one item
(In reply to Bernardo Gonzalez Kriegel from comment #45) > Tested and works, with Firefox 24.0. > > Questions > 1) At first I have problems with diacritics, title an author showed funny > chars in position of accented letters on checkout/in pages. To test more I > loaded arabic records and then all was fine. Don't know how that was fixed. > I have screen captures Could you please e-mail them to me? I don't have problems with accents on my installation. > 2) I can checkin many times one title, that was no problem un re-sycronize, > only states that the item is not checked-out > > 3) I can checkout many times a title to the same patron. On synchronization > all seems fine, but fines/charges are computed for every checkout, so I > ended up owing for more than one item That's by design. If you use hourly loans, you could check out a book to a person several times before going back online.
Created attachment 21552 [details] [review] Bug 10240 follow-up: make sure datepicker icons are available offline The next month/previous month icons for the datepicker were not available offline. With this patch they are.
Created attachment 21553 [details] [review] Bug 10240 follow-up: make sure datepicker icons are available offline The next month/previous month icons for the datepicker were not available offline. With this patch they are.
Created attachment 21554 [details] [review] [SIGNED-OFF] Bug 10240: Offline circulation using HTML5 and IndexedDB This patch adds an HTML5-based offline mode to Koha's existing circulation module, allowing librarians to check out items using a basically familiar interface. The feature will be implemented using the Application Cache and IndexedDB features of the HTML5 specification, both of which are fully supported on Firefox 10+ and Chrome 23+, with limited support going back to Firefox 4 and Chrome 11. The basic workflow enabled by this patch is as follows: Part 1: While connected to the Internet 1. Enable offline functionality by turning on the "AllowOfflineCirculation" system preference. 2. Sync the offline circulation database on the computer that will be used for offline circulation by following the "Offline circulation interface" link on the Circulation home page, choosing "Synchronize (must be online)", and clicking the "Download records" button. This process may take a while. 3. Bookmark /cgi-bin/koha/circ/offline.pl (the page you are currently on) for easy access when offline. Part 2: While disconnected from the Internet 4. Navigate to /cgi-bin/koha/circ/offline.pl using the bookmark you created while online. 5. Start checking books in by scanning the barcode of an item that has been returned into the box in the "Check in" tab. 6. Scan the barcodes of any additional items that have been returned. 7. Start checking out books to a patron by scanning the patron's barcode in the box in the "Check out" tab. 8. Set a due date (the "Remember for session" box will be checked by default, since circulation rules are not computed during offline transactions and therefore a due date must be specified by the librarian). 9. Scan an item barcode (if you did not set a due date, it will prompt you) to check the item out to the patron. 10. If a patron has a fine you can see the total amount (current to when the offline module was synced), and record a payment. Unlike when in online mode, there will be no breakdown of what item(s) fines are for, and you will only be able to record the payment amount and not associate it with a particular item. Part 3: While connected to the Internet 11. Click the "Synchronize" link and choose "Upload transactions" to upload the transactions recorded during the offline circulation session. 12. Navigate to /cgi-bin/koha/offline_circ/list.pl (there will be a link from the Offline circulation page) and review the transactions, as described in the documentation for the Firefox Offline circulation plugin: http://wiki.koha-community.org/wiki/Offline_circulation_firefox_plugin Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Comment: Works very well, no koha-qa errors Test with Firefox 24.0 1) did some checkouts pre sync 2) synchronize database (Download) 3) go offline 4) Proceed to checkin some items from patron 5) Proceed to checkout items to patrons, setting date 6) Proceed to checkout to expired patron, warning appears 7) go online 8) Upload records 9) go to review transacctions and proceed 10) verified on patrons that checkin/out are done
Created attachment 21555 [details] [review] [SIGNED-OFF] 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>
Created attachment 21556 [details] [review] [SIGNED-OFF] Bug 10240 follow-up: don't delete transactions if auth fails When uploading transactions, we were not checking that authentication had succeeded before deleting the transactions from the local database. That was bad. With this patch, we check. That is good. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Created attachment 21557 [details] [review] [SIGNED-OFF] Bug 10240 follow-up: fix display Fix the following two issues: 1) After paying a fine when offline the fine amount becomes NaN. 2) For previous checkouts for a pratron the title and barcode fields have the wrong infomation in them (i.e. they have been swapped) Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Created attachment 21558 [details] [review] [SIGNED-OFF] Bug 10240 follow-up: disable logout/set library Logging out/setting the library does not work while using offline mode, so it makes no sense to present those options to the user. Much better is some sort of explanatory message informing them that those two links don't work. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Created attachment 21559 [details] [review] [SIGNED-OFF] Bug 10240: warn when patron's card is expired This patch improves the alert messages to be slightly better English and warns the librarian if a patron's card has expired. Like all alerts, this is non-fatal since in the case of network failure there is no particular reason to expect that the offline database is current. To test this particular patch you can try checking something out to an expired patron, otherwise test plan remains the same as above. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Created attachment 21560 [details] [review] [SIGNED-OFF] Bug 10240 follow-up: make sure datepicker icons are available offline The next month/previous month icons for the datepicker were not available offline. With this patch they are. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Created attachment 21573 [details] [review] Bug 10240: Offline circulation using HTML5 and IndexedDB This patch adds an HTML5-based offline mode to Koha's existing circulation module, allowing librarians to check out items using a basically familiar interface. The feature will be implemented using the Application Cache and IndexedDB features of the HTML5 specification, both of which are fully supported on Firefox 10+ and Chrome 23+, with limited support going back to Firefox 4 and Chrome 11. The basic workflow enabled by this patch is as follows: Part 1: While connected to the Internet 1. Enable offline functionality by turning on the "AllowOfflineCirculation" system preference. 2. Sync the offline circulation database on the computer that will be used for offline circulation by following the "Offline circulation interface" link on the Circulation home page, choosing "Synchronize (must be online)", and clicking the "Download records" button. This process may take a while. 3. Bookmark /cgi-bin/koha/circ/offline.pl (the page you are currently on) for easy access when offline. Part 2: While disconnected from the Internet 4. Navigate to /cgi-bin/koha/circ/offline.pl using the bookmark you created while online. 5. Start checking books in by scanning the barcode of an item that has been returned into the box in the "Check in" tab. 6. Scan the barcodes of any additional items that have been returned. 7. Start checking out books to a patron by scanning the patron's barcode in the box in the "Check out" tab. 8. Set a due date (the "Remember for session" box will be checked by default, since circulation rules are not computed during offline transactions and therefore a due date must be specified by the librarian). 9. Scan an item barcode (if you did not set a due date, it will prompt you) to check the item out to the patron. 10. If a patron has a fine you can see the total amount (current to when the offline module was synced), and record a payment. Unlike when in online mode, there will be no breakdown of what item(s) fines are for, and you will only be able to record the payment amount and not associate it with a particular item. Part 3: While connected to the Internet 11. Click the "Synchronize" link and choose "Upload transactions" to upload the transactions recorded during the offline circulation session. 12. Navigate to /cgi-bin/koha/offline_circ/list.pl (there will be a link from the Offline circulation page) and review the transactions, as described in the documentation for the Firefox Offline circulation plugin: http://wiki.koha-community.org/wiki/Offline_circulation_firefox_plugin Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Comment: Works very well, no koha-qa errors Test with Firefox 24.0 1) did some checkouts pre sync 2) synchronize database (Download) 3) go offline 4) Proceed to checkin some items from patron 5) Proceed to checkout items to patrons, setting date 6) Proceed to checkout to expired patron, warning appears 7) go online 8) Upload records 9) go to review transacctions and proceed 10) verified on patrons that checkin/out are done Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Created attachment 21574 [details] [review] 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>
Created attachment 21575 [details] [review] Bug 10240 follow-up: don't delete transactions if auth fails When uploading transactions, we were not checking that authentication had succeeded before deleting the transactions from the local database. That was bad. With this patch, we check. That is good. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Created attachment 21576 [details] [review] Bug 10240 follow-up: fix display Fix the following two issues: 1) After paying a fine when offline the fine amount becomes NaN. 2) For previous checkouts for a pratron the title and barcode fields have the wrong infomation in them (i.e. they have been swapped) Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Created attachment 21577 [details] [review] Bug 10240 follow-up: disable logout/set library Logging out/setting the library does not work while using offline mode, so it makes no sense to present those options to the user. Much better is some sort of explanatory message informing them that those two links don't work. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Created attachment 21578 [details] [review] Bug 10240: warn when patron's card is expired This patch improves the alert messages to be slightly better English and warns the librarian if a patron's card has expired. Like all alerts, this is non-fatal since in the case of network failure there is no particular reason to expect that the offline database is current. To test this particular patch you can try checking something out to an expired patron, otherwise test plan remains the same as above. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Created attachment 21579 [details] [review] Bug 10240 follow-up: make sure datepicker icons are available offline The next month/previous month icons for the datepicker were not available offline. With this patch they are. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Jared, I really would like to mark this feature as passed qa but I think I found 2 potential blocker things: 1/ I am under the impression that the payment don't work To reproduce: online: checkout/checkin an item in order to produce a fine offline: the alert appears, I make the payment, upload the transaction, execute the action. In the payment list, there is a new line: Payment,thanks 0.00 0.00 2/ Why don't you block a checkout to a restricted user? Minor: The search by partial name does not work, only a checkout using a cardnumber works (contrary to what it is displayed). For discussion.
(In reply to Jonathan Druart from comment #63) > Jared, > I really would like to mark this feature as passed qa but I think I found 2 > potential blocker things: > 1/ I am under the impression that the payment don't work > To reproduce: > online: checkout/checkin an item in order to produce a fine > offline: the alert appears, I make the payment, upload the transaction, > execute the action. > In the payment list, there is a new line: > Payment,thanks 0.00 0.00 I will check this. > 2/ Why don't you block a checkout to a restricted user? If the offline database is out-of-date (because, for example, you're using offline circ due to an unplanned outage), you don't want to be blocking people from checking out. Same reason an incorrect barcode can't block circ: it could be a new book. > Minor: The search by partial name does not work, only a checkout using a > cardnumber works (contrary to what it is displayed). Good point. I'll change that label. I never even thought about it, since it's generated elsewhere in Koha.
Created attachment 21718 [details] [review] Bug 10240 QA follow-up: correctly record fines and fix label At some point in rebasing I managed to remove the part of the code that saved fine payments. This patch re-adds that feature. This patch also corrects the label on the check out tab to not mention partial names for checkouts when offline, and partial name searches are not supported in offline circ.
Thanks Jared for your quick patch! QA comment: I follow this feature from the beginning and all detected issues have been taken into consideration. Further improvement: displays the list of checkout and payment for a patron. At the moment, if a librarian go back on the checkout page, the previous (but not processed!) offline operations are not shown). Marked as Passed QA.
Created attachment 21719 [details] [review] Bug 10240: Offline circulation using HTML5 and IndexedDB This patch adds an HTML5-based offline mode to Koha's existing circulation module, allowing librarians to check out items using a basically familiar interface. The feature will be implemented using the Application Cache and IndexedDB features of the HTML5 specification, both of which are fully supported on Firefox 10+ and Chrome 23+, with limited support going back to Firefox 4 and Chrome 11. The basic workflow enabled by this patch is as follows: Part 1: While connected to the Internet 1. Enable offline functionality by turning on the "AllowOfflineCirculation" system preference. 2. Sync the offline circulation database on the computer that will be used for offline circulation by following the "Offline circulation interface" link on the Circulation home page, choosing "Synchronize (must be online)", and clicking the "Download records" button. This process may take a while. 3. Bookmark /cgi-bin/koha/circ/offline.pl (the page you are currently on) for easy access when offline. Part 2: While disconnected from the Internet 4. Navigate to /cgi-bin/koha/circ/offline.pl using the bookmark you created while online. 5. Start checking books in by scanning the barcode of an item that has been returned into the box in the "Check in" tab. 6. Scan the barcodes of any additional items that have been returned. 7. Start checking out books to a patron by scanning the patron's barcode in the box in the "Check out" tab. 8. Set a due date (the "Remember for session" box will be checked by default, since circulation rules are not computed during offline transactions and therefore a due date must be specified by the librarian). 9. Scan an item barcode (if you did not set a due date, it will prompt you) to check the item out to the patron. 10. If a patron has a fine you can see the total amount (current to when the offline module was synced), and record a payment. Unlike when in online mode, there will be no breakdown of what item(s) fines are for, and you will only be able to record the payment amount and not associate it with a particular item. Part 3: While connected to the Internet 11. Click the "Synchronize" link and choose "Upload transactions" to upload the transactions recorded during the offline circulation session. 12. Navigate to /cgi-bin/koha/offline_circ/list.pl (there will be a link from the Offline circulation page) and review the transactions, as described in the documentation for the Firefox Offline circulation plugin: http://wiki.koha-community.org/wiki/Offline_circulation_firefox_plugin Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Comment: Works very well, no koha-qa errors Test with Firefox 24.0 1) did some checkouts pre sync 2) synchronize database (Download) 3) go offline 4) Proceed to checkin some items from patron 5) Proceed to checkout items to patrons, setting date 6) Proceed to checkout to expired patron, warning appears 7) go online 8) Upload records 9) go to review transacctions and proceed 10) verified on patrons that checkin/out are done Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Created attachment 21720 [details] [review] 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>
Created attachment 21721 [details] [review] Bug 10240 follow-up: don't delete transactions if auth fails When uploading transactions, we were not checking that authentication had succeeded before deleting the transactions from the local database. That was bad. With this patch, we check. That is good. 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>
Created attachment 21722 [details] [review] Bug 10240 follow-up: fix display Fix the following two issues: 1) After paying a fine when offline the fine amount becomes NaN. 2) For previous checkouts for a pratron the title and barcode fields have the wrong infomation in them (i.e. they have been swapped) 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>
Created attachment 21723 [details] [review] Bug 10240 follow-up: disable logout/set library Logging out/setting the library does not work while using offline mode, so it makes no sense to present those options to the user. Much better is some sort of explanatory message informing them that those two links don't work. 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>
Created attachment 21724 [details] [review] Bug 10240: warn when patron's card is expired This patch improves the alert messages to be slightly better English and warns the librarian if a patron's card has expired. Like all alerts, this is non-fatal since in the case of network failure there is no particular reason to expect that the offline database is current. To test this particular patch you can try checking something out to an expired patron, otherwise test plan remains the same as above. 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>
Created attachment 21725 [details] [review] Bug 10240 follow-up: make sure datepicker icons are available offline The next month/previous month icons for the datepicker were not available offline. With this patch they are. 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>
Created attachment 21726 [details] [review] Bug 10240 QA follow-up: correctly record fines and fix label At some point in rebasing I managed to remove the part of the code that saved fine payments. This patch re-adds that feature. This patch also corrects the label on the check out tab to not mention partial names for checkouts when offline, and partial name searches are not supported in offline circ. Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Pushed to master. Thanks, Jared!