koha.git
2 years agoBug 28759: limit accessibility for "Manage API keys"
Petro Vashchuk [Tue, 10 Aug 2021 15:08:53 +0000 (18:08 +0300)]
Bug 28759: limit accessibility for "Manage API keys"

This patch limits the accessibility for "Manage API keys" section only
to superlibrarians and the owner of that said API key account.

The way it does it is by checking if user is superlibrarian or if
logged-in user is the same as a patron id/borrower number is the same
as logged-in user number both in template and apikeys.pl and making sure
the link is inaccessible or redirects to the 403 page if user tries to
go there directly.

To reproduce:
1) create/pick existing patron, set Staff access, allows viewing
of catalogue in staff interface (catalogue)" and "Add, modify and
iew patron information (borrowers)" permissions on;
2) enable "RESTOAuth2ClientCredentials" in sysprefs;
3) login with that user into staff interface;
4) check any other patron, go to the "More"->"Manage API keys" and
check that you can see, add delete their API keys;
5) apply patch;
6) with that same user try to access "Manage API keys" page again.
Ensure that you can't access that page of other patrons but can
access your own page and manage your own API keys.
7) log in with superlibrarian now and ensure that you can access every
"Manage API keys" page of every patron and apply changes there.

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>
2 years agoBug 28941: Deal with OPACSuggestionUnwantedFields
Jonathan Druart [Fri, 10 Sep 2021 09:33:18 +0000 (11:33 +0200)]
Bug 28941: Deal with OPACSuggestionUnwantedFields

Remove fields from OPACSuggestionUnwantedFields before creating the
suggestion

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
JD amended patch: remove useless sort

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28941: Filter suggestion inputs at the OPAC
Jonathan Druart [Thu, 2 Sep 2021 09:51:48 +0000 (11:51 +0200)]
Bug 28941: Filter suggestion inputs at the OPAC

The following sequence is bad:
46 my $suggestion      = $input->Vars;

181         &NewSuggestion($suggestion);

All columns can be set when we insert the suggestion into the DB
We definitely want to avoid the following fields to be set by the final
user: acceptedby, accepteddate, STATUS, etc...

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28947: Prevent OPAC user to create new users
Jonathan Druart [Fri, 3 Sep 2021 10:01:12 +0000 (12:01 +0200)]
Bug 28947: Prevent OPAC user to create new users

This patch prevents an existing user from exploiting the patron edit form in order to
force create new patrons

To test:
Try all combinations of PatronSelfRegistration and PatronSelfRegistrationVerifyByEmail
with and without this patch.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28935: (QA follow-up) Use BorrowerUnwantedField on staff client
Nick Clemens [Mon, 13 Sep 2021 12:56:30 +0000 (12:56 +0000)]
Bug 28935: (QA follow-up) Use BorrowerUnwantedField on staff client

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28935: No filtering on patron's data on member entry pages
Marcel de Rooy [Wed, 1 Sep 2021 14:04:31 +0000 (16:04 +0200)]
Bug 28935: No filtering on patron's data on member entry pages

Security patch. Follow-up for 28929.
Including correction for gonenoaddress and two others.
Includes unwanted fields too now.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28929: Add selenium tests
Jonathan Druart [Tue, 31 Aug 2021 15:12:22 +0000 (17:12 +0200)]
Bug 28929: Add selenium tests

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Bug 28929: (follow-up) Add exec flag to tests

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28929: Prevent flags to be sent during patron's edition
Jonathan Druart [Tue, 31 Aug 2021 13:55:15 +0000 (15:55 +0200)]
Bug 28929: Prevent flags to be sent during patron's edition

* selfreg and selfmod for OPAC
* patron's edition on staff

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested OPAC and staff side. Prevents mangling flags column.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28149: (follow-up) Add string for job status "new"
Owen Leonard [Tue, 17 Aug 2021 10:17:35 +0000 (10:17 +0000)]
Bug 28149: (follow-up) Add string for job status "new"

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28149: Improve internationalization and formatting on background jobs page
Owen Leonard [Wed, 14 Apr 2021 17:43:38 +0000 (17:43 +0000)]
Bug 28149: Improve internationalization and formatting on background jobs page

This patch adds some logic to the background jobs template in order to
make job status and job type translatable. Output of dates has been
changed to use the KohaDates plugin, using the "with_hours" flag.

This patch also modifies the page title and breadcrumbs so that if one
is viewing the details of a background job the page title and
breadcrumbs reflect this.

I've also added inclusion of the preferences search form in the header,
the default for administration pages which don't have their own search.

To test, apply the patch and go to Administration -> Background jobs.

 - If there are no background jobs listed, submit at least one batch of
   bibliograhpic records and at least one batch of authorty records for
   modification (Tools -> Batch record modification).
   - In the table of background jobs, the status should be shown
     correctly. If you see it capitalized ("Finished") you're seeing the
     new string in the template which will be used for translation.
   - In the "Type" column, you should see either "Batch authority record
     modification" or "Batch bibliographic record modification"
   - In the "Queued," "Started," and "Ended" columns the date should be
     formatted according to your system's dateformat system preference,
     including the time.
  - View the details of a background job. The same changes to status and
    type should be seen on this page, as well as the date formatting of
    the date fields.
    - In the breadcrumbs, confirm that it shows a link to the
      background jobs page followed by "Details if job #X".

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28392: make streettype and B_streettype work with BorrowerUnwantedField
Lucas Gass [Wed, 1 Sep 2021 14:17:21 +0000 (14:17 +0000)]
Bug 28392: make streettype and B_streettype work with BorrowerUnwantedField

To test:
1. Add values to the AV ROADTYPE
2. Go to the BorrowerUnwantedField system preference and attempt to hide streettype and B_streettype.
3. It doesn't work, the fields still show.
4. Apply patch
5. Repeat step 2, it should work now.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 21794: (QA follow-up) Separate city and country with a comma
Joonas Kylmälä [Sat, 4 Sep 2021 18:23:16 +0000 (18:23 +0000)]
Bug 21794: (QA follow-up) Separate city and country with a comma

If only the city and country address information was provided they ended
up being glued together like this: CityCountry. (AddressFormat=US style)

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 21794: Fix display of addresses on details tab in staff when city is empty
Katrin Fischer [Mon, 23 Aug 2021 22:34:13 +0000 (00:34 +0200)]
Bug 21794: Fix display of addresses on details tab in staff when city is empty

If the city field was not filled out on the main or alternate address,
the content of state, country and zipcode wouldn't display on the
Details tab in the patron account in staff.

To test:
- Enter main contact and alternate address without city
- Verify that the address information isn't shown on the details
  tab after saving
- Apply patch
- Verify that the information is displayed now
- Toggle AddressFormat and check display is correct for all settings
- Switch back to US address format
- Try several combinations of empty fields for city, zipcode, country
  and state. The punctuation and whitespace should always appear
  correctly.

Examples:
- Enter just country
- Enter zipcode and country
- ...

Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28936: Add sort1/sort2 to borrowers.json
Lucas Gass [Wed, 1 Sep 2021 16:24:52 +0000 (16:24 +0000)]
Bug 28936: Add sort1/sort2 to borrowers.json

To Test:
1. Check the BorrowerMandatoryField and BorrowerUnwantedField system preferences, sort1 and sort2 cannot be hidden or required
2. Apply patch
3. Check the BorrowerMandatoryField and BorrowerUnwantedField system preferences again, you should see sort1 and sort2
4. Since sort1 and sort2 are now added to borrowers.json we must also check the system preferences PatronQuickAddFields & PatronDuplicateMatchingAddFields
5. They should both now include sort1 and sort2, check to make sure they work with these two system preferences
6. Look at the system preferences PatronSelfRegistrationBorrowerMandatoryField, PatronSelfRegistrationBorrowerUnwantedField, and PatronSelfModificationBorrowerUnwantedField
7. sort1 and sort2 should be disabled in these OPAC system preferences

This patch does not attempt to add sort1 or sort2 to the self reg or borrower mod pages. If they should be added, which I am not sure they should, we should do so in a seperate bug

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28373: [21.05] Fix transformMARCXML4XSLT export in C4::XSLT
Jonathan Druart [Thu, 9 Sep 2021 08:31:39 +0000 (10:31 +0200)]
Bug 28373: [21.05] Fix transformMARCXML4XSLT export in C4::XSLT

 #   Failed test 'use Koha::OAI::Server::Repository;'
 #   at t/00-load.t line 62.
 #     Tried to use 'Koha::OAI::Server::Repository'.
 #     Error:  "transformMARCXML4XSLT" is not exported by the C4::XSLT module
 # Can't continue after import errors at /kohadevbox/koha/Koha/OAI/Server/Repository.pm line 39.

2 years agoBug 10265: (QA follow-up) Make if-else checks consistent
Joonas Kylmälä [Sun, 5 Sep 2021 12:10:17 +0000 (12:10 +0000)]
Bug 10265: (QA follow-up) Make if-else checks consistent

The != '' version doesn't check for the whitespace existing and thus
might have added the punctuation without the partNumber or partName being
inserted at all.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 10265: Keep punctuation for 8xx series added entry fields (MARC21)
Katrin Fischer [Sun, 22 Aug 2021 03:29:47 +0000 (03:29 +0000)]
Bug 10265: Keep punctuation for 8xx series added entry fields (MARC21)

At the moment the punctuation entered for $n $p and is
removed in the part template, which leads to displaying the subfields
without any punctuation and spaces in between.

To test:
- Catalog records with various combinations of 8xx series added
  entry fields. Subfield a, t, n, p and v are the most important.
- Verify the display in OPAC and staff is not great.
- Apply the patch.
- Verify the display in OPAC and staff is improved.

For examples see:
https://www.loc.gov/marc/bibliographic/bd80x83x.html

Important note: At the moment 8xx series added entry fields will only display, when
there is also a 490 ind. 1 = 1 field present.

Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28912: Remove duplicated warnings on the about page
Jonathan Druart [Fri, 27 Aug 2021 14:59:43 +0000 (16:59 +0200)]
Bug 28912: Remove duplicated warnings on the about page

Bad conflict resolution

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28912: Prevent Pseudonymization to be set if bcrypt_settings not set
Jonathan Druart [Fri, 27 Aug 2021 14:56:08 +0000 (16:56 +0200)]
Bug 28912: Prevent Pseudonymization to be set if bcrypt_settings not set

If Pseudonymization is set but the bcrypt_settings config used by the
feature is not set, then there is an ugly 500 on checking out.

bad bcrypt settings at /kohadevbox/koha/Koha/PseudonymizedTransaction.pm line 116.

However it's pretty hard to handle correctly this exception (and that's
why it hasn't be done initially). However we could prevent the pref to
be turned on if the config entry is not present.

Test plan:
Remove the bcrypt_settings from the config
Try to turn the syspref on
Add the config
Try to turn the syspref on/off

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
JD amended patch: fix qa failures

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28882: Disable select/hide all links
Jonathan Druart [Wed, 25 Aug 2021 09:47:18 +0000 (11:47 +0200)]
Bug 28882: Disable select/hide all links

We want to prevent non-superlibrarian users to remove superlibrarian
flag.
It's handled already in the controller, but needs to be done
client-side.

Here we are disabling the select/hide all links to remove the remaining
possibility to remove the superlibrarian flag from non-superlibrarian
users.

Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28882: permission UI allows selection of superlibrarian permission
Jonathan Druart [Thu, 19 Aug 2021 13:07:50 +0000 (15:07 +0200)]
Bug 28882: permission UI allows selection of superlibrarian permission

With bug 20100 and 22150 we allow to select all the permissions but the
superlibrarian permission, to ease the selection. And we also forbid a
non-superlibrarian user to add superlibrarian permission.

However there is something wrong in the JS code and it's possible to add
the superlibrarian permission. The user is getting an ugly 500 and so
the permission change is not done, but the UI checks must be fixed.

To recreate:
Login with a non-superlibrarian user
Edit permission
Clear all
=> You can select the "superlibrarian" permission

Test plan:
Login with a non-superlibrarian user
Try to set the superlibrarian permissions to a user
=> not possible
Try the select all/clear all
=> still cannot set the superlibrarian permission

Work to be done:
Login with a non-superlibrarian user
Edit permissions for a superlibrarian user
=> You can remove it, then cannot add it back
Should we allow removal of superlibrarian permission by
non-superlibrarian user?

Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28373: [21.05.x] Add PassItemMarcToXSLT system preference
Nick Clemens [Tue, 18 May 2021 15:06:43 +0000 (15:06 +0000)]
Bug 28373: [21.05.x] Add PassItemMarcToXSLT system preference

Default stylesheets do not reference item fields for XSLT display, however, we
spend time translating the values in the item fields.

This patch adds a system preference, PassItemMarcToXSLT. and unless enabled we remove
item fields before processing

To test:
1 - Perform some search on the staff client and opac
2 - Use the console (F12) to view the time spent on the network tab
3 - Note performance
4 - Apply patch, updatedatabase, restart_all
5 - Repeat searches
6 - Note that display has not changed
7 - Note performance, results should display slightly faster

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 28373: Unit test

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 28373: (QA follow-up) Fix typo in system preference description

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 28373: (follow-up) QA fixes

Use fully qualified subroutine name
Don't return explicit undef

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 28373: (QA follow-up) Add . to end of system preference description

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Bug 28373: Add note to XSLT prefs about the new pref

Bug 28373: Add warning if custom stylesheets are defined

This patch adds a check of the current XSLT prefs and warns to check the new pref
if any are not set to default

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 20529: Remove other occurrences of decodeURIComponent from browser.js
Jonathan Druart [Fri, 9 Jul 2021 14:01:43 +0000 (16:01 +0200)]
Bug 20529: Remove other occurrences of decodeURIComponent from browser.js

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 20529: Fix "Return to results" link broken by a double quote
Victor Grousset [Mon, 16 Apr 2018 16:55:48 +0000 (18:55 +0200)]
Bug 20529: Fix "Return to results" link broken by a double quote

(in the search query)

cause: decodeURIComponent used when URI encoding was necessary. (At
least in main usecase of this feature)
It could have been a copy and paste error. From the above
browseRecords() function.

== Test plan ==
1. Search in the staff catalogue «a "alice"»
     Replace a and alice with whatever than will return a result for you
2. Click on the first result
3. Check the "Return to results" link
     It should be like
     staff_url://cgi-bin/koha/catalogue/search.pl?idx=kw&q=a
     This is the bug. Because when clicking the link, your search will be
     'kw,wrdl: a'
     instead of
     'kw,wrdl: a "alice"'
4. Apply this patch.
5. Search in the staff catalogue «a "alice"»
     Replace a and alice with whatever than will return a result for you
6. Click on the first result
7. Check the "Return to results" link
     The link should preserve the full query

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 26195: Add a way to specify authorised values should be expanded [OAI]
Tomas Cohen Arazi [Thu, 13 Aug 2020 17:50:16 +0000 (14:50 -0300)]
Bug 26195: Add a way to specify authorised values should be expanded [OAI]

This patch introduces a new configuration entry for OAI so the resulting
records include authorised value descriptions instead of codes.

This is off by default.

To test:
1. Create a yaml file with the extended OAI configuration
2. Visit http://kohadev.myDNSname.org:8080/cgi-bin/koha/oai.pl
3. Browse some records
=> SUCCESS: The fields tied to AV show codes.
4. Update your configuration with 'expanded_avs: 1' for one  of the
   defined format like in:

  ---
  format:
    marc21:
      metadataPrefix: marc21
      metadataNamespace: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim
      schema: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd
      include_items: 0
    marcxml:
      metadataPrefix: marcxml
      metadataNamespace: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim
      schema: http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd
      include_items: 1
      expanded_avs: 1
5. restart_all
6. Repead 3
=> SUCCESS: AV descriptions are returned!
7. Sign off :-D

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28774: DBRev 21.05.03.001
Kyle M Hall [Fri, 3 Sep 2021 15:13:21 +0000 (11:13 -0400)]
Bug 28774: DBRev 21.05.03.001

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28774: Don't store blank values for rental discount
Nick Clemens [Wed, 28 Jul 2021 12:23:50 +0000 (12:23 +0000)]
Bug 28774: Don't store blank values for rental discount

This patch adds 'can_be_blank => 0' for the rentaldiscount rule to prevent
storing blank values in the database

Additionally, if there is no charge we do not need to check for a discount
and can simply return

To test:
1 - Set rental discount to "" to a rule in circulation rules
2 - Checkout an item that will follow this rule
3 - Check the intranet log:
    [WARN] Argument "" isn't numeric in subtraction (-) at /kohadevbox/koha/C4/Circulation.pm line 3385.
4 - Apply patch and restart all
5 - Update database
6 - Set the rule to "" again
7 - Check the DB, no rule is stored
    SELECT * FROM circulation_rules WHERE rule_name = 'rentaldiscount';
8 - Checkout the item again
9 - No warns in log

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28885: Skip invalid biblios for OpacBrowseResults
Kyle M Hall [Thu, 19 Aug 2021 14:49:34 +0000 (10:49 -0400)]
Bug 28885: Skip invalid biblios for OpacBrowseResults

If a record is deleted from Koha, but is for some reason not deleted from the search indexes, OpacBrowseResults can cause an ISE if the deleted record is in the search results for any given item. OpacBrowseResults loops through the search results, and checks if there is a biblionumber, but does *not* check to see if a result was pulled from the database for that biblionumber. It simply assumes the result must exist.

We should be checking to ensure the biblionumber was valid before operating on the biblio object.

Test Plan:
1) Use zebra for searching
2) Disable koha-indexer
3) Enable OpacBrowseResults
4) Perform a search
5) Delete an item in the search results
6) View on of the remaining items in the search results
7) Note the error
8) Apply this patch
9) Restart plack
10) Reload the page
11) The error should be gone!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28744: Better handling of undefined to_api_mapping
Tomas Cohen Arazi [Fri, 23 Jul 2021 03:39:16 +0000 (00:39 -0300)]
Bug 28744: Better handling of undefined to_api_mapping

We always had some mapping because of the DB vs. API object definition discrepancies. But bug 25260 revamps the reserves table, and it is a perfect match. It highlights this edge case: if no mapping defined, then and undef from_api_mapping is generated (as opposed to an empty hashref) and this leads to errors in the query translation from the API.

This patch makes a small change so this method always returns an empty
hashref.

To test:
1. Apply the regression tests
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Object.t
=> FAIL: Test fail!
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: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
JD amended patch: remove uneeded commented lines

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28744: Regression tests
Tomas Cohen Arazi [Fri, 23 Jul 2021 03:35:49 +0000 (00:35 -0300)]
Bug 28744: Regression tests

This patch adds tests for the following cases:
- to_api_mapping not defined
- to_api_mapping returning an empty hashref

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Object.t
=> FAIL: Tests fail :-(

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>
JD amended patch: remove uneeded commented lines

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2 years agoBug 28891: (bug 23916 follow up) Always use 'Checkout on' as default Checkout history...
Didier Gautheron [Mon, 23 Aug 2021 13:19:03 +0000 (15:19 +0200)]
Bug 28891: (bug 23916 follow up) Always use 'Checkout on' as default Checkout history sort column

To test:
1 - Unset RecordStaffUserOnCheckout
2 - Check out an item
3 - Display Checkout history, table is sorted by 'Checkout on' column
4 - Set RecordStaffUserOnCheckout
5 - Display Checkout history, table is sorted by 'Renewed' column
6 - Apply patch
7 - Redo 1, 3, 4 and 5, table is always sorted by 'Checkout on'

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 7703: (follow-up) Treat no items like none available
Owen Leonard [Fri, 6 Aug 2021 12:54:46 +0000 (12:54 +0000)]
Bug 7703: (follow-up) Treat no items like none available

This patch modifies the holds template so that during the
multi-hold process, titles with no items attached are treated the same
way as titles with no items available (items exist but cannot be place
don hold):

 - The row showing such a record will say "No items are available to be
    placed on hold."
 - The pickup location dropdown will be hidden.

To test, follow the previous test plan and confirm that these change are
reflected. Now that the pickup location field isn't present for titles
without items you should be able to complete the holds process.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 7703: (QA follow-up)
Kyle M Hall [Fri, 6 Aug 2021 11:46:12 +0000 (11:46 +0000)]
Bug 7703: (QA follow-up)

Revised test plan from Owen:

This patch modifies the hold process so that if one of the titles in a
multi-hold process has no items the process doesn't abort completely.

To test, apply the patch and perform a search in the catalog which will
return one or more records with no items attached.

 - Check checkboxes for multiple results, some of which have items and
   at least one of which has no items.
 - Click "Place hold."
 - You should be taken to the page for placing multiple holds, with a
   heading, "Cannot place hold on some items."
 - Note: You will not be able to complete the holds process without the
   next patch.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 7703: Don't block bulk hold action on search results if some items can't be place...
Kyle M Hall [Fri, 6 Aug 2021 11:19:12 +0000 (11:19 +0000)]
Bug 7703: Don't block bulk hold action on search results if some items can't be placed on hold

If you select multiple titles on the search results page in order to
place a bulk hold and some of those titles have no items you get a
JavaScript alert warning you can some cannot be placed on hold. You are
blocked from completing the action until you deselect the invalid hold.

This is unnecessary because the bulk hold process will safely refuse to
place a hold on these titles later in the process.

This patch removes the check that prevents submitting a multi-hold if
one or more records in the multi-hold have no items.

Test plan:
1) Apply patch
2) On the staff interface, do a search
3) On the search results, select at least one record with items and one
   record with no items.
4) Click the 'Place hold' button.
5) You should be redirected to reserve/request.pl with the message
   "Cannot place hold: this record has no items attached."

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28554: Fix t/db_dependent/AuthorisedValues.t
Fridolin Somers [Wed, 4 Aug 2021 08:11:10 +0000 (22:11 -1000)]
Bug 28554: Fix t/db_dependent/AuthorisedValues.t

Fixes where sort on lib breaks the test.

Also removes useless params in search_by_koha_field()

Run prove t/db_dependent/AuthorisedValues.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28554: In itemsearch sort item types filter by description
Fridolin Somers [Fri, 11 Jun 2021 11:42:00 +0000 (13:42 +0200)]
Bug 28554: In itemsearch sort item types filter by description

In itemsearch form, the item types filter should be sorted by description.

Test plan :
1) Create several values and descriptions in item types
2) Go to itemsearch
3) See filter by item types sorts on description and not on value

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28554: In Koha::AuthorisedValues sort by description
Fridolin Somers [Fri, 11 Jun 2021 11:35:41 +0000 (13:35 +0200)]
Bug 28554: In Koha::AuthorisedValues sort by description

In itemsearch form, there are several filters build with authorized values.
There values should be sorted by description.

Test plan :
1) Create several values and descriptions in authorized values LOC
2) Go to itemsearch
3) See filter by location sorts on description and not on value

Seems change in search_by_marc_field can not be tested in interface

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28812: Improve robustness of selector
Jonathan Druart [Mon, 30 Aug 2021 12:43:35 +0000 (14:43 +0200)]
Bug 28812: Improve robustness of selector

Use the same fix as bug 28828.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28812: (bug 7882 follow up) Copy all subfields in plugin editor
Didier Gautheron [Thu, 26 Aug 2021 13:27:45 +0000 (15:27 +0200)]
Bug 28812: (bug 7882 follow up) Copy all subfields in plugin editor

To test:
1- Create a notice with a 700$a and 700$d
2- Click on 700 $a field Tag Editor
3- Only 700$a is copied in search windows eg /authorities/auth_finder.pl pop up
4- Apply patch
5- Redo 2
6- 700$a is copied in 'Search main heading ($a only)' and $d is copied in 'Search main heading'

Signed-off-by: George Veranis <gveranis@dataly.gr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 25619: Adjust POD and move date check before logging
Nick Clemens [Thu, 26 Aug 2021 19:07:53 +0000 (19:07 +0000)]
Bug 25619: Adjust POD and move date check before logging

Potentially we could have logged a change when no date was passed.

This patch moves the test before logging and updates POD

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 25619: Adjust POD
Jonathan Druart [Wed, 11 Aug 2021 11:17:13 +0000 (13:17 +0200)]
Bug 25619: Adjust POD

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 25619: (QA follow-up) Fix subtest description
Kyle M Hall [Thu, 22 Jul 2021 10:24:12 +0000 (06:24 -0400)]
Bug 25619: (QA follow-up) Fix subtest description

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 25619: Unit Tests
Kyle M Hall [Fri, 16 Jul 2021 18:26:37 +0000 (14:26 -0400)]
Bug 25619: Unit Tests

Signed-off-by: Abbey Holt <aholt@dubuque.lib.ia.us>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 25619: Add ability to adjust expiration date for waiting holds
Kyle M Hall [Fri, 16 Jul 2021 17:50:29 +0000 (13:50 -0400)]
Bug 25619: Add ability to adjust expiration date for waiting holds

There are times when an item that is waiting for pickup needs to have the expiration date extended. This would give staff the ability to modify one by one, as needed, the reserves.expirationdate for a given item awaiting pickup.

Test Plan:
1) Place a hold, trap an item for it such that is is waiting
2) Attempt to update the expiration date
3) Note the new date is not saved
4) Apply this patch, restart all the things!
5) Attempt to update the expiration date
6) The new date should be saved!

Signed-off-by: Abbey Holt <aholt@dubuque.lib.ia.us>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 26223: (QA follow-up) Fix filter order
Tomas Cohen Arazi [Thu, 26 Aug 2021 12:06:50 +0000 (09:06 -0300)]
Bug 26223: (QA follow-up) Fix filter order

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 26223: include item information in OPAC ISBD view
Andreas Roussos [Mon, 17 Aug 2020 08:57:03 +0000 (10:57 +0200)]
Bug 26223: include item information in OPAC ISBD view

The ISBD view in the OPAC interface does not display item information.

This patch fixes that.

Test plan:
0) Have a biblio with at least one item attached to it and include one
   of the following snippets in the OPACISBD system preference,
   depending on your MARC flavour:

   MARC21:
   #952|<br/><h2>Items</h2><table><th>Copy number</th><th>Shelving
   location</th><th>Koha item type</th><th>Barcode</th><th>Call number
   (Full call number)</th><th>Materials specified (bound volume or
   other part)</th>|<tr><td>{952t} </td><td> {952c} </td><td> {952y}
   </td><td> {952p} </td><td> {952o} </td><td> {9523}</td></tr>|</table>

   UNIMARC:
   #995|<br/><h2>Items</h2><table><th>Copy number</th><th>Shelving
   location</th><th>Koha collection</th><th>Barcode</th><th>Call number
   (Full call number)</th><th>Numbering (volume or other part)</th>|
   <tr><td>{9956} </td><td> {995e} </td><td> {995h} </td><td> {995f}
   </td><td> {995k} </td><td> {995l}</td></tr>|</table>

   Switch to the OPAC ISBD view for your biblio; notice how it does
   not display item information.
1) Apply the patch, and restart Plack/memcached if necessary.
2) Refresh the OPAC ISBD view page, this time you should see item
   information as per the OPACISBD system preference setting.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28881: (bug 23376 follow-up) Fix suggestion display on order receive page
Jonathan Druart [Thu, 19 Aug 2021 10:34:58 +0000 (12:34 +0200)]
Bug 28881: (bug 23376 follow-up) Fix suggestion display on order receive page

On bug 23376 we replaced $order, from hashref Koha::Acq::Order, but 2
occurrences have not been corrected.

It causes a bug on the order receive page when the bib is linked with a
suggestion.

Test plan:
Create an order from bib A, create a suggestion for purchase on bib A
(OPAC)
Receive the order.
Without the patch: Notice the "Suggested by: (suggestion #)"
With the patch you see the info of the suggester

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoFix release notes for 21.05.03 release v21.05.03
Kyle M Hall [Tue, 24 Aug 2021 14:55:59 +0000 (10:55 -0400)]
Fix release notes for 21.05.03 release

2 years agoUpdate release notes for 21.05.03 release
Kyle M Hall [Tue, 24 Aug 2021 13:50:18 +0000 (09:50 -0400)]
Update release notes for 21.05.03 release

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoIncrement version for 21.05.03 release
Kyle M Hall [Tue, 24 Aug 2021 12:15:56 +0000 (08:15 -0400)]
Increment version for 21.05.03 release

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoFix translations for Koha 21.05.03
Kyle M Hall [Tue, 24 Aug 2021 12:14:03 +0000 (08:14 -0400)]
Fix translations for Koha 21.05.03

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoTranslation updates for Koha 21.05.03
Koha translators [Tue, 24 Aug 2021 11:11:36 +0000 (08:11 -0300)]
Translation updates for Koha 21.05.03

2 years agoBug 28784: (QA follow-up) Remove num_paragraph cookie from include
Marcel de Rooy [Fri, 6 Aug 2021 08:03:27 +0000 (08:03 +0000)]
Bug 28784: (QA follow-up) Remove num_paragraph cookie from include

Still found in opac-bottom.inc.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28784: (follow-up) Always make three search boxes
Nick Clemens [Tue, 3 Aug 2021 12:17:02 +0000 (12:17 +0000)]
Bug 28784: (follow-up) Always make three search boxes

The previous patch removed search_boxes_loop - that's okay, it was always
getting the same three values.

If we don't do something in the template though, we get no boxes

Ultimately this should be a include, and not a hardcoded loop, but keeping changes
small for backporting

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28784: Remove code related to num_paragraph cookie
Jonathan Druart [Tue, 3 Aug 2021 08:58:47 +0000 (10:58 +0200)]
Bug 28784: Remove code related to num_paragraph cookie

It could lead to server freeze if set to a big value (we are pushing
into an array and so RAM is being fulfilled, and CPU is looping).

I don't understand the point of this cookie.

        var numPar = $("#booleansearch fieldset p").size();
        if (numPar > [% search_boxes_count | html %]){
            jQuery.cookie("num_paragraph", numPar,{ path: '/'});
        }else{
            jQuery.removeCookie("num_paragraph", { path: '/'});
        }

But "#booleansearch fieldset p" does not exist, it's not 'p' but 'div'
elements.

I've removed the code related to num_paragraph and the "Return to the
last advanced search" feature still works as before.

From this comment:
    # determine what to display next to the search boxes (ie, boolean option
    # shouldn't appear on the first one, scan indexes should, adding a new
    # box should only appear on the last, etc.

The only bit that is not working as described is "adding a new box
should only appear on the last", but it has been working this way for
a long time already I think, and I don't see it as a bug.

Test plan:
Read the code, check that the above is correct.
Search for regression in this "return to last adv search" feature added
by bug 13307.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28872: DBRev 21.05.02.003
Kyle M Hall [Fri, 20 Aug 2021 18:09:13 +0000 (14:09 -0400)]
Bug 28872: DBRev 21.05.02.003

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28872: Fix QA issues on atomicupdate
Jonathan Druart [Wed, 18 Aug 2021 11:03:09 +0000 (13:03 +0200)]
Bug 28872: Fix QA issues on atomicupdate

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28872: Atomicupdate to correct existing values
Andrew Fuerste-Henry [Tue, 17 Aug 2021 23:57:54 +0000 (23:57 +0000)]
Bug 28872: Atomicupdate to correct existing values

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28872: make AcquisitionLog, NewsLog, NoticesLog use 1/0 for their values
Andrew Fuerste-Henry [Tue, 17 Aug 2021 17:29:02 +0000 (17:29 +0000)]
Bug 28872: make AcquisitionLog, NewsLog, NoticesLog use 1/0 for their values

To test:
1 - edit AcquisitionLog, NewsLog, NoticesLog to change their values
2 - in About Koha, see the errors noted above
3 - apply patch, restart services
4 - re-edit AcquisitionLog, NewsLog, NoticesLog to change their values again
5 - reload About, see errors are cleared
6 - confirm that actions are logged as expected when logs are on, not logged when logs are off

Signed-off-by: Kelly <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28525: Dont let TinyMCE do code cleanup
Lucas Gass [Mon, 7 Jun 2021 22:17:46 +0000 (22:17 +0000)]
Bug 28525: Dont let TinyMCE do code cleanup

If you look at Bug 24764 and Bug 26942 we adjusted the TinyMCE for the News tool so it will not do some types of automatic code clean up.

The TinyMCE editor for system preferences which can be enabled by 'UseWYSIWYGinSystemPreferences' has the same problems.

We should make the configurations the same.

To Test:
1. Turn on 'UseWYSIWYGinSystemPreferences'
2. Go to a system preference like 'RestrictedPageContent'
3. Try entering something like '<i class="fa fa-facebook-official" aria-hidden="true">TEST</i>' in the Source Code window
4. It gets cleaned up by the editor
5. Try something like '<a href="https://www.test.com" referrerpolicy="&quot;no-referrer-when-downgrade">TEST</a>'
6. It's cleaned up by the editor.
7. Try something like '<link href="https://fonts.googleapis.com/css?family=Open+Sans” rel=“stylesheet">'
8. Cleaned up by editor.
9. Apply patch
10. Try step 3, 5, and 7 again.
11. It should not be changed by the editor

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28861: Item type column always hidden in OPAC holds history
Tomas Cohen Arazi [Fri, 13 Aug 2021 20:00:38 +0000 (17:00 -0300)]
Bug 28861: Item type column always hidden in OPAC holds history

This patch fixes the 'Requested item  type' column not showing for holds
history in OPAC.

It was due to a template variable not being set. When solved, it become
clear that an import was missing for a template plugin.

To test:
1. Enable AllowHoldItemTypeSelection
2. Add a couple item-type constrained holds
3. See them in the holds history page
=> SUCCESS: Item type column shows
4. Enable OPACHoldsHistory
5. Look for them in the OPAC
=> FAIL: The item type column doesn't show
6. Apply this patch
7. Repeat 5
=> SUCCESS: The column shows! The item type is described!
8. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28776: Warns from GetItemsInfo when biblio marked as serial
Nick Clemens [Wed, 28 Jul 2021 13:32:24 +0000 (13:32 +0000)]
Bug 28776: Warns from GetItemsInfo when biblio marked as serial

GetItemsInfo sorts the items using serial fields if the biblio is
defined as a serial

The fields may not be defined. We can add a fallback to blank in this case

To test:
1 - Mark a record with items as serial in the marc (942$s)
2 - At least one of the items should have no enumchron defined
3 - Load the detail page
4 - Warns in logs:
    [WARN] Use of uninitialized value in string comparison (cmp) at /kohadevbox/koha/C4/Items.pm line 811.
5 - Apply patch and restart all
6 - Reload the details page
7 - No more warns

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28873: Fix age displayed in db_dependent/Koha/Patrons.t
Fridolin Somers [Tue, 17 Aug 2021 20:19:29 +0000 (10:19 -1000)]
Bug 28873: Fix age displayed in db_dependent/Koha/Patrons.t

In test suite db_dependent/Koha/Patrons.t actually shows :

    1..10
    ok 1 - Patron with no dateofbirth is always valid for any category
    ok 2 - Today=2020-02-28, dob=2015-03-01, is 5, should be valid=0
    ok 3 - Today=2020-02-28, dob=2015-02-27, is 5, should be valid=1
    ok 4 - Today=2020-02-28, dob=2009-02-28, is 11, should be valid=0
    ok 5 - Today=2020-02-28, dob=2015-02-28, is 7, should be valid=1
    ok 6 - Today=2020-02-28, dob=2009-02-27, is 11, should be valid=0
    ok 7 - Today=2020-02-28, dob=2016-08-27, is 3, should be valid=0
    ok 8 - Today=2020-02-28, dob=2009-03-01, is 11, should be valid=1
    ok 9 - Today=2020-02-28, dob=2007-08-27, is 12, should be valid=0
    ok 10 - Today=2020-02-28, dob=2015-02-28, is 5, should be valid=1

Some ages are incorrect :

1) dob=2009-03-01, is 11
=> it is age 10
so valid=1 in category 5 to 10

2) dob=2015-03-01, is 5
=> it is age 4
so valid=0 in category 5 to 10

3) dob=2015-02-28, is 7
=> this date of birth is already tested
I suppose here dob is wrong, age wanted is 7 in the middle of age restrictions.
so dob=2013-02-28

This patch fixes ages.
Also adds the category code 'AGE_5_10' in messages to display age limits

Test plan :
Run prove -v t/db_dependent/Koha/Patrons.t without and with patch

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28802: Fix Asset.t
Jonathan Druart [Wed, 18 Aug 2021 14:25:26 +0000 (16:25 +0200)]
Bug 28802: Fix Asset.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28802: Untranslatable strings in browser.js
Fridolin Somers [Tue, 3 Aug 2021 08:57:10 +0000 (22:57 -1000)]
Bug 28802: Untranslatable strings in browser.js

File koha-tmpl/intranet-tmpl/js/browser.js is not parsed by translation
process, which uses koha-tmpl/intranet-tmpl/prog/js/**/*.js
We must move it to prog/js.

Test plan :
1) Perform a search on staff interface
2) Click on a result
3) Check you see records browser

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28868: Add back mastheadsearch class name
Lucas Gass [Mon, 16 Aug 2021 21:23:47 +0000 (21:23 +0000)]
Bug 28868: Add back mastheadsearch class name

In masthead.inc there is a wrapper for the main search bar called #opac-main-search. Prior to Bug 20168 that warpper had a class name of 'mastheadsearch'.

Historically CSS/JS customization of the main search bar was done via the mastheadsearch class.

Test plan:
1. Inscept the element on the OPAC main page and see the element with an ID of 'opac-main-search'.
2. Apply patch
3. Inscept that same element and you should now also see a class of 'mastheadsearch'.
4. Nothing visually should be different with the patch applied.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 26852: subfield $e missing in X11 definition of MARC21 headings
Janusz Kaczmarek [Sun, 21 Dec 2014 08:31:47 +0000 (09:31 +0100)]
Bug 26852: subfield $e missing in X11 definition of MARC21 headings

This patch adds $e to 111 and 611, but removes it from 100 and 110 as it's
used for the relator term there and should not be copied. Same for 111$j.

Test plan:

1. Have a biblio record with, for example, 711 field with a $e subfield.
2. Have two auth records: one with 111 field reflecting the 711 field and second similar but without $e subfield
3. Have LinkerModule set to Default
4. Run link_bibs_to_authorities.pl
5. 711 should remain unlinked since there were two record found by the Default Linker and no one was chosen.

6. Apply the patch.
7. Run link_bibs_to_authorities.pl
8. 711 should be linked now.

Repeat testing in similar fashion for authorities:

9. 100/110 $e
10. 111 $j

NB zebra index definition is OK:
kohaidx:index_match_heading tag="111" subfields="acdefghjklnpqstvxyz" subdivisions="vxyz">
in etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml

Signed-off-by: Sara Brown <sbrown@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28834: Correct wording biblios/authorities in tools home
Fridolin Somers [Mon, 9 Aug 2021 20:07:53 +0000 (10:07 -1000)]
Bug 28834: Correct wording biblios/authorities in tools home

In tools home, we actually see 2 wordings : biblios/bibliographic authorities/authority
Looks like bibliographic is more correct.

Test plan :
1) Apply patch and look at words in tools home /cgi-bin/koha/tools/tools-home.pl

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28779: (QA follow-up) Even more specific message
Katrin Fischer [Tue, 10 Aug 2021 13:21:18 +0000 (15:21 +0200)]
Bug 28779: (QA follow-up) Even more specific message

For the detail page, the MARC view etc. we use the text:

The record you requested does not exist (488).

I think this is better than "not found", because that sounds
like it might be an issue with the search index, which we can
rule out in this case.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28779: (QA follow-up) More specific message and soem cleanup
Nick Clemens [Fri, 30 Jul 2021 14:39:39 +0000 (14:39 +0000)]
Bug 28779: (QA follow-up) More specific message and soem cleanup

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28779: Skip processing of non-existent biblios
Joonas Kylmälä [Thu, 29 Jul 2021 16:35:47 +0000 (19:35 +0300)]
Bug 28779: Skip processing of non-existent biblios

Just checking with a regex that whether an input looks like a biblionumber
is not enough, we need to also verify there is a biblio really existing
in the database and skip processing of hold request for non-existent
biblionumbers.

To test:
 1) Go to page /cgi-bin/koha/reserve/request.pl?biblionumbers=XXXXX
    where XXXXX is non-existent biblionumber, notice internal server error
 2) Apply patch
 3) Repeat step 1 and notice we cannot place a hold

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28825: Can't edit local cover image for item from details page
Owen Leonard [Fri, 6 Aug 2021 16:49:50 +0000 (16:49 +0000)]
Bug 28825: Can't edit local cover image for item from details page

This patch corrects the markup for local cover images attached to items.
The correction allows correct display of an "edit" link when the user
clicks an item's cover image and views it in the lightbox-style modal.

To test, apply the patch and make sure the "LocalCoverImages" system
preference is enabled.

- View the details of a bibliographic record in the catalog which has
  items attached..
- In the table of holdings, click Edit -> Upload image.
- Upload an image for the item and return to the bibliographic detail
  page.
- Your image should now be displayed in the holdings table.
- Click the image to view it.
- In the footer of the modal there is an edit link: "Local cover image
  (edit). Before this patch the edit link would lead to a missing page.
  After applying the patch the link should take you to the "Image view"
  where you have the option of deleting the image or uploading another
  one.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 27847: Compiled CSS changes
Kyle M Hall [Fri, 13 Aug 2021 11:57:25 +0000 (07:57 -0400)]
Bug 27847: Compiled CSS changes

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 27847: Don't obscure page when checkin modal is non-blocking
Owen Leonard [Mon, 19 Apr 2021 11:49:25 +0000 (11:49 +0000)]
Bug 27847: Don't obscure page when checkin modal is non-blocking

This patch changes the series of events striggered when a non-blocking
modal dialog is displayed during checkin. If the "TransfersBlockCirc"
preference is set to "Don't block," the user can continue to check in
even though a transfer dialog has appeared. This patch hides the modal's
"backdrop" element so that the modal doesn't look like one which blocks
further action.

There is no Bootstrap backdrop option which both hides the backdrop and
makes it non-blocking, so we have to use the default non-blocking option
and "manually" hide the backdrop.

The "show.bs.modal" event must be added in order to make the
necessary change before the modal is displayed. This prevents the
darkened backdrop from appearing and then being hidden.

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).

- Set the "TransfersBlockCirc" preference to "Don't block."
- Check in an item which belongs to another library.
- A modal dialog should be displayed: "Please return this item to XXX"
- The page "behind" the modal should not be darkened, and the cursor
  focus should remain in the check-in field.
- Checking in an item which as a hold should still trigger the
  "blocking" behavior: The modal must be dismissed by clicking one of
  its buttons (not the backdrop) and the page behind the modal should be
  darkend.
- Test with "TransfersBlockCirc" set to "Block." Checking in an item
  belonging to another library should trigger the "blocking" modal
  behavior.
- Test that other checkins still work correctly.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28764: (QA follow-up) Add comment, remove two defined's
Marcel de Rooy [Mon, 9 Aug 2021 13:41:45 +0000 (13:41 +0000)]
Bug 28764: (QA follow-up) Add comment, remove two defined's

If we no longer offer the sortfield with :asc actively, we should
probably write it somewhere too.
Replaced a few defined tests by empty test. No need to split empty
string or zero etc.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28764: Alter sort dropdown to use direction parameter
Nick Clemens [Fri, 30 Jul 2021 10:54:47 +0000 (10:54 +0000)]
Bug 28764: Alter sort dropdown to use direction parameter

This code is odd -we build a select in the template, then turn it into a list of links using javascript
This patch adds a direction data element and uses it while building the links

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28764: Parse direction parameter in public list view
Nick Clemens [Tue, 27 Jul 2021 11:27:21 +0000 (11:27 +0000)]
Bug 28764: Parse direction parameter in public list view

This patch adds a check for a 'direction' paramter in list sorting.

It maintains the existing syntax for sorting 'sortfield=field:direction'
but adds support for the form used in paginations and more commonly thtoughout
Koha' sortfield=field&direction=direction'

To test:
1 - Create a public list
2 - Add enough items to generate two pages (40 worked for me)
3 - View the list and enforce sorting by date added descending:
    sortfield=dateadded:desc
4 - Note the titles shown
5 - Click to second page using the pagination bar
6 - Note the same titles are shown, in a reversed order
7 - Apply patch
8 - repeat 305
9 - Second page is sorted correctly!

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>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28813: DBRev 21.05.02.002
Kyle M Hall [Fri, 13 Aug 2021 11:44:34 +0000 (07:44 -0400)]
Bug 28813: DBRev 21.05.02.002

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28813: Rename delivery_note to failure_code
Martin Renvoize [Thu, 5 Aug 2021 09:17:29 +0000 (10:17 +0100)]
Bug 28813: Rename delivery_note to failure_code

We now use the codes from the half implimented error_code in place of
the plain text that was being added to the delivery_note field. As part
of that we rename the field to failure_code to clarify it's intended
content.

Test plan
1/ Confirm t/db_dependent/Letters.t passes

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28813: Update unit tests
Martin Renvoize [Thu, 5 Aug 2021 09:16:24 +0000 (10:16 +0100)]
Bug 28813: Update unit tests

This patch updates the unit tests to check for failure_code instead of
delivery_note and catches a missing case.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28813: DBIC Schema Update
Martin Renvoize [Thu, 5 Aug 2021 09:15:58 +0000 (10:15 +0100)]
Bug 28813: DBIC Schema Update

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28813: Update database field name
Martin Renvoize [Thu, 5 Aug 2021 09:14:49 +0000 (10:14 +0100)]
Bug 28813: Update database field name

Update the database field name from 'delivery_note' to 'failure_code' to
more accurately denote it's use.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28835: Fix ability to pass list contents to batch record modification
Fridolin Somers [Tue, 10 Aug 2021 09:14:03 +0000 (23:14 -1000)]
Bug 28835: Fix ability to pass list contents to batch record modification

Bug 12759 added the ability to pass list contents to batch record
modification/deletion tools.
Patch Bug 22417 [Restore the 'add to list' feature] removed the fetch
of lists in batch_record_modification.pl I don't understand why.
It still exists in batch_delete_records.pl.

Note that this is needed when first form is displayed.

Test plan :
1) Create a private and a public list of records
2) Open Tools > Batch record modification
3) Check you can use the lists
4) Open Tools > Batch record deletion
5) Check you can use the lists

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28828: Fix unimarc_field_4XX.tt and marc21_linking_section.tt value builders
Nick Clemens [Mon, 9 Aug 2021 12:09:13 +0000 (12:09 +0000)]
Bug 28828: Fix unimarc_field_4XX.tt and marc21_linking_section.tt value builders

Find closest ul for value builders.

Since Bug 22399 changes in biblio editor, value builder unimarc_field_4XX.tt JavaScript
code does not do its job anymore.
This is because a div is added and this call is now wrong:
  var subfields = whichfield.parentNode.parentNode.getElementsByTagName('input');

Test plan 1:
1) Use a UNIMARC DB
2) Define value builder unimarc_field_4XX on 463$t
3) Create a record B1 with 200$a, 200$f
4) Create a new record B2
5) Click on value builder in 463$t
6) Search for record B1
7) Click on "Choose"
=> Without patch only 463$t is filled with a value
=> With patch 463 $t, $a, $0 and $9 are filled with a value

Test plan 2:
1) Use a MARC_21 DB
2) Define plugin marc21_linking_section.pl on 773$t
3) Make sure 773$t and other subfields are visible in intranet/editor
4) Create a new record in basic cataloging editor
5) Click on value builder in 773$t
6) Search fro a record
7) Click on "Choose"
=> Without patch fields are not fileld
=> With patch subfields are correctly filled

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28569: In opac-suggestions.pl preselect user library
Fridolin Somers [Wed, 16 Jun 2021 09:17:19 +0000 (11:17 +0200)]
Bug 28569: In opac-suggestions.pl preselect user library

In OPAC new purchase suggestion opac-suggestions.pl for library combobox :
actually first value is selected, user library should be selected.

Test plan :
1) Create a new library named 'ZZZ top'
2) Set this library on a user U1
2) Loggin at OPAC with user U1
3) Create a new suggestion
=> Check library 'ZZZ top' is preselected

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28727: (QA follow-up) Simplify permission check
Katrin Fischer [Tue, 10 Aug 2021 23:04:49 +0000 (01:04 +0200)]
Bug 28727: (QA follow-up) Simplify permission check

There was another permission check for edit_items directly below,
so instead of changing them to both be edit_items, I think we
can now remove one.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28727: Show edit item link when user has edit items permission
Andrew Fuerste-Henry [Tue, 20 Jul 2021 19:42:41 +0000 (19:42 +0000)]
Bug 28727: Show edit item link when user has edit items permission

To test:
1: log in as a user with edit_items but not edit_catalogue
2: confirm you do not get an Edit Item link on moredetail.pl
3: apply patch, restart, reload
4: confirm link now shows

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28804: (bug 25026 follow-up) Handle SQL errors in reports
Jonathan Druart [Wed, 4 Aug 2021 06:59:40 +0000 (08:59 +0200)]
Bug 28804: (bug 25026 follow-up) Handle SQL errors in reports

Since bug 25026 DBMS errors are raised, but the report module is not
dealing correctly with the errors.
If an error occurred in execute_query, next queries will fail as well,
we should skip them.

Test plan:
1. Create report from SQL queries, containing errors (invalid syntax, etc.)
'SELECT id FROM borrowers' can do it
2. Execute the query
=> Without this patch you get a 500
=> With this patch applied you see that the error raised at DBMS level
is propagated to the UI
3. Confirm that there is no regression on valid queries

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoRevert "Bug 28833: Speed up holds queue builder via parallel processing"
Kyle M Hall [Wed, 11 Aug 2021 13:21:11 +0000 (09:21 -0400)]
Revert "Bug 28833: Speed up holds queue builder via parallel processing"

This reverts commit 08ad241ab510350d44673376c28d853a328a4ec5.

2 years agoBug 28833: Speed up holds queue builder via parallel processing
Kyle M Hall [Mon, 9 Aug 2021 17:46:00 +0000 (13:46 -0400)]
Bug 28833: Speed up holds queue builder via parallel processing

The holds queue builder can take a very long time to run on systems with many holds. For example, a partner with 124,784 unfilled ( not found ) holds, is taking about 64 minutes to run. If we run that same number of holds in 5 parallel chunks ( splitting the number of records as evenly as possible, but *not* taking into account the holds per bib ), it takes 21.5 minutes. If we use 10 loops, it takes less then 14 minutes.

Test Plan:
1) Generate a huge number of holds ( a few thousand at the minimum )
2) Run the holds queue builder, use the `time` utility to track how much
   time it took to run
3) Set HoldsQueueParallelLoopsCount to 10
4) Repeat step 2, note the improvement in speed
5) Experiment with other values for HoldsQueueParallelLoopsCount
6) prove t/db_dependent/HoldsQueue.t

2 years agoBug 28630: Improve date comparisons in tests
Jonathan Druart [Wed, 4 Aug 2021 09:12:41 +0000 (11:12 +0200)]
Bug 28630: Improve date comparisons in tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28630: (follow-up) Update wording of syspref
Martin Renvoize [Mon, 28 Jun 2021 13:42:13 +0000 (14:42 +0100)]
Bug 28630: (follow-up) Update wording of syspref

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28630: Add unit tests
Martin Renvoize [Fri, 25 Jun 2021 09:33:18 +0000 (10:33 +0100)]
Bug 28630: Add unit tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28630: Add track_login_daily to ILSDI::AuthenticatePatron
Martin Renvoize [Fri, 25 Jun 2021 08:50:50 +0000 (09:50 +0100)]
Bug 28630: Add track_login_daily to ILSDI::AuthenticatePatron

This patch adds a call to track_login_daily for the AuthenticatePatron
method in ILSDI.

Many libraries use this ILSDI endpoint for electron book borrowing and
need to maintain the lastseen based on this type of lending.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28773: (QA follow-up) Additional changes
Marcel de Rooy [Fri, 30 Jul 2021 08:51:24 +0000 (08:51 +0000)]
Bug 28773: (QA follow-up) Additional changes

The work of the first patch was not yet finished.

[1] Similar changes to template for Cataloging and Authorities
[2] Made a better distinction now between short title on button
    and long title on menu and modal
[3] The short title parameter removes need for previewed var
[4] To keep related code closer, moved the dataPreview hidden code

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28773: (bug 23302 follow-up) Fix add order from z3950 search results
Jonathan Druart [Wed, 28 Jul 2021 10:04:43 +0000 (12:04 +0200)]
Bug 28773: (bug 23302 follow-up) Fix add order from z3950 search results

For translated interface.

Using 'Order' (the button text) was not a good idea as the interface can
be translated :)

Signed-off-by: Mark Hofstetter <koha@trust-box.at>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28754: Only adjust holds on specific biblio and don't go past end of array
Nick Clemens [Fri, 23 Jul 2021 17:56:39 +0000 (17:56 +0000)]
Bug 28754: Only adjust holds on specific biblio and don't go past end of array

Our query for lowest priority holds only needs to adjust holds on the biblio we are looking at
so I add biblionumber

Additionally we can simply find the end of the array and use that rather than 99998
so I set new_rank to scalar @priority

Lastly, we don't need to fetch the lowest priority holds if we are ignoring lowest priority
so I move it into the conditional

To test:
 1 - Add holds with lowest priorty to 2 records in the catalog
 2 - Add a hold on a third record
 3 - Note errors in log like:
    [2021/07/23 17:47:17] [WARN] splice() offset past end of array at /kohadevbox/koha/C4/Reserves.pm line 1649
 4 - Apply patch and restart all the things
 5 - Add a new hold on third record - no warns
 6 - Make one of the holds on third record have lowestPriority (click rightmost arrow with line at bottom)
 7 - Note no warns
 8 - Adjust other holds on record and note no warns

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28741: (follow-up) Silence warning
Tomas Cohen Arazi [Mon, 2 Aug 2021 13:04:01 +0000 (10:04 -0300)]
Bug 28741: (follow-up) Silence warning

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28741: Fix use of resumption token params
Nick Clemens [Thu, 22 Jul 2021 17:56:39 +0000 (17:56 +0000)]
Bug 28741: Fix use of resumption token params

TO test:
 1 - Enable OAI-PMH server in Koha
 2 - Set OAI-PMH:MaxCount to 5
 3 - Define 6 sets in Admin->OAI sets configuration
    Can setSpec and setName to 1,2,3....
 4 - Browse to:
    http://localhost:8080/cgi-bin/koha/oai.pl?verb=ListSets
 5 - Click 'Show more'
 6 - Keep seeing the same 5 - note the page says 'Results fetched -4-0'
 7 - Apply patch
 8 - Restart all the things
 9 - Reload the ListSets URL above
10 - Click 'Show more'
11 - See the 6th set and note no 'Show more'
12 - Set OAI-PMH:MaxCount to 1
13 - Go to the base ListSets url again
14 - Confirm you can 'Show more' until you reach the end

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2 years agoBug 28741: Regression tests
Tomas Cohen Arazi [Fri, 30 Jul 2021 17:53:31 +0000 (14:53 -0300)]
Bug 28741: Regression tests

This patch adds regression tests for the behavior.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>