koha.git
2 years agoBug 18984: Remove NORMARC support
Jonathan Druart [Thu, 21 Jan 2021 09:28:21 +0000 (10:28 +0100)]
Bug 18984: Remove NORMARC support

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27101: Fix sample_notices.t
Jonathan Druart [Fri, 16 Jul 2021 08:40:46 +0000 (10:40 +0200)]
Bug 27101: Fix sample_notices.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27101: Remove fr-CA installer data
Jonathan Druart [Fri, 16 Jul 2021 08:39:45 +0000 (10:39 +0200)]
Bug 27101: Remove fr-CA installer data

With installer data in YAML format and it's translations,
there are no need for localized installer files.

This patch removes fr-CA installer files.

1) Apply the patch
2) Translate to fr-CA
   cd misc/translator
   ./translate update fr-CA
   ./translate install fr-CA
3) Do a clean install using fr-CA,
   check no problems during install

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: Add fr-FR AR_REQUESTED notice
Tomas Cohen Arazi [Wed, 6 Oct 2021 13:34:42 +0000 (10:34 -0300)]
Bug 27944: Add fr-FR AR_REQUESTED notice

This patch adds the missing notice.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27725: Use JavaScript to set history state during patron search
Owen Leonard [Thu, 18 Feb 2021 16:37:37 +0000 (16:37 +0000)]
Bug 27725: Use JavaScript to set history state during patron search

This patch modifies the patron search page so that clicks on the "Browse
by last name" letters add an entry to the browser history, allowing the
user to click back and forth from results while preserving their search.

To test, apply the patch and go to Patrons in the staff interface.

- Click one of the "Browse by last name" letters.
- The table of search results should load the correct data.
- In the browser's location bar you should see a query string added to
  the URL, e.g. /cgi-bin/koha/members/members-home.pl?firstletter=Q
- Click another letter.
- Click the back button. You should be returned to the search results
  for your first letter choice.
- Clicking the forward button should work correctly as well.
- Other patron searches (header search, sidebar search) should continue
  to work as expected.

EDIT: Clear single-letter querystring history item if only one result
was returned.

EDIT 2: Fixed handling of history state changes so that forward and back
buttons work correctly.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 27725: (follow-up) Remove code for clearing search results

This patch removes code which cleared search results if there was no
first-letter search. It was unnecessary for the letter search
functionality and made all other searches fail.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28730: (QA follow-up) Add new option to example configs
Martin Renvoize [Wed, 22 Sep 2021 15:57:46 +0000 (16:57 +0100)]
Bug 28730: (QA follow-up) Add new option to example configs

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28730: Add option to format AH field (due date) in SIP checkout response
Nick Clemens [Wed, 21 Jul 2021 13:56:22 +0000 (13:56 +0000)]
Bug 28730: Add option to format AH field (due date) in SIP checkout response

This patch adds a new option to sip accounts:
format_due_date

If set to 1 the AH field in checkouts will follow the dateFormat system preference and format as due dates (ignoring time portion if 23:59:59 or 11:59:59)

To test:
 1 - checkout an item via SIP:
perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -t CR --item 3999900000001 --patron enda -m checkout
 2 - Note the AH field is like "YYYYMMDD    HHMMSS"
 3 - Apply patch
 4 - repeat SIP checkout - nothing has changed
 5 - edit SIPConfig.xml and add format_due_date="1" to 'term1' account:
    <login id="term1"  password="term1" delimiter="|" error-detect="enabled" institution="CPL" encoding="ascii"     checked_in_ok="1" format_due_date="1"/>
 6 - restart all
 7 - repeat the SIP checkout
 8 - AH field now matches dateFormat system preference
 9 - Change your dateFormat preference
10 - repeat the SIP checkout
11 - AH matches new format

Note: If you cannot renew and don't get an AH just check the item back in:
perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -t CR --item 3999900000001 --patron enda -m checkin

Signed-off-by: Winfred Thompkins <Winfred.thompkins@cedarhilltx.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 18631: Use - instead of _ for options
Jonathan Druart [Thu, 7 Oct 2021 09:10:45 +0000 (11:10 +0200)]
Bug 18631: Use - instead of _ for options

To match existing options

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 18631: Add option to specify logs to preserve or delete in cleanup_database.pl
Nick Clemens [Wed, 21 Jul 2021 19:15:27 +0000 (19:15 +0000)]
Bug 18631: Add option to specify logs to preserve or delete in cleanup_database.pl

This adds two new parameters:
--log_module
--preserve_log

These can be repeated to include or exclude specific modules from the cleanup

To test:
0 - Apply patch
1 - Enable cataloging log and borrowers log
2 - Make some changes to borrowers and records
3 - run cleanup databse with --logs 0 --preserve_log=MEMBERS --preserve_log=CATALOGUING
4 - nothing is removed
5 - run cleanup databse with --logs 0 --log_module=MEMBERS
6 - the borrower logs are removed, the record changes remain
7 - run cleanup database with --logs 0
8 - record changes are removed (all other logs too)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29175: finishreceive: Replace , by ;
Marcel de Rooy [Tue, 5 Oct 2021 13:02:38 +0000 (13:02 +0000)]
Bug 29175: finishreceive: Replace , by ;

This certainly is one of my shortest fixes ever ;)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28821: (QA follow-up) Adjust javascript test
Marcel de Rooy [Wed, 29 Sep 2021 12:45:47 +0000 (12:45 +0000)]
Bug 28821: (QA follow-up) Adjust javascript test

The test did not work when SearchEngine == Elasticsearch.

Test plan:
Verify if it works now for Elasticsearch.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28821: (follow-up) Improve operation of button plus/less
Marcel de Rooy [Fri, 6 Aug 2021 07:28:12 +0000 (07:28 +0000)]
Bug 28821: (follow-up) Improve operation of button plus/less

Follow-up for bug 28784.

Do not remove the op select on the first row.
Allow plus/less on all lines. Allow less until we have one line left.
Make sure that first op is disabled and hidden with plus/less.

Test plan:
Search on multiple indexes on advanced search.
Verify that plus/minus works as expected.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26544: Add housebound details to delivery page
Lucas Gass [Thu, 29 Jul 2021 22:39:09 +0000 (22:39 +0000)]
Bug 26544: Add housebound details to delivery page

To test:
1. Turn on the housebound module
2. go to the housebound for a given patron /cgi-bin/koha/members/housebound.pl?borrowernumber=X
3. add some housebound details, fill out all the fields
4. Go to 'Add a new delivery'
5. No housebound details, hard to know what the patron likes or days to deliver!
6. apply patch
7. Go to 'Add a delivery'
8. See the housebound details, yay! All the line breaks should be preserved.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28931: Remove unused Koha::DateUtils from tests
Jonathan Druart [Mon, 4 Oct 2021 08:52:29 +0000 (10:52 +0200)]
Bug 28931: Remove unused Koha::DateUtils from tests

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28931: Use EXPORT_OK from Koha::DateUtils
Jonathan Druart [Fri, 10 Sep 2021 10:01:01 +0000 (12:01 +0200)]
Bug 28931: Use EXPORT_OK from Koha::DateUtils

It has been missed on bug 17600.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Adjusted commit title.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29179: Remove useless includes in moveitem.pl
Tomas Cohen Arazi [Tue, 5 Oct 2021 16:24:58 +0000 (13:24 -0300)]
Bug 29179: Remove useless includes in moveitem.pl

This patch moves a trivially unneeded set of includes from this file.

To test:
1. Apply the patch
2. Try attaching an item to another biblio
=> SUCCESS: Things work as expected!
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29083: Don't pass _count var
Jonathan Druart [Thu, 7 Oct 2021 08:14:49 +0000 (10:14 +0200)]
Bug 29083: Don't pass _count var

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29086: (follow-up) Remove unrequired Koha::ArticleRequest::Status uses
Tomas Cohen Arazi [Wed, 22 Sep 2021 19:53:50 +0000 (16:53 -0300)]
Bug 29086: (follow-up) Remove unrequired Koha::ArticleRequest::Status uses

I noticed a couple places in which this library was included but not
used.

To test:
1. Apply this patch
2. Run:
   $ git grep 'Koha::ArticleRequest::Status'
=> SUCCESS: There aren't any calls to their defined constants in
Biblio.pm or Patrons.pm
3. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29086: Simplify querying active article requests
Tomas Cohen Arazi [Wed, 22 Sep 2021 19:49:33 +0000 (16:49 -0300)]
Bug 29086: Simplify querying active article requests

This patch makes a trivial replacement of a query for a higher level
method that does the same query.

To test:
1. Enable the ArticleRequests feature
2. Place some article requests on known biblios
3. Have some article requests be active on others finished (either
   completed or cancelled)
4. Go to the detail page for those records
=> SUCCESS: The active article requests count is correct!
5. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29084: Update article requests-related Koha::Biblio methods to use relationships
Tomas Cohen Arazi [Wed, 22 Sep 2021 19:19:21 +0000 (16:19 -0300)]
Bug 29084: Update article requests-related Koha::Biblio methods to use relationships

This patch makes Koha::Patron->article_requests use the underlying DBIC
relationship and _new_from_dbic instead of a plain search. It also
refactors 'article_requests_current' and 'article_requests_finished' to
use ->article_requests, as well as the new methods introduced by bug
29082 for filtering.

No behavior change should take place.

To test:
1. Apply the unit tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Biblio.t \
           t/db_dependent/ArticleRequests.t
=> SUCCESS: Tests pass!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

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

This patch adds missing tests for Koha::Biblio->article_requests and
reorganizes (and extends) the tests for 'article_requests_current' and
'article_requests_finished' that were originally in ArticleRequests.t
into Koha/Biblio.t as we do now.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/ArticleRequests.t \
           t/db_dependent/Koha/Biblio.t
=> SUCCESS: Tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 29084: Remove article_requests_finished and article_requests_current

This patch removes those methods that are not really needed. Templates
are adjusted to use the expected combination of
->article_requests->filter_by_current.

To test:
1. Apply this patch
2. Visit a biblio with article requests
=> SUCCESS: All works
3. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Biblio.t
=> SUCCESS: Tests pass, less tests.
4. Sign off :-D

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29083: Update article requests-related Koha::Patron methods to use relationships
Tomas Cohen Arazi [Wed, 22 Sep 2021 18:46:26 +0000 (15:46 -0300)]
Bug 29083: Update article requests-related Koha::Patron methods to use relationships

This patch makes Koha::Patron->article_requests use the underlying DBIC
relationship and _new_from_dbic instead of a plain search. It also
refactors 'article_requests_current' and 'article_requests_finished' to
use ->article_requests, as well as the new methods introduced by bug
29082 for filtering.

No behavior change should take place.

To test:
1. Apply the unit tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Patron.t \
           t/db_dependent/ArticleRequests.t
=> SUCCESS: Tests pass!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Bug 29083: Unit tests

This patch adds missing tests for Koha::Patron->article_requests and
moves (and extends) tests for 'article_requests_current' and
'article_requests_finished' that were originally in ArticleRequests.t
into Koha/Patron.t as we now do.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/ArticleRequests.t \
           t/db_dependent/Koha/Patron.t
=> SUCCESS: Tests pass!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Bug 29083: (QA follow-up) Remove unused param

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Bug 29083: Fix OPAC listing of article requests

This patch makes the OPAC template reuse a precalculated value for the
active article requests for the patron (and its count).

The original code relied on the methods returning a list, which is not
the case for _new_from_dbic until bug 28883 is pushed.

This patch fixes that.

Note: there was an odd behavior when ArticleRequests was enabled but no
active article requests were present: the tab wasn't rendered but the
'empty table' with the 'You have no article requests currently.' message
was displayed below the Checkouts tab. I'm not sure that was caused by
this patches, or other. Fixed on this patch.

To test:
1. In the OPAC, go to 'your summary'
=> FAIL: Things don't show for article requests
2. Add some article requests and repeat 1
=> FAIL: Something's wrong there
3. Apply this patch and repeat 1
=> Yes! Things show correctly!
4. Cancel all your article requests
=> SUCCESS: Things render as they should
5. Re-enter the 'your summary' page (to force re-rendering)
=> SUCCESS: Things render correctly for empty article requests
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Bug 29083: Remove article_requests_finished and article_requests_current

This patch removes those methods that are not really needed. Templates
are adjusted to use the expected combination of
->article_requests->filter_by_current.

To test:
1. Apply this patch
2. Visit a patron with article requests
=> SUCCESS: All works
3. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Patron.t
=> SUCCESS: Tests pass, less tests.
4. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29082: Simplify tests
Jonathan Druart [Mon, 4 Oct 2021 10:44:51 +0000 (12:44 +0200)]
Bug 29082: Simplify tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29082: Add filtering methods to Koha::ArticleRequests
Tomas Cohen Arazi [Wed, 22 Sep 2021 18:23:07 +0000 (15:23 -0300)]
Bug 29082: Add filtering methods to Koha::ArticleRequests

This patch adds handy methods for filtering Koha::ArticleRequests
resultsets.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/ArticleRequests.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: (QA follow-up) Wrap tests in transaction
Tomas Cohen Arazi [Wed, 6 Oct 2021 16:44:16 +0000 (13:44 -0300)]
Bug 27526: (QA follow-up) Wrap tests in transaction

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Improve robustness of tests
Jonathan Druart [Wed, 6 Oct 2021 13:45:17 +0000 (15:45 +0200)]
Bug 27526: Improve robustness of tests

* Could fail if not using the original sample data: build the AV we need
instead of relying on what is in the DB

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Fix perlcritic in tests
Jonathan Druart [Wed, 6 Oct 2021 13:53:47 +0000 (15:53 +0200)]
Bug 27526: Fix perlcritic in tests

Problem while critiquing "t/db_dependent/Koha/Item.t": Can't parse code: Encountered unexpected character '195'

non-ascii chars must be quoted when used as hash keys

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26352: Switch from using call() to call_recursive()
Kyle M Hall [Thu, 14 Jan 2021 14:47:46 +0000 (09:47 -0500)]
Bug 26352: Switch from using call() to call_recursive()

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26352: (QA follow-up) Add additional tests
Martin Renvoize [Fri, 20 Nov 2020 14:13:39 +0000 (14:13 +0000)]
Bug 26352: (QA follow-up) Add additional tests

This patch adds additional unit tests for autoMemberNum handling and
corrects the implimentation there.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26352: Replace call to barcode_generate with call to patron_barcode_transform
Kyle M Hall [Fri, 20 Nov 2020 13:32:14 +0000 (08:32 -0500)]
Bug 26352: Replace call to barcode_generate with call to patron_barcode_transform

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26352: Add unit test
Kyle M Hall [Thu, 12 Nov 2020 18:34:33 +0000 (13:34 -0500)]
Bug 26352: Add unit test

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26352: Add plugin hooks to transform patron barcodes
Kyle M Hall [Wed, 2 Sep 2020 13:22:57 +0000 (09:22 -0400)]
Bug 26352: Add plugin hooks to transform patron barcodes

Some of our partners have unusual barcode requirements that have
required us to transform scanned barcodes using javascript. This is not
the most reliable method. It would make more sense to have Koha
transform the barcodes on the backend using a plugin. We should add
hooks to transform and generate new item and patron barcodes.

Test Plan:
1) Apply this patch
2) Download and install the Barcode Transformer plugin
   https://github.com/bywatersolutions/koha-plugin-barcode-transformer/releases/download/v1.0.1/koha-plugin-barcode-transformer-v1.0.1.kpz
3) Go to the plugin configuration page, set the configuration to the example configuration from the same page
4) In the patron search and anywhere else you can scan a patron
   cardnumber, type in some cardnumbers but prefix them with A and postfix
   them with A or B, e.g. A12345AA12345B
5) Note the letters are removed by Koha!
6) Try a cardnumber like X123456Y
7) Note Koha converts it to Z13456Z

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 26351: Add plugin hooks to transform item barcodes
Kyle M Hall [Wed, 2 Sep 2020 13:17:31 +0000 (09:17 -0400)]
Bug 26351: Add plugin hooks to transform item barcodes

Some of our partners have unusual barcode requirements that have
required us to transform scanned barcodes using javascript. This is not
the most reliable method. It would make more sense to have Koha
transform the barcodes on the backend using a plugin. We should add
hooks to transform and generate new item and patron barcodes.

Test Plan:
1) Apply this patch
2) Download and install the Barcode Transformer plugin
   https://github.com/bywatersolutions/koha-plugin-barcode-transformer/releases/
3) Go to the plugin configuration page, set the configuration to the example configuration from the same page
4) In the item barcode field on the checkin and checkout pages,
   and anywhere else you can scan an item barcode, type in some
   valid barcodes, but prefix them with X and postfix them with
   Y, e.g. X123456Y
5) Note the letters are removed by Koha!

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 26351: (QA follow-up) Fix QA script issue

* Fixes issue with barcode generate stub so perlcritic is happy
* Removes extra semicolon from return call in configure method

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 26351: Add unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 26351: (QA follow-up) Remove unused method barcode_transform

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 26351: (QA follow-up) Rename barcode_transform to item_barcode_transform

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 26351: (QA follow-up) Barcodes inputted into Koha should always pass though barcodedecode

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 26351: (QA follow-up) Catch one last case of itemBarcodeInputFilter

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 26351: (QA follow-up) Fix Checkouts.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 26351: Use call_recursive() as a replacement for call()

The method `call()` is not sufficient for barcode transformations. It's
possible that more than one barcode transformation plugin will be
installed. The `call_recursive()` method takes the output of the first
plugin and uses it as the input for the next plugin and so on. This allowes
each plugin to see the current version of the barcode and modify it if
necessary.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 26351: Fix t/db_dependent/Koha/Plugins/Circulation_hooks.t

Bug 26351: Revert improper change to unit test, fix number of tests

Bug 26351: Remove uneeded use Koha::Plugins statements

Left over from previous changes

Bug 26351: Add missing barcodedecode import

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28026: Add call_recursive() as a supplement for call()
Kyle M Hall [Tue, 23 Mar 2021 16:07:20 +0000 (16:07 +0000)]
Bug 28026: Add call_recursive() as a supplement for call()

The method call() is not sufficient for all plugin hook types. It's
possible that more than one plugin will be installed that wants to
return the arguaments passed in an updated form.  These transformation
plugins need to work recursively rather than independantly.

This patch adss a `call_recursive()` method that takes the output of
the first plugin and uses it as the input for the next plugin and so
on. This allowes each plugin to see the current version of the arguament
list and modify it as necessary.

Test plan
1/ Run the included tests - t/db_dependent/Koha/Plugins/Plugins.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 25429: DBRev 21.06.00.030
Jonathan Druart [Wed, 6 Oct 2021 12:55:45 +0000 (14:55 +0200)]
Bug 25429: DBRev 21.06.00.030

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 25429: (QA follow-up) Add extra variable for days
Marcel de Rooy [Fri, 1 Oct 2021 08:45:48 +0000 (08:45 +0000)]
Bug 25429: (QA follow-up) Add extra variable for days

I think it is a bit more clear to use another variable for the
number of days from the preferences than overwriting the flag
variable.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested by adding an authval for LOST.
Filling prefs ClaimReturnedLostValue, CleanUpDatabaseReturnClaims.
Claiming a return, resolving it. Setting date back via SQL.
Running the script with -v --return-claims, toggling --confirm.
The claim is counted and deleted with confirm.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 25429: Require command line switch to enable, control DAYS via syspref
Kyle M Hall [Thu, 13 May 2021 13:28:36 +0000 (09:28 -0400)]
Bug 25429: Require command line switch to enable, control DAYS via syspref

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 25429: Use filter_by_last_update
Kyle M Hall [Tue, 6 Apr 2021 13:16:52 +0000 (09:16 -0400)]
Bug 25429: Use filter_by_last_update

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 25429: Script should be able to run with only return claims
Kyle M Hall [Tue, 12 Jan 2021 12:55:22 +0000 (07:55 -0500)]
Bug 25429: Script should be able to run with only return claims

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 25429: Cleanup Database - remove resolved claims returned from db after X days
Kyle M Hall [Fri, 8 May 2020 18:02:34 +0000 (14:02 -0400)]
Bug 25429: Cleanup Database - remove resolved claims returned from db after X days

Add option to cleanup_database script to removed 'resolved' return claims from the database after a specified number of days.

Test Plan:
1) Apply this patch
2) Set the new syspref CleanUpDatabaseReturnClaims to a number of days
3) Run cleanup_database.pl
4) Note resolved claims older than the specified number of days are removed from the database

Bug 25429: Implement system preference, remove command line switch

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27032: (follow-up) Pass rather than fetch variables
Nick Clemens [Mon, 22 Mar 2021 13:29:13 +0000 (13:29 +0000)]
Bug 27032: (follow-up) Pass rather than fetch variables

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Rebased-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27032: Move auto renewal code out of CanBookBeRenewed
Joonas Kylmälä [Mon, 16 Nov 2020 13:49:07 +0000 (15:49 +0200)]
Bug 27032: Move auto renewal code out of CanBookBeRenewed

This moves the checks related to whether auto renewal can be done on
the checkout to its own function _CanBookBeAutoRenewed(). This makes
it more clear which parts of the code are related to auto renewal
checking and which are not.

To test:
  1) Make sure prove t/db_dependent/Circulation.t still passes

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Rebased-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27032: Remove unused variables
Joonas Kylmälä [Mon, 16 Nov 2020 12:00:15 +0000 (14:00 +0200)]
Bug 27032: Remove unused variables

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Rebased-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Add tests for columns_to_str and host_items
Jonathan Druart [Mon, 2 Aug 2021 12:47:09 +0000 (14:47 +0200)]
Bug 27526: Add tests for columns_to_str and host_items

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Add missing POD
Jonathan Druart [Fri, 30 Jul 2021 14:25:04 +0000 (16:25 +0200)]
Bug 27526: Add missing POD

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Fix cn_source display
Jonathan Druart [Fri, 23 Jul 2021 13:16:32 +0000 (15:16 +0200)]
Bug 27526: Fix cn_source display

For an unknown reason C4::Biblio::GetAuthorisedValueDesc (that we are
calling from Koha::Item->columns_to_str) does not deal with class
sources.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Fix encoding issue on subfield
Jonathan Druart [Wed, 21 Jul 2021 09:24:27 +0000 (11:24 +0200)]
Bug 27526: Fix encoding issue on subfield

If you have a "é" subfield it should work!

Note that VARCHAR(1) for binary means 1-byte (from MySQL doc):
"For example, if the default character set is utf8mb4, CHAR(5) BINARY is
treated as CHAR(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin. This
differs from BINARY(5), which stores 5-byte binary strings that have the
binary character set and collation."

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Remove uneeded call to TransformMarcToKoha
Jonathan Druart [Tue, 20 Jul 2021 12:49:48 +0000 (14:49 +0200)]
Bug 27526: Remove uneeded call to TransformMarcToKoha

And also clean some imports.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Fix empty string vs undef
Jonathan Druart [Tue, 20 Jul 2021 10:09:55 +0000 (12:09 +0200)]
Bug 27526: Fix empty string vs undef

Empty strings must be removed, not inserted as empty strings in DB.
The relevant code is in TransformHtmlToXml, $skip variable.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Fix incorrect condition
Jonathan Druart [Tue, 20 Jul 2021 09:45:25 +0000 (11:45 +0200)]
Bug 27526: Fix incorrect condition

The barcode was always prefilled!

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Fix Add multiple copies
Jonathan Druart [Fri, 9 Jul 2021 08:03:26 +0000 (10:03 +0200)]
Bug 27526: Fix Add multiple copies

This has been moved to Koha::Item->store by bug 27545.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Fix Add & duplicate
Jonathan Druart [Fri, 9 Jul 2021 08:00:05 +0000 (10:00 +0200)]
Bug 27526: Fix Add & duplicate

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Fix PrefillItem
Jonathan Druart [Fri, 9 Jul 2021 07:24:19 +0000 (09:24 +0200)]
Bug 27526: Fix PrefillItem

We are basically adding:
  $current_item = $item->unblessed;

Other changes are for readability

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Fix mandatory and important checks
Jonathan Druart [Thu, 8 Jul 2021 13:48:36 +0000 (15:48 +0200)]
Bug 27526: Fix mandatory and important checks

The input names have been changed from "field_value" to $kohafield.
Modifying this could have an impact in other area, where
CheckMandatorySubfields and CheckImportantSubfields are called.
Using .input_marceditor let us fix the additem.tt form and prevent to
break the other ones.
Note that the other ones are actually broken (!)

Also note that there is a typo in the error message
        alertString2 += "\n- " + "%s " + MSG_MANDATORY_FIELDS_EMPTY.format(total_errors);
There is an extra %s

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Fix repeatable more subfields
Jonathan Druart [Thu, 8 Jul 2021 13:32:59 +0000 (15:32 +0200)]
Bug 27526: Fix repeatable more subfields

We retrieved always the first value.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Improve grep for date fields
Jonathan Druart [Wed, 23 Jun 2021 08:35:54 +0000 (10:35 +0200)]
Bug 27526: Improve grep for date fields

'replacementpricedate' should not catch 'price'

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Adjust code to use Koha::Items
Jonathan Druart [Mon, 25 Jan 2021 10:55:38 +0000 (11:55 +0100)]
Bug 27526: Adjust code to use Koha::Items

Not that we removed all the transformations of the item and are using
Koha::Item from DB to TT (and the other way around), some code needs
adjustments.

- Retrieve host items can be simplified (see Koha::Biblio->host_items)
- Some TT variables have been renamed for better understanding
- Koha::Item->columns_to_str return a hashref with the representation
string of the columns. A date will return the value how it must be
displayed, using output_pref. A subfield linked with a AV will be
replaced with the AV's description.
- LastCreatedItem cookie serializes and stores Koha::Item->unblessed,
no longer the MARC::Record

Change in behaviour: If a subfield is linked with a AV cat and the value
is not a valid AV, before this patch the column was displayed with an
empty value. Now the column is hidden, it's considered empty.
In the sample data it happens with itemlost (0) and withdrawn (0).

Test plan:
1. Test the Prefill
 a. Turn PrefillItem on
 b. Fill in SubfieldsToUseWhenPrefill with some subfield codes
 c. Catalogue an item, save
 => The values from subfields listed in SubfieldsToUseWhenPrefill must be
 kept
2. more subfields
 a. Add subfields that are not linked with a koha field (k is available)
 b. Create an item and fill in all the values
 c. Confirm that non linked subfields are stored and displayed correctly
 d. Try with a "more subfield" that is linked with an authorised value
 category
3. Test barcode values
4. Test the different "Add" buttons at the bottom of the form

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Remove AddItemFromMarc from additem
Jonathan Druart [Fri, 22 Jan 2021 10:46:38 +0000 (11:46 +0100)]
Bug 27526: Remove AddItemFromMarc from additem

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27526: Remove ModItemFromMarc from additem
Jonathan Druart [Fri, 22 Jan 2021 10:24:58 +0000 (11:24 +0100)]
Bug 27526: Remove ModItemFromMarc from additem

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28930: Keep cardnumber be editable after server side form validation fails during...
Andreas Jonsson [Tue, 31 Aug 2021 12:50:03 +0000 (12:50 +0000)]
Bug 28930: Keep cardnumber be editable after server side form validation fails during self registration.

Test plan:

- Enable the system preference PatronSelfRegistration
- Make sure  PatronSelfRegistrationBorrowerUnwantedField does not
  contain cardnumber.
- Set the system preference  GDPR_Policy to "Enforce".
- In the OPAC click "Log in to your account" and "Register here".
- Fill out the form with valid data, but make sure you leave the
  checkbox under "GDPR consent" unchecked.
- Submit the form
- You will get back the form with the error message "You have not filled
  out all required fields. Please fill in all missing fields and
  resubmit."
- Without patch: cardnumber is not editable, and there is no input
  element for borrower_cardnumber (so the cardnumber will be lost when
  resubmitting the form)
- With patch: cardnumber is editable.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27945: (follow-up) Add tests
Jonathan Druart [Wed, 6 Oct 2021 09:32:17 +0000 (11:32 +0200)]
Bug 27945: (follow-up) Add tests

Restore +x flag

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: Fix t/db_dependent/AuthorisedValues.t
Jonathan Druart [Wed, 6 Oct 2021 09:42:48 +0000 (11:42 +0200)]
Bug 27944: Fix t/db_dependent/AuthorisedValues.t

 #   Failed test 'The second category should be correct (ordered by category name)'
 #   at t/db_dependent/AuthorisedValues.t line 141.
 #          got: 'AR_CANCELLATION'
 #     expected: 'av_for_testing'

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27947: (QA follow-up) Fix shipped notice
Tomas Cohen Arazi [Tue, 5 Oct 2021 14:44:01 +0000 (11:44 -0300)]
Bug 27947: (QA follow-up) Fix shipped notice

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27947: (QA follow-up) Make parameters a hashref
Tomas Cohen Arazi [Tue, 5 Oct 2021 14:10:10 +0000 (11:10 -0300)]
Bug 27947: (QA follow-up) Make parameters a hashref

This patch makes the Koha::ArticleRequest->cancel parameters into a
hashref. (Missing) tests are added for those parameters being set as
well.

Calls to ->cancel are updated.

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27947: DBIC schema changes
Jonathan Druart [Tue, 5 Oct 2021 09:44:02 +0000 (11:44 +0200)]
Bug 27947: DBIC schema changes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27947: DBRev 21.06.00.029
Jonathan Druart [Tue, 5 Oct 2021 09:34:52 +0000 (11:34 +0200)]
Bug 27947: DBRev 21.06.00.029

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27947: (QA follow-up) Clarify permissions
Tomas Cohen Arazi [Fri, 17 Sep 2021 18:39:17 +0000 (15:39 -0300)]
Bug 27947: (QA follow-up) Clarify permissions

Privileged routes need permissions defined. This patch adds the minimum
required permission until there are article request-specific permissions
in Koha: circulate: circulate_remaining_permissions

It is also clarified that interacting with an article request  from
another patron, but having your own patron_id in the path would return
404 instead of 403, as technically the resource (an article request from
the patron, identified.by the supplied id) doesn't exist.

Tests are tweaked.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27947: (QA follow-up) Update test to highlight issue
Martin Renvoize [Fri, 17 Sep 2021 16:09:58 +0000 (17:09 +0100)]
Bug 27947: (QA follow-up) Update test to highlight issue

This addition to the tests highlights a permissions/security check
error.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27947: (QA follow-up) Remove incorrect permission check
Martin Renvoize [Fri, 17 Sep 2021 15:46:14 +0000 (16:46 +0100)]
Bug 27947: (QA follow-up) Remove incorrect permission check

The API was checking for 'reserverforothers' permission, but that
doesn't make sense to apply here.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27947: Add regression tests for routes
Tomas Cohen Arazi [Fri, 17 Sep 2021 15:13:09 +0000 (12:13 -0300)]
Bug 27947: Add regression tests for routes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27947: (QA follow-up) Refactor routes
Tomas Cohen Arazi [Fri, 17 Sep 2021 14:42:34 +0000 (11:42 -0300)]
Bug 27947: (QA follow-up) Refactor routes

This patch refactors the route specs a bit, and also reorganizes code
for easier tracking.

Unused exceptions that were added earlier are removed for now.

A follow-up patch will add tests to this routes.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27947: (follow-up) Add OPAC cancellation as new reason too
Marcel de Rooy [Fri, 17 Sep 2021 09:06:08 +0000 (09:06 +0000)]
Bug 27947: (follow-up) Add OPAC cancellation as new reason too

Something that currently comes up now already too:
If the user cancels from the OPAC page, there is no reason in the notice.
We could simply add one now.

Test plan:
Run dbrev to add the OPAC authval.
Create new AR and cancel it from OPAC.
Verify notice created for the user.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27947: (follow-up) Improve atomic update
Marcel de Rooy [Fri, 17 Sep 2021 08:38:44 +0000 (08:38 +0000)]
Bug 27947: (follow-up) Improve atomic update

We do not need to replace the whole notice text, we only need to
replace the reference to article_requests.notes.

Test plan:
Run the dbrev. Verify result for notice AR_CANCELED.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27947: Add cancellation reason to article request
Agustin Moyano [Fri, 20 Aug 2021 02:51:38 +0000 (23:51 -0300)]
Bug 27947: Add cancellation reason to article request

This bug adds a cancellation reason authorised values to article requests

To test:
1. apply this patch
2. updatedatabase
3. in staff interface go to /cgi-bin/koha/admin/authorised_values.pl
CHECK => AR_CANCELLATION category should appears
4. place several article requests
5. in staff interface go to /cgi-bin/koha/circ/article-requests.pl
6. select multiple requests, or just one and cancel them
SUCCESS => a modal pops up offering to select a cancellation reason
CHECK => message_queue table has messages with cancellation reason included
7. repeat steps 4 to 6 but for /cgi-bin/koha/circ/request-article.pl
8. cancelling article requests from opac interface should work just as before

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27947: Add authorised values list in article requests cancellation
Agustin Moyano [Fri, 20 Aug 2021 02:00:26 +0000 (23:00 -0300)]
Bug 27947: Add authorised values list in article requests cancellation

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27945: Terminology: max daily => open requests limit
Tomas Cohen Arazi [Tue, 5 Oct 2021 15:02:12 +0000 (12:02 -0300)]
Bug 27945: Terminology: max daily => open requests limit

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27945: Don't save rule if not defined
Jonathan Druart [Tue, 5 Oct 2021 09:30:37 +0000 (11:30 +0200)]
Bug 27945: Don't save rule if not defined

The DB rev added a row with NULL (unlimited), and the UI a row with ''
(unlimited as well) when saved without value.

Better is to not have a row (still unlimited)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27945: Fix error handling and translatability
Tomas Cohen Arazi [Mon, 4 Oct 2021 15:08:12 +0000 (12:08 -0300)]
Bug 27945: Fix error handling and translatability

This patch adds better error handling and reporting when placing an
article request fails. It also makes the error messages translatable.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27945: Implement limits using circulation rules
Tomas Cohen Arazi [Mon, 4 Oct 2021 12:43:11 +0000 (09:43 -0300)]
Bug 27945: Implement limits using circulation rules

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27945: Add max_daily_article_requests circulation rule
Tomas Cohen Arazi [Mon, 4 Oct 2021 12:14:16 +0000 (09:14 -0300)]
Bug 27945: Add max_daily_article_requests circulation rule

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27945: Clarify 'same day' behavior
Tomas Cohen Arazi [Thu, 30 Sep 2021 18:57:00 +0000 (15:57 -0300)]
Bug 27945: Clarify 'same day' behavior

This patch introduces tests for the 'same day' check of the ability to
place article requests for a patron.

The limit goes against current requests, and those that have been
completed on the same day. The tests cover this specific situation.

The current behavior is that it takes into account a 24 hr timespan, but
consensus on the QA step was that we should do it as 'same day' and use
a separate feature request to change this, if required.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Patron.t
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27945: Add limit article request feature
Agustin Moyano [Tue, 27 Jul 2021 15:20:46 +0000 (12:20 -0300)]
Bug 27945: Add limit article request feature

This patch makes it possible to limit article requests per patron per day.

To test:
1. Apply patches
2. updatedatabase
3. Enable ArticleRequests preference
4. Edit a patron category and set an article request limit to 1
CHECK => if you set the limit to anything else but a positive number or empty string, a warning appears
5. In staff search biblios and request an article for a patron of the modified category
6. Repeat step 5
SUCCESS => if limit is reached, when you select the user to request an article a warning appears saying that the limit was reached
7. Repeat steps 5 and 6 but this time in opac
SUCCESS => Patron is not allowed to request another article if limit is reached
8. prove t/db_dependent/ArticleRequests.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Edit: This patchset originally changed the 'categories' table structure
and relied on that for limit calculation. I removed all that code and
squashed into this one, as we moved everything to the circulation_rules
table.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27945: Add tests
Agustin Moyano [Thu, 22 Jul 2021 00:54:41 +0000 (00:54 +0000)]
Bug 27945: Add tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: DBIC schema changes
Jonathan Druart [Tue, 5 Oct 2021 09:42:07 +0000 (11:42 +0200)]
Bug 27944: DBIC schema changes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: DBRev 21.06.00.028
Jonathan Druart [Tue, 5 Oct 2021 09:34:24 +0000 (11:34 +0200)]
Bug 27944: DBRev 21.06.00.028

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: Add missing tests
Tomas Cohen Arazi [Thu, 30 Sep 2021 18:05:54 +0000 (15:05 -0300)]
Bug 27944: Add missing tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: (follow-up) Add POD
Tomas Cohen Arazi [Thu, 30 Sep 2021 14:55:11 +0000 (11:55 -0300)]
Bug 27944: (follow-up) Add POD

The library didn't contain real POD. This patch adds it.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: (QA follow-up) Make atomic update idempotent
Tomas Cohen Arazi [Wed, 22 Sep 2021 17:42:28 +0000 (14:42 -0300)]
Bug 27944: (QA follow-up) Make atomic update idempotent

This patch checks the DB structure to see if the status column
definition contains 'REQUESTED' as a valid ENUM value.

The script is also moved into the new style.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: (QA follow-up) Add span to fix pipe separator
Nick Clemens [Fri, 17 Sep 2021 11:03:17 +0000 (11:03 +0000)]
Bug 27944: (QA follow-up) Add span to fix pipe separator

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: (QA follow-up) Make staff home page show new article requests
Tomas Cohen Arazi [Tue, 10 Aug 2021 16:39:46 +0000 (13:39 -0300)]
Bug 27944: (QA follow-up) Make staff home page show new article requests

As exposed on comment 29, the current code is showing the 'pending'
requests when it should display 'requested' ones (i.e. the new ones).

This patch changes that accordingly.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: (QA follow-up) Rename ->open for ->set_pending
Tomas Cohen Arazi [Tue, 10 Aug 2021 16:16:53 +0000 (13:16 -0300)]
Bug 27944: (QA follow-up) Rename ->open for ->set_pending

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: REQUESTED is the new default status
Tomas Cohen Arazi [Tue, 10 Aug 2021 16:11:42 +0000 (13:11 -0300)]
Bug 27944: REQUESTED is the new default status

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: (follow-up) Move statuses to constants
Marcel de Rooy [Thu, 15 Jul 2021 06:13:36 +0000 (06:13 +0000)]
Bug 27944: (follow-up) Move statuses to constants

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: (follow-up) Move existing statuses, rename idempotent
Marcel de Rooy [Wed, 14 Jul 2021 15:01:23 +0000 (15:01 +0000)]
Bug 27944: (follow-up) Move existing statuses, rename idempotent

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: (follow-up) Improving consistency between notice names
Marcel de Rooy [Wed, 14 Jul 2021 14:42:30 +0000 (14:42 +0000)]
Bug 27944: (follow-up) Improving consistency between notice names

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: Add missing Status module
Marcel de Rooy [Thu, 8 Jul 2021 09:30:34 +0000 (09:30 +0000)]
Bug 27944: Add missing Status module

Test plan:
perl -c the module or run qa tools

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: Add "requested" stage in article request process
Agustin Moyano [Tue, 30 Mar 2021 13:52:31 +0000 (10:52 -0300)]
Bug 27944: Add "requested" stage in article request process

This patch adds the stage "requested" in article request process, which
is previous to pending stage.

To test:
1. apply this patch
2. updatedatabase
3. enable ArticleRequests syspref
4. from staff inteface and from opac search for a record and place an
   article request
5. koha-mysql kohadev
6. query: select subject, content, letter_code from message_queue;
CHECK => There is a message for each article request with code
AR_REQUESTED
      => In opac-user.pl, in "Article requests" tab you should see a row
in the table with "Requested" status
5. in staff go to Circulation -> Article Requests
SUCCESS => You should see 3 tabs, one for Requested stage (with two
requests), one for Pending stage and one for Processing stage.
6. play with actions buttons
CHECK => you should see a new action called "Set request as pending"
SUCCESS => All action buttons behave as expected, and tab counts updates
correctly.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: Add AR_REQUESTED message in sample_notices.yml and modify AR_PENDING
Agustin Moyano [Tue, 30 Mar 2021 13:51:57 +0000 (10:51 -0300)]
Bug 27944: Add AR_REQUESTED message in sample_notices.yml and modify AR_PENDING

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 27944: Add new letter in atomicupdate, and modify status column in article_reques...
Agustin Moyano [Tue, 30 Mar 2021 13:49:06 +0000 (10:49 -0300)]
Bug 27944: Add new letter in atomicupdate, and modify status column in article_requests table

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29128: Remove the other whitespace in browse shelf link
Jérémy Breuillard [Tue, 28 Sep 2021 13:14:45 +0000 (13:14 +0000)]
Bug 29128: Remove the other whitespace in browse shelf link

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 29128: Remove whitespace in browse shelf link
Lucas Gass [Mon, 27 Sep 2021 20:16:22 +0000 (20:16 +0000)]
Bug 29128: Remove whitespace in browse shelf link

To test:
-Turn on OPACShelfBrowser and make sure you have some itemcallnumbers
-Go to detail page and see the link: (Browse shelf )
-Apply patch and look at the link again, it should be: (Browse shelf)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>