koha.git
4 years agoBug 24266: (alternate patch) Only use defined borrowernumbers in reconcile_balances...
Aleisha Amohia [Mon, 16 Mar 2020 22:09:51 +0000]
Bug 24266: (alternate patch) Only use defined borrowernumbers in reconcile_balances.pl cron

I believe the error is triggered when borrowernumbers are left empty in
the accountlines table. Not sure why this would happen, but it appears
to be what causes the problem.

Do not apply the first patch if testing this patch.

To test:
1) sudo koha-mysql INSTANCENAME
2) Create a test borrower, add any payment etc to create an accountline,
    then delete this borrower
3) ensure the AccountAutoReconcile syspref is disabled
4) Go to another borrower's accounting tab
5) Create a manual credit or debit. Confirm this shows in the 'Make a
payment' tab as an amount that COULD be applied, but isn't automatically
applied
6) in your terminal, run the reconcile_balances.pl script
7) Confirm the error does not show in the logs and the balance for
the borrower is correctly reconciled.

Sponsored-by: Horowhenua District Council
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 25095: Remove warn left in FeePayment.pm
Kyle M Hall [Thu, 9 Apr 2020 12:24:44 +0000]
Bug 25095: Remove warn left in FeePayment.pm

It appears that a debugging statement was accidentally left in FeePayment.pm by bug 5605.

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

4 years agoBug 22778: Add unit test
Kyle M Hall [Wed, 8 Apr 2020 14:52:23 +0000]
Bug 22778: Add unit test

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

4 years agoBug 22778: Suggestions with no "suggester" can cause errors
Kyle M Hall [Thu, 25 Apr 2019 19:50:35 +0000]
Bug 22778: Suggestions with no "suggester" can cause errors

If one tries to modify a suggestion that has no suggester you will get the following error:

Can't call method "lang" on an undefined value at /usr/share/koha/lib/C4/Suggestions.pm line 506

Koha assumes that every suggestion has a borrowernumber in suggestedby

Test Plan:
1) Create a suggestion with an unpopulated suggestedby
2) Attempt to modify that suggestion
3) Note the error
4) Apply this patch
5) Restart all teh things
6) Attempt to modify that suggestion
7) No error!

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 24027: Add POD about the new parameter in Koha::Item->store
Jonathan Druart [Wed, 8 Apr 2020 14:11:54 +0000]
Bug 24027: Add POD about the new parameter in Koha::Item->store

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

4 years agoBug 24027: (QA follow-up) Fix POD warning
Tomas Cohen Arazi [Wed, 8 Apr 2020 13:17:32 +0000]
Bug 24027: (QA follow-up) Fix POD warning

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24027: Call ModZebra once after all items added/deleted in a batch
Andrew Nugged [Mon, 6 Apr 2020 16:11:35 +0000]
Bug 24027: Call ModZebra once after all items added/deleted in a batch

Issue description:
- call to ModZebra was unconditional inside 'store' method for Koha::Item,
  so it was after each item added, or deleted.
- ModZebra called with param biblionumber, so it is the same parameter
  across calls for each items with same biblionumber, especially when we
  adding/removing in a batch.
- with ElasticSearch enabled this makes even more significant load
  and it is also progressively grows when more items already in DB

Solution:
- to add extra parameter 'skip_modzebra_update' and propagate it down to
 'store' method call to prevent call of ModZebra,
- but to call ModZebra once after the whole batch loop in the upper layer

Test plan / how to replicate:
- make sure that you have in the admin settings "SearchEngine" set to
  "Elasticsearch" and your ES is configured and working
  ( /cgi-bin/koha/admin/preferences.pl?op=search&searchfield=SearchEngine )
- select one of biblioitems without items
  ( /cgi-bin/koha/cataloguing/additem.pl?biblionumber=XXX )
- press button "add multiple copies of this item",
- enter 200 items, start measuring time and submit the page/form...

On my test machine when adding 200 items 3 times in a row (so 600 in
total, but to show that time grows with every next batch gradually):

WHEN ElasticSearch DISABLED (only Zebra queue):
- 9s, 12s, 13s
WHEN ElasticSearch ENABLED:
- 1.3m, 3.2m, 4.8m
WITH PATCH WHEN ElasticSearch ENABLED:
- 10s, 13s, 15s

Same slowness (because also same call to ModZebra) happens when you try
to delete all items ("op=delallitems"). And same fix.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 23514: Split Call Numbers for all layout types
Theodoros Theodoropoulos [Wed, 8 Apr 2020 07:21:12 +0000]
Bug 23514: Split Call Numbers for all layout types

This patch ensures call numbers are properly split for layout types
other than 'BAR'.

Test plan:

1. Go to Label Creator and choose/create a Label Layout with "Choose
layout type: Biblio"
2. make sure you have at least "itemcallnumber" in Bibliographic data to
print/Data fields
3. check "Split call numbers" box and save the layout (ie testlayout)
4. create a label batch, using items that have a call number (ie
DC611.B848 H84 1997). LCC is used here, but you may try with Dewey as
well.
5. export selected batch using any template and the layout you created
in previous step to a PDF
6. Call numbers are splitted (as expected) in the resulting PDF file
7. edit the layout you created in the previous step (ie testlayout) and
change the  "Choose layout type:" to either Biblio/Barcode (BIBBAR) or
Barcode/Biblio (BARBIB)
8. export the same batch using the same template and layout as before
9. Call numbers are NOT splitted at all

After patch is applied, call numbers splitting functions are applied
even in Biblio/Barcode (BIBBAR) or Barcode/Biblio (BARBIB) layout types.

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

4 years agoBug 7046: (RM follow-up) Add Filters
Martin Renvoize [Wed, 8 Apr 2020 12:18:46 +0000]
Bug 7046: (RM follow-up) Add Filters

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

4 years agoBug 24840: (follow-up) Catch some further cases of DateTime->now
Martin Renvoize [Wed, 8 Apr 2020 09:43:54 +0000]
Bug 24840: (follow-up) Catch some further cases of DateTime->now

This patch corrects a few additional cases where DateTime->now is called
directly instead of via Koha::DateUtils.

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

4 years agoBug 24840: Replace DateTime->now with dt_from_string
Nick Clemens [Thu, 26 Mar 2020 11:05:32 +0000]
Bug 24840: Replace DateTime->now with dt_from_string

We should use Koha::DateUtils instead of Date::Time directly

This patch simplay replaces calls to now() with a call to dt_from_string()
which does effectively the same thing.

Probably reading the code and verifying changes is sufficient but...

To test:
1 - confirm the files all compile
2 - confirm all tests pass
3 - confirm Koha still works

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

4 years agoBug 25081: Fix wrong comment
Jonathan Druart [Wed, 8 Apr 2020 09:45:51 +0000]
Bug 25081: Fix wrong comment

Not directly related to previous patch, coming from 23435.

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

4 years agoBug 25081: Fix creation of new item for a received issue
Janusz Kaczmarek [Tue, 7 Apr 2020 20:23:20 +0000]
Bug 25081: Fix creation of new item for a received issue

The Bug 23435 introduced the idea of multiple copies added while
receiving a new issue.  Unfortunately, under some circumstances, it
causes no items being added at all.  It occurs stochastically, only
under some conditions.  But it is quite likely to happen while receiving
a supplemental issue.

The reason fot hist is that, in serials-edit.pl, line ca 292 and infra,
@num_copies is treated in the same way as @tags, while it should be
treated similarly to @bibnums.  It will be obvious after examining the
content of parameters tag, subfield, field_value, ..., number_of_copies.
In other words, for every edited issue number_of_copies is a scalar.

Nota bene:
a) beter to initialize $countdistinct with zero;
b) note that in master, now, before applying the patch,
$itemhash{$item}->{'num_copies'} is treated once as a scalar
and in the next line--as an array:

$itemhash{$item}->{'num_copies'} //= 1;

for (my $copy = 0; $copy < $itemhash{$item}->{'num_copies'}[$index];){

TEST PLAN
=========
1. Have a subscription with the option "Create an item
record when receiving this serial" active and try to receive a
supplemental issue.  Control that a new item under the biblio record
(usually) will not be created.
2. Apply the patch.
3. Repeat p. 1 -- a new item should be created.

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.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 22937: Add hint to groups editor
Kyle M Hall [Fri, 27 Mar 2020 16:01:05 +0000]
Bug 22937: Add hint to groups editor

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.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 25046: Add test
Jonathan Druart [Wed, 8 Apr 2020 09:28:31 +0000]
Bug 25046: Add test

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

4 years agoBug 25046: Include borrowers.othernames in SELECT statement
Andreas Roussos [Thu, 2 Apr 2020 17:14:57 +0000]
Bug 25046: Include borrowers.othernames in SELECT statement

In C4/Utils/DataTables/Members.pm, the SELECT statement that fetches
patron data from the database does not include borrowers.othernames
in the field list. As a consequence, when the output is in the form
of a DataTable, the Template Toolkit files that refer to .othernames
(such as the patron-title.inc include) won't display the information
from the 'Other name' input field if that field has been filled in.

This patch fixes that.

Test plan:
0) Have a few patrons with some data in the 'Other name' field.
1) Perform a generic search in Home > Patrons to ensure you will get
   a DataTable with results.
2) Observe that the 'Name' column does not include 'Other name' info.
3) Apply the patch, and restart Plack if necessary.
4) Repeat your search: this time you should see the information from
   the 'Other name' field, it will be next to the patron's First name
   and within parentheses.

Sponsored-by: Eugenides Foundation Library
Signed-off-by: Devinim <nazli@devinim.com.tr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 7046: Preselect dropdown option and prefill input
Jonathan Druart [Wed, 8 Apr 2020 08:42:41 +0000]
Bug 7046: Preselect dropdown option and prefill input

With previous renew values

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

4 years agoBug 7046: Implemented subscription renewal dropdown sub length element
Alex Buckley [Mon, 27 Nov 2017 02:31:35 +0000]
Bug 7046: Implemented subscription renewal dropdown sub length element

To make this work I moved the _get_sub_length function from
subscription-add.pl to C4/Serials.pm so that the subscription-renew.pl
script could also call it to store the sublength for the appropriate
field of the subscriptions database table.

Test plan:
1. Create a subscription and notice that there is a dropdown box for sub
   length containing the values: issues, weeks, months
2. Renew the subscription and notice that there are 3 input text boxes:
   'number of num', 'number of weeks' and 'number of months'
3. Input a 'Number of weeks' value of 2
4. Query the subscription database table and notice that the value of 2
   has been stored in the weeklength field for the subscription record you
   just renewed
5. Apply the patch
6. Renew the subscription and notice that there is now a sublength
   dropdown box containing issues, weeks and months
7. Set the month value to 3
8. Query the database and notice that 3 was stored in the monthlength
   field for the subscription record
9. Create a new subscription and select the sub length values of issues
   and 3
10. Query the database and notice that the numberlength field for the
   subscription you just created is set to 3 showing that the sublength
   dropbox is still working for creating a new subscription

Sponsored-By: Catalyst IT
Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au>
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 24826: Remove warnings from Sendmail
Jonathan Druart [Wed, 11 Mar 2020 15:21:06 +0000]
Bug 24826: Remove warnings from Sendmail

Use of uninitialized value $mail{"Cc"} in substitution (s///) at /usr/share/perl5/Mail/Sendmail.pm

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

4 years agoBug 24940: Serials statistics wizard: order vendor list alphabetically
David Roberts [Fri, 3 Apr 2020 15:23:01 +0000]
Bug 24940: Serials statistics wizard: order vendor list alphabetically

This patch changes the dropdown from being sorted by aqbookseller.id to
aqbookseller.name

To test:
1) Add at least 2 vendors:
 - First: ZZZZ
 - Second: AAAA
2) Add subscriptions for each of the vendors
3) Check the pull down in the serials statistics wizard and verify it
lists them as ZZZZ, AAAA
4) Apply the patch
5) Re-check the pull down in the wizard and check that the vendors are
now listed AAAA,ZZZZ

Signed-off-by: Devinim <kohadevinim@devinim.com.tr>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 25019: Make the ViewPolicy filter initialization standard
Tomas Cohen Arazi [Mon, 30 Mar 2020 12:39:13 +0000]
Bug 25019: Make the ViewPolicy filter initialization standard

This patch makes the ViewPolicy filter use the 'params' accessor instead
of relying of ->{options} which has no accessor. This will allow
interacting with the filter object be similar through all the filters in
the chain.

To test, we just need to verify no behaviour change takes place:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Filter_MARC_ViewPolicy.t
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests still pass!
4. Sign off :-D

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 25041: Restore #ASKED anchor in suggestions table
Jonathan Druart [Fri, 3 Apr 2020 09:42:59 +0000]
Bug 25041: Restore #ASKED anchor in suggestions table

On commit 4494e8ba6ca7d28972fcc1161c680ecf0b091f62
   Bug 23594: Batch modification for itemtypes on suggestions page
The anchors of the tabs on suggestion.pl has been replaced with
tab_$count instead of the status code.
There was a need at the time, but I cannot remember it.
I restored the previous behavior, and did not find any regressions.

Test plan:
1 - Add several suggestions to Koha
2 - Set them in different status, leaving at least one pending
3 - Go to home page, note it shows count of pending
4 - Click the link on home page
5 - It takes you to correct tab

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 24801: (follow-up) Display all the libraries - Selenium fix
Jonathan Druart [Wed, 8 Apr 2020 06:47:49 +0000]
Bug 24801: (follow-up) Display all the libraries - Selenium fix

We have it failing now for the delete link..
14:26:50 selenium_1   | 05:26:50.451 WARN - Exception: Unable to locate element: {"method":"xpath","selector":"//*[@id=\"delete_library_UT_BC\"]"}

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

4 years agoBug 23355: (RM follow-up) Restore lost ID's
Martin Renvoize [Tue, 7 Apr 2020 11:43:43 +0000]
Bug 23355: (RM follow-up) Restore lost ID's

Some ID's were lost during a QA followup, this patch restores them.

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

4 years agoBug 4944: (RM follow-up) Add OpacNoItemTypeImages to UsageStats test
Martin Renvoize [Mon, 6 Apr 2020 12:02:54 +0000]
Bug 4944: (RM follow-up) Add OpacNoItemTypeImages to UsageStats test

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

4 years agoBug 20754: DBRev 19.12.00.067
Martin Renvoize [Mon, 6 Apr 2020 11:28:36 +0000]
Bug 20754: DBRev 19.12.00.067

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

4 years agoBug 20754: DB revision to remove double accepted shares
Marcel de Rooy [Fri, 4 May 2018 08:42:38 +0000]
Bug 20754: DB revision to remove double accepted shares

[Originally submitted for bug 11943, parked at 20754.]
[Attempt to revive it now.]

Although it is no problem to have them, we could do a cleanup.
This patch just removes duplicate rows from the table.

Note: I considered adding a unique index like:
    ALTER TABLE virtualshelfshares ADD UNIQUE INDEX (shelfnumber, borrowernumber, invitekey);
But the possible NULL values in borrowernumber and/or invitekey require
additional code changes. So I left it alone.

Test plan:
[1] Create two records with same borrowernumber and shelfnumber in the shares
    table, if not present already.
[2] Run updatedatabase.pl

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

4 years agoBug 24604: Add 'Pay' button under Transactions tab in patron accounting
Julian Maurice [Thu, 6 Feb 2020 15:15:43 +0000]
Bug 24604: Add 'Pay' button under Transactions tab in patron accounting

It does the same thing as the 'Pay' button under 'Make a payment' tab.
It is nothing more than a shortcut.

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 4461: DBRev 19.12.00.066
Martin Renvoize [Mon, 6 Apr 2020 10:25:02 +0000]
Bug 4461: DBRev 19.12.00.066

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

4 years agoBug 4461: Use inbound_email_address to know if we display the dropdown list
Jonathan Druart [Fri, 3 Apr 2020 13:06:53 +0000]
Bug 4461: Use inbound_email_address to know if we display the dropdown list

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: Correctly deal with encoding/escaping chars
Jonathan Druart [Fri, 3 Apr 2020 11:52:12 +0000]
Bug 4461: Correctly deal with encoding/escaping chars

This patch deals (hopefully) correctly with encoding and escaping chars.
It also remove OPACBaseURL from the url stored in DB, and readd is on
display, to avoid possible attacks.

Test plan:
Go to the authority search
fill term with something hacky
<script>alert('booh!')</script>And Ŝ♥m€ E★tr₳
Search
Click the "Report a problem" link
Fill the form and make sure the url is displayed correctly
submit
Check problem_reports.problempage in DB => Should be correctly displayed
Go to staff interface, "OPAC problem reports"
=> Confirm the link is correctly display
Click it
=> Confirm that you are at the OPAC, and the URL is 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 4461: Extend problem_reports.problempage to TEXT
Jonathan Druart [Fri, 3 Apr 2020 12:40:16 +0000]
Bug 4461: Extend problem_reports.problempage to TEXT

255 chars is not enough if want want to store any kind of URL, for
instance an authorities search can be much longer

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: dbic schema update
Jonathan Druart [Fri, 3 Apr 2020 12:39:45 +0000]
Bug 4461: dbic schema update

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: Hide link if KohaAdminEmailAddress is not set
Jonathan Druart [Fri, 3 Apr 2020 12:04:38 +0000]
Bug 4461: Hide link if KohaAdminEmailAddress is not set

opac-reportproblem.pl returns a 404 in that case

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: Fix OPAC link from staff
Jonathan Druart [Thu, 2 Apr 2020 10:51:39 +0000]
Bug 4461: Fix OPAC link from staff

QA: We have a security issue here, we should not make this link
clickable from the staff side.

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: get_effective_email has been renamed inbound_email_address
Jonathan Druart [Thu, 2 Apr 2020 09:25:31 +0000]
Bug 4461: get_effective_email has been renamed inbound_email_address

On commit 027051c938924a33a64014794705526ab68351af
   Bug 22823: Rename method with ->inbound_email_address

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: Fix status and borrowernumber fields in problem_reports and more
Aleisha Amohia [Wed, 18 Mar 2020 22:50:50 +0000]
Bug 4461: Fix status and borrowernumber fields in problem_reports and more

status varchar(6) with readable statuses
borrowernumber not null default 0
hide form if message successfully sent
fixing hide viewed and hide closed filters
adding recipient column

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: DBIC Schema Files
Martin Renvoize [Wed, 11 Mar 2020 09:08:52 +0000]
Bug 4461: DBIC Schema Files

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: Checks on library email before enqueuing letter
Aleisha Amohia [Thu, 19 Mar 2020 00:26:33 +0000]
Bug 4461: Checks on library email before enqueuing letter

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: Update license statements
Jonathan Druart [Thu, 12 Mar 2020 11:51:27 +0000]
Bug 4461: Update license statements

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) Add missing relationship accessor
Martin Renvoize [Wed, 11 Mar 2020 09:06:09 +0000]
Bug 4461: (follow-up) Add missing relationship accessor

I think this was a simple case of Aliesha missing a file when commiting.

So I could proceed with testing I just quickly re-implimented the patron
relationship accessor.

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: Manage problem reports on the staff client
Aleisha Amohia [Wed, 11 Mar 2020 01:52:27 +0000]
Bug 4461: Manage problem reports on the staff client

Test plan:

- Update database and upgrade schema files (if you haven't already).
Restart memcached
- Check your user's permissions and ensure the 'problem_reports'
permission is ticked. Confirm the OPACReportProblem syspref is enabled
- Log into the OPAC and submit a problem report
- Log into the staff client
- You should see a box at the bottom of the main page showing your
pending problem report
- Click the link and confirm it takes you to the new page for managing
problem reports
- Go to Administration
- Confirm you can see a link to 'OPAC problem reports' under the
'Additional parameters' heading
- Click 'OPAC problem reports'
- Confirm your problem report is showing in the table
- Open the OPAC in another tab and submit at least two more problem
reports (so you should have at least three in the table after
refreshing)
- Try the different buttons
    - selecting multiple problem reports and using the big 'mark
    viewed', 'mark closed', 'mark new' buttons. Confirm there are no
    failures and that the number of selected problem reports is correct
    - select all, clear all, hide viewed, hide closed, hide new, show
    all
    - individual 'mark viewed', 'mark closed', 'mark new' buttons for
    each problem report. Confirm the status shows and the correct button
    is disabled while others are enabled
- Confirm the problem page link works as expected

Sponsored-by: Catalyst IT
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: Add problem reports link to mainpage and admin home
Aleisha Amohia [Tue, 10 Mar 2020 22:52:29 +0000]
Bug 4461: Add problem reports link to mainpage and admin home

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: Adding user flags for managing OPAC problem reports
Aleisha Amohia [Tue, 10 Mar 2020 22:27:56 +0000]
Bug 4461: Adding user flags for managing OPAC problem reports

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 get_effective_email from bug 22823
Martin Renvoize [Mon, 2 Mar 2020 15:18:33 +0000]
Bug 4461: Use get_effective_email from bug 22823

Use the get_effective_email from Koha::Library to get an appropriate
inbound address for the branch as aposed to using branchemail 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: Drop 'from_address' use 'reply_address'
Martin Renvoize [Mon, 2 Mar 2020 15:16:37 +0000]
Bug 4461: Drop 'from_address' use 'reply_address'

This patch adds support for using the reply-to field added in bug 10269
and drops 'from_address' as it will get defined at a later stage in the
emailing process anyway.

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: Remove hard requirement on OpacKohaUrl
Martin Renvoize [Mon, 2 Mar 2020 14:58:15 +0000]
Bug 4461: Remove hard requirement on OpacKohaUrl

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: Better error handling
Jonathan Druart [Wed, 26 Feb 2020 11:15:42 +0000]
Bug 4461: Better error handling

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: Simplify recipients code
Jonathan Druart [Wed, 26 Feb 2020 10:59:34 +0000]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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]
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>