koha.git
4 years agoBug 17359: Correct encoding when displaying patron import summary
Jonathan Druart [Wed, 16 Oct 2019 08:47:28 +0000 (10:47 +0200)]
Bug 17359: Correct encoding when displaying patron import summary

There is an encoding issue when the patron import summry, the string
must be UTF8 decoded before being sent to the template.

Test plan:
- Create a patron import CSV file with import issues. Use UTF8 characters.
See file attached to the bug report 'patron_import.csv'
=> The screen should display the line correctly
- Correct the import issue (add a surname for Chloé)
=> The imported patrons should contain the correct values.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 17359: Add tests
Jonathan Druart [Wed, 16 Oct 2019 08:22:38 +0000 (10:22 +0200)]
Bug 17359: Add tests

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23968: Add div this id around OPACMySummaryNote content
Fridolin Somers [Tue, 5 Nov 2019 08:55:25 +0000 (09:55 +0100)]
Bug 23968: Add div this id around OPACMySummaryNote content

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23968: fix OPACMySummaryNote feature
Fridolin Somers [Tue, 5 Nov 2019 08:52:59 +0000 (09:52 +0100)]
Bug 23968: fix OPACMySummaryNote feature

The system preference OPACMySummaryNote is used to display on the logged-in patron summary page at OPAC.
It does not display anymore.

Looks like it comes from code :
[% IF OPACMySummaryNote %][% Koha.Preference('OPACMySummaryNote') | $raw %][% END %]
OPACMySummaryNote used to be a provided variable.

Test plan:
1) Enable system preference OPACMySummaryNote
2) Enter some HTML into it
3) Go to OPAC and loggin
4) Check you see the HTML in opac-user.pl
5) Disable the preference
6) Check you dont see the HTML anymore

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 11514: Untranslatable "Uncertain" text in acq
Owen Leonard [Wed, 17 Apr 2019 18:44:27 +0000 (18:44 +0000)]
Bug 11514: Untranslatable "Uncertain" text in acq

This patch modifies two pages so that the "Uncertain price" information
is shown by the template rather than the Perl script, making the text
translatable.

To test, apply the patch and go to Acquisitions.

 - Locate or create an order in a basket which has an uncertain price.
 - When viewing the contents of that basket the order which was marked
   as having an uncertain price should be labeled "Uncertain."
 - The same should be true for the invoice page. If you don't have an
   existing invoice with an "uncertain" order,
   - Go to "Receive shipments" for the vendor your "uncertain" order is
     with.
   - Create a new invoice.
   - Receive one or more orders which has an uncertain price.
   - Press the "finish receiving" button.
   - In the "Invoice details" section of the invoice page you should
     see the "Uncertain" label on the correct order.

Signed-off-by: Christophe Croullebois <christophe.croullebois@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
For the invoice view: close, receive, reopen, mark prices uncertain, go
to the invoice page (not sure it's expected however)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23382: (RM follow-up) Ensure tests pass on Wednesdays
Martin Renvoize [Wed, 6 Nov 2019 14:45:12 +0000 (14:45 +0000)]
Bug 23382: (RM follow-up) Ensure tests pass on Wednesdays

Koha::Calendar assumes we never issue an item on a closed day.. this is
a fair assumption but the hardcoded closed day in our tests means it
does not hold true in this case.

This patch sets the closed day dynamically to prevent such a case.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23523: (follow-up) Clarify meaning configurations in tests
Nick Clemens [Wed, 6 Nov 2019 12:12:31 +0000 (12:12 +0000)]
Bug 23523: (follow-up) Clarify meaning configurations in tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23523: (follow-up) Adjust tests for new expectations
Nick Clemens [Wed, 6 Nov 2019 12:09:11 +0000 (12:09 +0000)]
Bug 23523: (follow-up) Adjust tests for new expectations

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23068: (RM follow-up) Make Net::Netmask required
Martin Renvoize [Wed, 6 Nov 2019 12:09:49 +0000 (12:09 +0000)]
Bug 23068: (RM follow-up) Make Net::Netmask required

Net::Netmask is used in the new Plack::Middleware::RealIP module, which
is in turn used in the psgi plack startup script.  We don't have access
to C4::Context inside the startup script and as such don't have access
to the config to work out if loading this module should be optional.

As such, I'm taking the easy route and just making the dependancy a
required one. It's small and already packaged for debian and as such
should not cause anyone any issues.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23382: (RM follow-up) Revert "hours_between should match..."
Martin Renvoize [Tue, 5 Nov 2019 14:18:28 +0000 (14:18 +0000)]
Bug 23382: (RM follow-up) Revert "hours_between should match..."

This reverts commit a693c7243c23f888e2fad38a4fff9f37ff4a9301 which
caused regressions.

The original loop compared start date to end date and iterated all the
way to start date equals end date. The alternate implimentation
inadvertantly looped from start date, skipped the first day then
iterated up to one day beyond end date.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23050: (RM follow-up) Add Try::Tiny to controller
Martin Renvoize [Tue, 5 Nov 2019 13:53:06 +0000 (13:53 +0000)]
Bug 23050: (RM follow-up) Add Try::Tiny to controller

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23050: (QA follow-up) Add Koha::Plugins::Tab class
Tomas Cohen Arazi [Mon, 4 Nov 2019 14:52:33 +0000 (11:52 -0300)]
Bug 23050: (QA follow-up) Add Koha::Plugins::Tab class

This minimal class encapsulates the tabs to be passed around to the
templates, so error checking on missing bits is done in a single place.

It throws exceptions on errors

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23050: Fix creation of biblio tab's id
Julian Maurice [Mon, 30 Sep 2019 08:10:17 +0000 (10:10 +0200)]
Bug 23050: Fix creation of biblio tab's id

(Too much javascript in my head...)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23050: Fix tab's id to avoid compatibility issues
Julian Maurice [Mon, 15 Jul 2019 12:28:47 +0000 (14:28 +0200)]
Bug 23050: Fix tab's id to avoid compatibility issues

MDN says:

  Using characters except ASCII letters, digits, '_', '-' and '.' may
  cause compatibility problems, as they weren't allowed in HTML 4.
  Though this restriction has been lifted in HTML5, an ID should start
  with a letter for compatibility.

https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23050: Add missing template filters
Julian Maurice [Mon, 15 Jul 2019 12:10:25 +0000 (14:10 +0200)]
Bug 23050: Add missing template filters

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23050: Plugin hook to add tabs in intranet biblio details page
Julian Maurice [Wed, 5 Jun 2019 14:26:34 +0000 (16:26 +0200)]
Bug 23050: Plugin hook to add tabs in intranet biblio details page

Test Plan:
1) Enable plugins
2) Download and install the latest version of this plugin
https://git.biblibre.com/biblibre/koha-plugin-intranet-detail-hook
3) Browse to catalogue/detail.pl for a record
4) Note you see two new tabs with content

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23522: (QA follow-up) Typo fix in comment
Martin Renvoize [Mon, 4 Nov 2019 20:25:11 +0000 (20:25 +0000)]
Bug 23522: (QA follow-up) Typo fix in comment

Tiny typo fix in a new code comment

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23522: Show actual price on in baskets
Nick Clemens [Thu, 29 Aug 2019 14:51:16 +0000 (14:51 +0000)]
Bug 23522: Show actual price on in baskets

To test:
 1 - Create a new basket in acq, mark it as 'standing'
 2 - Add an item, leave the RRP and Vendor price as 0
 3 - Receive shipments for the vendor
 4 - Select the title from this basket
 5 - On receipt enter an actual cost
 6 - Finsih receiving
 7 - Go to the basket
 8 - Note the total for the order and the basket are 0, keep this browser tab open
 9 - Open a new browser tab and create a new non standing basket
10 - Add to basket, again with no RRP or vendor price
11 - Close the basket, receive the item
12 - Enter an actual cost on receipt
13 - Return to view the basket
14 - Total and order are $0
15 - Apply patch
16 - Refresh the basket in both tabs
17 - You now see the actual price for the orders

Signed-off-by: Rhonda Kuiper <rkuiper@roundrocktexas.gov>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23523: (QA follow-up) Minor POD corrections
Martin Renvoize [Mon, 4 Nov 2019 20:12:58 +0000 (20:12 +0000)]
Bug 23523: (QA follow-up) Minor POD corrections

This just fixes a couple of typos in the POD that predate this patch but
I noticed whilst QAing this ;)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23523: unitprice tax column values are not populated if entered upon ordering
Nick Clemens [Thu, 29 Aug 2019 18:42:24 +0000 (18:42 +0000)]
Bug 23523: unitprice tax column values are not populated if entered upon ordering

To test:
 1 - Add an item to an acquisitions basket
 2 - Make sure to enter 'Actual cost'
 3 - Check the db:
    SELECT * FROM aqorders WHERE ordernumber={your ordernumber}
 4 - Note that unitprice_tax_included and unitprice_tax_excluded are not populated
 5 - Apply patch
 6 - Edit that order
 7 - Check DB
 8 - Values should be populated
 9 - Place another order, ensude values populated on creation
10 - QA people: prove -v t/db_dependent/Acquisition/populate_order_with_prices.t

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23234: Mock DateTime->now using the time zone
Jonathan Druart [Thu, 24 Oct 2019 10:29:23 +0000 (12:29 +0200)]
Bug 23234: Mock DateTime->now using the time zone

The timezone of the two dt was different, one was UTC, the other one was
my local one.
When we mocked DateTime->now we did not use the time zone, we must use
dt_from_string instead

Test plan:
Make sure your environment has a different time zone than UTC
`prove t/db_dependent/Circulation.t` should fail without this patch

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23181: Unable to use payment library in ACCOUNT_PAYMENT or ACCOUNT_WRITEOFF notices
Kyle M Hall [Fri, 21 Jun 2019 12:51:15 +0000 (08:51 -0400)]
Bug 23181: Unable to use payment library in ACCOUNT_PAYMENT or ACCOUNT_WRITEOFF notices

Do to a simple semantic typo, the branches key will always be null for the tables key of the parameters for GetPreparedLetter.

Test Plan:
0) Activate UseEmailReceipts
1) Attempt to use [% branch.branchname %] in the ACCOUNT_PAYMENT notice
2) Note it produces no output
3) Apply this patch
4) Make another payment
5) You should now see the branche's name!

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Also requires UseEmailReceipts to be activated.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23181: Extend unit tests
Katrin Fischer [Sat, 2 Nov 2019 01:05:06 +0000 (01:05 +0000)]
Bug 23181: Extend unit tests

Run t/db_dependent/Accounts.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23429: ilsdi.pl GetRecords documentation does not match output
Jon Knight [Wed, 21 Aug 2019 14:14:19 +0000 (15:14 +0100)]
Bug 23429: ilsdi.pl GetRecords documentation does not match output

Updated contents of Describe for GetRecords to match current behaviour.

To test, ensure ILSDI is configured and then compare the output of:

http://yourserver/cgi-bin/koha/ilsdi.pl?service=Describe&verb=GetRecords

before and after applying the patch. Note that afterwards it includes
things like <onloan> and has removed elements such as <date_due> that no
longer get returned.

https://bugs.koha-community.org/show_bug.cgi?id=23429

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23963: Revert bug 21987 to restore image quality
Martin Renvoize [Mon, 4 Nov 2019 13:25:19 +0000 (13:25 +0000)]
Bug 23963: Revert bug 21987 to restore image quality

Bug 21987 had unexpected effects upon image quality for thumbnails.
Currently, we are working to resolve those issues but have not managed
to correct them inside the release window for this cycle. As such, I
have chosen to revert the original bug whilst we work on a resolution.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoRevert "Bug 21987: Add tests"
Martin Renvoize [Mon, 4 Nov 2019 13:21:16 +0000 (13:21 +0000)]
Revert "Bug 21987: Add tests"

This reverts commit afb39b132b10b74efec31cd8191cdcd72a61d8d3.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoRevert "Bug 21987: Do not generate true color thumbnails if not needed"
Martin Renvoize [Mon, 4 Nov 2019 13:21:13 +0000 (13:21 +0000)]
Revert "Bug 21987: Do not generate true color thumbnails if not needed"

This reverts commit 5c41d584cb654efbfd8c854bac0d30d87a054ab5.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoRevert "Bug 21987: (RM follow-up) Add text for simple tests"
Martin Renvoize [Mon, 4 Nov 2019 13:21:09 +0000 (13:21 +0000)]
Revert "Bug 21987: (RM follow-up) Add text for simple tests"

This reverts commit 1464328718619a673f233406fdb238f0391b0785.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23903: (QA follow-up) Fix selenium tests
Jonathan Druart [Mon, 4 Nov 2019 11:01:21 +0000 (12:01 +0100)]
Bug 23903: (QA follow-up) Fix selenium tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22581: (RM follow-up) Add sysprefs to Search.t
Martin Renvoize [Mon, 4 Nov 2019 10:43:49 +0000 (10:43 +0000)]
Bug 22581: (RM follow-up) Add sysprefs to Search.t

This patch adds explicit disablement of the sysprefs introduced by this
bug to the Search.t test to silence warnings.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23834: (RM follow-up) Add new file to Makefile.PL
Martin Renvoize [Mon, 4 Nov 2019 10:09:40 +0000 (10:09 +0000)]
Bug 23834: (RM follow-up) Add new file to Makefile.PL

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22581: DBRev 19.06.00.048
Martin Renvoize [Sun, 3 Nov 2019 08:14:08 +0000 (08:14 +0000)]
Bug 22581: DBRev 19.06.00.048

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22581: (RM follow-up) Add License to about page.
Martin Renvoize [Sun, 3 Nov 2019 08:10:42 +0000 (08:10 +0000)]
Bug 22581: (RM follow-up) Add License to about page.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22581: Show and play musical inscripts
Agustin Moyano [Mon, 28 Oct 2019 21:15:22 +0000 (18:15 -0300)]
Bug 22581: Show and play musical inscripts

This patch adds musical inscripts to OPAC's detail page

To test:
1. run previous patch test plan
2. apply this patch
3. edit a the marc structure of a MARC bibliographic framework, and in tag 031 enable the following subfiels to be visible in editor: 2, g, n, o, p, u
4. search the catalog for a record that belongs to that framework, and edit tag 031 with the following:
   * 2:pe
   * g:G-2
   * n:xFCGD
   * o:3/8
   * p:'6B/{8B+(6B''E'B})({AFD})/{6.E3G},8B-/({6'EGF})({FAG})({GEB})/4F6-
   * u:http://nonexistent.org/url/of/a/midi
5. save and click in opac view
CHECK => even though you add a 031 tag there is no musical inscript shown in opac view
6. in admin module enable OPACShowMusicalInscripts preference
7. refresh opac view
SUCCESS => it takes a few seconds to load, but you see a link that says 'Audio file' pointing to the URL you placed in 'u' subfield, and below you see the musical inscript
8. in admin module enable OPACPlayMusicalInscripts preference
9. refresh opac view
SUCCESS => You see a play button below the musical inscript, and when you click, the song is played
10. sign off

Sponsored-by: Biblioteca Provincial Fr. Mamerto Esquiú (Provincia Franciscana de la Asunción)
Co-authored-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22581: Add new system preferences
Agustin Moyano [Mon, 28 Oct 2019 21:15:22 +0000 (18:15 -0300)]
Bug 22581: Add new system preferences

This patch adds 2 new system preferences:
1. OPACShowMusicalInscripts - to toggle musical inscripts to appear in opac's detail page
2. OPACPlayMusicalInscripts - to toggle musical inscripts to be transformed and payed in midi. Depends on OPACShowMusicalInscripts to be enabled.

To test:
1. apply this patch
2. perl installer/data/mysql/updatedatabase.pl
3. search for this new preferences in admin module
SUCCESS => they appear in OPAC section.
4. sign off

Sponsored-by: Biblioteca Provincial Fr. Mamerto Esquiú (Provincia Franciscana de la Asunción)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23834: Add default ESLint configuration
Owen Leonard [Thu, 17 Oct 2019 13:46:42 +0000 (13:46 +0000)]
Bug 23834: Add default ESLint configuration

This patch adds a default ESLint configuration for use when editing
JavaScript, as recommended in the coding guidelines:

https://wiki.koha-community.org/wiki/Coding_Guidelines#JS8:_Follow_guidelines_set_by_ESLint

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22592: Add index scan emulation to Elasticsearch
Ere Maijala [Thu, 28 Mar 2019 11:37:13 +0000 (13:37 +0200)]
Bug 22592: Add index scan emulation to Elasticsearch

Adds support for using the "scan indexes" action in advanced search by using faceting with a prefix filter. Requires that the field be set as facetable for anything to be found.

Test plan:
1. Apply patch
2. Go to advanced search and click "More options"
3. Select author as the search field, enter a last name and check "Scan indexes"
4. Perform search and observe the result list resembling scan results

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20194: Display both biblioitems.itemtype and items.itype in circulation screens
Alex Arnaud [Thu, 25 Oct 2018 09:19:01 +0000 (11:19 +0200)]
Bug 20194: Display both biblioitems.itemtype and items.itype in circulation screens

Test plan:
1. Verify that biblioitems.itemtype, items.itype are
   mapped to a MARC field. Otherwise create those mappings.
2. Create a biblio with an itemtype
3. Create an item with a different itemtype for this biblio
4. Check out this item to a patron (P1)
5. Verify that both itemtypes are displayed in the
checkouts table (moremember.pl, circulation.pl, returns.pl)
6. Create a patron whose guarantor is P1 and verify that both itemtypes
and the ccode are displayed in the 'relatives checkouts' table

Followed test plan, patch worked as described, also passes QA test tool
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23841: Compiled CSS
Martin Renvoize [Sun, 3 Nov 2019 07:46:29 +0000 (07:46 +0000)]
Bug 23841: Compiled CSS

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23841: Add link to bibliographic details page in item details breadcrumbs
Owen Leonard [Mon, 21 Oct 2019 12:00:03 +0000 (12:00 +0000)]
Bug 23841: Add link to bibliographic details page in item details breadcrumbs

This patch adds a link to the default bibliographic details page from
the breadcrumbs menu on the item details page.

The patch also makes a minor update to staff client CSS to allow for use
of biblio-default-view.inc to generate the link and have it styled
correctly.

To test, apply the patch and update the staff client CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

Locate an record in the catalog and view the item details page. Verify
that the breadcrumbs menu includes a link back to the bibliographic
details page as defined in the IntranetBiblioDefaultView system
preference.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23506: Display correct icon in staff client and OPAC
Lucas Gass [Tue, 29 Oct 2019 17:40:47 +0000 (17:40 +0000)]
Bug 23506: Display correct icon in staff client and OPAC

When the leader6 is set to 'i' the MARC21slim2intranetDetail.xsl
attempts to display 'SO.png' which does not exist.

TEST PLAN:
1. Find or create a record with an 'i' as the 6th position in the 000 leader.
2. Do to the OPAC detail page and staff detail for an item in that record.
3. Notice the material type icon does not display because SO.png does not exist.
4. Apply patch and restart_all
5. Look at the opac detail and staff detail page again after clearning the browser cache.
6. The material type icon now displays (MU.png), this is the same icon used on the OPAC results page.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23946: Remove Noun Project icons from the About page
Owen Leonard [Fri, 1 Nov 2019 15:38:49 +0000 (15:38 +0000)]
Bug 23946: Remove Noun Project icons from the About page

This patch removes the part of the About page which gives attribution
for Noun Project icons on the staff client home page.

To test, apply the patch and view the About page in the staff client.
There should be no reference to Noun Project icons.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22661: TinyMCE/WYSIWYG editor doesn't translate
Owen Leonard [Mon, 7 Oct 2019 14:57:32 +0000 (14:57 +0000)]
Bug 22661: TinyMCE/WYSIWYG editor doesn't translate

This patch updates the TinyMCE editor to the latest version (5.0.16) and
adds a translatable include file which will allow the TinyMCE interface
to show the same translation as Koha.

The configuration of the editor has been updated according to the new
version's requirements, keeping all the tools available we had before
and adding emoji support.

To test, apply the patch and enable the UseWYSIWYGinSystemPreferences
system preference.

TESTING THE UPGRADED EDITOR

 - Go to Administration -> System preferences -> OPAC.
 - Multiple instances of the TinyMCE editor should appear on the page:
   opaccredits, OpacCustomSearch, OpacLoginInstructions, etc.
 - Test adding and editing content to one or more of these editors.
   Confirm that the various editor tools work correctly.
 - Verify that changing the contents of any editor (including via paste)
   enables the corresponding "Save all X preferences" button.

 - Test the news editor under Tools -> News.

 - Test the library "OPAC info" editor in libraries administration:
   Administration -> Libraries -> Edit library -> OPAC info.

TESTING TRANSLATABILITY

 - Update a translation:

   > cd misc/translator
   > perl translate update fr-FR

 - Open the corresponding .po file for the staff client, e.g.
   misc/translator/po/fr-FR-staff-prog.po
 - Locate strings pulled from includes/str/tinymce_i18n.inc for
   translation, e.g.:

   #. SCRIPT
   #: intranet-tmpl/prog/en/includes/str/tinymce_i18n.inc:1
   #, fuzzy
   msgid "File"
   msgstr "Fichier :"

 - Edit the "msgstr" string however you want (it's just for testing) and
   remove the "fuzzy" line.
 - Install the updated translation:

   > perl translate install fr-FR

 - Go to Administration -> System preferences -> OPAC.
 - In each instance of the TinyMCE editor, the first menu item should
   have as its label the translation "msgstr" string you edited.

 - Check that the "About" page shows updated information about
   the TinyMCE version, 5.0.16.

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23862: add enumchron to holds-table
Lucas Gass [Fri, 18 Oct 2019 12:56:43 +0000 (12:56 +0000)]
Bug 23862: add enumchron to holds-table

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23938: Restore title display in last checked out box
Nick Clemens [Thu, 31 Oct 2019 19:03:59 +0000 (19:03 +0000)]
Bug 23938: Restore title display in last checked out box

To test:
1 - Check out to a patron
2 - Note the display under the checkotu box does not have title
3 - Apply patch
4 - Checkout another item
5 - Note the title displays

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23762: Editing is_html status of email template fails under multi-languages
Bin Wen [Mon, 7 Oct 2019 13:01:39 +0000 (09:01 -0400)]
Bug 23762: Editing is_html status of email template fails under multi-languages

To test:
1.Enable multi-languages
2.Set the preference 'TranslateNotices' on  'Allow'
3.Go to: tools==>Notices & slips==>Edit (one notice)
4.Click on the "Email" in the Default, uncheck the checkbox for 'HTML Messages'.
5.Save
6.Reopen the notice, nothing changed.
7.Apply the patch
8.Repeat the steps 4 and 5
9.Success.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23089: Fix QueryBuilder tests.
Ere Maijala [Thu, 24 Oct 2019 10:35:52 +0000 (13:35 +0300)]
Bug 23089: Fix QueryBuilder tests.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23089: Fix sorting on sum and regular fields
Nick [Thu, 10 Oct 2019 16:06:08 +0000 (16:06 +0000)]
Bug 23089: Fix sorting on sum and regular fields

As of bug 20589 we no longer analyze sort fields and so we no longer need to append ".phrase"
to our sort in searches.

Additionally, sort fields based on 'sum' should also use sum in building the value to sort on

To test:
0 - Be using ES
1 - Find the most circulated item in your collection
2 - Search for '*'
3 - Sort by popularity DESC
4 - Note that item is not first
5 - Try to sort by anything but relevancy, it fails
6 - Apply patch
7 - Redo searches and sorts
8 - Things should now work as expected

Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23089: Unit tests
Nick [Thu, 10 Oct 2019 16:05:50 +0000 (16:05 +0000)]
Bug 23089: Unit tests

Signed-off-by: Ere Maijala <ere.maijala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23805: (RM follow-up) Remove CHECK constraints
Martin Renvoize [Fri, 1 Nov 2019 13:09:31 +0000 (13:09 +0000)]
Bug 23805: (RM follow-up) Remove CHECK constraints

MariaDB and MySQL support different syntaxes for CHECK constraints at
different versions. To remove complexities in the updatedatabase script
I have opted to remove all CHECK constraints entirely.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 21824: Add tests
Jonathan Druart [Thu, 13 Dec 2018 21:24:32 +0000 (18:24 -0300)]
Bug 21824: Add tests

Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 21824: Add KohaDates method 'output_preference' to make it easy to store formatte...
Kyle M Hall [Tue, 13 Nov 2018 17:36:17 +0000 (12:36 -0500)]
Bug 21824: Add KohaDates method 'output_preference' to make it easy to store formatted dates in TT variable

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 21824: Add ability to format dates in various formats in templates
Kyle M Hall [Tue, 13 Nov 2018 16:09:05 +0000 (11:09 -0500)]
Bug 21824: Add ability to format dates in various formats in templates

This patch adds the ability to set a date format for the Template Toolkit filter KohaDates

Test plan:
1) Apply this patch
2) In a template, use the filter param "dateformat => 'iso'"
3) Note the output is in ISO format

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22814: Make patron names on holds modal consistent (second check-in)
Katrin Fischer [Thu, 10 Oct 2019 12:53:10 +0000 (12:53 +0000)]
Bug 22814: Make patron names on holds modal consistent (second check-in)

Bug 22203 changed the behavior on the hold-found2 modal
that pops up when a hold is found so that whether or not
the patron's name is displayed is now governed by the
HidePatronName system preference.

However, if a hold is confirmed and you check the item
in a second time, the modal that pops up is hold-found1
and whether or not the patron's name is displayed in
the hold-found1 modal is not governed by the HidePatronName
system preference.

For the sake of consistency, the display of the patron's
name on hold-found2 and hold-found1 should both be governed
by the HidePatronName system preference.

To test:
- Place a hold on an item
- Check in the item to trigger the hold modal
- Confirm hold
- Check the item in again - verify name of patron displays
- Apply patch
- Repeat
- Verify name display now matches between the two modals
- change HidePatronName pref
- Repeat
- Name display should still match

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23860: Update tests to new style
Tomas Cohen Arazi [Tue, 22 Oct 2019 16:56:15 +0000 (13:56 -0300)]
Bug 23860: Update tests to new style

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23860: Make the patrons endpoint add the Location header
Tomas Cohen Arazi [Mon, 21 Oct 2019 19:21:16 +0000 (16:21 -0300)]
Bug 23860: Make the patrons endpoint add the Location header

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23860: Regression tests
Tomas Cohen Arazi [Mon, 21 Oct 2019 19:20:54 +0000 (16:20 -0300)]
Bug 23860: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23859: Update tests to new style
Tomas Cohen Arazi [Mon, 21 Oct 2019 19:12:16 +0000 (16:12 -0300)]
Bug 23859: Update tests to new style

The /cities endpoint is refered in several places as the reference
implementation of a route for devs to pick it for copy and pasting. Yet,
it is outdated in terms of how the tests are written.

This patch rewrites some bits so it uses BASIC auth and the built-ins
Test::Mojo provides.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23859: Make POST add the Location header on cities endpoint
Tomas Cohen Arazi [Mon, 21 Oct 2019 17:42:28 +0000 (14:42 -0300)]
Bug 23859: Make POST add the Location header on cities endpoint

According to the coding guidelines, this endpoint should be adding the
Location header on POST actions.

To test:
1. Apply the tests patch
2. Run:
    $ kshell
    k$ prove t/db_dependent/api/v1/cities.t
=> FAIL: Tests fail!
3. Apply this patch
4. Repeat (1)
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23859: Regression tests
Tomas Cohen Arazi [Mon, 21 Oct 2019 17:41:59 +0000 (14:41 -0300)]
Bug 23859: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 17084: Automatic debian/control updates
Nightly Build Bot [Thu, 31 Oct 2019 23:28:04 +0000 (00:28 +0100)]
Bug 17084: Automatic debian/control updates

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23805: (QA follow-up) Corrections for cash_register_stats
Martin Renvoize [Thu, 31 Oct 2019 17:49:29 +0000 (17:49 +0000)]
Bug 23805: (QA follow-up) Corrections for cash_register_stats

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 17084: Automatic debian/control updates
Nightly Build Bot [Tue, 8 Oct 2019 22:26:59 +0000 (00:26 +0200)]
Bug 17084: Automatic debian/control updates

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23805: (RM follow-up) updatedatabase.pl mariadb support
Martin Renvoize [Mon, 28 Oct 2019 17:13:09 +0000 (17:13 +0000)]
Bug 23805: (RM follow-up) updatedatabase.pl mariadb support

MySQL and MariaDB have different syntax when it comes to dropping a
CHECK constraint.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23068: Add ability for Koha to handle X-Forwarded-For headers so REMOTE_ADDR...
Kyle M Hall [Thu, 6 Jun 2019 19:35:10 +0000 (15:35 -0400)]
Bug 23068: Add ability for Koha to handle X-Forwarded-For headers so REMOTE_ADDR features work behind a proxy

Koha has a number of features that rely on knowing the IP address of the connecting client. If that server is behind a proxy these features do not work.
This patch adds a module to automatically convert the X-Forwarded-For header into the REMOTE_ADDR environment variable for both CGI and Plack processes.

TEST PLAN:
1) Apply this patch set
2) Install Plack::Middleware::RealIP via cpanm or your favorite utility
3) Update your plack.psgi with the changes you find in this patch set ( this process differs based on your testing environment )
4) Restart plack
5) Tail the plack error log for your instance
6) Use curl to access the OPAC, adding an X-Forwarded-For header: curl --header "X-Forwarded-For: 32.32.32.32" http://127.0.0.1:8080
7) Note the logs output this address if you are unproxied
8) If you are proxied, restart plack using a command like below, where the ip you see in the logs ("REAL IP) is what you put in the koha conf:
    <koha_trusted_proxies>172.22.0.1 1.1.1.1</koha_trusted_proxies>
9) Restart all the things!
10) Repeat step 6
11) You should now see "REAL IP: 32.32.32.32" in the plack logs as the remote address in your plack-error.log logs!
12) Disable plack so you are running in cgi mode, repeat step 6 again
13) You should see "REAL IP: 32.32.32.32" as the remove address in your opac-error.log logs!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Ed Veal <eveal@mckinneytexas.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23903: Compiled CSS
Martin Renvoize [Thu, 31 Oct 2019 15:41:31 +0000 (15:41 +0000)]
Bug 23903: Compiled CSS

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23903: Replace OPAC icons with Font Awesome
Owen Leonard [Fri, 25 Oct 2019 18:41:34 +0000 (18:41 +0000)]
Bug 23903: Replace OPAC icons with Font Awesome

This patch replaces CSS-based background image icons with Font Awesome
icons. This will eliminate the use of sprite.png altogether.

To test, apply the patch and regenerate the OPAC CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

Because JavaScript events are often triggered by class, the changes made
in this patch require testing of JavaScript-driven behavior as well as
visual confirmation of the changes.

Enable OPAC features to expose them for testing: Login, Holds, Article
requests, Tags, Cart, Search term highlighting.

 - Perform a search in the OPAC
   - In the header at the top of the search results, check the
     'Unhighlight/Highlight' link.
   - Select some search results and verify that the multi-item controls
     are enabled: Add to cart/Lists; Place hold; Tag. Check that these
     controls work correctly.
   - Verify that the following links look correct and work correctly:
     'Place hold,' 'Request article,' 'Log in to add tags,' 'Add to
     cart.'
   - Log in to the OPAC and return to the search results page. Check the
     'Add tag' and 'Save to lists' links.

 - View the lists page
   - Test the 'Edit' and 'Delete' controls.
   - View the contents of a list. Test the following:
      - Controls at the top of the table of results ('New list,'
        'Download list,' 'Send list,' 'Print list,' 'Edit list,' and
        'Delete list').
      - Multi-selection operations: 'Place hold,' 'Tag,' and 'Remove
        from list.'
      - Controls for each item on the list: 'Place hold,' 'Add tag,'
        'Save to another list,' 'Remove from this list,' and 'Add to
        cart.'

   - View the bibliographic detail page for any search result
     - In the right-hand sidebar menu, verify that these controls look
       correct and work correctly: 'Place hold,' 'Print,' 'Request
       article,' 'Save to your lists,' 'Add to your cart,'
      'Unhighlight,' 'Send to device,' 'Save record,' and 'More
      searches.'
     - Test the shelf browser by clicking 'Browse shelf' under the call
       number for any of the holdings.
       - Test the 'Next' and 'Previous' controls.
     - Check the tabs for switching between 'Normal,' 'MARC,' and 'ISBD'
       views and verify that they look correct on each of those pages.

 - Add some items to the Cart and open the Cart
   - Test the cart controls at the top: 'More details/Brief display,'
     'Send,' 'Download,' 'Empty and close,' 'Hide window,' 'Print.'
   - Test the multiple-selection controls: 'Remove,' 'Add to list,'
     'Place hold,' and 'Tag.'

 - Log in to the OPAC as a user who has items checked out which can be
   renewed. On the 'Your summary' page, on the 'Checked out' tab, test
   the 'Renew selected' and 'Renew all' links.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23903: Font Awesome upgrade
Owen Leonard [Fri, 25 Oct 2019 18:25:28 +0000 (18:25 +0000)]
Bug 23903: Font Awesome upgrade

The switch to Font Awesome for more icons in the OPAC doesn't require a
Font Awesome upgrade but this is a good chance to do it.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: (RM follow-up) Add _type methods to ReturnClaim class
Martin Renvoize [Thu, 31 Oct 2019 14:38:10 +0000 (14:38 +0000)]
Bug 14697: (RM follow-up) Add _type methods to ReturnClaim class

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23630: (QA follow-up) Fix tests
Nick Clemens [Thu, 31 Oct 2019 13:19:24 +0000 (13:19 +0000)]
Bug 23630: (QA follow-up) Fix tests

marc_records_to_documents is now an arrayref of hashes, not an arrayref of arrays

_sanitise_records has been removed, we don't need those tests anymore

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22706: (RM follow-up) Add unit tests
Martin Renvoize [Thu, 31 Oct 2019 12:21:01 +0000 (12:21 +0000)]
Bug 22706: (RM follow-up) Add unit tests

Helps if one actually adds the new test file to the commit!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: DBRev 19.06.00.047
Martin Renvoize [Thu, 31 Oct 2019 12:16:46 +0000 (12:16 +0000)]
Bug 14697: DBRev 19.06.00.047

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: (QA follow-up) Remove tab chars
Josef Moravec [Wed, 30 Oct 2019 18:00:53 +0000 (18:00 +0000)]
Bug 14697: (QA follow-up) Remove tab chars

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: (follow-up) Add auth values to the sample data
Tomas Cohen Arazi [Wed, 30 Oct 2019 15:17:15 +0000 (12:17 -0300)]
Bug 14697: (follow-up) Add auth values to the sample data

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: (QA follow-up) Restore FK on issue_id and adjust tests
Tomas Cohen Arazi [Tue, 29 Oct 2019 20:43:13 +0000 (17:43 -0300)]
Bug 14697: (QA follow-up) Restore FK on issue_id and adjust tests

This patch reintroduces the FK constraint on issue_id. The tests are
adjusted to reflect the UNIQUE constraint we also added.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: (QA follow-up) Add missing AV category
Tomas Cohen Arazi [Tue, 29 Oct 2019 18:57:06 +0000 (15:57 -0300)]
Bug 14697: (QA follow-up) Add missing AV category

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: (QA follow-up) Organize tests in subtests
Tomas Cohen Arazi [Tue, 29 Oct 2019 18:38:48 +0000 (15:38 -0300)]
Bug 14697: (QA follow-up) Organize tests in subtests

This patch organizes the tests better, and adds some more.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: Make controller methods rely on the stashed user
Tomas Cohen Arazi [Tue, 29 Oct 2019 13:27:18 +0000 (10:27 -0300)]
Bug 14697: Make controller methods rely on the stashed user

This patch adjusts the return values and HTTP status codes, as well as
removing the use of C4::Context->userenv. It also makes the date
calculation happen on the DB engine in the case of resolving the claim.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: (follow-up) Rely on the UNIQUE constraint and return 409 for issue_id
Tomas Cohen Arazi [Mon, 28 Oct 2019 19:18:52 +0000 (16:18 -0300)]
Bug 14697: (follow-up) Rely on the UNIQUE constraint and return 409 for issue_id

This patch avoids querying the DB for an already existing
Koha::Checkouts::ReturnClaim with the same issue_id, now that there's a
UNIQUE constraint on it.

Also, 409 should be returned instead. Tests added for this changes.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/return_claims.t
=> SUCCESS: tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: Schema updates
Kyle M Hall [Tue, 29 Oct 2019 15:32:15 +0000 (12:32 -0300)]
Bug 14697: Schema updates

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: Enhance the return claims feature
Kyle M Hall [Tue, 29 Oct 2019 15:29:54 +0000 (12:29 -0300)]
Bug 14697: Enhance the return claims feature

This adds a "Claims returned" feature that extends and enhances the claims returned lost status.
To use this feature, a new LOST status to represent an item claimed as returned needs to be created.
The value of this LOST authorised value should be set in the new syspref ClaimReturnedLostValue.
Setting this system preference turns on the feature.

Once the feature is enabled, you should be able to mark checked out items as return claims from the
checkout and patron details pages, and also modify them from the new claims tab on those pages.

Returning a claimed item will notify the librarian that the item in question has a claim on it.

Setting the ClaimReturnedWarningThreshold will add an alert to make librarians aware that this
patron has many return claims on the patron's record.

Test Plan:
1) Create a "Claims Returned" lost value
2) Create some RETURN_CLAIM_RESOLUTION authorized values
3) Set ClaimReturnedLostValue
4) Set ClaimReturnedChargeFee
5) Set ClaimReturnedWarningThreshold
6) Create some checkouts
7) Claim some returns
8) Verify ClaimReturnedChargeFee works with all 3 options
9) Verify ClaimReturnedWarningThreshold shows a warning once the threshold has been exceeded
10) Edit notes on a claim
11) Resolve a claim
12) Delete a claim

Sponsored-by: North Central Regional Library System
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: Add routes to handle return claims
Kyle M Hall [Tue, 29 Oct 2019 15:29:37 +0000 (12:29 -0300)]
Bug 14697: Add routes to handle return claims

This patch adds the /return_claims route to add new return claims, and
then routes to updates notes and the resolution code.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/return_claims.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: Add Koha::Patron->return_claims
Kyle M Hall [Tue, 29 Oct 2019 15:28:53 +0000 (12:28 -0300)]
Bug 14697: Add Koha::Patron->return_claims

Adds the ability to get a list of a patron's return claims directly
from the Patron object.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: Add Koha::Checkout->claim_returned
Kyle M Hall [Tue, 29 Oct 2019 15:28:36 +0000 (12:28 -0300)]
Bug 14697: Add Koha::Checkout->claim_returned

Adds the ability to generate a return claim from a Checkout object.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: Add return claim handling to AddReturn
Kyle M Hall [Tue, 29 Oct 2019 15:28:24 +0000 (12:28 -0300)]
Bug 14697: Add return claim handling to AddReturn

This adds the ability to alert a librarian of an item claimed as returned is actually returned.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: Introduce Koha::Checkouts::ReturnClaim(s)
Kyle M Hall [Tue, 29 Oct 2019 15:26:56 +0000 (12:26 -0300)]
Bug 14697: Introduce Koha::Checkouts::ReturnClaim(s)

This patch introduces the Koha::Object(s)-derived classes for handling
return claims. Tests are added to cover the overloaded ->store method,
and domain-specific exceptions are added as well.

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Checkouts/ReturnClaim.t
=> SUCCESS: Tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: Add new schema file
Kyle M Hall [Fri, 22 Feb 2019 14:40:35 +0000 (09:40 -0500)]
Bug 14697: Add new schema file

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 14697: Update database
Kyle M Hall [Fri, 22 Feb 2019 13:46:34 +0000 (08:46 -0500)]
Bug 14697: Update database

This patch introduces the new table and related sysprefs.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 15260: DBRev 19.06.00.046
Martin Renvoize [Thu, 31 Oct 2019 11:56:46 +0000 (11:56 +0000)]
Bug 15260: DBRev 19.06.00.046

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 15260: (follow-up) Add missing POD
Andrew Isherwood [Fri, 17 May 2019 11:06:48 +0000 (12:06 +0100)]
Bug 15260: (follow-up) Add missing POD

As per comment #33

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 15260: (QA follow-up) Fix updatedatabase message
Liz Rea [Mon, 6 May 2019 17:18:57 +0000 (17:18 +0000)]
Bug 15260: (QA follow-up) Fix updatedatabase message

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 15260: (follow-up) Fix bug in subtraction
Andrew Isherwood [Wed, 1 May 2019 11:12:14 +0000 (12:12 +0100)]
Bug 15260: (follow-up) Fix bug in subtraction

prev_open_days can receive either positive or negative numbers and
then does the right thing with them. However, we weren't also doing this
with the number it receives back from get_push_amt

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 15260: (follow-up) Fix misnamed variable
Andrew Isherwood [Fri, 12 Apr 2019 11:31:31 +0000 (12:31 +0100)]
Bug 15260: (follow-up) Fix misnamed variable

This was causing the amount to push by to be incorrectly calculated

Sponsored-by: Cheshire West and Chester Council
Sponsored-by: Cheshire East Council
Sponsored-by: Newcastle City Council
Sponsored-by: Sefton Council
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 15260: Fix calculation of add amount
Andrew Isherwood [Tue, 26 Mar 2019 14:43:34 +0000 (14:43 +0000)]
Bug 15260: Fix calculation of add amount

In a sequence of closed days, we should take into account the nature
of each closed day as we encounter it in order to calculate the amount
to add to reach the next potential closed date. We are now doing this.

Sponsored-by: Cheshire West and Chester Council
Sponsored-by: Cheshire East Council
Sponsored-by: Newcastle City Council
Sponsored-by: Sefton Council
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 15260: Add unit tests
Andrew Isherwood [Mon, 4 Feb 2019 15:11:34 +0000 (15:11 +0000)]
Bug 15260: Add unit tests

This patch adds unit tests of the CalcDueDate function to ensure that
the useDaysMode "Dayweek" mode works as expected

Sponsored-by: Cheshire West and Chester Council
Sponsored-by: Cheshire East Council
Sponsored-by: Newcastle City Council
Sponsored-by: Sefton Council
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 15260: Implement weekly rollforward
Andrew Isherwood [Fri, 1 Feb 2019 14:07:01 +0000 (14:07 +0000)]
Bug 15260: Implement weekly rollforward

This patch will, when appropriate, roll due dates forward by full weeks,
rather than single days.

Sponsored-by: Cheshire West and Chester Council
Sponsored-by: Cheshire East Council
Sponsored-by: Newcastle City Council
Sponsored-by: Sefton Council
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 15260: Modify next/prev_open_day
Andrew Isherwood [Fri, 1 Feb 2019 12:24:54 +0000 (12:24 +0000)]
Bug 15260: Modify next/prev_open_day

We require next_open_day & prev_open_day to be more flexible. We could
create a separate sub, but that's not very DRY given that they'll do
pretty much the same thing.

So next_open_day becomes next_open_days and prev_open_day becomes
prev_open_days and both functions accept an additional parameter which
determines how many days they add or subtract.

All calls of these two functions have been modified accordingly.

Sponsored-by: Cheshire West and Chester Council
Sponsored-by: Cheshire East Council
Sponsored-by: Newcastle City Council
Sponsored-by: Sefton Council
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 15260: Modify description of Dayweek option
Andrew Isherwood [Fri, 1 Feb 2019 11:42:24 +0000 (11:42 +0000)]
Bug 15260: Modify description of Dayweek option

Sponsored-by: Cheshire West and Chester Council
Sponsored-by: Cheshire East Council
Sponsored-by: Newcastle City Council
Sponsored-by: Sefton Council
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 15260: Add new useDaysMode option "Dayweek"
Andrew Isherwood [Thu, 31 Jan 2019 15:36:52 +0000 (15:36 +0000)]
Bug 15260: Add new useDaysMode option "Dayweek"

This patch adds a new "Dayweek" option to the useDaysMode syspref, it
has the description: "the calendar to push the due date to the next open
day on the same weekday".

Sponsored-by: Cheshire West and Chester Council
Sponsored-by: Cheshire East Council
Sponsored-by: Newcastle City Council
Sponsored-by: Sefton Council
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23866: DBRev 19.06.00.045
Martin Renvoize [Thu, 31 Oct 2019 11:37:33 +0000 (11:37 +0000)]
Bug 23866: DBRev 19.06.00.045

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>