]> git.koha-community.org Git - koha.git/log
koha.git
4 years agoBug 4461: Simplify recipients code
Jonathan Druart [Wed, 26 Feb 2020 10:59:34 +0000 (11:59 +0100)]
Bug 4461: Simplify recipients code

As the feature is now turned off without KohaAdminEmailAddress, we only
need to check if the email address of the library if defined.
Not that we should not check for $library->branchreplyto or
ReplytoDefault, but only $library->branchemail, as we do everywhere else
(I think)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 4461: Redirect to 404 if KohaAdminEmailAddress is not defined
Jonathan Druart [Wed, 26 Feb 2020 10:41:39 +0000 (11:41 +0100)]
Bug 4461: Redirect to 404 if KohaAdminEmailAddress is not defined

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 4461: Use our local_referer instead of HTTP_REFERER
Jonathan Druart [Wed, 26 Feb 2020 10:28:30 +0000 (11:28 +0100)]
Bug 4461: Use our local_referer instead of HTTP_REFERER

Cannot remember why exactly, but it seems that we should not use
HTTP_REFERER directly.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 4461: Use KohaAdminEmailAddress pref as 'from'
Jonathan Druart [Wed, 26 Feb 2020 10:08:51 +0000 (11:08 +0100)]
Bug 4461: Use KohaAdminEmailAddress pref as 'from'

We usually do not specify the from_address on enqueuing the notice, but
when sending it (from _send_message_by_email). That way a) the code is
centralized (as we must use $patron->notice_email_address) and b) the
email used is the one that is in the DB when the letter is effectively
sent.
Here I guess you need to give it when the notice is enqueued as you want
to default to the koha admin address.

I do not think it's a good idea, we should not send an email with "from"
if not really sent by the user.
We have the borrowernumber anyway to know who filled the form.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 4461: Rename report date with created_on
Jonathan Druart [Wed, 26 Feb 2020 09:58:38 +0000 (10:58 +0100)]
Bug 4461: Rename report date with created_on

And make it a timestamp type column

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 4461: (follow-up) Creating sample notice and other fixes
Aleisha Amohia [Tue, 25 Feb 2020 04:04:43 +0000 (04:04 +0000)]
Bug 4461: (follow-up) Creating sample notice and other fixes

- filters
- capitalisation
- atomic update

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 4461: (follow-up) Redirect to 404 if OPACProblemReport not enabled
Aleisha Amohia [Tue, 11 Feb 2020 19:48:30 +0000 (19:48 +0000)]
Bug 4461: (follow-up) Redirect to 404 if OPACProblemReport not enabled

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 4461: Submit a problem report
Aleisha Amohia [Tue, 11 Feb 2020 03:16:11 +0000 (03:16 +0000)]
Bug 4461: Submit a problem report

To test:
1) Apply patch, update database, rebuild schema file
2) Restart koha-common and memcached
3) Confirm that your user has an email address.
4) Confirm that your library does NOT have an email address.
5) Confirm that syspref KohaAdminEmailAddress and syspref ReplytoDefault are not filled. Enable the OPACReportProblem syspref.
6) Log into OPAC
7) Click the 'Report a problem' link at the bottom of whatever page
you're on
8) Notice that there is no form is and there is an error message alerting that reports cannot be submitted
9) Add an email address for your library (in either the email field or the replyto field). Refresh the OPAC problem report page. The form should now show, and the recipient field should say 'library'.
10) Complete the form and submit. Check the message_queue in the database and confirm the to_address is correct. Confirm there is a success message.
11) Add an email address for the syspref KohaAdminEmailAddress and refresh the OPAC problem report page again. The recipient field should now be a dropdown. Select the Koha Administrator option.
12) Complete the form and submit. Check the message_queue in the database and confirm the to_address is the value in KohaAdminEmailAddress. Confirm there is a success message.
13) Ensure all details in the message_queue are correct.
14) Log out of the OPAC
15) Click the Report a problem link again and confirm you are forced to log in

Sponsored-by: Catalyst IT
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 4461: Problem Report Koha objects
Aleisha Amohia [Tue, 11 Feb 2020 00:00:11 +0000 (00:00 +0000)]
Bug 4461: Problem Report Koha objects

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 4461: Database and syspref changes
Aleisha Amohia [Mon, 10 Feb 2020 00:50:51 +0000 (00:50 +0000)]
Bug 4461: Database and syspref changes

Adding problem_reports table and OPACReportProblem syspref

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23173: DBRev 19.12.00.065
Martin Renvoize [Mon, 6 Apr 2020 10:11:12 +0000 (11:11 +0100)]
Bug 23173: DBRev 19.12.00.065

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23173: (follow-up) Fix QA script errors
Kyle M Hall [Wed, 1 Apr 2020 19:13:06 +0000 (15:13 -0400)]
Bug 23173: (follow-up) Fix QA script errors

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23173: (follow-up) Small improvements in efficiency
Kyle M Hall [Wed, 1 Apr 2020 19:09:48 +0000 (15:09 -0400)]
Bug 23173: (follow-up) Small improvements in efficiency

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23173: (follow-up) Display available partners
Andrew Isherwood [Mon, 16 Mar 2020 12:06:03 +0000 (12:06 +0000)]
Bug 23173: (follow-up) Display available partners

When selecting partners for search during the "Place request with
partner libraries" workflow, there was no indication of which partners
could actually be searched (i.e. are attached to a Z target and enabled
for partner search). We now list them

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@tudublin.ie>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23173: (follow-up) Allow for customisable display name
Andrew Isherwood [Mon, 17 Feb 2020 12:29:19 +0000 (12:29 +0000)]
Bug 23173: (follow-up) Allow for customisable display name

We now allow for the service to return a name that can be specified in
the plugin config. This patch switches to using that, rather than just
the plugin name defined in the plugin's metadata hashref

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@tudublin.ie>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23173: (follow-up) Allow for wide characters
Andrew Isherwood [Thu, 6 Feb 2020 11:08:41 +0000 (11:08 +0000)]
Bug 23173: (follow-up) Allow for wide characters

The conversion of the metadata into Base64 for passing in the API call
to the plugin API routes was failing if the metadata contained a wide
character, so we now encode it into UTF-8 first

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@tudublin.ie>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23173: Add unit tests
Andrew Isherwood [Tue, 10 Sep 2019 15:32:49 +0000 (16:32 +0100)]
Bug 23173: Add unit tests

Test Koha::Illrequests::Availability

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@tudublin.ie>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23173: Provide core infrastructure
Andrew Isherwood [Thu, 11 Jul 2019 13:15:55 +0000 (14:15 +0100)]
Bug 23173: Provide core infrastructure

This patch adds the required infrastructure to enable ILL availability
plugins to intercept the request creation process and, using the
supplied metadata, search for and display possible relevant items from
whichever availability plugins are installed.

Currently three availability plugins exist:

z39.50 - Searches any number of the Koha instance's configured Z targets
https://github.com/PTFS-Europe/koha-plugin-ill-avail-z3950

EDS - Searches the EBSCO Discovery Service
https://github.com/PTFS-Europe/koha-plugin-ill-avail-eds

Unpaywall - Searches the Unpaywall API for possible open access versions
of the requested item
https://github.com/PTFS-Europe/koha-plugin-ill-avail-unpaywall

The Unpaywall plugin is intended to serve as a "reference" plugin as the
API it deals with is extremely simple

Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@tudublin.ie>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23173: Add ILLCheckAvailability syspref
Andrew Isherwood [Fri, 21 Jun 2019 09:17:03 +0000 (10:17 +0100)]
Bug 23173: Add ILLCheckAvailability syspref

This patch adds the new syspref "ILLCheckAvailability"

Sponsored-by: Public Health England
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@tudublin.ie>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18227: (QA follow-up) Add fix to koha-common.postinst
Tomas Cohen Arazi [Wed, 1 Apr 2020 03:11:19 +0000 (00:11 -0300)]
Bug 18227: (QA follow-up) Add fix to koha-common.postinst

Now koha-common.postinst has a way to patch log4perl configs on
instances, we should patch the Z3950 responder config accordingly,
before it is backported to 19.11 or the 20.05 release :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18227: Handle utf8 in Koha::Logger
Olli-Antti Kivilahti [Wed, 8 Mar 2017 10:51:43 +0000 (12:51 +0200)]
Bug 18227: Handle utf8 in Koha::Logger

No more wide characters in print when logging to a file with Koha::Logger.

Test with this string

"♯Turpo :"

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24537: Tidy code
Kyle M Hall [Wed, 1 Apr 2020 10:19:24 +0000 (06:19 -0400)]
Bug 24537: Tidy code

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24537: Allow IP ranges in ILS-DI:AuthorizedIPs using Net::Netmask
David Cook [Thu, 30 Jan 2020 03:53:09 +0000 (14:53 +1100)]
Bug 24537: Allow IP ranges in ILS-DI:AuthorizedIPs using Net::Netmask

This patch uses Net::Netmask to match IPs from ILS-DI:AuthorizedIPs
against $ENV{REMOTE_USER}. By using Net::Netmask, we can use addresses
in a variety of formats. This includes 127.0.0.1, 192.168.1.0/24,
10.0.0, and so on.

To Test:
1. Apply the patch
2. Empty the 'ILS-DI:AuthorizedIPs' system preference
3. Send a request to '/cgi-bin/koha/ilsdi.pl?service=LookupPatron&id=1&id_type=cardnumber'
3b. Note that the request is successful
4. Set the 'ILS-DI:AuthorizedIPs' system preference to a subnet including
your IP address (e.g. 192.168.1.0/24)
5. Send a request to '/cgi-bin/koha/ilsdi.pl?service=LookupPatron&id=1&id_type=cardnumber'
5b. Note that the request is successful
6. Set the 'ILS-DI:AuthorizedIPs' system preference to a subnet that doesn't include
your IP address (e.g. 1.1.1)
7. Send a request to '/cgi-bin/koha/ilsdi.pl?service=LookupPatron&id=1&id_type=cardnumber'
7b. Note that your request is refused
8. Try a variety of permutations including bad values (e.g. 192.168.1.) or multiple values
(e.g. 10.0.0.0/8,192.168.1.0/24) or multiple values including a mix of good and bad values

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23601: Prevent default for auxclick
Nick Clemens [Mon, 30 Mar 2020 15:16:36 +0000 (15:16 +0000)]
Bug 23601: Prevent default for auxclick

The issue appears to be that the default action is not prevented for middle click because it registers
an 'auxclick' event as opposed to a 'click' event

To test:
1 - Perform a search in staff client
2 - Shift-click and hold on a result
3 - Note a new tab opens
4 - Release the click, no change
5 - Middle click and hold on a result
6 - New tab opens
7 - Release, a second new tab opens
8 - Apply patch
9 - Reload page
10 - Middle click and hold
11 - New tab opens
12 - Release
13 - No new tab

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24964: Restore pagination for patrons for owner/users of funds
Jonathan Druart [Mon, 6 Apr 2020 09:44:18 +0000 (11:44 +0200)]
Bug 24964: Restore pagination for patrons for owner/users of funds

admin/add_user_search.pl sets 'patrons_with_acq_perm_only', to only
retrieve patrons with acq (order_manage) permissions.

The original bug was hidden in the existing code, but the behavior was
terrible.
To prevent patrons matching the permissions contrainst to be hidden, we
fetched ALL the patrons from the DB, then filtered them depending on
their permissions. This might have awful performance on DB with lot of
patrons.

So basically with this patch we are adding the pagination back to the
"owner/users for funds" feature, as the permission filtering is now done
at DB level.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 4944: DBRev 19.12.00.064
Martin Renvoize [Mon, 6 Apr 2020 09:56:04 +0000 (10:56 +0100)]
Bug 4944: DBRev 19.12.00.064

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 4944: Do not rely on the values from cache during the update DB process
Jonathan Druart [Tue, 31 Mar 2020 12:45:14 +0000 (14:45 +0200)]
Bug 4944: Do not rely on the values from cache during the update DB process

We never know, as we insert values direcly to the DB, the cache may not
be correct.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 4944: Add OpacNoItemTypeImages system preference
Katrin Fischer [Fri, 27 Mar 2020 06:00:29 +0000 (06:00 +0000)]
Bug 4944: Add OpacNoItemTypeImages system preference

At the moment noItemTypeImages pref controls staff and OPAC
display. With this patch, there will be a separate OpacNoItemTypes
preference that allows to control display of each separately.

To test:
- Apply patch and run database update
In Administration:
- Search for 'noItemTypes' preferences
- Verify the settings of both prefs match
- Toggle prefs, verify everything works ok
- Go to the item types configuration page
- Try different settings for both prefs:
  - Both set to No: Only a message with a link to the prefs should show
  - Both set to Yes or either set to Yes: image configuration options
    should show
In the OPAC:
- Check the following pages with item-level_itypes = record
  - advanced search
  - detail page
  - place hold page
- Check the following pages with item-level_itypes = item
  - result list
  - a list (opac-shelves)
  - checkouts and overdues tabs in patron account
    (Note: this didn't work right before, but will now.)
  - reading history in patron account

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22534: DBRev 19.12.00.063
Martin Renvoize [Mon, 6 Apr 2020 09:48:09 +0000 (10:48 +0100)]
Bug 22534: DBRev 19.12.00.063

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22534: Added syspref for defining what guarantee fields are pre filled
Alex Buckley [Mon, 23 Mar 2020 04:14:39 +0000 (04:14 +0000)]
Bug 22534: Added syspref for defining what guarantee fields are pre filled

Librarians should be able to define what sections in member entryfields in 'Main address',
'Contact' and 'Alternate contact' in member entry form for guarantee's are pre-filled from guarantor's record

The 'Guarantor surname, 'Guarantor first name' and 'relationship' fields
in the 'Contact' section should not be filled from guarantor patron
record as those fields are intended for guarantor's without patron
records in Koha.

Test plan:
1. On an adult patron's record (which has all fields filled out in the
'Main address', 'Contact' (Except for 'Guarantor surname', 'Guarantor
first name', and 'relationship'), 'Alternate address', and 'Alternate contact') select 'Add guarantee'

2. Observe:

* Fields in 'Main address' are all automatically pre-filled
from guarantor record

* Fields in 'Contact' (except 'Guarantor surname', 'Guarantor firstname'
and 'relationship') are all automatically pre-filled from guarantor
record

* Fields in 'Alternate address' (except for Contact note) are pre-filled from guarantor record

* None of the fields in 'Alternate contact' are pre-filled from guarantor

4. Apply patch

5. Run database updates
cd installer/data/mysql
sudo koha-shell <instancename>
./updatedatabase.pl

6. Restart plack:
sudo koha-plack --restart <instancename>

7. Go to Administration > Global system preferences and search for the
new PrefillGuaranteeField system preference

8. Observe this syspref contains checkboxes and the following are
selected by default:
Contact - Primary email
Contact - Primary phone
Main address - Address
Main address - City
Main address - Country
Main address - State
Main address - ZIP/Postal code
Main address - street number

Please note: 'Contact - Guarantor surname', 'Contact - Guarantor first
name', Contact - relationship' are not in PrefillGuaranteeField syspref
as they are for non Koha patrons and so should not be pre-filled from a Koha
patron.

9. Repeat step 1 and observe the following fields are prefilled from guarantor:
In Main address section -
streetnumber
address
city
state
zipcode/postal code
country

In Contact section -
Primary phone
Primary email

10. In the PrefillGuaranteeField syspref click '[Select all]' checkboxes

11. Repeat step 1 and observe all fields in 'Main address', 'Contact'
(except Guarantor surname, Guarantor first name, and relationship),
Alternate address and Alterate contact are filled from guarantor record.

i.e. The values in guarantor's 'Alternate address' fields fill the
guarantee's 'Alternate address' fields

12. Change a few of the prefilled field values and 'Save' and observe your changes
have been saved in addition to the unaltered pre-filled values in other
fields

13. Amend PrefillGuarantee field syspref to have no checkboxes selected

14. Repeat step 1 and observe none of the fields in Main address,
Contact, Alternate address and Alternate contact are pre-filled

15. Run tests:
sudo koha-shell <instancename>
prove xt
prove t

Sponsored-by: Waitaki Distict Council, NZ
Signed-off-by: Sally <sally.healey@cheshiresharedservices.go.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24183: Add before_send_messages hook
Martin Renvoize [Thu, 5 Dec 2019 17:42:50 +0000 (17:42 +0000)]
Bug 24183: Add before_send_messages hook

This patch adds a simple hook to the process_message_queue cronjob
to allow plugins to pre-process messages in the messaging queue before
they are sent.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24699: Split items.uri in OPAC detail view
Marcel de Rooy [Thu, 20 Feb 2020 14:43:43 +0000 (14:43 +0000)]
Bug 24699: Split items.uri in OPAC detail view

Same change as in bug 24697 for staff. If there are more URIs in 952u,
we split them and show the real URL instead of Link to resource or the
value of pref URLLinkText.

I introduced a few template variables here to make the code a bit more
compact and readable.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 16547: Do not display "multi holds" view if only one is selected
Jonathan Druart [Mon, 13 Jan 2020 09:48:11 +0000 (10:48 +0100)]
Bug 16547: Do not display "multi holds" view if only one is selected

If a hold is selected from the result list, we should let the ability to
select an item-level hold.

Test plan:
I. Detail page
1/ Go to a bibliographic record detail page
2/ Click "Place hold"
3/ Select a patron
=> No change expected, you can select an item

II. Search result, multiple holds
1/ Search for an item with more than one search result
2/ Select several items, click 'Place hold'
3/ Enter a patron card number
=> No change expected, item level holds are not available.

III. Search result, single hold
1/ Search for an item with more than one search result
2/ Select only one item, click 'Place hold'
3/ Enter a patron card number
=> With this patch applied, item level hold is available. The screen is the same
as when you place a hold from the bibliographic record detail page
=> Without this patch you cannot place an item-level hold

QA notes: We could go a bit further and remove the 2 biblionumbers and
biblionumber from hold script, as well as remove the checkMultiHold in
request.tt. We should not have a biblionumbers param that contain a list
of biblionumber separated by '/' but several biblionumber parameters
instead.

QA notes 2: About placerequest.pl, see bug 19618 comment 27.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24492: (RM follow-up) Varaible name corretion
Martin Renvoize [Mon, 6 Apr 2020 09:36:35 +0000 (10:36 +0100)]
Bug 24492: (RM follow-up) Varaible name corretion

Bug 24492 was not correctly rebased after bug 23355 and did not account
for a variable name change in the 'add_cashup' action. This patch deals
with that.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 25020: Preserve time part when batch extending due dates
Jonathan Druart [Mon, 30 Mar 2020 14:11:51 +0000 (16:11 +0200)]
Bug 25020: Preserve time part when batch extending due dates

When selecting a new hard due date, we should keep the time part of the
original checkouts.

Test plan:
1 - Checkout an item specifying a date due
2 - Checkout an item without specifying a date due
3 - Use Tools->Batch extend due date
4 - Select a hard due date
5 - On the confirmation screen you should see that the time part has
been kept
6 - Confirm
7 - Make sure the correct values hava been inserted in DB
8 - Try now using the other option, give a number of days
9 - Repeat 4-7

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 25022: Display problem in authority editor with repeatable field
Owen Leonard [Tue, 31 Mar 2020 14:20:23 +0000 (14:20 +0000)]
Bug 25022: Display problem in authority editor with repeatable field

This patch corrects an error in the structure of the authority editor
template so that repeating subfields do not generate invalid markup. The
correction was found by comparing with addbiblio.tt.

If you are viewing the diff, please note that some minor whitespace
changes have been made.

To reproduce, clone and and populate any repeatable subfield, save, and
open the authority for editing again. The clones subfield will be
formatting incorrectly, showing bullet points on each line.

To test, apply the patch and reload the authority editor showing the
record with the cloned subfield. It should display correctly.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 25004: Search results place hold button not enabled when checking result checkbox...
Owen Leonard [Tue, 31 Mar 2020 14:54:41 +0000 (14:54 +0000)]
Bug 25004: Search results place hold button not enabled when checking result checkboxes on opac-search.pl

This patch makes a minor correction to the markup of the OPAC search
results page so that the event handlers attached to the checkboxes work
correctly. The broken markup broke the jQuery selector used to control
the event.

An extra </div> was added by mistake by Bug 14715.

To test, apply the patch and test the process of selecting multiple
titles by checking the checkbox. Doing so should activate the "Place
hold" and "Tag" controls.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 25024: Do not escape $
Jonathan Druart [Wed, 1 Apr 2020 08:58:28 +0000 (10:58 +0200)]
Bug 25024: Do not escape $

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 25024: Make grep match full string
Nick Clemens [Tue, 31 Mar 2020 13:55:21 +0000 (13:55 +0000)]
Bug 25024: Make grep match full string

To test:
1 - Create or have a branch with code CPL
2 - Create two new branches 'ACPL' and 'CPLA'
3 - In branch transfer limits disallow some itype or collection from another branch (FPL) to ACPL and CPLA
4 - Set UseBranchTransferLimits to 'Enforce'
5 - Find a biblio with one item belonging to FPL
6 - On opac, attempt to place a hold
7 - Note that ACPL and CPLA don't show in dropdown, OK
8 - Note that CPL is disabled, NOT OK
9 - Apply patch
10 - Place hold
11 - CPL is now enabled

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Joel Sasse <jsasse@plumcreeklibrary.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 17938: Fix display of label for repeated MARC 583 - Action note fields
Katrin Fischer [Thu, 26 Mar 2020 22:30:52 +0000 (22:30 +0000)]
Bug 17938: Fix display of label for repeated MARC 583 - Action note fields

When there are mulitple 583 on a record, the label "Action note" will be
repeated for each. This fixes it, so that the label only appears once and
multiple fields are separated by | following the existing pattern.

Also makes sure there is a space between $z and other subfields.

Note:
Ind. 1 = private - These won't display in the OPAC
Ind. 1 = 0 or empty - These will display in the OPAC
Staff will display all 583 independent from indicator.

To test:
- Add one or more records with none, one and muliple 583, at least one including $z
  For examples see:
  http://www.loc.gov/marc/bibliographic/bd583.html
- Verify display problems
- Apply patch
- Verify display is improved - one label and $z is followed by a space

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 25010: DBRev 19.12.00.062
Martin Renvoize [Fri, 3 Apr 2020 13:28:05 +0000 (14:28 +0100)]
Bug 25010: DBRev 19.12.00.062

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 25010: Fix typo 'rewewal' in debit types
Katrin Fischer [Thu, 26 Mar 2020 21:30:06 +0000 (21:30 +0000)]
Bug 25010: Fix typo 'rewewal' in debit types

This fixes a typo in the debit type description of
RENT_DAILY_RENEW

1) Go to Administration > Debit types
2) Show all debit types
3) Check for the typo
4) Apply patch
5) Verify that the typo is gone
6) Check account_debit_types table for type:
   SELECT * FROM account_debit_types;
7) Run database update
8) Repeat and verify typo is gone

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24941: Serials - Fix link to basket from acquisition details information
Katrin Fischer [Sat, 28 Mar 2020 00:22:35 +0000 (01:22 +0100)]
Bug 24941: Serials - Fix link to basket from acquisition details information

Adding orders from subscriptions makes acquisition information visible
in the serials module. In the table of acquisition data is a link back
to the basket - but this link is missing the basket number parameter -
it doesn't work. This patch fixes the TT variable to make it work.

To test:
- Add a subscription
- Add a new basket
- Add a order line using "Add from subscription"
- Go to the subscription details page, check the acquisitions tab
- Try the link to the basket - it should not work
- Apply patch
- Try the link again - now it should bring up the basket page with
  the order.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 25012: Fix class on OPAC view link in staff detail page
Katrin Fischer [Fri, 27 Mar 2020 23:46:55 +0000 (00:46 +0100)]
Bug 25012: Fix class on OPAC view link in staff detail page

Probably a copy & paste error: the OPAC view link on the staff
detail page currently has the class succeeding_entry_note.

This patch changes it to opac_view to allow for independent
styling of the link.

Note: The link will only be visible when OPACBaseURL is set.

To test:
- Use the element inspector or check the source code for
  the class used on the OPAC view link on the staff detail page
- Apply patch
- Repeat and verify that the class has changed to opac_view

Signed-off-by: David Roberts <david@koha-ptfs.co.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 25013: Fix capitalization: Edit Items on batch item edit
Katrin Fischer [Fri, 27 Mar 2020 23:54:21 +0000 (00:54 +0100)]
Bug 25013: Fix capitalization: Edit Items on batch item edit

Fixes a tiny string issue: Edit Items --> Edit items

To test:
- Go to tools / batch item edit
- Enter a barcode
- Check the heading above the edit item form
- Apply patch
- Verify the heading is now properly capitalized

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 25014: Fix capitalization for "Call Number" in staff and OPAC sort options
Katrin Fischer [Sat, 28 Mar 2020 00:05:14 +0000 (01:05 +0100)]
Bug 25014: Fix capitalization for "Call Number" in staff and OPAC sort options

There are some ocurrences of "Call Number" in the sort option lists in
staff and OPAC. The patch changes them to "Call number".

To test:
- Check the sort option list in staff and OPAC for the typo
- Apply patch
- Verify it's now all corrected

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24996: Compiled CSS
Martin Renvoize [Fri, 3 Apr 2020 13:15:34 +0000 (14:15 +0100)]
Bug 24996: Compiled CSS

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24996: Unwanted CSS change unhides OPAC results sorting button
Owen Leonard [Fri, 27 Mar 2020 01:36:22 +0000 (01:36 +0000)]
Bug 24996: Unwanted CSS change unhides OPAC results sorting button

This patch adds back a CSS selector which was incorrectly removed by Bug
23915. The "Go" button associated with the OPAC search results resort
operation should be hidden if JavaScript is enabled.

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 a search in the OPAC
 - On the search results page, there should be no "Go" button next to
   the re-sort/results per page selection fields.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 25006: Make Koha::Item->as_marc_field skip undefined subfields
Tomas Cohen Arazi [Fri, 27 Mar 2020 19:38:15 +0000 (16:38 -0300)]
Bug 25006: Make Koha::Item->as_marc_field skip undefined subfields

This patch makes as_marc_field skip subfields that don't have a value or
contains an empty string (replicating C4::Items:1021 logic).

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Item.t
=> FAIL: Tests fail because the generated MARC::Field contains undef
subfields.
3. Apply this patch
4. Repeat 2.
=> SUCCESS: Tests pass! Undefined and empty subfields are skipped!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 25006: Regression tests
Tomas Cohen Arazi [Fri, 27 Mar 2020 19:36:25 +0000 (16:36 -0300)]
Bug 25006: Regression tests

This patch introduces regression tests for as_marc_field. It makes sure
there are empty subfields and then uses List::MoreUtils' all to verify
all generated MARC subfields contain something (i.e. the undef ones are
skipped).

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 19475: Clear the caches at the end of the tests
Jonathan Druart [Mon, 30 Mar 2020 09:35:35 +0000 (11:35 +0200)]
Bug 19475: Clear the caches at the end of the tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 19475: Don't copy holiday if it already exists in target calendar
Emmi Takkinen [Wed, 4 Mar 2020 11:54:34 +0000 (13:54 +0200)]
Bug 19475: Don't copy holiday if it already exists in target calendar

Calendars copy tool created duplicate values to database.
Holidays in target calendar weren't checked before
inserting new holidays. This patch fixes this.

To test:
1. Add holidays for branch A
2. Copy branch A calendar to branch B
3. Repeat copy to branch B
=> Check database, branch B has now duplicate holidays
4. Delete holidays from branches A and B
5. Apply patch
6. Repeat steps 1-3
=> Check database, no duplicates

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 19475: Add unit tests
Emmi Takkinen [Thu, 12 Mar 2020 10:35:39 +0000 (12:35 +0200)]
Bug 19475: Add unit tests

To test prove:
t/db_dependent/Holidays.t

Sponsored-by: Koha-Suomi Oy
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 9422: (RM follow-up) Rebase Correction
Martin Renvoize [Fri, 3 Apr 2020 13:10:07 +0000 (14:10 +0100)]
Bug 9422: (RM follow-up) Rebase Correction

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 9422: Don't allow access to 'Upload patron images' when patronimages syspref...
Katrin Fischer [Sun, 10 Feb 2019 11:09:08 +0000 (12:09 +0100)]
Bug 9422: Don't allow access to 'Upload patron images' when patronimages syspref is off

In addition to checking the patron image upload permission, this
adds a check for the patronimages system preference to the tools
home page and sidebar.

To test:
- Check that the patron image upload tool only displays when
  - system preference patronimages is set to 'Allow'
    and user is either
  - superlibrarian or
  - has bath_upload_patron_images permission
- Save URL of patron image uploader page
- Turn off patronimages
- Verify you get redirected to the home page of Koha when trying
  to access the page

Note: this redirect is already used by the stock rotation feature.
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24474: DBRev 19.12.00.061
Martin Renvoize [Fri, 3 Apr 2020 13:04:48 +0000 (14:04 +0100)]
Bug 24474: DBRev 19.12.00.061

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24474: (QA follow-up) Fix failing test
Martin Renvoize [Tue, 31 Mar 2020 08:43:34 +0000 (09:43 +0100)]
Bug 24474: (QA follow-up) Fix failing test

The test was assuming default data and would fail if you ran through the
test plan (and disabled all but `onpayment` for the
'MarkLostItemsAsReturned' preference) on the data before running the
included unit tests.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24474: (follow-up) Add LOST_FOUND logic to Koha::Account::pay
Martin Renvoize [Fri, 14 Feb 2020 10:39:21 +0000 (10:39 +0000)]
Bug 24474: (follow-up) Add LOST_FOUND logic to Koha::Account::pay

This patch adds the same updated logic as found in
Koha::Account::Line->apply to handle LOST_FOUND credits being applied
against their associated LOST debit.

Currently a 'LOST_FOUND' credit is never created via the pay method and
so the additional test will always pass, but the addition here accounts
for possible future uses.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24474: (follow-up) Add onpayment to sysprefs file
Martin Renvoize [Mon, 10 Feb 2020 10:31:37 +0000 (10:31 +0000)]
Bug 24474: (follow-up) Add onpayment to sysprefs file

This patch adds the required line to the circulation.pref file to
dispaly the onpayment option in the MarkLostItemReturned preference

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24474: Filter out LOST_FOUND
Martin Renvoize [Wed, 5 Feb 2020 13:10:49 +0000 (13:10 +0000)]
Bug 24474: Filter out LOST_FOUND

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24474: Add `onpayment` option to `MarkLostItemsReturned`
Martin Renvoize [Wed, 5 Feb 2020 10:14:05 +0000 (10:14 +0000)]
Bug 24474: Add `onpayment` option to `MarkLostItemsReturned`

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24474: Add tests
Jonathan Druart [Tue, 4 Feb 2020 14:13:47 +0000 (15:13 +0100)]
Bug 24474: Add tests

This does the following using the interface:
- Unselect all the options from MarkLostItemsAsReturned except for
  'onpayment'
- Check an item out
- Create a manual invoice LOST for the checked in item
- Renew the item
- Check that the item was not returned

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24900: Checks in MARC mod templates for when from field does not equal conditiona...
Aleisha Amohia [Thu, 19 Mar 2020 04:37:34 +0000 (04:37 +0000)]
Bug 24900: Checks in MARC mod templates for when from field does not equal conditional field

When MARC modification template actions are applied, they assume that
the from field is the same as the conditional field. This patch adds
checks for this, as well as tests to confirm the behaviour is correct.

CASE 1: Delete 1st field 020 if 651$z exists
BROKEN BEHAVIOUR (before patch): deletes the 2nd instance of 020 instead
                                 of 1st
EXPECTED BEHAVIOUR (corrected by patch): deletes the 1st instance of 020

CASE 2: Delete 1st field 020 if 651$z matches Berlin. (must include '.')
BROKEN BEHAVIOUR (before patch): deletes the 2nd instance of 020
EXPECTED BEHAVIOUR (corrected by patch): deletes the 1st instance of 020

CASE 3: Delete field 020 if 650$2 does not match fast
BROKEN BEHAVIOUR (before patch): deletes all 020 fields even though
                                 650$2 does match fast
EXPECTED BEHAVIOUR (corrected by patch): does not delete 020 fields

Confirm tests pass: t/db_dependent/MarcModificationTemplates.t

Sponsored-by: Catalyst IT
Signed-off-by: Frank Hansen <frank.hansen@ub.lu.se>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22001: Errors are no longer logged by default (!)
Jonathan Druart [Tue, 31 Mar 2020 15:56:41 +0000 (17:56 +0200)]
Bug 22001: Errors are no longer logged by default (!)

This is one of the biggest part we will have to deal with when we will
switch to DBIC handler for UI as well.
The DBI errors will not be logged if we do not deal with them correctly.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22001: execute reports in an eval
Jonathan Druart [Tue, 31 Mar 2020 15:55:28 +0000 (17:55 +0200)]
Bug 22001: execute reports in an eval

Otherwise the tests will fail. We will certainly log twice the error
when run from the UI, but not a big deal. This definitely needs more
attention in a follow-up bug report.
We want to raise proper exceptions here.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22001: Fix Koha/Patrons.t
Jonathan Druart [Tue, 31 Mar 2020 15:54:36 +0000 (17:54 +0200)]
Bug 22001: Fix Koha/Patrons.t

The message is only printed once

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22001: Make the DBD error regex less strict
Jonathan Druart [Tue, 31 Mar 2020 15:53:47 +0000 (17:53 +0200)]
Bug 22001: Make the DBD error regex less strict

Now the message is looking like
DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Duplicate entry

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22001: Add the DBI error message
Jonathan Druart [Tue, 31 Mar 2020 15:27:12 +0000 (17:27 +0200)]
Bug 22001: Add the DBI error message

Using DBIx::Class error handler, we should not hide the error when
encapsulating it

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22001: Set unsafe only if RaiseError is not set
Jonathan Druart [Tue, 31 Mar 2020 13:58:21 +0000 (15:58 +0200)]
Bug 22001: Set unsafe only if RaiseError is not set

Sooooo....

That was tricky, and the solution looks trivial.
However it's not.
We have unsafe set for "historical reason".
Having it on when RaiseError is on have the effect of overwritting the
DBIC error handler.

The problem is:
t/db_dependent/Circulation/MarkIssueReturned.t (and other tests) is failing with:

  # expecting: Koha::Exceptions::Object::BadValue
  # found: DBIx::Class::Exception ({UNKNOWN}: Can't locate object method "rethrow" via package "DBD::mysql::st execute failed: Incorrect datetime value: 'bad_date' for column 'returndate' at row 1 [for Statement "UPDATE `issues` SET `returndate` = ? WHERE ( `issue_id` = ? )" with ParamValues: 0='bad_date', 1=238] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line

In Koha::Object->store, the exception is not a DBIx::Class::Exception object (as we except), but
a string (on which we cannot call rethrow).

Swithing unsafe off restores the expected behavior.
To make sure the UI will not be affected, it is only turned off when
RaiseError is set.

The situation is still wrong (for UI), from the POD https://metacpan.org/pod/DBIx::Class::Storage::DBI (/unsafe)
"""
Note that your custom settings can cause Storage to malfunction, especially if you set a HandleError handler that suppresses exceptions and/or disable RaiseError.
"""

And also https://metacpan.org/release/DBIx-Class/source/lib/DBIx/Class/Storage/DBI.pm#L1531

Many thanks Tomas for the digging exploration!

We need to turn RaiseError and remove the unsafe flag, for UI as well,
but that should be done at the beginning of a dev cycle.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23463: (follow-up 3) Fix timestamp default value
Jonathan Druart [Mon, 23 Mar 2020 16:21:24 +0000 (17:21 +0100)]
Bug 23463: (follow-up 3) Fix timestamp default value

This is the only situation I found where:
 * t/db_dependent/Koha/Item.t is passing
 * t/db_dependent/Koha/Object.t is passing
 * MySQL 8 is happy (and not fail with "Column 'timestamp' cannot be null"), which is certainly what I missed in the previous follow-up

About the change to Object.t: the next store was called without the
generated timestamp, so it is needed to call discard_changes.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 22001: Fix Object.t - handle correct RaiseError and PrintError
Jonathan Druart [Mon, 30 Mar 2020 09:04:51 +0000 (11:04 +0200)]
Bug 22001: Fix Object.t - handle correct RaiseError and PrintError

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 25018: Use new KOHA_TESTING envvar to detect environment testing
Jonathan Druart [Mon, 30 Mar 2020 08:16:23 +0000 (10:16 +0200)]
Bug 25018: Use new KOHA_TESTING envvar to detect environment testing

In some tests we want to know if we are in a testing environment.
When run the usual way, our trick works, the perl interpreter matches 'prove':
  $ENV{_} eq 'prove'

In other situations, we have the KOHA_NO_TABLE_LOCKS environment variables, for the SendCirculationAlert race conditions (see bug 15854 and bug 18364).

For unknown reasons, Jenkins runs the tests with /usr/bin/perl.

This patch suggests to rename KOHA_NO_TABLE_LOCKS and use KOHA_TESTING
instead, when prove is not used (or not correctly detected as it it the
case for Jenkins)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24614: Fix Reports/Guided.t
Jonathan Druart [Fri, 27 Mar 2020 16:09:27 +0000 (17:09 +0100)]
Bug 24614: Fix Reports/Guided.t

DBD::mysql::st execute failed: Column 'public' cannot be null [for Statement "UPDATE `saved_sql` SET `last_modified` = ?, `notes` = ?, `public` = ?, `report_group` = ?, `report_name` = ?, `report_subgroup` = ?,
`savedsql` = ? WHERE ( `id` = ? )" with ParamValues: 0='2020-03-27T16:03:04', 1=undef, 2=undef, 3=undef, 4='Just another report', 5=undef, 6=undef, 7=25] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1836.
    # Looks like you planned 17 tests but ran 6.

update_sql expect all the paramters to be set, otherwise it will be
nulled.

The best way to fix it is at test level. There is only 1 occurrence in
controller/module, and it sends all the parameters. That is the correct
way to do and will make things easier when we will removed them to use
Koha::Reports directly

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18177: (follow-up) remove aqbooksellers.currency
Jonathan Druart [Fri, 27 Mar 2020 15:46:30 +0000 (16:46 +0100)]
Bug 18177: (follow-up) remove aqbooksellers.currency

There was an occurrence in tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23204: Fix tests swapping fields (they are not ordered)
Jonathan Druart [Fri, 27 Mar 2020 15:36:08 +0000 (16:36 +0100)]
Bug 23204: Fix tests swapping fields (they are not ordered)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 25000: SQL report not updated
Nazlı Çetin [Fri, 27 Mar 2020 12:25:46 +0000 (12:25 +0000)]
Bug 25000: SQL report not updated

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23204: DBRev 19.12.00.060
Martin Renvoize [Fri, 27 Mar 2020 12:32:14 +0000 (12:32 +0000)]
Bug 23204: DBRev 19.12.00.060

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23473: (QA follow-up) Fix number of tests
Marcel de Rooy [Fri, 27 Mar 2020 09:43:55 +0000 (09:43 +0000)]
Bug 23473: (QA follow-up) Fix number of tests

=> Looks like you planned 158 tests but ran 159.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23473: (follow-up) Fix QA complaints (tabs, filters, Dumper)
Nick Clemens [Tue, 4 Feb 2020 12:14:51 +0000 (12:14 +0000)]
Bug 23473: (follow-up) Fix QA complaints (tabs, filters, Dumper)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23473: Don't allow staff password changes for imports
Nick Clemens [Wed, 8 Jan 2020 15:02:08 +0000 (15:02 +0000)]
Bug 23473: Don't allow staff password changes for imports

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23473: Don't allow setting blank passwords via import
Nick Clemens [Wed, 8 Jan 2020 14:24:04 +0000 (14:24 +0000)]
Bug 23473: Don't allow setting blank passwords via import

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23473: (follow-up) Catch and show password exceptions
Nick Clemens [Tue, 5 Nov 2019 12:58:45 +0000 (12:58 +0000)]
Bug 23473: (follow-up) Catch and show password exceptions

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23473: (follow-up) check if overwrite_passwords is set
Nick Clemens [Tue, 29 Oct 2019 10:24:42 +0000 (10:24 +0000)]
Bug 23473: (follow-up) check if overwrite_passwords is set

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23473: (follow-up) Make passwords 'secure' for tests
Nick [Thu, 3 Oct 2019 13:08:53 +0000 (13:08 +0000)]
Bug 23473: (follow-up) Make passwords 'secure' for tests

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23473: Allow overwrite of passwords during import
Nick Clemens [Mon, 19 Aug 2019 16:16:30 +0000 (16:16 +0000)]
Bug 23473: Allow overwrite of passwords during import

To test:
 1 - Have some patrons in your system
 2 - Export some of their info via reports
    SELECT cardnumber, userid, surname, firstname, password, branchcode, categorycode
 3 - Edit the file from above, changing all the password lines
 4 - Import the file with overwrite
 5 - Confirm passwords have not changed (run the report again and confirm the hashes are the same)
 6 - Apply patch
 7 - Restart all the things
 8 - Check the new box on import screen to overwrite passwrods
 9 - Import file again
10 - Confirm passwords have changed
11 - Signin using new password to verify the hash is the password as supplied
12 - Repeat via commandline import supplying --overwrite_passwords option
13 - Verify works as expected
14 - Prove -v t/db_dependent/Koha/Patrons/Import.t

Sponsored-by: ByWater Solutions
Signed-off-by: Ron Marion <ron.marion@goddard.edu>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18177: DBRev 19.12.00.059
Martin Renvoize [Fri, 27 Mar 2020 12:19:26 +0000 (12:19 +0000)]
Bug 18177: DBRev 19.12.00.059

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18177: Do not remove columns if at least one value exists
Jonathan Druart [Tue, 24 Mar 2020 15:22:33 +0000 (16:22 +0100)]
Bug 18177: Do not remove columns if at least one value exists

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18177: DBIC changes
Jonathan Druart [Tue, 17 Mar 2020 08:55:39 +0000 (09:55 +0100)]
Bug 18177: DBIC changes

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18177: DB changes
Jonathan Druart [Tue, 17 Mar 2020 08:50:18 +0000 (09:50 +0100)]
Bug 18177: DB changes

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18177: remove aqbooksellers.currency
Jonathan Druart [Tue, 17 Mar 2020 08:53:04 +0000 (09:53 +0100)]
Bug 18177: remove aqbooksellers.currency

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18177: remove aqbooksellers.bookselleremail
Jonathan Druart [Tue, 17 Mar 2020 08:47:46 +0000 (09:47 +0100)]
Bug 18177: remove aqbooksellers.bookselleremail

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18177: remove aqbooksellers.booksellerurl
Jonathan Druart [Tue, 17 Mar 2020 08:43:13 +0000 (09:43 +0100)]
Bug 18177: remove aqbooksellers.booksellerurl

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18177: remove aqbooksellers.booksellerfax
Jonathan Druart [Tue, 17 Mar 2020 08:42:37 +0000 (09:42 +0100)]
Bug 18177: remove aqbooksellers.booksellerfax

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18177: remove aqbooksellers.othersupplier
Jonathan Druart [Tue, 17 Mar 2020 08:40:04 +0000 (09:40 +0100)]
Bug 18177: remove aqbooksellers.othersupplier

This patchset removes some columns from the aqbooksellers table that are
not used:
 * booksellerfax
 * booksellerurl
 * bookselleremail
 * othersupplier
 * currency

The first 3 ones are certainly leftover from bug 10402.

Test plan:
For each for these fields you will make sure that they cannot be edited
from the interface.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23888: (follow-up) Wrap English string in translation function
Owen Leonard [Fri, 14 Feb 2020 15:07:16 +0000 (15:07 +0000)]
Bug 23888: (follow-up) Wrap English string in translation function

This patch makes alert added in subscription-add.js translatable using
the new __() function.

To test, apply the patch and confirm that the alert still works
correctly when submitting the subscription edit form with an invalid
vendor id.

Test that the string can be translated (using fr-Fr for example):

1. cd misc/translator && ./translate update fr-FR
2. Translate strings in misc/tranlator/po/fr-FR-messages-js.po
3. cd misc/translator && ./translate install fr-FR

Switch to the fr-FR translation and confirm the the alert shows your
translated string.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23888: Do not allow invalid vendor id on creating a subscription
Jonathan Druart [Mon, 11 Nov 2019 11:14:50 +0000 (12:14 +0100)]
Bug 23888: Do not allow invalid vendor id on creating a subscription

It will avoid crash and invalid data when creating/updating a
subscription.

This could have been done with a AJAX query but seems more convenient
this way.

Test plan:
- Create or update a subscription
- In the "Vendor" input try an empty string, a valid vendor's id, and
invalid one.
=> With an empty string you get the existing alert message
=> With a valid id you do not get any messages
=> With an invalid id you are not allowed to go to page 2

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24386: Prevent double form submission on adding orders to basket from a file
Nick Clemens [Thu, 9 Jan 2020 15:53:45 +0000 (15:53 +0000)]
Bug 24386: Prevent double form submission on adding orders to basket from a file

To test:
 1 - Have a marc record file
 2 - Go to Acquisitions, find a vendor, then an open basket
 3 - Add to basket from a new file (if you already have one staged you can choose that instead)
 4 - Import the file, then add to basket
 5 - On the page where you select the records and set info select a record, set matching to 'Do not check' fill in the fund for the order
 6 - When ready, click save as many times as you can
 7 - When you go to the basket there are many copies of the order added
 8 - Don't despair, apply the patch
 9 - Repeat above
10 - When ready to add orders, click furiously
11 - The order is only added once!
12 - Success!

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24883: (RM follow-up) Use Koha::Script
Martin Renvoize [Fri, 27 Mar 2020 12:12:31 +0000 (12:12 +0000)]
Bug 24883: (RM follow-up) Use Koha::Script

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24883: Add POD entry and remove unused variable
Bernardo Gonzalez Kriegel [Fri, 20 Mar 2020 22:35:29 +0000 (19:35 -0300)]
Bug 24883: Add POD entry and remove unused variable

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24883: Move new sub from load_yaml.pl
Jonathan Druart [Thu, 19 Mar 2020 12:09:33 +0000 (13:09 +0100)]
Bug 24883: Move new sub from load_yaml.pl

Use the sub from C4::Installer to avoid dup of code.

Note:
We are going to modify the script and so will do more stuffs.
We may want to rename it, maybe installer_utilities.pl,
misc/installer/yaml_utility.pl, any suggestions?

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>