]> git.koha-community.org Git - koha.git/log
koha.git
2 years agoBug 29803: Do not wait for the images more than 5 seconds
Jonathan Druart [Mon, 10 Jan 2022 11:29:11 +0000 (12:29 +0100)]
Bug 29803: Do not wait for the images more than 5 seconds

In case of the previous bug, the page was calling the callback function
every 100ms, endlessly. We should add a test to prevent future similar
problem.

Test plan:
Remove the previous patch "Prevent local cover image to be hidden if
Coce is enabled"
Recreate the test plan
=> You should see the local image displayed after 5 seconds, and a
log in the JS console

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29803: Prevent local cover image to be hidden if Coce is enabled
Jonathan Druart [Mon, 10 Jan 2022 11:19:54 +0000 (12:19 +0100)]
Bug 29803: Prevent local cover image to be hidden if Coce is enabled

If Coce is enabled by no image are returned by the service, then no
other image will be displayed (actually un-hidden)

The getURL is returning early if no image is returned by the service and
the "done" flag is never set.

Test plan:
Add a local cover image to a bibliographic record (ktd biblionumber=14
is good)
Set CoceHost = http://coce.bywatersolutions.com
Select all CoceProviders
Enable OpacCoce

=> If no image is returned by Coce then the local image should be
displayed anyway

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29969: Prevent crash if 'Update holds' clicked after bulk cancellation
Jonathan Druart [Fri, 28 Jan 2022 14:04:49 +0000 (15:04 +0100)]
Bug 29969: Prevent crash if 'Update holds' clicked after bulk cancellation

If you cancel holds in bulk, the list is not updated as we enqueued the
task. But the "Update hold(s)" button will explode if clicked.

Test plan:
Place several holds on a bib record
Use the "Cancel selected" link to cancel holds in bulk
The job is enqueued and the hold list still show the holds you cancelled
Click "Update holds"
=> Without this patch you get an ugly 500
Can't call method "found" on an undefined value at /kohadevbox/koha/C4/Reserves.pm line 1060
=> With this patch applied the table is refresh, no crash (and there is
a warning in the log, that may not be necessary)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29989: Improve headings in MARC staging template
Owen Leonard [Tue, 1 Feb 2022 11:55:23 +0000 (11:55 +0000)]
Bug 29989: Improve headings in MARC staging template

This patch updates the MARC staging page so that the headings are
descriptive based on the context.

To test, apply the patch and go to Tools -> Stage MARC for import.

- The heading should be "Stage MARC records for import."
- Upload a MARC file and stage the file for import.
- The heading on the next page should read "MARC staging results."

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 27770: ES: Deprecated aggregation order key [_term] used, replaced by [_key]
Kevin Carnes [Tue, 8 Feb 2022 13:35:18 +0000 (14:35 +0100)]
Bug 27770: ES: Deprecated aggregation order key [_term] used, replaced by [_key]

Starting in Elasticsearch 6.0 _key should be used instead of _term to order
buckets by their term

To test:
1) Run prove t/db_dependent/Koha/SearchEngine/Elasticsearch/Search.t
2) If you observe an error about types, apply patch for bug 25669
3) Run prove t/db_dependent/Koha/SearchEngine/Elasticsearch/Search.t
4) Observe if you get a deprecation warning about order key
5) Apply patch
6) Run prove t/db_dependent/Koha/SearchEngine/Elasticsearch/Search.t
7) Observe no deprecation warning about order key
8) Sign off

Sponsored-by: Lund University Library
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30115: Uninitialized value warning in C4/Output.pm
Blou [Tue, 15 Feb 2022 21:18:15 +0000 (16:18 -0500)]
Bug 30115: Uninitialized value warning in C4/Output.pm

Use of uninitialized value $url_suffix in concatenation (.) or string at GIT/C4/Output.pm line 180.
Use of uninitialized value $url_suffix in concatenation (.) or string at GIT/C4/Output.pm line 197.
Use of uninitialized value $url_suffix in concatenation (.) or string at GIT/C4/Output.pm line 211.

This is in pagination_bar sub.  A lot of pages call it.  For me it
happened with any Authority search (authorities/authorities-home.pl)
producing multiple results.

Simple fix is initializing the variable.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29625: Add test for get_all_biblios_iterator
Jonathan Druart [Fri, 18 Feb 2022 10:01:55 +0000 (11:01 +0100)]
Bug 29625: Add test for get_all_biblios_iterator

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29625: Fix var name in Koha::BiblioUtils get_all_biblios_iterator
Fridolin Somers [Thu, 2 Dec 2021 22:21:45 +0000 (12:21 -1000)]
Bug 29625: Fix var name in Koha::BiblioUtils get_all_biblios_iterator

In Koha::BiblioUtils, get_all_biblios_iterator method is a class level method like get_from_biblionumber.
So its first arg should be named $class instead of $self.
Even if this var in not used.

Test plan :
1) Run Elasticsearch full rebuild with and without patch
2) Check all biblio records are in index

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 22671: Show warning if browser doesn't support applicationCache
Owen Leonard [Mon, 18 Oct 2021 12:29:19 +0000 (12:29 +0000)]
Bug 22671: Show warning if browser doesn't support applicationCache

This patch adds a check for browser support for the "applicationCache"
feature required by the offline circulation tool. If the feature is not
available, a message is shown to the user that offline circulation is
disabled.

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

In a browser which supports applicationCache (Firefox < 81, Chrome < 94,
Safari <= 15), go to Circulation -> Built-in offline circulation
interface.

- You should see the standard Offline Circulation menu options: Check
  out, check in, syncrhonize, etc.
- Click "Synchronize," then "Download records."
- The process should complete correctly, updating the "last synced"
  information on the page.

Follow the same steps in a browser which has dropped support for
applicationCache. As soon as you reach the built-in offline circulation
page you should see a message, "Your browser is not compatible..."

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29853: Add HTML filter before KohaSpan filter
Fridolin Somers [Wed, 12 Jan 2022 05:40:35 +0000 (19:40 -1000)]
Bug 29853: Add HTML filter before KohaSpan filter

Usage of Template Toolkit plugin KohaSpan as filter is actually :
  Group [% added.title | $KohaSpan class = 'name' | $raw %] created.

But KohaSpan filter does not escape HTML characters.
Whe should filter HTML then KohaSpan.

This patch adds TT html filter before KohaSpan.
Also replaces in Javascript html() with text()
to ensure special caracters are still encoded.
See https://api.jquery.com/text/

Test plan :
1) Create a library with name Libra&apos;rie
2) Create a library group with name Grou&apos;pe
3) Play with this group
4) Add library
5) Remove library
6) Edit group
7) Delete group
8) Each time check that &apos, is not interpreted as single quote

Signed-off-by: Solène Desvaux <solene.desvaux@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29761: Prevent batch patron modification to process several time the same patron
Alex Buckley [Mon, 13 Dec 2021 02:31:51 +0000 (02:31 +0000)]
Bug 29761: Prevent batch patron modification to process several time the same patron

If a cardnumber, SMS number, or borrower number is inputted multiple times then the batch patron
modification page should not display that patron multiple times.

Test plan:
1. Create three text files that list card numbers, SMS numbers, and borrower numbers for three patrons. Example lists are below, notice in each there is one number duplicated:

Card numbers:
  23529000035676
  23529000651225
  23529000080862
  23529000035676

Borrower numbers:
  19
  49
  7
  49

SMS numbers:
  2125551212
  2125551212
  2125551213
  2125551214

2. Enable sending of SMS messages:
* Set SMSSendDriver system preference to Email

3. Make sure the cardnumbers, borrower numbers, and SMS numbers listed
above belong to patrons in your Koha

4. Go to Tools > Batch patron modification

5. Upload lists of cardnumbers, SMS numbers, and borrower numbers above, and confirm the following is happening in the batch patron modification page:
- Upload the text file of cardnumbers. Notice one patron is displayed twice
- Paste in the list of cardnumbers. Notice one patron is displayed twice
- Upload the text file of SMS numbers. Notice one patron is displayed twice
- Paste in the list of SMS numbers. Notice one patron is displayed twice
- Upload the text file of borrower numbers. Notice one patron is displayed twice
- Paste in the list of borrower numbers. Notice one patron is displayed twice

6. Apply patch and restart services

7. Repeat step 5 and this time observe that the patron record is not duplicated in the batch patron modification page

Sponsored-By: Catalyst IT
Signed-off-by: David Nind <david@davidnind.com>
JD Amended patch: adjust commit title
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30074: Add missing extended_attributes rs in DBIC schema
Jonathan Druart [Thu, 10 Feb 2022 14:28:11 +0000 (15:28 +0100)]
Bug 30074: Add missing extended_attributes rs in DBIC schema

REST API route /patrons has extended_attributes available (x-koha-embed) but it's actually not working.

GET /api/v1/patrons: unhandled exception (Koha::Exceptions::BadParameter)<<Cannot find Koha::Object class for extended_attributes>> Koha::REST::Plugin::Exceptions::__ANON__ /kohadevbo
x/koha/Koha/REST/Plugin/Exceptions.pm (73)

It's missing the relationship named "extended_attributes".

Test plan:
Create a new patron attribute CODE and a value for a patron

Hit /api/v1/patrons?q={"extended_attributes.type":"CODE"}

Also:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/patrons.t
=> FAIL: Tests fail, boooo
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30074: Regression tests
Tomas Cohen Arazi [Wed, 16 Feb 2022 14:50:40 +0000 (11:50 -0300)]
Bug 30074: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29795: add empty value for branchcode on self-reg form
Lucas Gass [Tue, 4 Jan 2022 22:44:32 +0000 (22:44 +0000)]
Bug 29795: add empty value for branchcode on self-reg form

1. Set branch code as a PatronSelfRegistrationBorrowerMandatoryField
2. Go to the self reg form and look at the Home library field, it defaults to the first choice alphabetically
3. Fill out the other required fields and the captcha. Don't change the branchcode value.
4. Submit the form, it submits.
5. If branchcode is required it should default to an empty value and force the user to make a choice.
6. Apply patch
7. Repeat 1-3
8. Now you cannot submit the form unless you choose a branchcode
9. Make sure it still works normally when branchcode is not in PatronSelfRegistrationBorrowerMandatoryField

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30099: Fix error when accessing circulation.pl without patron parameter
Fridolin Somers [Mon, 14 Feb 2022 20:35:53 +0000 (10:35 -1000)]
Bug 30099: Fix error when accessing circulation.pl without patron parameter

If I access circulation.pl directly, with no patron cardnumber or borrowernumber submitted, I get an error:
Can't call method "messages" on an undefined value at /kohadevbox/koha/circ/circulation.pl line 525

This is caused by Bug 29230 which calls $patron outside a
"if ($aptron)".

Test plan :
1) In staff interface, click in 'check out' search box
2) Hit enter (without a search text)
=> Without patch you get an error
=> With patch you see a blank page /cgi-bin/koha/circ/circulation.pl

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 23873: Enable capture groups in MarcModificationTemplates
Martin Renvoize [Mon, 13 Dec 2021 09:59:15 +0000 (09:59 +0000)]
Bug 23873: Enable capture groups in MarcModificationTemplates

This patch adds support for regular expression capture groups in
MarcModificationTemplates.

We escape double quotes in the replacement string, then quote the whole
string before applying the `ee` modifier to the final regex application.

See
https://blog.james.rcpt.to/2010/10/25/perl-search-and-replace-using-variables/
for further details.

Test plan
1) Attempt to use capture groups in your regular expression based
   MarcModificationTemplate and note it does not work.
2) Apply the patch and try again, this time the capture group should
   yield the expected results.
3) Run t/SimpleMARC.t and confirm the tests still pass.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 23873: Unit tests
Martin Renvoize [Mon, 13 Dec 2021 10:20:54 +0000 (10:20 +0000)]
Bug 23873: Unit tests

This patch adds a unit test for capture groups support in
Koha::SimpleMARC.

Test plan
1) Run the test prior to applying the capture groups fix, note it fails.
2) Apply teh capture groups fix patch
3) Run the test again, it should now pass

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30084: Remove explicit dependency of liblocale-codes-perl
Mason James [Mon, 24 May 2021 21:21:53 +0000 (09:21 +1200)]
Bug 30084: Remove explicit dependency of liblocale-codes-perl

1/ apply patch

2/ build and install new koha-common package

=> Package liblocale-codes-perl is not installed, Koha does not need it

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Mason James <mtj@kohaaloha.com>
JD amended patch: fix commit message
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30089: (bug 29844 follow-up) Fix placing holds - OPAC
Jonathan Druart [Tue, 15 Feb 2022 07:42:49 +0000 (08:42 +0100)]
Bug 30089: (bug 29844 follow-up) Fix placing holds - OPAC

The method Koha::AuthorisedValues->authorised_value is not covered by tests!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30104: (bug 29844 follow-up): Fix holds to pull
Jonathan Druart [Tue, 15 Feb 2022 07:45:42 +0000 (08:45 +0100)]
Bug 30104: (bug 29844 follow-up): Fix holds to pull

There was an error when circ/pendingreserves.pl was hit:
The method Koha::Items->biblionumber is not covered by tests!

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30090: Don't export some columns in patron search results
Fridolin Somers [Mon, 14 Feb 2022 21:04:25 +0000 (11:04 -1000)]
Bug 30090: Don't export some columns in patron search results

The checkout and Edit buttons should not export (Exel, Print) on the patron search result list.
Same for fist column with checkboxes.

Test plan :
1) Go to patrons module /cgi-bin/koha/members/members-home.pl
2) Perform a search with results
3) Click on 'Export' then 'Print'
=> Check you dont see column with checkboxes (text 'Select patron') and colum with actions

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29603: Compiled CSS
Fridolin Somers [Thu, 17 Feb 2022 06:56:58 +0000 (20:56 -1000)]
Bug 29603: Compiled CSS

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29603: Fix responsive behavior of facets menu in OPAC search results
Owen Leonard [Thu, 27 Jan 2022 15:29:32 +0000 (15:29 +0000)]
Bug 29603: Fix responsive behavior of facets menu in OPAC search results

The OPAC was originally featured a search results facets box that would
collapse at narrower browser widths and show a "Refine your search" link
under the breadcrumbs menu. At some point this broke, with the "Refine
your search" link appearing at the bottom instead.

This patch revises the page to restore the previous behavior.

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

- Perform catalog search in the OPAC which will return multiple results.
- View the page at various browser widths. At narrower widths the facets
  menu should appear as a "collapsed" box with a "Refine your search"
  link.
- Clicking the link should toggle the facets menu visibility.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29960: (follow-up) Include enquire.js in print slip template
Owen Leonard [Fri, 11 Feb 2022 12:36:21 +0000 (12:36 +0000)]
Bug 29960: (follow-up) Include enquire.js in print slip template

This patch adds enquire.js to the print slip template in order to
prevent a JS error.

Also removed is a line from global.js which was added in the previous
patch and which was an unwanted change.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29960: Remove Modernizr dependency in the OPAC
Owen Leonard [Tue, 30 Nov 2021 15:06:05 +0000 (15:06 +0000)]
Bug 29960: Remove Modernizr dependency in the OPAC

This patch refactors the code around JavaScript-driven responsive
behavior in the OPAC. The use of Modernizr dropped and the dependency
removed.

This patch also adds a missing listing for Enquire.js licensing on the
"About" page.

To test, apply the patch and perform a catalog search in the OPAC.

- Narrow your browser window until its width falls below 609 pixels
  (Using your browser's Responsive Design Mode is helpful for this, e.g.
  https://developer.mozilla.org/en-US/docs/Tools/Responsive_Design_Mode)
- The window should automatically scroll to the "main content" area, in
  this case the section headed by "Your search returned..."

- Change your browser window's width until it falls below 768 pixels.
- Scroll to the bottom of the search results where you should find the
  "Refine your search" facets box collapsed.
- As you increase your browser width above 768 pixels the facets box
  should expand.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29960: (follow-up) Include enquire.js in print slip template
Owen Leonard [Fri, 11 Feb 2022 12:36:21 +0000 (12:36 +0000)]
Bug 29960: (follow-up) Include enquire.js in print slip template

This patch adds enquire.js to the print slip template in order to
prevent a JS error.

Also removed is a line from global.js which was added in the previous
patch and which was an unwanted change.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29960: Remove Modernizr dependency in the OPAC
Owen Leonard [Tue, 30 Nov 2021 15:06:05 +0000 (15:06 +0000)]
Bug 29960: Remove Modernizr dependency in the OPAC

This patch refactors the code around JavaScript-driven responsive
behavior in the OPAC. The use of Modernizr dropped and the dependency
removed.

This patch also adds a missing listing for Enquire.js licensing on the
"About" page.

To test, apply the patch and perform a catalog search in the OPAC.

- Narrow your browser window until its width falls below 609 pixels
  (Using your browser's Responsive Design Mode is helpful for this, e.g.
  https://developer.mozilla.org/en-US/docs/Tools/Responsive_Design_Mode)
- The window should automatically scroll to the "main content" area, in
  this case the section headed by "Your search returned..."

- Change your browser window's width until it falls below 768 pixels.
- Scroll to the bottom of the search results where you should find the
  "Refine your search" facets box collapsed.
- As you increase your browser width above 768 pixels the facets box
  should expand.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29617: exclude categorycode from BorrowerUnwantedField
Lucas Gass [Thu, 2 Dec 2021 01:36:26 +0000 (01:36 +0000)]
Bug 29617: exclude categorycode from BorrowerUnwantedField

To test:
1. Go to BorrowerUnwantedField and select categorycode as unwanted
2. Try adding a new patron, you will see an error message in the staff client "Something went wrong when creating the patron. Check the logs." You will be unable to make a new patron.
3. Apply patch
4. Go to BorrowerUnwantedField, you are unable to exlcude it. Patrons need categorycodes

Signed-off-by: Emmanuel BĂ©temps <e.betemps@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30081: Use itemtype description instead of itemtype code
Lari Taskula [Fri, 11 Feb 2022 13:07:40 +0000 (13:07 +0000)]
Bug 30081: Use itemtype description instead of itemtype code

To test:
1. Use same plan as previous patch, but observe full item type description
   instead of item type code

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30081: Add item type column to holds table
Lari Taskula [Fri, 11 Feb 2022 12:53:55 +0000 (12:53 +0000)]
Bug 30081: Add item type column to holds table

Add new column item type to holds table in patron's details and check
out views. Some libraries will find this information useful for
distinguishing inter library holds from normal holds.

To test:
1. Apply patch
2. Place a hold and confirm it
3. Go to cgi-bin/koha/circ/circulation.pl?borrowernumber=1 with
   borrowernumber being the id of your patron
4. Click "1 Hold(s)" tab
5. Observe new column "Item type"
6. Confirm the item type is correct
7. Go to moremember.pl?borrowernumber=1 with
   borrowernumber being the id of your patron
8. Repeat steps 4-6

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30082: Bibliographic details tab missing when user can't add local cover image
Owen Leonard [Fri, 11 Feb 2022 15:24:43 +0000 (15:24 +0000)]
Bug 30082: Bibliographic details tab missing when user can't add local cover image

This patch corrects the template logic which determines whether the
"Images" tab should be displayed on the bibliographic detail page. The
"Images" tab should display whenever local cover images are enabled, not
just if the user has permission to manage cover images.

To test, apply the patch and go to Administration -> System preferences.

- Enable the LocalCoverImages system preference.
- Locate and view the detail page for a bibliographic record in the
  catalog which doesn't have a local cover image attached.

  - If you are logged in as a user with upload_local_cover_images
    permission you should see an "Images" tab with the message "No
    images have been uploaded for this bibliographic record yet" and an
    upload button.
  - If you are logged in as a user without upload_local_cover_images
    permission you should see an "Images" tab with just the "No
    images..." message.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29781: Enable capture groups in batch item modification
Martin Renvoize [Mon, 17 Jan 2022 13:38:28 +0000 (13:38 +0000)]
Bug 29781: Enable capture groups in batch item modification

This patch adds support for regular expression capture groups in
MarcModificationTemplates.

We escape double quotes in the replacement string, then quote the whole
string before applying the `ee` modifier to the final regex
application.

See https://blog.james.rcpt.to/2010/10/25/perl-search-and-replace-using-variables/
for further details.

Test plan
1) Attempt to use capture groups in your regular expression based
   batch item modification and note it does not work.
2) Apply the patch and try again, this time the capture group
   should yield the expected results.
3) Run t/SimpleMARC.t and confirm the tests still pass.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jo Hunter <jhunter@clicweb.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29781: Unit test
Martin Renvoize [Mon, 17 Jan 2022 13:50:34 +0000 (13:50 +0000)]
Bug 29781: Unit test

This patch adds a unit test for capture groups support in Koha::Items

Test plan
1) Run the test prior to applying the capture groups fix, note it fails.
2) Apply the capture groups fix patch
3) Run the test again, it should now pass

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jo Hunter <jhunter@clicweb.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29952: Replace obsolete DataTable column filter function
Owen Leonard [Thu, 27 Jan 2022 11:50:28 +0000 (11:50 +0000)]
Bug 29952: Replace obsolete DataTable column filter function

The "Filter paid transactions" link on the Accounting -> Transactions
page is broken because it uses an obsolete DataTables function for
filtering. This patch updates it to use the current syntax, available in
DataTables since version 1.10.

To test, apply the patch and locate a patron in the staff interface who
has multiple fines, some paid.

- View the patron's "Accounting" page and click the "Transactions" tab.
- Click the "Filter paid transactions" link. The table should be
  filtered so that only transactions with an outstanding amount > zero
  are shown.
- The filter link should change to read "Show all transactions."
- Clicking "Show all transactions" should clear the filter.
- Test with one or more columns hidden using the "Columns" control.
  Filtering should still work correctly with columns hidden.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29706: (follow-up) Adjust code to work for multi-holds
Nick Clemens [Tue, 8 Feb 2022 12:30:23 +0000 (12:30 +0000)]
Bug 29706: (follow-up) Adjust code to work for multi-holds

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29706: Hide items that cannot be held by default when placing hold on OPAC
Nick Clemens [Thu, 16 Dec 2021 01:59:50 +0000 (01:59 +0000)]
Bug 29706: Hide items that cannot be held by default when placing hold on OPAC

This patch adds a 'holdable' and 'unholdable' class to the rows of the table

Additionally I rename the 'backgroundcolor' field to 'onloan' as that is what it contains.
Note: Out of the box, there is no css associated with this class

I add a div around the table to allow hiding the new buttons as well when optiuons are hidden

It would be nice in the future to utilise a Koha table here, however, it is complicated by multi-holds

To test:
 1 - Add a number of items to a record, ensuring they belong to different libraries
 2 - Set 'Default checkout, hold and return policy'->'Hold policy' to 'From home library'
 3 - Sign in to opac and attempt to placehold on the record
 4 - Click 'show more options' and 'a specificitem'
 5 - Note holds table includes items that cannot be held
 6 - Apply patch
 7 - Reload holds page
 8 - Note items that cannot be heldare hidden
 9 - Click 'Show unholdable items' and note they appear
10 - Click 'Hide unholdable items' and veriofy they hide
11 - Test with multi holds

Signed-off-by: The Minh Luong <the-minh.luong@inlibro.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29706: Improve table elements
Nick Clemens [Thu, 16 Dec 2021 01:12:52 +0000 (01:12 +0000)]
Bug 29706: Improve table elements

This patch add a thead and tbody element to the 'copiesrow' table

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29616: Replace library information popup in the OPAC with a modal
Owen Leonard [Wed, 1 Dec 2021 17:47:51 +0000 (17:47 +0000)]
Bug 29616: Replace library information popup in the OPAC with a modal

This patch modifies the OPAC bibliographic detail page so that
information stored in libraries' "OPAC info" field can be displayed in a
modal window instead of in a tooltip. This will make it more readable,
especially for libraries with so much info content that the popup can
disappear off the bottom of the page.

To test, apply the patch and make sure you have at least one library
configured according to each of these:

A. One with both branches.branchurl and branches.opac_info
B. One with branches.branchurl but not branches.opac_info
C. One with branches.opac_info but not branches.branchurl
D. One with neither branches.branchurl nor branches.opac_info

View the bibliographic detail page in the OPAC for title(s) which have
holdings from the libraries you configured above. In the holdings table,
check the behavior of the library name in the "Current library" or "Home
library" columns *

- Case A: The library name appears as a link with an "info" icon.
  Clicking it shows the library information in a modal window. In the
  modal footer, a "Visit web site" button should take you to the correct
  URL.
- Case B: The library name appears as a link without an icon. Clicking
  the link takes you to the correct URL.
- Case C: The library name appears as a link with an "info" icon.
  Clicking it shows the library information in a modal window. In the
  modal footer there is no "Visit web site" button.
- Case D: The library name is plain text.

* Display of "Current library" and/or "Home library" is controlled by
  the OpacLocationBranchToDisplay system preference.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: The Minh Luong <the-minh.luong@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29634: Map biblio.medium to 245 by default (MARC21)
Caroline Cyr La Rose [Fri, 3 Dec 2021 15:13:12 +0000 (10:13 -0500)]
Bug 29634: Map biblio.medium to 245 by default (MARC21)

This patch adds a mapping from 245 to biblio.medium.

To test:
1) Apply patch
2) Delete existing frameworks
   -  In the database
      delete from marc_tag_structure;
      delete from marc_subfield_structure;
      delete from biblio_framework;
3) Load default framework
   - In a terminal, run
     ./misc/load_yaml.pl -f installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.yml --load
4) In the staff interface, go to Administration > MARC bibliographic framework
   - Make sure the default framework is there
5) In Administration > Koha to MARC mapping, check the mappings for biblio.medium
   - biblio.medium should be mapped to 245
6) Create a bibliographic record with a value in 245
   - In the database, check the biblio entry for this record, the value from 245 should be in medium

I hope I didn't forget anything! :)

Caroline

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29626: Map biblioitems.place to 264 by default (MARC21)
Caroline Cyr La Rose [Thu, 2 Dec 2021 22:46:39 +0000 (17:46 -0500)]
Bug 29626: Map biblioitems.place to 264 by default (MARC21)

This patch adds a mapping from 264 to biblioitems.place.

To test:
1) Apply patch
2) Delete existing frameworks
   -  In the database
      delete from marc_tag_structure;
      delete from marc_subfield_structure;
      delete from biblio_framework;
3) Load default framework
   - In a terminal, run
     ./misc/load_yaml.pl -f installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.yml --load
4) In the staff interface, go to Administration > MARC bibliographic framework
   - Make sure the default framework is there
5) In Administration > Koha to MARC mapping, check the mappings for biblioitems.place
   - biblioitems.place should be mapped to 260 as well as 264
6) Create a bibliographic record with a value in 264
   - In the database, check the biblioitems entry for this record, the value from 264 should be in place
7) Create a bibliographic record with a value un 260
   - In the database, check the biblioitems entry for this record, the value from 260 should be in place

I hope I didn't forget anything! :)

Caroline

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29627: Map biblioitems.publishercode to 264 by default (MARC21)
Caroline Cyr La Rose [Thu, 2 Dec 2021 22:54:31 +0000 (17:54 -0500)]
Bug 29627: Map biblioitems.publishercode to 264 by default (MARC21)

This patch adds a mapping from 264 to biblioitems.publishercode.

To test:
1) Apply patch
2) Delete existing frameworks
   -  In the database
      delete from marc_tag_structure;
      delete from marc_subfield_structure;
      delete from biblio_framework;
3) Load default framework
   - In a terminal, run
     ./misc/load_yaml.pl -f installer/data/mysql/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.yml --load
4) In the staff interface, go to Administration > MARC bibliographic framework
   - Make sure the default framework is there
5) In Administration > Koha to MARC mapping, check the mappings for biblioitems.publishercode
   - biblioitems.publishercode should be mapped to 260 as well as 264
6) Create a bibliographic record with a value in 264
   - In the database, check the biblioitems entry for this record, the value from 264 should be in publishercode
7) Create a bibliographic record with a value un 260
   - In the database, check the biblioitems entry for this record, the value from 260 should be in publishercode

I hope I didn't forget anything! :)

Caroline

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29385: Catch register_id for payments against fees
Jonathan Druart [Thu, 2 Dec 2021 12:52:45 +0000 (13:52 +0100)]
Bug 29385: Catch register_id for payments against fees

This patch refactors the pay method in SIP FeePayment such that we
consistently pass parameters to both invocations of Koha::Account->pay.

It ensure the missing cash_register definition is passed when a set of
account lines to pay is defined.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30101: Fix OPAC advanced search after Bug 29844
Fridolin Somers [Mon, 14 Feb 2022 20:07:44 +0000 (10:07 -1000)]
Bug 30101: Fix OPAC advanced search after Bug 29844

Bug 29844 forgot to add as_list to opac-search.pl.
You can see it changed search.pl

Patch fixes and also adds explicit interface = opac in get_search_groups() call.
Since intranet is explicit, opac should also be.
We keep opac as default value.

Test plan :
1) Create a libary group for OPAC and one for staff
2) Go to OPAC advanced search page
3) Check you see the OPAC libary group

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 26704: (follow-up) Fix t/db_dependent/Koha/Items.t
Fridolin Somers [Wed, 16 Feb 2022 08:06:44 +0000 (22:06 -1000)]
Bug 26704: (follow-up) Fix t/db_dependent/Koha/Items.t

Note this patch also fixes wrong text in test line 1295

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoRevert "Bug 29579: Show saved SQL report ID in database query"
Fridolin Somers [Wed, 16 Feb 2022 09:17:11 +0000 (23:17 -1000)]
Revert "Bug 29579: Show saved SQL report ID in database query"

This reverts commit 39ec12fc48919a92a3ec12b4c766605556a9b0c3.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29579: Show saved SQL report ID in database query
Pasi Kallinen [Fri, 26 Nov 2021 09:54:52 +0000 (11:54 +0200)]
Bug 29579: Show saved SQL report ID in database query

When trying to figure out which saved SQL report caused too much load,
it's useful to have the report id show in the mysql process list.

This patch adds the saved SQL ID number as a comment line in front
of the SQL before passing it to the database.

To test:
1) Run a saved report that takes long enough time, so you can:
2) Connect to the database with your preferred client, and use
   "show processlist;" to list all the running mysql processes.
3) The running saved SQL report should show up with
   "-- saved_sql.id=123" in the process info field.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29570: Simplify for loop
Jonathan Druart [Tue, 8 Feb 2022 16:35:27 +0000 (17:35 +0100)]
Bug 29570: Simplify for loop

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29570: Enable sorting orders by summary
Tomas Cohen Arazi [Wed, 2 Feb 2022 20:10:36 +0000 (17:10 -0300)]
Bug 29570: Enable sorting orders by summary

This patch enables (on receiving) sorting orders by the summary column.
It needs the previous patches to work. Title is given more precedence as
expressed by users on the bug report. Which, by the way, makes sense.

To test:
1. Create a basket
2. Create orders
3. Close basket
4. Receive shipment
5. Enter invoice information
=> SUCCESS: You should see your pending orders
=> FAIL: Verify the 'Summary' column is not sortable
7. Apply this patches
8. Restart Plack
9. Reload the page
=> SUCCESS: Can sort by the summary column
10. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29570: Fix sorting orders by biblioitems columns
Tomas Cohen Arazi [Wed, 2 Feb 2022 20:04:08 +0000 (17:04 -0300)]
Bug 29570: Fix sorting orders by biblioitems columns

The API representation of Koha::Biblio objects includes the
biblioitems.* columns too. This proved problematic as queries had to get
translated so they work (i.e. if a query passes q={"biblio.ean":"123%"}
then the query needs to be tweaked so biblio.ean is translated into
biblio.biblioitem.ean. This is solved, locally, in the controller.

But sorting needs the same kind of tweak, and it was missing. This patch
solves that by doing a similar conversion.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/acquisitions_orders.t
=> FAIL: Tests fail, searching on a 'biblioitems' column generates a 500
error.
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! We can sort on those fields
5. Sign off :-D

Note: you will notice the tests only cover sorting by ISBN. I consider
it enough as sorting is a DB problem, and we only want to know if the
generated ORDER BY is valid for the underlying query, and MySQL would
complain if it wasn't the case.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29570: Regression tests
Tomas Cohen Arazi [Wed, 2 Feb 2022 19:29:00 +0000 (16:29 -0300)]
Bug 29570: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29519: Allow resolution of claims return at checkin
Martin Renvoize [Wed, 17 Nov 2021 16:07:40 +0000 (16:07 +0000)]
Bug 29519: Allow resolution of claims return at checkin

Add a 'Resolve' button in the alert dialogue that is displayed when a
lost item with a return claim is checked in. The button will trigger the
usual resolution modal allowing the user to pick their resolution.

This patch splits the resolution modal out of checkouts.js and
checkouts-table.inc so it can be used outside of the checkouts table.
We then reload it, optionally based upon the presence of the claims
preference, where needed.  This has the added benefit that it saves a
little bit of page load data in cases where the feature is not enabled.

Test plan
1. As we alter the file locations of the resolution handling code we
   need to test that normal claims functionality continue to work as
   expected.
2. Test the new functoinality by checking in an item that has been
   claimed as returned (but not yet resolved). The dialogue box should
   now contain a 'resolve' button next to each claimant and clicking
   upon it should trigger the resolution modal where the librarian can
   subsequently pick the resolution and submit it.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29515: Make title for HTML customizations optional
Katrin Fischer [Tue, 16 Nov 2021 08:35:22 +0000 (08:35 +0000)]
Bug 29515: Make title for HTML customizations optional

This adds code to make the title field for HTML customizations optional
while it stays mandatory for news entries.

1) Add a new HTML customization, verify you are forced to enter a title
2) Apply patch
3) Repeat and verify that you can now save without title
4) Add a new news entry
5) Verify that the title field remained mandatory there.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28576: Update the maximum size of an image.
The Minh Luong [Tue, 1 Feb 2022 19:44:06 +0000 (14:44 -0500)]
Bug 28576: Update the maximum size of an image.

This patch modifies the maximum size of a patron's image, from 500KB to
2MB. Also, in Home/Patrons/anyPatron, when you try to add an image to a
patron, you can now see the supported file types AND the maximum size.

The following places are affected by this patch:
- Home/Patrons/anyPatron
- Home/Tools/Upload patron images
- Home/Tools/Patron card creator/Images

To test:
1)Search for any patron and go to his page.
2)Hover over the image area on the left and click on the "Add" button.
3)Notice that the message above the choose file button only specifies
file types without the maximum size.
4)Add an image bigger than 500KB.
5)Nothing happens. (This is because the maximum size is 5KB)
6)Apply the patch.
7)Repeat steps from 1 to 3.
8)Notice that the message now includes the maximum size.
9)Add an image bigger than 500KB, but smaller than 2MB.
10)The image is succesfully uploaded.
11)Add an image bigger than 2MB.
12)Nothing happens. (The maximum size is now 2MB)
13)Repeat the steps 9 to 12 in "Home/Tools/Upload patron images" and
"Home/Tools/Patron card creator/Images".
14)Notice that the maximum size is updated.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28576: Add patron image in patron detail section does not specify image size...
Salman Ali [Wed, 16 Jun 2021 17:20:24 +0000 (13:20 -0400)]
Bug 28576: Add patron image in patron detail section does not specify image size limit

When you try to add an image to a patron in Home/Patrons/anyPatron, it only states the file types that are supported but not the maximum size. If you try to add an image that is bigger than 500 kb, nothing happens and the reason is not presented.

This is not the case with the 2 other places where we can add patron images in which they give warnings:
Home/Tools/Upload patron images
Home/Tools/Patron card creator/Images

For now, i simply added the size limit to the file supported message.

To test:
1)Search for any patron and go to his page
2)Hover over the image area on the left and click on add
3)Notice the message above the choose file button only specifies file types not size.
4)Add an image bigger than 500 kb
5)Nothing happens
6)Apply patch
7)Repeat steps from 1 to 3
8)Notice the message now includes the maximum size

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28405: Add author for multi holds view
Jonathan Druart [Tue, 8 Feb 2022 18:03:47 +0000 (19:03 +0100)]
Bug 28405: Add author for multi holds view

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28405: add author name to request.tt when it exists
Lucas Gass [Thu, 20 Jan 2022 22:06:56 +0000 (22:06 +0000)]
Bug 28405: add author name to request.tt when it exists

To test:
1. Place a hold and observe request.tt
2. No author name
3. Apply patch
4. Reload request.tt
5. Author name should appear on the same line as the title.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: George Williams <george@nekls.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 26704: (follow-up) Rebase for bug 29785
Martin Renvoize [Fri, 11 Feb 2022 10:32:04 +0000 (10:32 +0000)]
Bug 26704: (follow-up) Rebase for bug 29785

Update newly introduced calls from '->messages' to '->object_messages'

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 26704: Unit tests
Tomas Cohen Arazi [Mon, 29 Nov 2021 18:18:21 +0000 (15:18 -0300)]
Bug 26704: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 26704: Update Koha::Item to use Koha::Object::Messages
Martin Renvoize [Fri, 19 Mar 2021 14:51:57 +0000 (14:51 +0000)]
Bug 26704: Update Koha::Item to use Koha::Object::Messages

Use the newly introduced Koha::Object::Messages system to pass
additional information provided by object methods internally in the
objects themselves.

This patch updates the existing bespoke passing scheme to something
we've formally agreed to adopt going forward.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 26257: Move translatable strings out of subscription-add.tt and into subscription...
Owen Leonard [Wed, 19 Aug 2020 19:50:01 +0000 (19:50 +0000)]
Bug 26257: Move translatable strings out of subscription-add.tt and into subscription-add.js

This patch removes the definition of translatable strings out of
templates and into the corresponding JavaScript file, using the new JS
i81n function.

To test:

- Apply the patch and go to Serials -> New subscription
- Click "Next" without filling out any fields. You should get two
  confirmations, "If you wish to claim late or missing issues you must
  link this subscription to a vendor. Click OK to ignore or Cancel to
  return and enter a vendor" and "You must choose or create a
  bibliographic record."
- Manually enter a vendor number which doesn't exist and click "Next."
  Error: "The vendor does not exist."
- Manually enter a record number which doesn't exist and click "Next."
  Error: "Bibliographic record does not exist!"
- Select a valid vendor and bibliographic record and proceed to the next
  page.
- Click "Test prediction pattern" without filling in any fields. Error:
  "Cannot test prediction pattern for the following reason(s): Frequency
  is not defined. - First publication date is not defined"
- Click "Save subscription" without filling in any information. Error:
  "You must choose a first publication date."
- Fill in a date and click "Save subscription." Error: "You must choose
  a subscription length or an end date."
- Enter a frequency and subscription start date and click "Save
  subscription." Error: "Please click on 'Test prediction pattern'
  before saving subscription."
- Click "Show advanced pattern" and then "Save subscription." Error:
  "You have modified the advanced prediction pattern. Please save your
  work or cancel modifications."

Testing numbering patterns:

- There are several strings related to setting and editing numbering
  patterns but I don't think they can be tested live while Bug 28012 is
  unfixed.

Testing Mana integration:

- To test Mana integration you must have Mana enabled, and a
  bibliographic record in your catalog which has an ISSN
  matching a record in Mana. You can go to "Search on Mana"
  from the Serials sidebar menu to locate a working record.
- Add a subscription using the bibliographic record which will match a
  record in Mana. When you click "Next" you should see a message at the
  top of the page saying, "Searching for subscription in Mana Knowledge
  Base"
- After a moment this message should be replaced with "Subscription
  found on Mana Knowledge Base: Show Mana results"
- Clicking the "Show Mana results" should trigger a modal window with
  the heading "Results from Mana Knowledge Base."

- Test the subscription add process using a bibliographic record which
  doesn't match anything in Mana. The message at the top of the page
  should read, "No subscription found on Mana Knowledge Base"

TESTING TRANSLATABILITY

- Update a translation, e.g. fr-FR:

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

- Open the corresponding .po file for JavaScript strings, e.g.
  misc/translator/po/fr-FR-messages-js.po
- Locate strings pulled from
  koha-tmpl/intranet-tmpl/prog/js/subscription-add.js for translation,
  e.g.:

  msgid "Next issue publication date is not defined"
  msgstr ""

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

  > perl translate install fr-FR

- Switch to your newly translated language in the staff client
  and repeat the test plan above. The translated strings should
  appear.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 24630: (follow-up 2) call number when singleBranchMode=1
Fridolin Somers [Tue, 9 Feb 2021 14:50:21 +0000 (15:50 +0100)]
Bug 24630: (follow-up 2) call number when singleBranchMode=1

singleBranchMode=1 is when there is only one library (branch).

Test disply of available item.
Patch allows display of call number like in regular mode

Signed-off-by: Florian Bontemps <florian.bontemps@biblibre.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 24630: (follow-up 1) fix indenting
Fridolin Somers [Tue, 9 Feb 2021 14:39:40 +0000 (15:39 +0100)]
Bug 24630: (follow-up 1) fix indenting

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 24630: UNIMARC XSLT changes for bug 7611
Nick Clemens [Tue, 11 Feb 2020 14:06:07 +0000 (14:06 +0000)]
Bug 24630: UNIMARC XSLT changes for bug 7611

Follow test plan from 7611 on a UNIMARC system.

These changes have not been tested by me

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29779: Fix unit tests count
Kyle Hall [Mon, 7 Feb 2022 16:37:15 +0000 (11:37 -0500)]
Bug 29779: Fix unit tests count

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29859: Fix currencies display
Jonathan Druart [Fri, 11 Feb 2022 09:24:15 +0000 (10:24 +0100)]
Bug 29859: Fix currencies display

Oops!

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29859: (follow-up) Use iterator instead of as_list
Jonathan Druart [Fri, 11 Feb 2022 08:15:34 +0000 (09:15 +0100)]
Bug 29859: (follow-up) Use iterator instead of as_list

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29844: Fix selenium/administration_tasks.t
Jonathan Druart [Fri, 11 Feb 2022 07:54:27 +0000 (08:54 +0100)]
Bug 29844: Fix selenium/administration_tasks.t

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29458: Fix selenium test
Jonathan Druart [Mon, 31 Jan 2022 15:39:59 +0000 (16:39 +0100)]
Bug 29458: Fix selenium test

The authentication.t selenium tests (and a couple of others) were
failing with:
Error while executing command: element not interactable: Element <input class="btn btn-primary" type="submit"> could not be scrolled into view at /usr/local/share/perl/5.32.1/Selenium/Remote/Driver.pm line 411. at /usr/local/share/perl/5.32.1/Selenium/Remote/Driver.pm line 356.

We changed the other of the form, and t::lib::Selenium::submit_form was
not getting the correct (first) form. The one from the auth modal was
retrieved and submit button was clicked. Selenium raised an error as it
is not displayed.
The ->is_displayed selenium method does not work, as per the doc
"""
Note: This does *not* tell you an element's 'visibility' property; as it still takes up space in the DOM and is therefore considered 'displayed'.
"""
https://metacpan.org/pod/Selenium::Remote::WebElement#is_displayed

"The internet" is saying we should be able to use the following in our
xpath expression: not(ancestor::div[contains(@style,'display:none')]
but it actually only works if the display:none rule is defined on the
node (not from .css). Which does not work for us.

The only solution I found is to check for the size of the element, which
is (0,0) if not effectively displayed.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29874: Remove unused method C4::SIP::ILS::Item::fill_reserve
Tomas Cohen Arazi [Thu, 13 Jan 2022 12:54:33 +0000 (09:54 -0300)]
Bug 29874: Remove unused method C4::SIP::ILS::Item::fill_reserve

This patch removes the unused method.

Likely a leftover from ancient ages. AddIssue already fills the hold and
is called in the Checkout.pm library.

To test:
1. Run:
   $ git grep fill_reserve
=> FAIL: Notice it is only mentioned in the line that defines it
2. Apply this patch
3. Repeat 1
=> SUCCESS: Removed.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29277: Compiled CSS
Fridolin Somers [Fri, 11 Feb 2022 00:18:16 +0000 (14:18 -1000)]
Bug 29277: Compiled CSS

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29277: Replace the use of jQueryUI tabs on item circulation alerts page
Owen Leonard [Fri, 21 Jan 2022 12:45:45 +0000 (12:45 +0000)]
Bug 29277: Replace the use of jQueryUI tabs on item circulation alerts page

This patch replaces jQueryUI tabs on the item circulation alerts page as
a simple example to start the process of switching how we implement
tabbed interfaces.

The patch bumps the Bootstrap version from 3.3.7 to 3.4.1 and adds the
tabs component.

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

- Go to Administration -> Item circulation alerts.
- Confirm that the "Checkout" and "Check-in" tabs look correct and work
  correctly.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29832: Use KohaTable
Jonathan Druart [Tue, 1 Feb 2022 15:38:15 +0000 (16:38 +0100)]
Bug 29832: Use KohaTable

NoSort is defined in KohaTable

Also add noExport

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29832: Make library column in desk list sortable
Owen Leonard [Mon, 10 Jan 2022 12:28:40 +0000 (12:28 +0000)]
Bug 29832: Make library column in desk list sortable

This patch makes minor updates to the DataTable configuration on the
Circulation Desks Administration page. Redundant options are removed and
existing options are updated to use current DataTables syntax.

To test, apply the patch and make sure that the UseCirculationDesks
system preference is enabled.

- Go to Administration -> Circulation desks.
- Add multiple circulation desks if necessary, at multiple libraries.
- The "Desk" column should be sorted by default, and the "Actions"
  column should not be sortable.
- The "Library" column should be sortable.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29397: Use kohaSelect for pickup locations
Tomas Cohen Arazi [Wed, 3 Nov 2021 17:48:44 +0000 (14:48 -0300)]
Bug 29397: Use kohaSelect for pickup locations

This patch makes the pickup location dropdowns that rely on Select2 and
the API use the new wrapper. The original transport function is removed
as it is now embedded in the wrapper.

To test:
1. Follow bug 29404 test plan
=> SUCCESS: All works
2. Apply this patches
3. Repeat 1
=> SUCCESS: All works!
4. 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: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29397: Add function documentation
Tomas Cohen Arazi [Wed, 3 Nov 2021 17:46:53 +0000 (14:46 -0300)]
Bug 29397: Add function documentation

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 7374: Add remote image option for authorized values
Owen Leonard [Thu, 13 Jan 2022 12:33:34 +0000 (12:33 +0000)]
Bug 7374: Add remote image option for authorized values

This patch adds the option of using a remote image for an authorized
value, just as you can with item types.

To test, apply the patch and go to Administration -> Authorized values.

- Click "CCODE" to view the collection authorized values.
- Edit a collection code.
- In the form, under "Choose an icon," there should now be a "Remote
  image" tab.
- Enter a remote image url, e.g. https://via.placeholder.com/50/FF0000/FFFFFF.png
- Click "Save."
- After the page redirects to the list of collection codes you should
  see your image in the table next to the code you edited.
- Test that you can still edit a collection to set "No image" or to
  use one of the local image sets.
- Test that remote images can also be added when adding a new
  collection.

- Make sure "ccode" is in the "AdvancedSearchTypes" sytem preference.
- Go to the catalog's advanced search page and click the "Collection"
  tab.
- You should see your collection image in the list of collections.
- Perform the same check in the OPAC.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
JD amended patch: fix indentation

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29867: (follow-up) Add markup comments
Owen Leonard [Wed, 12 Jan 2022 19:05:02 +0000 (19:05 +0000)]
Bug 29867: (follow-up) Add markup comments

This patch adds comments to the template to highlight the markup
structure.

This patch should have no effect on the page's appearance or
functionality.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29867: Reindent authorized values administration template
Owen Leonard [Wed, 12 Jan 2022 18:44:28 +0000 (18:44 +0000)]
Bug 29867: Reindent authorized values administration template

This patch performs general template cleanup to authorized values
administration: Make indentation consistent, replace tabs with spaces,
and trim trailing whitespace.

To test, apply the patch and go to Administration -> Authorized values.
Test that all functionality works correctly:

 - Adding or deleting categories
 - Adding, editing, and deleting authorized values.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29984: Remove unused method Koha::Patrons->anonymise_issue_history
Tomas Cohen Arazi [Fri, 4 Feb 2022 18:46:15 +0000 (15:46 -0300)]
Bug 29984: Remove unused method Koha::Patrons->anonymise_issue_history

The method is no longer used, and replaced by
Koha::Old::Checkouts->anonymize.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Patrons.t
=> SUCCESS: Tests still pass
3. Run:
   $ git grep anonymise_issue_history
=> SUCCESS: The code doesn't mention it
4. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29843: Use in opac/opac-privacy.pl
Tomas Cohen Arazi [Mon, 10 Jan 2022 14:44:07 +0000 (11:44 -0300)]
Bug 29843: Use in opac/opac-privacy.pl

This patch makes the opac/opac-privacy.pl OPAC page use the new
anonymize method.

To test:
1. Have some checked-in materiales
2. Have OPACPrivacy enabled
3. Notice your checkouts history contains what you expect
4. Go to 'your privacy'
5. Click on 'Delete checkout history'
=> SUCCESS: It works, no crash.
6. Sign off :-D

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29843: Use in tools/cleanborrowers.pl
Tomas Cohen Arazi [Mon, 10 Jan 2022 15:14:11 +0000 (12:14 -0300)]
Bug 29843: Use in tools/cleanborrowers.pl

This patch makes tools/cleanborrowers.pl use the new methods.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29843: Use in batch_anonymise.pl
Tomas Cohen Arazi [Mon, 10 Jan 2022 14:32:15 +0000 (11:32 -0300)]
Bug 29843: Use in batch_anonymise.pl

This patch makes the batch_anonymise.pl cronjob script use the newly
introduced methods instead of the old ones.

To test:
1. Try the tool
=> SUCCESS: No behavior change
2. Sign off :-D

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29843: Add ->anonymize and ->filter_by_anonymizable to Koha::Old::Checkouts
Tomas Cohen Arazi [Mon, 10 Jan 2022 14:23:10 +0000 (11:23 -0300)]
Bug 29843: Add ->anonymize and ->filter_by_anonymizable to Koha::Old::Checkouts

This patch implements high-level methods for:

* Filtering a Koha::Old::Checkouts resultset so only anonymizable rows
  are left
* Anonymizing the rows in a resultset

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

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29843: Unit tests
Tomas Cohen Arazi [Mon, 10 Jan 2022 14:22:52 +0000 (11:22 -0300)]
Bug 29843: Unit tests

This patch adds unit tests for the introduced methods.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29526: (follow-up) change wording on opac-holdshistory.tt when table is empty
Lucas Gass [Mon, 3 Jan 2022 23:02:23 +0000 (23:02 +0000)]
Bug 29526: (follow-up) change wording on opac-holdshistory.tt when table is empty

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29526: (follow-up) Put delete buttons in HTML table
Lucas Gass [Mon, 3 Jan 2022 18:07:14 +0000 (18:07 +0000)]
Bug 29526: (follow-up) Put delete buttons in HTML table

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29526: Add a way for patrons to delete their hold history
Tomas Cohen Arazi [Mon, 3 Jan 2022 14:53:32 +0000 (11:53 -0300)]
Bug 29526: Add a way for patrons to delete their hold history

The same way we have a button to immediately delete the checkouts history in the OPAC, we should have a similar option for the holds history.

This patch implements that.

To test:
1. Have a patron with some old checkouts and old holds.
2. Have OPACPrivacy, OPACHoldsHistory and opacreadinghistory enabled.
3. Notice in the OPAC the patron has some old checkouts and holds.
4. Use the Privacy tab to clean checkouts
=> SUCCESS: They are still cleaned as before this patch
5. Try to clean the old holds
=> SUCCESS: They are cleaned!
6. Add some old checkouts and holds
7. Use the new 'All' button
=> SUCCESS: All cleaned
8. Sign off :-D

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29525: Make Koha::Hold->fill anonymize if required
Tomas Cohen Arazi [Thu, 13 Jan 2022 17:40:04 +0000 (14:40 -0300)]
Bug 29525: Make Koha::Hold->fill anonymize if required

This patch makes filling a hold anonymize it on the same call, if
settings require it (i.e. if borrowers.privacy is set to 2).

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Hold.t
=> SUCCESS: The code actually does what it is meant to
3. Try on the UI, notice it gets anonymized if the patron has privacy == always/2.
4. Sign off :-D

Note: AnonymousPatron should be set. Otherwise it would set NULL. But
that's fine, that's what Koha does already.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29525: Make Koha::Hold->cancel anonymize if required
Tomas Cohen Arazi [Wed, 12 Jan 2022 19:32:24 +0000 (16:32 -0300)]
Bug 29525: Make Koha::Hold->cancel anonymize if required

This patch makes cancelling a hold anonymize it on the same call, if
settings require it (i.e. if borrowers.privacy is set to 2).

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Hold.t
=> SUCCESS: The code actually does what it is meant to
3. Try on the UI, cancelling a hold, noticing it gets anonymized if the
   patron has privacy == always/2.
4. Sign off :-D

Note: AnonymousPatron should be set. Otherwise it would set NULL. But
that's fine, that's what Koha does already.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29525: (follow-up) Adapt OPAC text to mention holds
Tomas Cohen Arazi [Mon, 3 Jan 2022 18:15:15 +0000 (15:15 -0300)]
Bug 29525: (follow-up) Adapt OPAC text to mention holds

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29525: Make batch_anonymise.pl deal with holds
Tomas Cohen Arazi [Mon, 3 Jan 2022 18:08:27 +0000 (15:08 -0300)]
Bug 29525: Make batch_anonymise.pl deal with holds

This patch makes the batch_anonymise.pl script handle holds too. It does
so by leveraging on the newly introduced method 'filter_by_anonymizable'
and also 'anonymize'.

To test:
1. Have a patron with two past holds.
2. Make sure they are a few days back:
   $ koha-mysql kohadev
   > UPDATE old_reserves SET timestamp=ADDDATE(NOW(), INTERVAL -4 DAY);
3. Run:
   $ kshell
  k$ perl misc/cronjobs/batch_anonymise.pl --days 2 -v
=> SUCCESS: You see something like:
Checkouts and holds before 2022-01-01 will be anonymised.
0 checkouts anonymised.
2 holds anonymised.
4. Repeat 3
=> SUCCESS: They are already anonymized. You see
Checkouts and holds before 2022-01-01 will be anonymised.
0 checkouts anonymised.
0 holds anonymised.
5. Sign off :-D

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29525: Add Koha::Old::Holds->filter_by_anonymizable
Tomas Cohen Arazi [Mon, 3 Jan 2022 18:06:23 +0000 (15:06 -0300)]
Bug 29525: Add Koha::Old::Holds->filter_by_anonymizable

This patch adds the 'filter_by_anonymizable' method, and tests for it. A
new DBIC relationship is added as well to the OldReserve schema file.

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

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29868: Add Koha::Old::Hold->anonymize
Tomas Cohen Arazi [Wed, 12 Jan 2022 19:24:35 +0000 (16:24 -0300)]
Bug 29868: Add Koha::Old::Hold->anonymize

This patch introduces a new method in Koha::Old::Hold. The method is
fully covered by tests.

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29869: (QA follow-up) import t::lib::Mocks for Hold.t for mock_preference
Kyle Hall [Fri, 14 Jan 2022 17:11:42 +0000 (12:11 -0500)]
Bug 29869: (QA follow-up) import t::lib::Mocks for Hold.t for mock_preference

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29869: Teach log viewer about FILL
Tomas Cohen Arazi [Thu, 13 Jan 2022 13:04:02 +0000 (10:04 -0300)]
Bug 29869: Teach log viewer about FILL

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29869: Remove C4::Reserves::ModReserveFill
Tomas Cohen Arazi [Thu, 13 Jan 2022 12:45:12 +0000 (09:45 -0300)]
Bug 29869: Remove C4::Reserves::ModReserveFill

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29869: Make ModReserveFill a (temporary) wrapper for Koha::Hold->fill
Tomas Cohen Arazi [Thu, 13 Jan 2022 12:08:11 +0000 (09:08 -0300)]
Bug 29869: Make ModReserveFill a (temporary) wrapper for Koha::Hold->fill

Before diving into removing ModReserveFill, I propose this:

In order to perform real-life testing of the new Koha::Hold->fill
method, this patch makes the ModReserveFill method, just call the new
one.

To test:
1. Apply this patchset
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Hold* \
           t/db_dependent/Hold* \
           t/db_dependent/api/v1/holds.t \
           t/db_dependent/Reserves* \
           t/db_dependent/Circulation* \
           t/db_dependent/SIP/*
=> SUCCESS: Tests pass!
3. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29869: Add Koha::Hold->fill
Tomas Cohen Arazi [Thu, 13 Jan 2022 12:03:20 +0000 (09:03 -0300)]
Bug 29869: Add Koha::Hold->fill

This patch introduces a new method for marking a hold as filled. The
code is the result of tracking the following methods in C4::Reserves:
- ModReserveFill
- GetReserveFee
- ChargeReserveFee

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

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29869: Unit tests
Tomas Cohen Arazi [Thu, 13 Jan 2022 12:03:04 +0000 (09:03 -0300)]
Bug 29869: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29780: Unit tests
Tomas Cohen Arazi [Mon, 3 Jan 2022 13:36:55 +0000 (10:36 -0300)]
Bug 29780: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>