koha.git
4 years agoBug 17532: Make koha-shell propagate the error code
Jonathan Druart [Thu, 13 Feb 2020 11:03:36 +0000 (12:03 +0100)]
Bug 17532: Make koha-shell propagate the error code

Context: I am trying to make koha-misc4dev stop when something wrong happens.
Basically we do not want the process to continue of the DB has not been populated correctly.
It will make the errors easier to catch.

The issue: Say a script that will return an error (die in perl for an easy example),
koha-shell will not return the 255 error code, but 0 instead.
The caller cannot know something wrong happened

The solution is to propagate the error and make koha-shell return the same error code
as the command it executed

An example:
=== t.pl ===
die('something wrong');

% perl t.pl;echo $?
something wrong at t.pl line 1.
255

% sudo koha-shell kohadev -p -c 'perl xxx.pl' ; echo $?
something wrong at xxx.pl line 1.
0

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Tested it with
  $ sudo debian/scripts/koha-shell kohadev -c 'exit 8'
  $ echo $?
  8
The unpatched version returns 0 (forgets about the error code).

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 22273: DBRev 19.11.04.002
Joy Nelson [Wed, 1 Apr 2020 20:52:41 +0000 (20:52 +0000)]
Bug 22273: DBRev 19.11.04.002

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 22273: DBRev 19.11.04.002
Joy Nelson [Wed, 1 Apr 2020 20:50:17 +0000 (20:50 +0000)]
Bug 22273: DBRev 19.11.04.002

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 22273: Modify Koha::ArticleRequest->store to fill created_on
Marcel de Rooy [Wed, 18 Dec 2019 13:49:59 +0000 (13:49 +0000)]
Bug 22273: Modify Koha::ArticleRequest->store to fill created_on

For a new record, store should fill created_on.
The database will always update the timestamp updated_on.
Since open also calls SUPER::store, we do not need to call it twice.

Test plan:
[1] Run t/db_dependent/ArticleRequests.t
[2] In the interface, add two article requests. Change the status of one
    to PROCESSING. Check created_on and updated_on in the article_requests
    table. The changed request should have updated_on > created_on.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
[1] Tests pass
ok 12 - New article request has created_on date set
ok 13 - New article request has updated_on date set

[2] Work as described.
No errors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 22273: Database revision for table article_requests
Marcel de Rooy [Wed, 18 Dec 2019 14:35:50 +0000 (14:35 +0000)]
Bug 22273: Database revision for table article_requests

Column created_on should not be updated. It is filled once by the
store method of Koha::ArticleRequest.
Column updated_on should be a timestamp, updated by the database.

Note: Although higher versions of MySQL and MariaDB support two timestamps
(NOT NULL) in one table, I kept on the safe side by allowing NULL on the
created_on column.

@RM: Don't forget to run DBIx update.

Test plan:
Run new install or upgrade.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 22273: Replace typo opan by opac in POD
Marcel de Rooy [Wed, 18 Dec 2019 13:39:57 +0000 (13:39 +0000)]
Bug 22273: Replace typo opan by opac in POD

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 17464: Order deny,allow / Deny from all was deprecated in Apache 2.4 and is now...
David Cook [Mon, 13 Jan 2020 06:05:17 +0000 (17:05 +1100)]
Bug 17464: Order deny,allow / Deny from all was deprecated in Apache 2.4 and is now a hard error

Patch change Apache access control from 2.2 to 2.4 directives.

Test plan:
0. Apply patch
1. Build Koha from source
2. Copy or symlink koha-dev/etc/koha-httpd.conf into your relevant
Apache directory.
3. Reload Apache
4. Note a lack of syntax errors regarding the "Order" directive

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 23488: Line wrapping doesn't always respect word order in Patron card creator
Maryse Simard [Wed, 21 Aug 2019 21:20:16 +0000 (17:20 -0400)]
Bug 23488: Line wrapping doesn't always respect word order in Patron card creator

When wrapping long lines of text, the line is divided by removing each
word from the end of the line and putting it in a new one until the line
is the right width. When the word to be removed appears multiple time
in the line, it is not the last occurrence that is removed.

This patch changes the regular expression used to remove the part of
the text that is wrapped to a new line, making sure it removes it at
the end of the text.

Test plan:

1. Go to Tools > Patron card creator

2. Have a card template and a card batch
    -> If needs be, you can create them by using
       New > Card template or New > Card batch

3. Create a layout and use one text field containing a long text with
    at least one word which is repeated a minimum of 2 times
    (preferably towrdds the end of the text, since it has to be picked
    as one of the words to appear in the new line). You can use this:

        one two three one two three one two three one two three
        one two three one two three one two three one two three ...

4. Go to Manage > Card batches and export a batch

5. Choose the layout set up in 3.

6. Click the Export button and open the resulting pdf file

7. Notice all the repeated word have been grouped
    -> For this example : all of the ones appear first, followed by
       all the twos and only then the threes.

8. Apply patch

9. Repeat step 4 through 7
    => this time the order of the words has not changed!

Signed-off-by: Gabriel DeCarufel <gabriel@inlibro.com>
Signed-off-by: William Frazilien <william.frazilien@inlibro.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 23753: Add missing humanMsg library to pages using background job JavaScript
Owen Leonard [Fri, 28 Feb 2020 16:48:37 +0000 (16:48 +0000)]
Bug 23753: Add missing humanMsg library to pages using background job JavaScript

The JavaScript used to process background uploads calls the humanMsg
library under some circumstances. There are several templates which use
background-job-progressbar.js which don't include the humanMsg assets.
This patch corrects those templates.

Note: upload-images.tt has been modified to remove the inclusion of
background-job-progressbar.js because it was unused.

To test, apply the patch and test the following processes which include
background job processing:

 - Batch item modification -- the background job is triggered when you
   submit your changes
 - Batch record modification -- the background job is triggered when you
   submit your changes
 - Stage MARC for import -- the background job is triggered when you
   click the "Sage for import" button after uploading a file
 - Staged MARC management -- the background job is triggered when you
   click "Import this batch into the catalog"

In each case the process should complete correctly. If you would like to
test the error message handling provided by the humanMsg library you can
deliberately introduce an error into the JavaScript. After applying the
patch you can modify js/background-job-progressbar.js to alter line 63
from:

   url: f.action,

...to:

   url: f.action + "foo",

Perform the same tests and confirm that you see an error message. Don't
forget to undo your changes to background-job-progressbar.js before
signing off.

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24736: (QA follow-up) Change tooltip wording
Katrin Fischer [Sat, 29 Feb 2020 09:49:46 +0000 (10:49 +0100)]
Bug 24736: (QA follow-up) Change tooltip wording

Suggesting a change of the tooltip wording to read:

There are no enrollments for this club yet

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24736: Disable "Enrollments" link if nobody enrolled to the club yet
Jonathan Druart [Wed, 26 Feb 2020 16:46:49 +0000 (17:46 +0100)]
Bug 24736: Disable "Enrollments" link if nobody enrolled to the club yet

The link is disabled but it's possible to click and access the page
anyway.

Test plan:
- Create a new club template
- Create a new club
- Click the Actions > Enrollments link
=> Without this patch you can access the page
=> With this patch applied you cannot, and a tooltip explains why (feel
free to suggest another wording)
- Add a new patron to this club (from /cgi-bin/koha/opac-user.pl#opac-user-clubs)
- Notice that the action link is not enabled and click takes you to the
list of enrollments

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24747: Corrects on-screen instructions in branch transfer limits
Andrew Fuerste-Henry [Thu, 27 Feb 2020 20:09:02 +0000 (14:09 -0600)]
Bug 24747: Corrects on-screen instructions in branch transfer limits

To test:
1- go to cgi-bin/koha/admin/branch_transfer_limits.pl
2- see wording "Check the boxes for the libraries you accept to checkin items from"
3- apply patch
4- see wording "Check the boxes for the libraries you allow your items to be transferred to"

To verify new wording accuractely describes behavior:
1- Set UseBranchTransferLimits set to Enforce using itemtype
2- Confirm circ rules allow holds
3- Confirm hold policy by item type allows holds
4- Confirm all branches are valid pickup locations in branch setup
5- In Branch Transfer Limits, set dropdown to Branch A, select itemtype Book, disable all transfers so Branch A does not accept books from any other branch
6- Find a patron from Branch A
7- Find a book from Branch B
8- On the intranet, successfully place hold on item for patron for pickup at branch A
9- Cancel hold
10- Log into opac as patron
11- Successfully place hold on item for pickup at Branch A
12- Cancel hold
13- In Branch Transfer Limits, set dropdown to Branch A, select itemtype Book, ENABLE all transfers so Branch A DOES accept books from any other branch
14- In Branch Transfer Limits, set dropdown to Branch B, select itemtype Book, disable all transfers so Branch B does not accept books from any other branch
15- On the intranet, try to place a hold on item for patron, confirm Branch B is your only pickup option
16- On the OPAC, log in as patron, try to place a hold on item, confirm Branch B is your only pickup option

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24739: Perform IPv6 tests only if Net::Netmask is correct version
David Cook [Fri, 28 Feb 2020 00:17:58 +0000 (00:17 +0000)]
Bug 24739: Perform IPv6 tests only if Net::Netmask is correct version

Test plan:
0. Apply patch
1. Set up Koha on stretch (e.g. koha/koha-testing:master)
2. perl t/Koha/Middlware/RealIP.t
3. Observe the following:
Subtest: IPv6 support
    ok 1 - Warn on IPv6 koha_trusted_proxies
    ok 2 - Unable to parse IPv6 address for trusted proxy, so ignore the X-Forwarded-For header
    1..2
ok 13 - IPv6 support

4. Set up Koha on buster (e.g. koha/koha-testing:master-buster)
5. perl t/Koha/Middlware/RealIP.t
6. Observe the following:
Subtest: IPv6 support
    ok 1 - Trust proxy (2001:db8:1234:5678:abcd:1234:abcd:1234) using IPv6 CIDR notation, so use the X-Forwarded-For header for the remote address
    1..1
ok 13 - IPv6 support

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24739: Skip tests when IPv6 support is found
Martin Renvoize [Thu, 27 Feb 2020 09:16:12 +0000 (09:16 +0000)]
Bug 24739: Skip tests when IPv6 support is found

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24753: Change Koha/Middlware to Koha/Middleware in test name
David Cook [Fri, 28 Feb 2020 00:28:02 +0000 (00:28 +0000)]
Bug 24753: Change Koha/Middlware to Koha/Middleware in test name

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24733: created_by param should be an arrayref
Nick Clemens [Wed, 26 Feb 2020 03:16:26 +0000 (03:16 +0000)]
Bug 24733: created_by param should be an arrayref

We allow for the user to add multiple users to this field, and the
search function expects and array. We have been treating it as a scalar

TO test:
1 - Have an open basket in acquisitions
2 - Add to basket - from an existing order (copy)
3 - Enter a name in the 'Basket created by' field and select a user
4 - Hit search
5 - ISE (Can't use string ("1") as an ARRAY ref while "strict refs" in use at /usr/share/koha/lib/C4/Acquisition.pm line 2482.)
6 - Apply patch
7 - Repeat 1-4
8 - Success!
9 - Test with mutiple 'created by' entries as well

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 21879: Code cleaning in printinvoice.pl
Nazlı Çetin [Fri, 21 Feb 2020 14:33:42 +0000 (14:33 +0000)]
Bug 21879: Code cleaning in printinvoice.pl

Coming from
  commit 51aa6db46c604aa202a3d8f8e5028557480efbd5
  Bug 12001: Move GetMemberAccountRecords to the Koha namespace

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24705: Holds placed via SIP will be given first priority
Kyle M Hall [Fri, 21 Feb 2020 14:41:27 +0000 (09:41 -0500)]
Bug 24705: Holds placed via SIP will be given first priority

The SIP server does not calculate and pass a priority to AddReserve, which causes the hold to be given priority 1.

Test Plan:
1) Place a hold via SIP for a record with existing holds
2) Note the new hold is top priority
3) Apply this patch
4) Restart SIP
5) Repeat step 1
6) New hold should be last priority

Signed-off-by: Christofer Zorn <Christofer.Zorn@ajaxlibrary.ca>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24705: Add tests
Jonathan Druart [Mon, 24 Feb 2020 09:40:54 +0000 (10:40 +0100)]
Bug 24705: Add tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24103: DBRev 19.11.04.001
Joy Nelson [Wed, 1 Apr 2020 15:35:46 +0000 (15:35 +0000)]
Bug 24103: DBRev 19.11.04.001

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24103: (follow-up) Dump query on opac authorities search
Nick Clemens [Fri, 14 Feb 2020 11:34:46 +0000 (11:34 +0000)]
Bug 24103: (follow-up) Dump query on opac authorities search

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24103: Add option to dump search query to templates
Nick Clemens [Mon, 25 Nov 2019 14:58:00 +0000 (14:58 +0000)]
Bug 24103: Add option to dump search query to templates

To test:
1 - Apply patch, update database
2 - Note new syspref 'DumpSearchQueryTemplate'
3 - Leave it off
4 - Enable DumpTemplateVariablesOpac and Staff
5 - Search on staff and opac
6 - View the source
7 - Search for 'search_query' - you shouldn't find it
8 - Enable the new pref
9 - Repeat, but you should find the query
10 - Test staff/opac search and advanced search, cataloguing search, authority search, authfinder search, adding to a basket form a new biblio
11 - All should work and show the query
12 - This will work under both ES and Zebra

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24732: Set DumpTemplateVars Dumper options for Indent and Sort
Nick Clemens [Tue, 25 Feb 2020 18:51:41 +0000 (18:51 +0000)]
Bug 24732: Set DumpTemplateVars Dumper options for Indent and Sort

To test:
1 - Enable sysprefs
    DumpTemplateVarsOpac
    DumpTemplateVarsIntranet
2 - View some pages on staff client and opac
3 - View the page source
4 - See a large mass of comments including the page vars at the top of the source
5 - Refresh page and note order of vars changes
6 - Apply patch
7 - View page source on some pages and note things are much easier to read
8 - Refresh page and note variable order does not change

Signed-off-by: George Williams <george@nekls.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24294: (QA follow-up) Add rollback and 008 default test
Marcel de Rooy [Tue, 25 Feb 2020 13:40:52 +0000 (13:40 +0000)]
Bug 24294: (QA follow-up) Add rollback and 008 default test

Default for 008 was not tested yet.
Only wondering if we should insert default values only when we meet an
undefined value. Or should we also add if we meet an empty string? Is the
latter not more realistic in MARC?

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24294: Add default value support for control fields in ACQ framework
Jonathan Druart [Thu, 2 Jan 2020 11:09:27 +0000 (12:09 +0100)]
Bug 24294: Add default value support for control fields in ACQ framework

When trying to add an order using the ACQ framework with a 008@ tag,
Koha explodes:

Control fields (generally, just tags below 010) do not have subfields,
use data() at /home/vagrant/kohaclone/C4/Acquisition.pm line 3272.

Test plan:
Set a default value for a control field in the ACQ framework
Turn on UseACQFrameworkForBiblioRecords
Create a new order from a new record
The default value should be displayed
Save
=> No crash

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24605: (QA follow-up) Fix unencoded series link in staff interface
Katrin Fischer [Sun, 23 Feb 2020 21:25:00 +0000 (21:25 +0000)]
Bug 24605: (QA follow-up) Fix unencoded series link in staff interface

Same change as the first patch, but for the staff detail page.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24605: Fix unencoded series link
Nick Clemens [Thu, 6 Feb 2020 17:45:07 +0000 (17:45 +0000)]
Bug 24605: Fix unencoded series link

To test:
1 - Add an 830 to a record with a volume subfield separated by a semicolon
    830$aThe series ;$vvol 8.
2 - View the record in the opac
3 - Click the series link, no results
4 - View the link url - the semicolon is not encoded
5 - Apply patch
6 - link works
7 - URL is corrrectly encoded

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24809: (QA follow-up) Add prefix to prevent disambiguity
Marcel de Rooy [Fri, 20 Mar 2020 10:12:24 +0000 (10:12 +0000)]
Bug 24809: (QA follow-up) Add prefix to prevent disambiguity

This seems not to be needed. Just at the safe side.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24809: Get only timestamp of deleted items attached to existing bibs when check...
Nick Clemens [Thu, 5 Mar 2020 10:59:22 +0000 (10:59 +0000)]
Bug 24809: Get only timestamp of deleted items attached to existing bibs when check if bib deleted

To test:
 1 - Edit/create a file in the koha home dir '/var/lib/koha/{instance}/OAI.yaml' with content like below:
format:
  marcxml:
    metadataPrefix: marcxml
    metadataNamespace: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim
    schema: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd
    include_items: 1
 2 - Set the systempreferences below to indicated values:
  OAI-PMH => Enable
  OAI-PMH:ConfFile => /var/lib/koha/{instace}/OAI.yaml
 3 - View a record with items and confirm the items show:
  http://localhost:8080/cgi-bin/koha/oai.pl?verb=GetRecord&metadataPrefix=marcxml&identifier=KOHA-OAI-TEST:4
 4 - Delete the items, then delete the record
 5 - Reload the URL from step 3
 6 - Internal Server Error:
  Empty String at /kohadevbox/koha/Koha/OAI/Server/Record.pm line 58.
    at /usr/share/perl/5.24/Carp.pm line 167
 7 - Apply patch
 8 - restart_all
 9 - Repeat
10 - Reload URL from step 3
11 - Success

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24114: (QA follow-up) Fix counts for lock, anonymize and delete
Marcel de Rooy [Fri, 29 Nov 2019 09:45:48 +0000 (09:45 +0000)]
Bug 24114: (QA follow-up) Fix counts for lock, anonymize and delete

Since these operations impact on the resultset, the counts should be
saved before.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24114: (follow-up) Resolve warning on non-numeric subtraction
Marcel de Rooy [Fri, 29 Nov 2019 09:17:19 +0000 (09:17 +0000)]
Bug 24114: (follow-up) Resolve warning on non-numeric subtraction

Argument "" isn't numeric in subtraction (-) at /usr/share/koha/Koha/Patrons.pm line 290.

Coming from an empty or undefined FailedLoginAttempts.

Test plan:
Verify that Koha/Patrons.t still passes.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24114: Remove warn statements from Koha::Patrons
Jonathan Druart [Tue, 26 Nov 2019 10:11:35 +0000 (11:11 +0100)]
Bug 24114: Remove warn statements from Koha::Patrons

The warn must be done in the cronjob.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Followed this test plan (with two follow-ups applied):
[1] Prefs: UnsubscribeReflectionDelay=1, PatronAnonymizeDelay=2, PatronRemovalDelay=3, FailedLoginAttempts was undef
[2] Pick borrower and set expiry to NOW-2, and lock him (login_attempts=-1) Could be achieved too by settings FailedLoginAttempts and trying wrong passwords. Run cleanup job:
    Locked 0 patrons
    Anonymized 1 patrons
    Deleted 0 patrons
[3] Pick borrower, set expiry to NOW-3. Run cleanup job:
    Locked 0 patrons
    Anonymized 0 patrons
    Deleted 1 patrons

Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24682: Make UsageStatsGeolocation readonly (and redirect to the config page)
Jonathan Druart [Fri, 21 Feb 2020 09:31:54 +0000 (10:31 +0100)]
Bug 24682: Make UsageStatsGeolocation readonly (and redirect to the config page)

To prevent invalid values in this pref (and so on the server), we should
make this input readonly on the syspref page.
The sysprefs related to Hea should be edited from the dedicated page, so
also adding a note about that.

Test plan:
Search syspref with "UsageStats"
Notice the note about the admin page
Notice the UsageStatsGeolocation input is now readonly (and resized, to
display the whole value when filled)

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24527: misc/cronjobs/update_totalissues.pl problem with multiple items
Fridolin Somers [Tue, 28 Jan 2020 15:09:20 +0000 (16:09 +0100)]
Bug 24527: misc/cronjobs/update_totalissues.pl problem with multiple items

misc/cronjobs/update_totalissues.pl when issuing statistics table, no-incremental,  has a problem for biblio with multiple items.
The first SQL query gets the biblios linked to items with issues in statistics :

SELECT
  biblio.biblionumber, COUNT(statistics.itemnumber)
FROM
  biblio
LEFT JOIN
  items
ON
  (biblio.biblionumber=items.biblionumber)
LEFT JOIN
  statistics
ON
  (items.itemnumber=statistics.itemnumber)
WHERE
  statistics.type = 'issue'
$limit
GROUP BY
  biblio.biblionumber

The second SQL query is :
SELECT
  biblio.biblionumber, 0
FROM
  biblio
LEFT JOIN
  items
ON
  (biblio.biblionumber=items.biblionumber)
LEFT JOIN
  statistics
ON
  (items.itemnumber=statistics.itemnumber)
WHERE
  statistics.itemnumber IS NULL
GROUP BY
  biblio.biblionumber

The problem is that this second query will set to 0 where ANY item has no entry in statistics table.
So when running it sets 0 to the biblio that had a value from first
query.

I think the best fix is to use "WHERE statistics.type = 'issue'" inside que JOIN :
LEFT JOIN statistics ON (items.itemnumber=statistics.itemnumber AND statistics.type = 'issue')

Test plan :
1) Begin with an empty database
2) Create a biblio 1 with no items
3) Create a biblio 2 with 3 items
4) Create a biblio 3 with 2 items
5) Checkout and checkin all items of biblio 2
6) Checkout and checkin the firt item of biblio 3
7) run misc/cronjobs/update_totalissues.pl --use-stats -v
8) Check biblio 1 has biblioitems.totalissues = 0
9) Check biblio 2 has biblioitems.totalissues = 3
10) Without patch the biblio 3 has biblioitems.totalissues = 0
11) With patch the biblio 3 has biblioitems.totalissues = 1
12) Check misc/cronjobs/update_totalissues.pl --incremental is OK

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24711: Don't add logout input to login form
Nick Clemens [Fri, 21 Feb 2020 21:11:37 +0000 (21:11 +0000)]
Bug 24711: Don't add logout input to login form

To test:
1 - Set OpacPublic syspref to 'Disable'
2 - Log in to OPAC
3 - Log out
4 - Try to log in again
5 - No error, but you get the login form again
6 - Apply patch
7 - Repeat
8 - This time you can log in again

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoUpdate release notes for 19.11.04 release v19.11.04
Joy Nelson [Tue, 24 Mar 2020 18:55:21 +0000 (18:55 +0000)]
Update release notes for 19.11.04 release

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoIncrement version for 19.11.04 release
Joy Nelson [Tue, 24 Mar 2020 18:40:33 +0000 (18:40 +0000)]
Increment version for 19.11.04 release

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24673: Add CSRF token support to opac-messaging.pl
David Cook [Mon, 17 Feb 2020 06:50:49 +0000 (06:50 +0000)]
Bug 24673: Add CSRF token support to opac-messaging.pl

This patch adds CSRF token support to opac-messaging.pl,
which allows users to manually update their messaging preferences,
but prevents bad actors from tricking people into updating their
preferences from cross-site requests.

Test plan:
0. Set SMSSendDriver global system preference to "Test" if unset
1. Log into the OPAC
2. Navigate to a URL in your browser like the following:
http://localhost:8080/cgi-bin/koha/opac-messaging.pl?modify=yes
&1=email&digest=1&2-DAYS=5&2=email&digest=2&4=email&SMSnumber=0444444444
3. Observe that the preference and SMS number update

4. Apply the patch

5. Navigate to a URL in your browser like the following:
http://localhost:8080/cgi-bin/koha/opac-messaging.pl?modify=yes
&1=email&digest=1&2-DAYS=5&2=email&digest=2&4=email&SMSnumber=0444444444
6. Observe that you get an error message of "Wrong CSRF token" instead
of the previous behaviour
7. Navigate to a URL in your browser like the following:
http://localhost:8080/cgi-bin/koha/opac-messaging.pl
8. Update "Advance notice" to 3 and update "SMS number" to 61111111111
9. Observe that the "Advance notice" and "SMS number" fields update
correctly

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24878: Add auth check for copy-holidays
Jonathan Druart [Tue, 17 Mar 2020 10:37:12 +0000 (11:37 +0100)]
Bug 24878: Add auth check for copy-holidays

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24878: Add authentication checks to the calendar tool
Jonathan Druart [Mon, 16 Mar 2020 15:26:48 +0000 (16:26 +0100)]
Bug 24878: Add authentication checks to the calendar tool

There is a security hole in 2 scripts that are used by the UI to edit
holidays.

To test:
1) Go to Tools -> Calendar, for Centerville
   Check no holiday for 30/4/2020
2) To add a new holiday without login execute
   a curl command with necessary parameters
3) Reload page from 1), verify the new holiday
   edit and delete the holiday
4) Apply the patch
5) Do 2) again, this time you get a lengthy output,
   with the magic words:

   <title>Koha &rsaquo;
       Log in to Koha
   </title>

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Only tested newHoliday but the fix is the same.
No errors

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24846: DBRev 19.11.03.005
Joy Nelson [Mon, 23 Mar 2020 23:39:49 +0000 (23:39 +0000)]
Bug 24846: DBRev 19.11.03.005

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24846: Update items.onloan with the new due date
Jonathan Druart [Tue, 17 Mar 2020 15:59:44 +0000 (16:59 +0100)]
Bug 24846: Update items.onloan with the new due date

Signed-off-by: Donna Bachowski <donna@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24846: Add new tool to batch extend due dates
Jonathan Druart [Mon, 16 Mar 2020 10:45:44 +0000 (11:45 +0100)]
Bug 24846: Add new tool to batch extend due dates

With events sometimes leading to unforeseen branch closures (think Coronavirus as
an example), it would be helpful to have a tool that would allow librarians to
update due dates in bulk based on branch and current due date of the material.

It allows to select checkouts given the following parameters:
 * libraries
 * patron's categories
 * range of the due date

You can set a hard due date, or define a number of days to extend the
due date.

Test plan:
Check some items out
Use the new tool to extend the due dates
Test the different filters to make sure they all work

Note: What about holidays?

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24846: Link to the new tool
Jonathan Druart [Mon, 16 Mar 2020 10:51:10 +0000 (11:51 +0100)]
Bug 24846: Link to the new tool

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24846: Add new permission batch_extend_due_dates
Jonathan Druart [Mon, 16 Mar 2020 10:45:15 +0000 (11:45 +0100)]
Bug 24846: Add new permission batch_extend_due_dates

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 22359: Prevent undercollection at the server
Martin Renvoize [Fri, 24 Jan 2020 12:23:39 +0000 (12:23 +0000)]
Bug 22359: Prevent undercollection at the server

This patch adds some additional handling to prevent undercollection of
fees at the server side.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 22359: Improvements to payment collection inputs
Martin Renvoize [Wed, 20 Nov 2019 16:01:56 +0000 (16:01 +0000)]
Bug 22359: Improvements to payment collection inputs

This patch attempts to clarify the uses of the various input fields on
the paycollect screens.

It does this by adding validation to the form such that entering a
'collected' value that is lower than the 'paid' value is now forbidden.

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24676: Remove <p/> typo in opac-auth.tt
David Cook [Tue, 18 Feb 2020 00:59:05 +0000 (00:59 +0000)]
Bug 24676: Remove <p/> typo in opac-auth.tt

This patch removes some trivial invalid HTML from opac-auth.tt

Test plan:
1. Apply patch
2. As an unauthenticated user, try to place a hold on a search result
e.g. http://localhost:8080/cgi-bin/koha/opac-reserve.pl?biblionumber=29
3. View source or use an inspector to see there is no <p></p> block
between <input type="submit" value="Log in" class="btn"> and
<div id="nologininstructions">

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 17896: Remove duplicated use statements
Jonathan Druart [Fri, 21 Feb 2020 13:35:30 +0000 (14:35 +0100)]
Bug 17896: Remove duplicated use statements

and remove uneeded '&'

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 17896: load BakerTaylor module with use
Nick Clemens [Fri, 21 Feb 2020 12:56:53 +0000 (12:56 +0000)]
Bug 17896: load BakerTaylor module with use

We are incinsistent here, Amazon and Syndetics module are always loaeded in some places
BakerTaylor is conditional everywhere, and causes issues under plack

For simplicity sake I think we should just load this (small) module where it might be needed

To test:
1 - Disable Baker and Taylor images
2 - Restart plack
3 - Visit opac-readingrecord, opac-detail, opac-search, opac-shelves, opac-user
    Log in to opac
    Virew your reading history
    Make/view a list
    Search the catalog
    Look at an individual title
4 - Enable BakerTaylorEnabled
    If you don't have Baker and Taylor credentials, simply fudge them with bad data and enable
5 - Repeat steps above, in the word of Joubu "Kaboom"
6 - Apply patch
7 - Repeat 1-4
8 - You shoudl be able to load all the pages after enabling the pref

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24532: DBRev 19.11.03.004
Joy Nelson [Fri, 13 Mar 2020 01:10:09 +0000 (01:10 +0000)]
Bug 24532: DBRev 19.11.03.004

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24532: Fix misidentified credit_types from bug 23049
Martin Renvoize [Thu, 30 Jan 2020 14:39:22 +0000 (14:39 +0000)]
Bug 24532: Fix misidentified credit_types from bug 23049

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24532: Fix original DB update for bug 23049
Martin Renvoize [Thu, 30 Jan 2020 13:19:37 +0000 (13:19 +0000)]
Bug 24532: Fix original DB update for bug 23049

Pathalogical cases of Payments and Writeoffs being converted to debits
are identified during the DB update for bug 23049, but we are not
correctly limiting to those types accountlines when subsequently
populating the debit_type field.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24538: Handle Net::Netmask parser errors
David Cook [Wed, 19 Feb 2020 02:07:30 +0000 (02:07 +0000)]
Bug 24538: Handle Net::Netmask parser errors

This patch switches from the new() to new2() constructor,
which will return an undef value when it fails to parse a value.

This patch warns on parser failures, but otherwise silently drops
the invalid value, and returns objects for any valid input it can parse.
This way one mistake won't disable the whole feature.

To test:
1. Run the unit test t/Koha/Middlware/RealIP.t

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24538: Add unit tests for Koha::Middleware::RealIP
David Cook [Wed, 19 Feb 2020 02:05:07 +0000 (02:05 +0000)]
Bug 24538: Add unit tests for Koha::Middleware::RealIP

This patch adds some unit tests for Koha::Middleware::RealIP

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24269: Adjust C4::Heading to generate headings from auth tags
Nick Clemens [Tue, 14 Jan 2020 13:00:03 +0000 (13:00 +0000)]
Bug 24269: Adjust C4::Heading to generate headings from auth tags

To test:
1 - Be using Elasticsearch
2 - Check that field 150 is mapped to 'Match-heading' or add it (the subfields don't matter)
3 - Add a topic term authority record like "150 $aCats$vFiction"
4 - Add a 650 with $aCats and $vFiction and  $e depicted to a bibliographic record
5 - Run the linker for the bib
    perl misc/link_bibs_to_authorities.pl --bib-limit "biblionumber=89" -v
6 - Confirm the record is not correctly linked to the record
7 - Apply patch
8 - Reindex authorities for ES
    perl misc/search_tools/rebuild_elasticsearch.pl -v -d -a
9 - Run the linker and confirm record is correctly linked
    perl misc/link_bibs_to_authorities.pl --bib-limit "biblionumber=89" -v

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 21633: DBRev 19.11.03.003
Joy Nelson [Fri, 13 Mar 2020 00:29:45 +0000 (00:29 +0000)]
Bug 21633: DBRev 19.11.03.003

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 21633: (follow-up) Cleanup other values for finesMode
Nick Clemens [Thu, 23 Jan 2020 12:06:21 +0000 (12:06 +0000)]
Bug 21633: (follow-up) Cleanup other values for finesMode

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 21633: Remove finesMode 'test'
Nick Clemens [Fri, 3 Jan 2020 14:56:53 +0000 (14:56 +0000)]
Bug 21633: Remove finesMode 'test'

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24094: Strip trailing spaces and punctuation from authority headings
Nick Clemens [Fri, 31 Jan 2020 14:18:24 +0000 (14:18 +0000)]
Bug 24094: Strip trailing spaces and punctuation from authority headings

Both when searching for and creating new authorities we need to remove
punctuation that exists in the bibliographic record but does not belong in
the authority record.

For example, a series with a volume contains a semicolon in the bib record,
however, this should not be passed to the authority as the volume is not
included in the authority record.

To test:
 1 - Set AutoCreateAuthorities to 'generate'
 2 - Set BiblioAddsAuthorities to 'true'
 3 - Set CatalogModuleRelink to 'Do'
 4 - Find or create a record with:
    a 100 field with a subfield e preceded by a comma: 100 $aBoring, M. Eugene M ,$e author
    an 830 field with a volume preceded by a semicolon: 650$aLord of the rings ;$v 3.
 5 - Save the records and check the links
 6 - Note punctuation is passed through
 7 - Save again, auth records are created again
 8 - Apply patch
 9 - Save again, new auth records are created again
10 - Check the records, punctuation has been removed
11 - Save again, no more records created.

Signed-off-by: Myka Kennedy Stephens <mkstephens@lancasterseminary.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24094: Unit tests
Nick Clemens [Fri, 31 Jan 2020 14:18:14 +0000 (14:18 +0000)]
Bug 24094: Unit tests

Signed-off-by: Myka Kennedy Stephens <mkstephens@lancasterseminary.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24494: Make the regex more exact
Jonathan Druart [Thu, 13 Feb 2020 16:01:06 +0000 (17:01 +0100)]
Bug 24494: Make the regex more exact

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24494: tests: 00-valid-xml.t shouldn't check node_modules
Victor Grousset/tuxayo [Thu, 23 Jan 2020 14:55:18 +0000 (15:55 +0100)]
Bug 24494: tests: 00-valid-xml.t shouldn't check node_modules

== Test plan ==
- work with SCSS (just recompile it if you never did)
  - https://wiki.koha-community.org/wiki/Working_with_staff_client_SCSS
- now you have a node_modules directory
- prove -r t/00-valid-xml.t
- it should fail on files in node_modules
- apply this patch
- prove -r t/00-valid-xml.t
- it should work
- sabotage a legitimate XML file, like etc/SIPconfig.xml
- prove -r t/00-valid-xml.t
- it should fail, good the test is still useful
- undo the sabotage

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 19791: Keep user in circ when viewing patron's logs
Jonathan Druart [Fri, 14 Feb 2020 10:44:44 +0000 (11:44 +0100)]
Bug 19791: Keep user in circ when viewing patron's logs

When a librarian is viewing the log for a given patron (tab "modification log"
from the circulation module), the "object" and "modules" parameter can
be modified. It does not make sense, we should stay in the circulation
module and avoid those fields to be modified.

Test plan:
- Modify several patrons (in order to have several modification logs)
- Go to the modification log tab of one of them
- Notice that the "Object" input is not a "Borrowernumber" labelled
input and that you cannot modify it.
Also notice that the "modules" is hidden.
- Go to the log viewer tool and notice that the view is still the same
as before this patch.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24051: Remove "search( %condition ) is deprecated" warning from batchMod.pl
Jonathan Druart [Mon, 18 Nov 2019 10:29:46 +0000 (11:29 +0100)]
Bug 24051: Remove "search( %condition ) is deprecated" warning from batchMod.pl

Test plan:
Go to Home › Tools › Batch item modification
Insert barcodes and continue
=> Without this patch you will get warning in the log
=> With this patch applied you warning does no longer appear
Confirm that the number of holds is correct

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 22245: Allow copy/move from and to control fields
Jonathan Druart [Sat, 16 Feb 2019 14:46:08 +0000 (11:46 -0300)]
Bug 22245: Allow copy/move from and to control fields

The JS conditions were wrong, we want to allow copy and move between
control fields.

Test plan:
Create a new MARC modification template action using control fields.
Confirm that you are allowed to copy/move a control field to another one

Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24666: (QA follow-up) Add missing filters
Martin Renvoize [Tue, 18 Feb 2020 18:32:02 +0000 (18:32 +0000)]
Bug 24666: (QA follow-up) Add missing filters

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24666: Display not registered guarantors on the patron detail page
Jonathan Druart [Mon, 17 Feb 2020 13:39:50 +0000 (14:39 +0100)]
Bug 24666: Display not registered guarantors on the patron detail page

There was no way to see the not registered guarantors apart of editing
the patron.

Test plan:
- Create a patron with category type "Child"
- Define a "guarantor surname" and/or "guarantor firstname" in the
"Contact" block (the patron is not registered)
- See the patron's detail page and notice that the info appear
- Edit and add a registered guarantor
- See the patron's detail page and notice that the 2 guarantors info appear

Note that the relationship has been added.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 5016: Fix some translation issues with English PDF order templates
Katrin Fischer [Sun, 24 Nov 2019 12:01:20 +0000 (13:01 +0100)]
Bug 5016: Fix some translation issues with English PDF order templates

Changes made:
- Instead of n° print no.
- Market Identification => Market identification
- GST => Tax

To test:
- Create at least 2 baskets with one or more orders
- Create a basket group with those baskets
- Print the PDF using
  - the 2 page layout
  - the 3 page layout
- Verify that the changes made appear and everything looks correct

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 17221: (follow-up) Orphan comma in shelf browser
Katrin Fischer [Sun, 12 Jan 2020 03:55:41 +0000 (03:55 +0000)]
Bug 17221: (follow-up) Orphan comma in shelf browser

This further improves the display if no location or no
collection has been set. Example output:

Browsing Centerville shelves, Collection: Non-fiction

Also changes 'Collection code' to 'collection' and takes
care of additional spaces before the comma.

To test:
- Make sure your OpacShelfBrowser pref is set to "Show"
- Search for a record with items and callnumbers in your OPAC
- "Browse shelf"
- Navigate back and forth, verify the information showing on
  top of the list is correctly formatted
- Try different combinations for the following prefs:
  - ShelfBrowserUsesCcode
  - ShelfBrowserUsesHomeBranch
  - ShelfBrowserUsesLocation
- Verify the display is always nicely formatted

Note: fixing capitalization here is tricky, as it also
depends on what was displayed before. If you have no
homebranch, you would want "Shelving...", if you have one
we'd like "shelving...". Left as I found it for now.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 17221: Remove orphan commas in shelf browser
phette23 [Sun, 12 Jan 2020 10:32:53 +0000 (11:32 +0100)]
Bug 17221: Remove orphan commas in shelf browser

This patch adds more conditions to the shelf browser template
such that the displayed text reads as a proper list no matter
what combination of system preferences are utilized

Sponsored-by: California College of the Arts
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 21944: Improve efficiency of code
Kyle M Hall [Tue, 3 Dec 2019 16:03:18 +0000 (11:03 -0500)]
Bug 21944: Improve efficiency of code

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 21944: Reroute waiting hold from wrong branch
Christopher Brannon [Tue, 4 Dec 2018 16:38:34 +0000 (16:38 +0000)]
Bug 21944: Reroute waiting hold from wrong branch

To Test:
1) Place a hold on an item.
2) Check in the item to trigger the hold.  Item is now listed as
waiting.
3) Set branch to a different library.
4) Check in the item to trigger the hold.  Notice that nothing but a
local use is recorded.
5) Apply the patch.
6) Repeat steps 1-4.  Notice that the hold is triggered around routed to
its original pickup location.  A transfer is set and the hold status
is changed from waiting to correctly showing the item as in transit.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 21944: Test for Circulation.pm
Christopher Brannon [Thu, 13 Dec 2018 00:08:54 +0000 (00:08 +0000)]
Bug 21944: Test for Circulation.pm

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24110: Do not html filter TT vars when dumped
Jonathan Druart [Tue, 26 Nov 2019 08:27:21 +0000 (09:27 +0100)]
Bug 24110: Do not html filter TT vars when dumped

DumpTemplateVarsIntranet and DumpTemplateVarsOpac are devs tools to
display the variables sent to the template. They should not be filtered
otherwise it's getting complicate to read.

For instance: $VAR1 = { var =&gt; val }

Test plan:
Turn DumpTemplateVarsIntranet on
Go to the main page
Show the source of the page
Confirm that the variable are displayed as it and not filtered

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24514: Add option to exclude title from patron-title.inc
Nick Clemens [Fri, 24 Jan 2020 17:33:48 +0000 (17:33 +0000)]
Bug 24514: Add option to exclude title from patron-title.inc

Without this patch sorting by patron name on the 'holds awaiting
pickup' report sorted by title, surname, firstname. With this
patch the list will sort by surname, firstname, ignoring the title.

To test:
- generate and capture a hold for a patron named "Mr. A A"
- generate and capture a hold for a patron named "A A"
- generste and capture a hold for patron named "Mr. B B"
- generste and capture a hold for patron named "B B"
- go to holds awaiting pickup
- sort by patron name ascending
- holds sort Mr. A, Mr. B, A, B
- sort by patron name descending
- holds sort B, A, Mr. B, Mr. A
- APPLY PATCH
- Reload holds awaiting pickup
- Confirm holds sort on Surname

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 18933: Allow OPAC messaging SMS number to be set to empty
Aleisha Amohia [Sun, 9 Feb 2020 21:55:01 +0000 (21:55 +0000)]
Bug 18933: Allow OPAC messaging SMS number to be set to empty

To test:
1) Ensure EnhancedMessagingPreferences is enabled and
EnhancedMessagingPreferencesOPAC is set to Show. Set SMSSendDriver to
Email
2) Log in to OPAC, go to your messaging tab
3) Set an SMS number if you havent already
4) Try to remove it (set to empty)
5) Notice that it says the number has been updated, but it has not
been set to empty
6) Apply patch and refresh page
7) Attempt to set the number to empty
8) Confirm this is successful

Sponsored-by: Catalyst IT
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24388: Remove uneeded test in lateorders.tt
Jonathan Druart [Mon, 16 Dec 2019 17:50:16 +0000 (18:50 +0100)]
Bug 24388: Remove uneeded test in lateorders.tt

The budget_lock is never set (and has never been).

Test plan:
For QAer only, make sure this never worked

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24549: Do not set "last patron" cookie if showLastPatron is disabled
Jonathan Druart [Wed, 12 Feb 2020 14:49:17 +0000 (15:49 +0100)]
Bug 24549: Do not set "last patron" cookie if showLastPatron is disabled

If the showLastPatron syspref is disabled, we should not store the 3
cookies we use for this feature.

Test plan:
0/ Do not apply this patch
1/ Turn off showLastPatron
2/ Search for a patron, click on a result
3/ Open the cookie list of your browser
=> You see 3 cookies named lastborrowercard, lastborrowername,
lastborrowernumber
4/ Remove them
5/ Apply the patch
6/ Reload the patron detail page
=> The 3 cookies are not created
7/ Turn the pref on
8/ Reload the patron detail page
=> The 3 cookies are created
9/ Eat one of them.

QA note: it's a bit dirty, we should do that JS side, but
staff-global.js is too widely used to make the change easy. Any other
suggestions welcomed.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24725: (QA follow-up) Add missing spaces between elements on claims tab
Katrin Fischer [Mon, 24 Feb 2020 17:01:19 +0000 (17:01 +0000)]
Bug 24725: (QA follow-up) Add missing spaces between elements on claims tab

There was a missing space between the title and the barcode.
Also added a space between title and author.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24725: Remove ES template literals in checkouts.js
Jonathan Druart [Tue, 25 Feb 2020 13:40:06 +0000 (14:40 +0100)]
Bug 24725: Remove ES template literals in checkouts.js

From Julian on bug 24661 comment 6:
"""
It looks like xgettext does not like ES6 template literals.

https://savannah.gnu.org/bugs/?50920

From what I understand, support for template literals was added in gettext 0.20 (still not packaged in debian) but is still buggy in latest released version 0.20.1 and a fix is present in master.
"""

We should not use backticks ` in .js file, it breaks xgettext.

To replicate:
kohadev-koha@e1f3025cca60:/kohadevbox/koha/misc/translator$ perl translate update es-ES
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:569: warning: unterminated string
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:858: warning: unterminated string
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:904: warning: unterminated string
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:911: warning: unterminated string
koha-tmpl/intranet-tmpl/prog/js/checkouts.js:1095: warning: RegExp literal terminated too early
/usr/bin/msgmerge: error while opening "/kohadevbox/koha/misc/translator/po/es-ES-messages-js.po" for reading: No such file or directory

(last error 'No such file or directory' is not related to this).

Test plan:
Make sure nothing is broken on the claims table
Confirm that the errors do not longer appear on `perl translate update LANG`

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>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24727: (bug 14697 follow-up) Replace link on title to bib detail page
Jonathan Druart [Tue, 25 Feb 2020 13:17:27 +0000 (14:17 +0100)]
Bug 24727: (bug 14697 follow-up) Replace link on title to bib detail page

903                               let title = `<a
class="return-claim-title strong"
href="/cgi-bin/koha/circ/request-rcticle.pl?biblionumber=[%
rc.checkout.item.biblionumber | html %]">

At first it seems like a typo:
request-rcticle.pl vs request-acticle.pl

But actually it does not make sense to link to request-article, we want
(I think) to link to the bibliographic record detail page.

Test plan:
- Have something in the claim table (cf bug 14697)
- Click on the title of the bibliographic record

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>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24664: Add missing *-messages-js.po
Bernardo Gonzalez Kriegel [Fri, 14 Feb 2020 14:33:44 +0000 (11:33 -0300)]
Bug 24664: Add missing *-messages-js.po

If you try to update some language translation files
translate script will complain of missing *-messajes-js.po
file.

This patch adds those missing files

To test:
1) Go to misc translation
2) Update some language, eg- fr-FR
Check error
/usr/bin/msgmerge: error while opening "/.../misc/translator/po/es-ES-messages-js.po" for reading: No such file or directory
3) Apply this patch
4) Repeat 2), no error message

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24677: (bug 24002 follow-up) Incorrect DATE value: '00-00-0000' in C4/Serials.pm
Jonathan Druart [Mon, 17 Feb 2020 17:18:48 +0000 (18:18 +0100)]
Bug 24677: (bug 24002 follow-up) Incorrect DATE value: '00-00-0000' in C4/Serials.pm

Oops, wrong copy/paste here! The column order changes was not expected.

From bug 24002:
  commit 3d3336ed6607d80b72502075ebf9567cf48e1709
  Bug 24002: Incorrect DATE value: '00-00-0000' in C4/Serials.pm

The changes from this patch are like:
-            year(IF(serial.publisheddate="00-00-0000",serial.planneddate,serial.publisheddate)) as year,
+            year(IF(serial.publisheddate IS NULL,serial.publisheddate,serial.planneddate)) as year,

This is stilly, if publisheddate is null we do not want to return it.

It comes from a wrong copy/paste from the other commits:
-                        ORDER BY IF(publisheddate<>'0000-00-00',publisheddate,planneddate) DESC";
+                        ORDER BY IF(publisheddate IS NULL,planneddate,publisheddate) DESC";

="00-00-0000" vs <>"0000-00-00"

Test plan:
Eyeball the previous patches from bug 24002 and notice that the changes in the commit listed previously are wrong

Signed-off-by: Janusz Kaczmarek <januszop@gmail.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24642: Make Cache::Memcached::Fast::Safe required
Jonathan Druart [Wed, 12 Feb 2020 14:24:35 +0000 (15:24 +0100)]
Bug 24642: Make Cache::Memcached::Fast::Safe required

There is something wrong between the logic in Koha::Cache->new and our
dependencies.

We are having Cache::Memcached required, but
Cache::Memcached::Fast::Safe is optional.
However, in Koha::Cache->new we are initializing the Memcached cache
only if Cache::Memcached::Fast::Safe is installed.

We could fix the logic in Koha::Cache, but it seems better to make
Cache::Memcached::Fast::Safe mandatory (especially after bug 13193).

Note that after bug 13193, you are loosing the Memcached cache, as
Cache::Memcached::Fast::Safe will not get installed by default.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 13193: (RM follow-up) Remove Cache::Memcached::Fast from PerlDependencies
Martin Renvoize [Fri, 7 Feb 2020 14:32:13 +0000 (14:32 +0000)]
Bug 13193: (RM follow-up) Remove Cache::Memcached::Fast from PerlDependencies

We replaced this module with Cache::Memcached::Fast::Safe and so do not
need to depend upon it any longer.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 13193: (follow-up) Update debian/control file
Mason James [Fri, 7 Feb 2020 02:11:05 +0000 (15:11 +1300)]
Bug 13193: (follow-up) Update debian/control file

The dependancy has now been packaged, this patch adds it to the debian
control file for package installs.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 13193: Make Memcached usage fork safe
Joonas Kylmälä [Mon, 16 Sep 2019 10:26:01 +0000 (10:26 +0000)]
Bug 13193: Make Memcached usage fork safe

When a high enough number of forks try to access for example system
preferences with Koha::Cache using memcached as backend the results of
different cache requests get mixed up.

The problem is fixed by using Cache::Memcached::Fast::Safe that is a
fork safe version of Cache::Memcached::Fast.

Sponsored-by: The National Library of Finland
Signed-off-by: David Cook <dcook@prosentient.com.au>
Works as described, and solves an insidious difficult to debug
problem in Koha.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24661: Fix inclusion of locale-related javascript files
Julian Maurice [Fri, 14 Feb 2020 08:46:01 +0000 (09:46 +0100)]
Bug 24661: Fix inclusion of locale-related javascript files

2 js files (Gettext.js, i18n.js) + 1 generated js file (locale_data.js)
were added by bug 21156. Their URL are broken and the files are not loaded.

Use Template::Toolkit plugin Asset to include these files, and exclude
locale_data.js when language is english, because obviously translations
are not needed in this case.

Test plan:
1. Just make sure the files mentioned above are loaded correctly when in
   English and in other languages as well

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24734: Fix paths in LangInstaller.pm for JS files
Julian Maurice [Wed, 26 Feb 2020 19:09:52 +0000 (20:09 +0100)]
Bug 24734: Fix paths in LangInstaller.pm for JS files

Use intrahtdocs and opachtdocs in order to get the correct paths for all
kind of installations

Test plan:
1. With a dev install, run ./translator create/update/install xx-XX and
   verify that there is no error message
2. With a standard install, run ./translator create/update/install xx-XX
   and verify that there is no error message

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Tested for dev/single/standard installs, no errors,
just a (normal) warn from po2json.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 21156: (RM follow-up) Correction to added filters
Martin Renvoize [Fri, 14 Feb 2020 11:42:54 +0000 (11:42 +0000)]
Bug 21156: (RM follow-up) Correction to added filters

These lines required url filters rather than uri filters, my mistake :(

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 21156: (RM follow-up) Add missing filters
Martin Renvoize [Mon, 10 Feb 2020 14:13:04 +0000 (14:13 +0000)]
Bug 21156: (RM follow-up) Add missing filters

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 21156: Add plural translation capabilities to JS files
Julian Maurice [Mon, 4 Jan 2016 20:08:29 +0000 (21:08 +0100)]
Bug 21156: Add plural translation capabilities to JS files

It adds Javascript equivalent of Koha::I18N's exported subroutines, and
they are used the same way.

String extraction is done only on *.js files and require gettext 0.19
(available in Debian jessie, and also in wheezy-backports)

It adds Javascript library Gettext.js for handling translation and a
Perl script po2json to transform PO file into JSON.

Gettext.js and po2json both come from Locale::Simple.
There are several tools named po2json. It's simpler to integrate this
one into Koha than to check if the good one is installed on the system.
Locale::Simple is not needed.

To avoid polluting the global namespace too much, this patch also
introduce a global JS object named Koha and add some stuff in Koha.i18n

Test plan:
1. Add a translatable string in a JS file. For example, add this:
     alert(__nx("There is one item", "There are {count} items", 3,
     {count: 3}));
   to staff-global.js
2. cd misc/translator && ./translate update fr-FR
3. Open misc/translator/po/fr-FR-messages-js.po, verify that your
   string is present, and translate it
4. cd misc/translator && ./translate install fr-FR
5. (Optional) Verify that
   koha-tmpl/intranet-tmpl/prog/fr-FR/js/locale_data.js exists and
   contains your translation
6. Open your browser on the staff main page, change language and verify
   that the message is translated
7. Repeat 1-6 on OPAC side

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Works well, translation is OK and test message is displayed correctly.
Current qa-tool error is a false positive.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 23527: BakerTaylorBookstoreURL is converted to escaped characters by template...
David Kuhn [Sat, 31 Aug 2019 23:23:16 +0000 (16:23 -0700)]
Bug 23527: BakerTaylorBookstoreURL is converted to escaped characters by template, rendering it invalid

Changing the template toolkit filter for rendering the value of
BakerTaylorBookstoreURL in opac-detail.tt and opac-results.tt from uri
to url fixes the problem.

To test (requires a Baker & Taylor username and password):

1. Enter the B&T url into BakerTaylorBookstoreURL.
2. Set BakerTaylorEnabled to "add" and enter your username and password.
3. Look up a title in the OPAC.
4. Locate a title with a cover image.
5. Click on the cover image. You are not redirected to the url stored
   in BakerTaylorBookstoreURL.
6. Display the full record for the title
7. Click on the cover image. You are not redirected to the url stored
   in BakerTaylorBookstoreURL.
8. Apply the patch.
9. Refresh the OPAC display.
10. Click on the cover image. You are now redirected to the specified url.
11. Return to the results list.
12. Click on a cover image. You are now redirected to the specified url.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Although I don't have valid Baker & Taylor credentials I was able to use
dummy data to verify that the links in the template are correctly
encoded with this patch.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24640: DBRev 19.11.03.002
Joy Nelson [Thu, 5 Mar 2020 01:50:40 +0000 (01:50 +0000)]
Bug 24640: DBRev 19.11.03.002

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24640: Allow quotes.timestamp to be NULL
Jonathan Druart [Wed, 12 Feb 2020 11:26:25 +0000 (12:26 +0100)]
Bug 24640: Allow quotes.timestamp to be NULL

It is broken with strict mode enable, timestamp is created without
default value.

Note that the .sql installer file init the value with NOW(), which is
wrong.

DBD::mysql::st execute failed: Field 'timestamp' doesn't have a default
value [for Statement "INSERT INTO quotes (source, text) VALUES (?, ?);"
with ParamValues: 0="poeut", 1="pouet"] at
/kohadevbox/koha/tools/quotes/quotes_ajax.pl line 49.

Test plan:
Create a new quote of the day
=> Without this patch you will get an error

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24654: Remove trailing quote in rda264 XSLT
Nick Clemens [Thu, 13 Feb 2020 15:43:30 +0000 (15:43 +0000)]
Bug 24654: Remove trailing quote in rda264 XSLT

To test:
1 - Find or add a recod with a 264 field
2 - Make sure there is a subfield b
3 - View the record in opac
4 - Right click on publisher link and copy and paste into a text editor
5 - Note the trailing " in the search
6 - Apply patch
7 - Refresh
8 - Link is correctly formed now

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24621: Phase out jquery.cookie.js: Basic MARC editor
Owen Leonard [Mon, 10 Feb 2020 19:04:57 +0000 (19:04 +0000)]
Bug 24621: Phase out jquery.cookie.js: Basic MARC editor

This patch removes the use of the jquery.cookie plugin by the basic MARC
editor for setting two interface preferences: Showing MARC tag numbers
and showing MARC documentation links.

To test, apply the patch and open the basic MARC editor.

 - From the "Settings" menu, select the "Show MARC tag documentation
   links" link. This should toggle the display of the "?" link next to
   MARC tag descriptions.
 - Reload the page to confirm that your selection has been saved.
 - Perform the same test with the "Show tags" menu item.

You can also follow the changes to the cookie using the browser's
developer console. Look for cookies named 'marcdocs_***' and
'marctags_***' (where *** is the borrowernumber of the logged-in
user) and confirm that the value of each flips from "show" to "hide" and
back.

https://developer.mozilla.org/en-US/docs/Tools/Storage_Inspector
https://developers.google.com/web/tools/chrome-devtools/storage/cookies

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24619: Phase out jquery.cookie.js: MARC Frameworks
Owen Leonard [Mon, 10 Feb 2020 17:58:04 +0000 (17:58 +0000)]
Bug 24619: Phase out jquery.cookie.js: MARC Frameworks

This patch removes the use of the jquery.cookie plugin on the MARC
Frameworks page and replaces it with a call to the new js-cookie
library.

To test, apply the patch and go to Administration -> MARC
bibliographic frameworks.

 - Choose the 'MARC structure' menu item for one of the frameworks
   listed.
 - On the page which lists the tags in the framework, check the box
   labeled "Display only used tags/subfields." The page should reload.
 - The checkbox should remain checked and the list of tags should now
   show only used tags.
 - Uncheck the checkbox and the page should reload again.

You can also follow the changes to the cookie using the browser's
developer console. Look for a cookie named
'marctagstructure_selectdisplay' and confirm that the value flips from 0
to 1 and back.

https://developer.mozilla.org/en-US/docs/Tools/Storage_Inspector
https://developers.google.com/web/tools/chrome-devtools/storage/cookies

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
4 years agoBug 24389: Better error handle when claiming late orders
Jonathan Druart [Mon, 16 Dec 2019 16:15:19 +0000 (17:15 +0100)]
Bug 24389: Better error handle when claiming late orders

A successful message says that the email has been sent and the order has
been claimed, but nothing happened.

Test plan:
0. Do not apply this patch
1. Create a new vendor, does not create a contact
2. Create some orders, close the basket
3. Go to the late orders page and claims some orders
=> You get a successful message, but the claim has not been done!
4. Apply this patch
5. Claim the orders
=> You get an error
6. Set a contact for the vendor
7. Claim the orders
=> Success

In the docker container, you may need to:
% apt install postfix
% postfix start
Edit /etc/hosts
127.0.0.1       localhost localhost.localdomain

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>