koha.git
3 years agoBug 16357: Override __WARN__ in Plack to use Log4Perl
David Cook [Mon, 22 Jun 2020 03:53:16 +0000 (03:53 +0000)]
Bug 16357: Override __WARN__ in Plack to use Log4Perl

This patch overrides __WARN__ in Plack to use Log4Perl to add
timestamps to error output. The Log4Perl config uses a screen
appender so the output still goes to STDERR so that it is still
managed by Starman.

This patch adds a Plack::Middleware::LogWarn package dependency.
(The dependency is very simplistic, so we could always do out own
 version if we would prefer to skip the external dependency.)

To Test:
0) apt-get install libplack-middleware-logwarn-perl
1) Apply patch
2) Copy PLACK block from etc/log4perl.conf to
/etc/koha/sites/kohadev/log4perl.conf
3) Copy debian/templates/plack.psgi to /etc/koha/sites/kohadev/plack.psgi
4) Create some output on STDERR (it might be necessary to add
a 'warn "TEST";' line to the intranet or OPAC)
5) koha-plack --restart kohadev
6) Open /var/log/koha/kohadev/plack-error.log
7) Observe a log line like the following:
[2020/06/22 03:51:23] [WARN] TEST at /kohadevbox/koha/opac/opac-user.pl line 59.

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 17458: Remove use of datereceived from order receive page
Katrin Fischer [Tue, 14 Apr 2020 11:42:22 +0000 (11:42 +0000)]
Bug 17458: Remove use of datereceived from order receive page

Before this patch the order receive page (parcel.pl) would show
... Received by: <current user> On: <current date>

This is not really helpful. Whenever you viewed an invoice, it
would tell you it was _you_ who received that _today_.

As we don't store a creator of an invoice and the order lines
in an invoice could have been received by different people (which
we also don't know about), the "Received by" is removed by this patch.

Instead of today's date, we can show the shipment date entered for
the invoice. Again: different order lines could have been received
on different dates for this shipment. So only the shipment date makes
sense as it's on invoice level.

This also makes changes to the page title, breadcrumby and page heading:
When the invoice is closed, they will read:
  Receipt summary for [vendor] ...
When the invoice is not closed, they wil read:
  Receive orders from [vendor] ...

To test:
- Create a basket with some orders in acq
- Close the basket
- Receive shipment and create an invoice
  - Make sure shipment date is not set to today
- Verify the information shown on top of parcel.pl is you and today
- Change staff users
- Go to your invoice, it's now this user and today
- Apply patch
- Received by: should be gone and the On: replaced by Shipment date:
  with the date you selected
- Check the page title, breadcrumbs and headings read all the same 'Receive orders...'
- Finish receiving and close the invoice
- "Go to receipt page"
- Verify they now read "Receipt summary.."

If you have older invoices in your system, it would work
even better with these as you'd see that always today's date
is displaying without the patch.

Signed-off-by: Marjorie <marjorie.barry-vila@collecto.ca>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23485: Show barcode in holds to pull
Andrew Fuerste-Henry [Wed, 16 Sep 2020 11:18:49 +0000 (11:18 +0000)]
Bug 23485: Show barcode in holds to pull

Updated to only show one barcode number, with either an "only" or an "or any available" depending on whether it's an item or bib hold.
Also incorporating feedback to simplify the TT logic and remove list formatting.

To test:
1 - Place an item level hold on a bib with several items with the same callnumber
2 - View the holds to pull report
3 - Try to guess which one on the shelf is right?
4 - Apply patch
5 - See the barcode in holds to pull report
6 - You can now grab the correct item (but don't yet)
7 - Place a next available hold on the same title
8 - See the report now shows one possible valid barcode with the text "or any available."
9 - Check in a different item that fills the next available hold
10 - Now the report shows the single item for the borrower

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24780: Make items.stocknumber show up in batch item modification
Katrin Fischer [Thu, 24 Sep 2020 21:52:33 +0000 (23:52 +0200)]
Bug 24780: Make items.stocknumber show up in batch item modification

It looks like the field was intentionally removed from the list
of batch editable fields in the past. This makes sense as we
used to have a unique index on it at some point - but we do have
no more.

This removes the exception so that the invendory number behaves
like the other fields on the batch item edit form.

To test:
- Create some items with and without stocknumber
- Go to tools > batch item modification
- Enter the barcodes of your selected items in the list or
  upload a file with them
- Verify that the stocknumber/inventory number is not showing
  in the item edit form below
- Apply patch
- Reload the page - inventory number is there now
- Batch edit the inventory number and verify it works as expected

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25624: Add --where option to update_patrons_category.pl
Jonathan Druart [Tue, 1 Sep 2020 13:07:49 +0000 (15:07 +0200)]
Bug 25624: Add --where option to update_patrons_category.pl

The script did not allow to find empty fields or use wildcards

With this new option we will now have the ability to filter patrons by
some of their attributes.

Test plan:
1 - Run the script with no parameters and verify the help explains the parameters
2 - Try the script with one or more --where parameters, like:
  --where "firstname='koha'"
3 - Test null values
  --where "firstname IS NULL"
4 - Test like values with wildcards
  --where "firstname LIKE '%a%'
5 - Test like with the word null to find fields containing the word rather than being unset

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26224: Prevent double submit of header check in form
Nick Clemens [Mon, 17 Aug 2020 10:16:14 +0000 (10:16 +0000)]
Bug 26224: Prevent double submit of header check in form

To test:
 1 - Browse to Home
 1 - In the header bar select the 'Check in' tab
 2 - Type a barcode into the box
 3 - Hit Enter as many as times as you can
 4 - Check the statistics table:
    SELECT * FROM statistics WHERE itemnumber={itemnumber} AND DATE(datetime)=CURDATE();
 5 - Note you have multiple lines for the same item at the same time
 6 - Apply patch
 7 - Reload the page
 8 - Type the barcode
 9 - Press Enter even more fast and more furiously
10 - Check the statistics table
11 - Only one entry, huzzah!

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26323: (QA follow-up) Fix syntax errors
Katrin Fischer [Fri, 25 Sep 2020 16:28:17 +0000 (16:28 +0000)]
Bug 26323: (QA follow-up) Fix syntax errors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26323: (follow-up) Add new cases introduced
Martin Renvoize [Fri, 25 Sep 2020 15:53:52 +0000 (16:53 +0100)]
Bug 26323: (follow-up) Add new cases introduced

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26323: Retrieve the correct values for LOST, DAMAGED, LOC and CCODE
Jonathan Druart [Thu, 3 Sep 2020 13:59:22 +0000 (15:59 +0200)]
Bug 26323: Retrieve the correct values for LOST, DAMAGED, LOC and CCODE

Same as previously

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26323: Retrieve the correct NOT_LOAN value
Jonathan Druart [Thu, 3 Sep 2020 13:37:15 +0000 (15:37 +0200)]
Bug 26323: Retrieve the correct NOT_LOAN value

From the template we are assuming that items.notforloan is mapped with
the NOT_LOAN authorised value category, but that is not necessarily the
case.

We must retrieve the correct AV category

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26414: Tidy the tests
Jonathan Druart [Mon, 28 Sep 2020 13:32:52 +0000 (15:32 +0200)]
Bug 26414: Tidy the tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26414: Unable to export Withdrawn status using CSV profile
Alexis Ripetti [Fri, 11 Sep 2020 20:11:55 +0000 (16:11 -0400)]
Bug 26414: Unable to export Withdrawn status using CSV profile

When using CSV profiles to export MARC records, it is impossible to export the withdrawn status. I suspect it is because withdrawn is in 952$0 and 0 is considered null rather than an actual 0.

Test Plan :
1) Go to Tools > CSV profiles
2) Click on New CSV profile
3) Enter a profile name (ex. Simple record)
4) In the Profile MARC fields field enter the following (for MARC21)
245a|100a|952o|9520
5) Save your profile
6) Go to Search and search for something
7) Add a couple of things in your cart
8) Go to your cart
9) Click on Download and choose your CSV profile
10) Open the file and notice the 9520 column contains the whole of the 952 field and not just the withdrawn status
11) Apply patch
12) Redo steps 9) and 10)

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26418: Fix translatability of REFUND credit type
Martin Renvoize [Wed, 9 Sep 2020 14:34:13 +0000 (15:34 +0100)]
Bug 26418: Fix translatability of REFUND credit type

The description of REFUND type accountline credits introduced with the "issue refund" feature is not translatable.

To test:
- Make sure a language with a complete translation is installed
- Switch to the language
- Go to any user account
- Add a manual invoice
- Pay it off fully or partially
- Click on "issue refund"
- Confirm the refund
- Check the description of the line in the patron account is not translated.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26424: Better performance of svc/checkouts
Fridolin Somers [Thu, 10 Sep 2020 13:12:39 +0000 (15:12 +0200)]
Bug 26424: Better performance of svc/checkouts

Ajax script svc/checkouts display checkouts of a patron.
For each item, it fetches a Koha::ItemType object and a Koha::AuthorisedValues object for location,ccode,lost and damaged.

For performance on huge number of checkouts :
Item types should be fetch once before the loop.
authorised values should call Koha::AuthorisedValues->get_description_by_koha_field because it uses a cache.

I've tested with Plack :
Without patch :
100 checkouts = 6 seconds
1000 checkouts = 60 seconds
With patch :
100 checkouts = 5 seconds
1000 checkouts = 44 seconds

Patch also changes the fact that authorised value categories are no longer hardcoded LOC,CCODE,LOST and DAMAGED, they depend on default framework.
Like is doing Bug 26323.

Test plan :
1) Dont apply patch
2) Use sql to define some items lost and damaged
3) Look at checkouts table on a patron with a lot of checkouts
4) Apply patch
5) Look at checkouts table again
6) Check infos are the same : record level item type, item type, location, collection, lost, damaged
7) Check infos are the same in "Number of checkouts by item type"

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26490: Fix column configuration for fines trasactions
Katrin Fischer [Sun, 20 Sep 2020 22:06:32 +0000 (22:06 +0000)]
Bug 26490: Fix column configuration for fines trasactions

Hiding the last columns on the fines transactions in the
patron account in staff didn't work correctly as we had missed
adding Home library to the configuration options when it was
added.

This adds the missing definition and now all columns can be
toggled correctly.

To test:
- Go to any patron account in staff
- Go to Accounting > tab transactions (maybe add some fines)
- Toggle the columns on the table using the menu, especially
  - notes, home library and checkout date
- Go to Administration > Table configuration
- Verify the settings for the table work well from there too -
  with the patch, home_library will show as new option

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26497: "Hide all columns" throws Javascript error on aqplan.pl
Owen Leonard [Mon, 21 Sep 2020 10:59:56 +0000 (10:59 +0000)]
Bug 26497: "Hide all columns" throws Javascript error on aqplan.pl

This patch updates the JavaScript for checking and unchecking checkboxes
on the Acquisitions planning page so that it doesn't require the
checkboxes plugin.

To test, apply the patch and go to Administration -> Budgets -> Budget
details -> Planning.

On the planning page, test the "Show all columns" and "Hide all columns"
checkboxes. They should work correctly to show and hide the correct
columns.

Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26541: Remove percent sign from discount button
Andrew Fuerste-Henry [Fri, 25 Sep 2020 21:09:03 +0000 (21:09 +0000)]
Bug 26541: Remove percent sign from discount button

Realized I'd left a stray tag, fixed.

To test:
1 - go to borrower account, apply manual fee
2 - go to Transactions tab and see that fee has "% Apply discount" button
3 - apply patch, restart, reload page
4 - button just says "Apply discount"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 16314: Compiled CSS
Jonathan Druart [Mon, 28 Sep 2020 09:09:30 +0000 (11:09 +0200)]
Bug 16314: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 15933: Add +x to the script
Jonathan Druart [Mon, 28 Sep 2020 08:36:40 +0000 (10:36 +0200)]
Bug 15933: Add +x to the script

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26384: Add .t extension to make the script executed by CI
Jonathan Druart [Mon, 28 Sep 2020 08:35:01 +0000 (10:35 +0200)]
Bug 26384: Add .t extension to make the script executed by CI

The test file is not run as it does not have the .t extension

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26505: Suspend hold modal broken in the OPAC
Owen Leonard [Tue, 22 Sep 2020 11:01:30 +0000 (11:01 +0000)]
Bug 26505: Suspend hold modal broken in the OPAC

This patch makes corrections to the markup for the suspend hold modal in
the OPAC. It hadn't been updated during the upgrade to Bootstrap 4.

The JavaScript controlling the "suspend until" datepicker has been
modified because the datepicker pop-up was not positioned correctly in
this new version.

Unrelated: The markup for confirmation modals has been updated to
replace Bootstrap 3's "btn-default" with Bootstrap 4's "btn-secondary."

To test, apply the patch and make sure the SuspendHoldsOpac and
AutoResumeSuspendedHolds system preferences are enabled.

- Log in to the OPAC as a user who has holds.
- On the "Your summary" page open the "Holds" tab.
- In the list of holds, click the "Suspend" button.
- The modal should appear and look correct.
- Test the "Suspend until" field: Clicking in the form field should
  trigger the datepicker. It should be positioned correctly under the
  form field.
- Confirm that the datepicker populates the field.
- Submit the suspension and confirm that the hold is suspended.
- Click the "Cancel" button for a hold. Confirm that the confirmation
  dialog appears correctly.

Edit: Updated class of hidden submit button. Test the page with JS
disabled to test that the "Suspend until" form works correctly.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25758: Return on_reserve over too_soon when not calling from automatic_renewals...
Nick Clemens [Fri, 4 Sep 2020 12:47:58 +0000 (12:47 +0000)]
Bug 25758: Return on_reserve over too_soon when not calling from automatic_renewals cron

Bug 19014 altered CanBookBeRenewed to return (auto_)too_soon over on_reserve

For cron purposes this is the correct behaviour.

For display purposes we wish to see on_reserve over too_soon

This patchset adds a switch to 'CanBookBeRenewed' to alter the priority of these statuses

To test:
 1 - set NoRenewalBeforePrecision to date only
 2 - set a circ rule to auto-renewal=yes, no renewal before=0, checkout period to 7 days
 3 - check item out
 4 - confirm item shows Scheduled For Automatic Renewal in issues table
 5 - place a hold on the item for another patron
 6 - reload issues table for patron 1, confirm checkout still shows "scheduled for automatic renewal" rather than "on hold"
 7 - change No Renewal Before value to 7
 8 - reload issues table for patron 1, confirm checkout now shows "on hold"
 9 - Apply patch
10 - restart_all
11 - Reload the issues table - confirm 'on_hold' still shows
12 - Change No Renewal Before to 0
13 - Refresh issues table, still shows 'On hold'
14 - perl misc/cronjobs/automatic_renewals.pl -v
15 - Result shows 'auto_too_soon'
16 - prove -v t/db_dependent/Circulation.t

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25265: (QA follow-up) Check server type in Elasticsearch::index_records
Marcel de Rooy [Fri, 25 Sep 2020 07:42:44 +0000 (07:42 +0000)]
Bug 25265: (QA follow-up) Check server type in Elasticsearch::index_records

Doing the same change as previously (renaming biblionumber), but fixing
at the same the record fetch. If (theoretically) an authority is passed
without a record, it would have fetched a biblio record.

Test plan:
You need Elasticsearch here.
Replaced this line in AddAuthority:
    $indexer->index_records( $authid, "specialUpdate", "authorityserver", $record );
by
    $indexer->index_records( $authid, "specialUpdate", "authorityserver", undef );
And updated an authority record. Check if you can search for the change.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25265: (QA follow-up) Rename biblionumber in ModZebra, index_records
Marcel de Rooy [Fri, 25 Sep 2020 07:02:56 +0000 (07:02 +0000)]
Bug 25265: (QA follow-up) Rename biblionumber in ModZebra, index_records

ModZebra:
The name is very misleading: we can index authid's too here.
And yes, it should not be in C4/Biblio too ;) A first step..

Adding the same change here in Koha/SearchEngine/Zebra/Indexer.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25265: (QA follow-up) Add shebang to Indexer.t
Marcel de Rooy [Fri, 25 Sep 2020 06:29:14 +0000 (06:29 +0000)]
Bug 25265: (QA follow-up) Add shebang to Indexer.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25265: (follow-up) Don't index malformed records
Nick Clemens [Wed, 23 Sep 2020 18:57:26 +0000 (18:57 +0000)]
Bug 25265: (follow-up) Don't index malformed records

This is analogous to 26522, we shoudl skip record that cannot be retrieved for indexing

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25265: Fix copy paste error for parameter
Nick Clemens [Tue, 22 Sep 2020 17:38:03 +0000 (17:38 +0000)]
Bug 25265: Fix copy paste error for parameter

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25265: Rename skip_modzebra_update to skip_record_index
Nick Clemens [Thu, 17 Sep 2020 12:55:53 +0000 (12:55 +0000)]
Bug 25265: Rename skip_modzebra_update to skip_record_index

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25265: Prevent double reindex of the same item in batchmod
Nick Clemens [Wed, 5 Aug 2020 12:20:47 +0000 (14:20 +0200)]
Bug 25265: Prevent double reindex of the same item in batchmod

When batch editing, 2 reindex calls are sent to ES/Zebra.
We can easily avoid that reusing the skip_modzebra_update (renamed skip_record_index)

Additionally we should only send one request for biblio, and we should
only do it if we succeed

As the whole batch mod is in a transaction it is possible to fail in which case
Zebra queue is reset, but ES indexes have already been set

In addition to the skip param this patchset moves Zebra and Elasticsearch calls to
Indexer modules and introduces a generic Koha::SearchEngine::Indexer so that we don't
need to check the engine when calling for index

The new index_records routine takes an array so that we can reduce the calls to
the ES server.

The index_records routine for Zebra loops over ModZebra to avoid affecting current behaviour

Test plan:

General tests, under both search engines:
  1 - Add a biblio and confirm it is searchable
  2 - Edit the biblio and confirm changes are searchable
  3 - Add an item, confirm it is searchable
  4 - Delete an item, confirm it is not searchable
  5 - Delete a biblio, confirm it is not searchable
  6 - Add an authority and confirm it is searchable
  7 - Delete an authority and confirm it is not searchable

Batch mod tests, under both search engines
  1 - Have a bib with several items, none marked 'not for loan'
  2 - Do a staff search that returns this biblio
  3 - Items show as available
  4 - Click on title to go to details page
  5 - Edit->Item in a batch
  6 - Set the not for loan status for all items
  7 - Repeat your search
  8 - Items show as not for loan
  9 - Test batch deleting items
    a - Test with a list of items, not deleting bibs
    b - Test with a list of items, deleting bibs if no items remain where all items are only item on a biblio:
     SELECT MAX(barcode) FROM items GROUP BY biblionumber HAVING COUNT(barcode) IN (1)
    c - Test with a list of items, deleting bibs if no items remain where some items are the only item on a biblio:
     SELECT MAX(barcode) FROM items GROUP BY biblionumber HAVING COUNT(barcode) IN (1,2)
 10 - Confirm records are update/deleted as appropriate

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25265: Unit tests
Nick Clemens [Thu, 17 Sep 2020 11:43:44 +0000 (11:43 +0000)]
Bug 25265: Unit tests

These cover Koha::SearchEngine::Indexer and ensure that all calls in the code
are routed correctly to the expected search engine

Bug 25265: (follow-up) Skip tests if elastic not configured

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26510: Transport Cost Matrix editor doesn't show all data when HoldsQueueSkipClos...
Kyle M Hall [Tue, 22 Sep 2020 18:10:10 +0000 (14:10 -0400)]
Bug 26510: Transport Cost Matrix editor doesn't show all data when HoldsQueueSkipClosed is enabled

If HoldsQueueSkipClosed is enabled, and a library happens to be closed
on the day you edit the transport cost matrix, all the values for that
library will not show. Instead they will appear disabled, and if you
were to edit the cell and save a new value in it, it will also
'disappear' when the page is reloaded.

Test Plan:
1) Set today as a holiday for a library
2) Set HoldsQueueSkipClosed to 'open'
3) Go to the transport cost matrix editor
4) Edit a cell where the 'from' is for the closed library
5) Note the value doesn't 'save', it is still in the database though
6) Apply this patch
7) Restart all the things!
8) Reload the transport cost matrix editor
9) The value now appears correctly!

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26434: Fix plugin dirs addition to @INC
Fridolin Somers [Fri, 11 Sep 2020 14:03:28 +0000 (16:03 +0200)]
Bug 26434: Fix plugin dirs addition to @INC

Plugin dirs defined in koha-conf.xml are added to @INC in order to compile perl code.
Looks like with plack those dirs are added several times.
This may lead to an error "INCLUDE_PATH exceeds 64 directories".

This bug was identified with Carrousel plugin : https://inlibro.com/instructions-carrousel/

Test plan :
1) Enable plack and plugins
2) Look at page about.pl : @INC contains one plugin dir 'var/lib/plugins'
3) Install plugin KitchenSink : https://github.com/bywatersolutions/koha-plugin-kitchen-sink
4) Dont apply patch
5) Use configure on KitchenSink
6) Look at page about.pl : @INC contains server plugin dir 'var/lib/plugins'
7) Apply patch and restart plack
8) Use configure on KitchenSink
9) Look at page about.pl : @INC contains one plugin dir 'var/lib/plugins'

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26438: Rename temporary Koha::Item variables to avoid conflict
Colin Campbell [Fri, 11 Sep 2020 17:16:28 +0000 (18:16 +0100)]
Bug 26438: Rename temporary Koha::Item variables to avoid conflict

Returns from Koha::Item calls were stored in temporary variables
called $item. Unfortunately they occur in routines already with
an $item variable holding a lineitem and hide that variable although
only required for two lines of code. An error occurs if girfield
is called on the wrong variable. Renamed all three occurences
of $item to $kitem to avoid the error

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26231: Remove incorrect use of AddAuthority() when 001 present
David Cook [Tue, 18 Aug 2020 02:20:32 +0000 (12:20 +1000)]
Bug 26231: Remove incorrect use of AddAuthority() when 001 present

This patch removes the use of AddAuthority with a non-empty
authid argument, since that triggers an update rather than an insert.

In practice, the update also fails, but the error isn't raised,
as the database connection doesn't have RaiseError set.

Test plan:
1) Do not apply patch
2) Try to bulkmarcimport an authority file with a 001
3) Observe that the script reports success but no authority is added
4) Apply the path
5) Try to bulkmarcimport an authority file with a 001
6) Observe that the script reports success and the authority is added

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26341: Database update for bug 21443 is not idempotent and will destroy settings
Kyle M Hall [Tue, 1 Sep 2020 14:42:47 +0000 (10:42 -0400)]
Bug 26341: Database update for bug 21443 is not idempotent and will destroy settings

If the database update for bug 21443 is run, and the library changes any
of the hourly or daily rental fees following the calendar, a second run
of the database update will overwrite those changes.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26507: Elasticsearch - Index records after storing new item
Nick Clemens [Tue, 22 Sep 2020 14:14:55 +0000 (14:14 +0000)]
Bug 26507: Elasticsearch - Index records after storing new item

Currently Item->store indexes the record before the DB update - that is wrong

To test:
 1 - Find/create a bib with no items
 2 - add an item with barcode "abc123"
 3 - do a general keyword search for "abc123," see your bib is not in the results
 4 - perform a search that includes your bib in the results, confirm it shows as having no items
 5 - click through to bib details, confirm it shows your item here
 6 - edit and save your item
 7 - confirm barcode is now searchable
 8 - apply patches
 9 - Add a new item "cde456"
10 - Confirm it returns in searches
11 - Edit 'cde456' and change barcode to 'fgh789'
12 - Confirm the new abrcode is searchable

Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24807: (QA follow-up) Remove uneccessary tests
Nick Clemens [Fri, 18 Sep 2020 10:35:43 +0000 (10:35 +0000)]
Bug 24807: (QA follow-up) Remove uneccessary tests

These tests fail now, the code expects a real response from ES in Indexer.pm
but these tests mock 'bulk' and so don't have the necessary fields.

We are testing the same code above and can just add the _id == biblionumber test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 19889: (follow-up 2) update DB adjustments
Jonathan Druart [Wed, 23 Sep 2020 19:59:02 +0000 (21:59 +0200)]
Bug 19889: (follow-up 2) update DB adjustments

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 19889: (follow-up) update DB adjustments
Jonathan Druart [Fri, 18 Sep 2020 09:38:57 +0000 (11:38 +0200)]
Bug 19889: (follow-up) update DB adjustments

Fix fields order

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 18958: DBRev 20.06.00.039
Jonathan Druart [Fri, 18 Sep 2020 09:46:10 +0000 (09:46 +0000)]
Bug 18958: DBRev 20.06.00.039

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 18958: (follow-up) Ensure hold fill target reserve_id is set for all hold types
Nick Clemens [Tue, 25 Aug 2020 10:35:02 +0000 (10:35 +0000)]
Bug 18958: (follow-up) Ensure hold fill target reserve_id is set for all hold types

MapItemsToHoldRequests has three sections: Local holds, item level holds, bib level holds

Only one of them was setting the reserve_id. This patch makes al three set it and adds tests

To test:
1 - Repeat test plan on bug
2 - sudo koha-mysql kohadev
    SELECT * FROM hold_fill_targets
3 - Ensure reserve_id is set at appropriate times
4 - prove -v  t/db_dependent/HoldsQueue.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Bug 18958: (QA follow-up) Fix number of tests

In HoldsQueue.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 18958: DBIC schema changes
Nick Clemens [Tue, 25 Aug 2020 09:55:42 +0000 (09:55 +0000)]
Bug 18958: DBIC schema changes

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 18958: (QA follow-up) Add missing comma to kohastructure.sql
Katrin Fischer [Sat, 22 Aug 2020 03:12:36 +0000 (03:12 +0000)]
Bug 18958: (QA follow-up) Add missing comma to kohastructure.sql

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 18958: Make hold_fill_targets specific to reserves
Nick Clemens [Fri, 14 Aug 2020 11:06:40 +0000 (11:06 +0000)]
Bug 18958: Make hold_fill_targets specific to reserves

After looking at Marcel's comments, the problem is in our matching
to hold_fill_targets - rather than adjusting to find filled/waiting holds we
could ensure that hold_fill_targets only refers to the specific hold it
is intended to

This patch is clearer, if slightly less performant than last (we now return all
the reserves and have to find the 'highest')

Test Plan:
 1 - Create and use a patron that can place multiple record level holds per record
 2 - Create a record with X items, each at a different library
 3 - Place X 'Next available' holds on the record for the patron using the 'Holds to place' box
 4 - perl misc/cronjobs/holds/build_holdsqueue.pl
 5 - Check in LibraryA's copy as LibraryA and confirm the hold
 6 - Revisit request.pl for the record, notice the next hold in line is now item-specific
 7 - Checkout the item to the patron, notice the remaining hold is marked waiting
 8 - Attempt to place another hold for your patron, notice that it requires an item-specific hold
 8 - Apply this patch
 9 - Repeat steps 1-5
10 - Revisit request.pl for the record, notice the next hold in line has *not* become item-specific
11 - Checkout the item to the patron, ensure the first hold is filled and the second remains record level
12 - Repeat whole test plan without building holds queue to confirm holds are still treated correctly

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 18958: Unit tests
Nick Clemens [Mon, 12 Aug 2019 18:41:24 +0000 (18:41 +0000)]
Bug 18958: Unit tests

Signed-off-by: Bonnie Gardner <bgardner@cityoflewiston.org>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
JD amended patch: perltidy and simplify item/biblio creation

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26448: Don't overwrite commit parameter passed to koha-elasticsearch
Joonas Kylmälä [Mon, 14 Sep 2020 07:27:24 +0000 (10:27 +0300)]
Bug 26448: Don't overwrite commit parameter passed to koha-elasticsearch

The "--commit" or "-c" parameter was incorrectly not used if it was
passed to the koha-elasticsearch program.

To test:
1) Before patch notice koha-elasticsearch --rebuild --commit 1 -v <instance>
   only commits every 5000 records
2) Apply patch and notice the above command commits every 1 record

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26451: fix typo in bulkmarcimport.pl
Andreas Roussos [Mon, 14 Sep 2020 08:08:23 +0000 (10:08 +0200)]
Bug 26451: fix typo in bulkmarcimport.pl

bulkmarcimport.pl displays a small typo when a MARC modification
template is being used: "modofication".

This patch fixes that.

Test plan: apply the patch, and confirm the script no longer
displays the typo.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26283: Add dateexpiry and dateenrolled to new borrower fields modal
Katrin Fischer [Thu, 27 Aug 2020 07:30:54 +0000 (07:30 +0000)]
Bug 26283: Add dateexpiry and dateenrolled to new borrower fields modal

While these may not make sense for all patron field preferences, I think
it's better to have them in general than to have them missing.

To test:
- Check the modal for BorrowerMandatoryField system preference
- Verify dateenrolled and dateexpiry fields are missing
- Apply patch
- Verify the dates are listed now
- Set both to mandatory
- Verify that they are indeed mandatory when adding a new patron now

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26421: Use Bootstrap screen reader text class for shelf browser messages
Owen Leonard [Wed, 9 Sep 2020 15:58:04 +0000 (15:58 +0000)]
Bug 26421: Use Bootstrap screen reader text class for shelf browser messages

This patch udpates the markup added by Bug 26039, replacing the "hidden"
class, which is no longer functional with Bootstrap 4, with "sr-only," a
class designed specifically for screen reader text.

The patch also corrects a typo, "shelfbrowers" -> "shelf browser"

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

View the detail page for a bibliographic record with items. In the
holdings table, you should see links labeled "Browse shelf."

When you open the shelf browser there should be a link at the top that
reads "Close shelf browser."

If you have access to a screen reader, test that the hidden text is
announced by the reader. "Browse shelf (Opens below)" and "Close shelf
browser (Hides shelf browser)."

Signed-off-by: Stina Hallin <stina.hallin@ub.lu.se>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26464: Code correction in opac-main when news_id passed
Marcel de Rooy [Tue, 15 Sep 2020 12:09:56 +0000 (12:09 +0000)]
Bug 26464: Code correction in opac-main when news_id passed

Theoretical change. If somehow the search would return more than one result, the code is wrong.

The if test can be simplified: remove scalar and >0.
We should not pass @array to one param. It would theoretically add wrong items or
trigger an odd number warning. If it is only one, it is no problem. But it is buggy.

Test plan:
Pass an existing news_id to opac-main. Item visible?
And pass a not-existing. Error message?

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 10921: Prevent an order from a closed basket to be edited
Jonathan Druart [Fri, 31 Jul 2020 09:15:57 +0000 (11:15 +0200)]
Bug 10921: Prevent an order from a closed basket to be edited

We don't allow editing of orders that are part of a closed basket, but
we don't enforce the rule in the controller file.

This patch use output_and_exit to stop the script and display an error
to the end user.

Test plan:
Create a basket, add an order
On the basket view you see the "Modify" link, open it in a separate tab
=> You can edit the basket
Keep this tab open, get back to the other one and close the basket
Reload the tab with the order edition form
=> You cannot longer edit the basket

QA: Do we need a check in addorder.pl as well?

Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 15933: Add cataloguing plugin to search for existing publishers in other records
Owen Leonard [Mon, 13 Jul 2020 17:42:36 +0000 (17:42 +0000)]
Bug 15933: Add cataloguing plugin to search for existing publishers in other records

This patch adds a new cataloging plugin for MARC21 installations,
marc21_field-260b.pl. When enabled it provides autocomplete for
publisher name, pulling existing data from biblioitems.publishercode.

To test, apply the patch and enable the plugin:

- Go to Administration -> MARC bibliographic framework -> MARC structure
  -> 260 -> Edit subfields -> Subfield b -> Other options.
- Set "Plugin" to marc21_field_260b.pl.
- Go to Cataloging and edit or create a record.
- Under tab 2 click the field for 260$b. Start typing a publisher name.
  A dropdown should appear with matching publishers.
- Selecting one of the results should populate the form field with that
  information.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Also works with 264$b.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24807: DBRev 20.06.00.038
Jonathan Druart [Fri, 18 Sep 2020 09:46:10 +0000 (09:46 +0000)]
Bug 24807: DBRev 20.06.00.038

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24807: (follow-up) Add support for spaces as unknown characters
Nick Clemens [Fri, 10 Jul 2020 13:15:58 +0000 (13:15 +0000)]
Bug 24807: (follow-up) Add support for spaces as unknown characters

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24807: (follow-up) Fix spelling
Nick Clemens [Thu, 7 May 2020 16:26:38 +0000 (16:26 +0000)]
Bug 24807: (follow-up) Fix spelling

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24807: Simplify with new and imporved value_callbacks
David Gustafsson [Mon, 20 Apr 2020 11:03:24 +0000 (13:03 +0200)]
Bug 24807: Simplify with new and imporved value_callbacks

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24807: Refactor using tokenize_callbacks
David Gustafsson [Thu, 16 Apr 2020 15:26:41 +0000 (17:26 +0200)]
Bug 24807: Refactor using tokenize_callbacks

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24807: Add suppport for uncertain fields and ranges
Nick Clemens [Wed, 8 Apr 2020 09:55:20 +0000 (09:55 +0000)]
Bug 24807: Add suppport for uncertain fields and ranges

To test:
1 - Have some records with uncertain dates in the 008
    19uu, 195u, etc.
2 - Index them in Elasticsearch
3 - Do a search that will return them
4 - Sort results by publication/copyright date
5 - Note odd results
6 - Apply patch
7 - Reindex
8 - Sorting should be improved

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24807: Update tests
David Gustafsson [Thu, 16 Apr 2020 12:51:13 +0000 (14:51 +0200)]
Bug 24807: Update tests

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24807: Add database update script
David Gustafsson [Thu, 5 Mar 2020 10:35:32 +0000 (11:35 +0100)]
Bug 24807: Add database update script

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24807: Add "year" type to improve sorting behaviour
David Gustafsson [Wed, 4 Mar 2020 16:07:11 +0000 (17:07 +0100)]
Bug 24807: Add "year" type to improve sorting behaviour

Add a "year" search field type. Fields with this type will only
retain values that looks like years, so invalid values such as
whitespace or word characters will not be indexed.
This for instance improves the behaviour when sorting by
"date-of-publication". If all values are indexed, records with
junk data instead of valid years will appear first among the search
results, drowning out more relevant hits. If assigning this field
the "year" type these records will instead always appear last,
regarless of sort order.

To test:

1) Have at least two biblios, one with a valid year in 008 (pos 7-10)
and another with an invalid one ("uuuu" for example)
2) Perform a wildcard search (*) and sort results by publication date.
3) The record with invalid year of pulication in 008 should appear first
4) Apply patch and run database updates
5) Reindex ElasticSearch
6) Perform the same search as in 2)
7) The record with the invalid year should now appear last

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25744: replace <b> with <strong> in the staff interface
Lucas Gass [Thu, 6 Aug 2020 18:21:52 +0000 (18:21 +0000)]
Bug 25744: replace <b> with <strong> in the staff interface

This patch set attempts to replace all the <i> tags with <em> and all
the <b> tags with <strong> in the staff interface.
I attempted to get all the templates, includes, and xslt files.

To test:

1. Review the changes as best as possible, looking for mistakes.
2. grep for <i> and <b> in the modules, includes, and xslt folders. You should get nothing/
3. If you grep '<\/i>' you should only see instances of Font Awesome.
4. If you grep '<\/b>' you should only see instances where caret is used.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25744: Replace <i> with <em> in staff interface
Lucas Gass [Thu, 6 Aug 2020 17:29:54 +0000 (17:29 +0000)]
Bug 25744: Replace <i> with <em> in staff interface

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26049: Replace li with span class results_summary in UNIMARC intranet XSLT
Fridolin Somers [Thu, 23 Jul 2020 08:21:36 +0000 (10:21 +0200)]
Bug 26049: Replace li with span class results_summary in UNIMARC intranet XSLT

In all XSLT for record display, fields are created with <span class="results_summary> except in UNIMARC intranet where there is just <li>.

This allows a better CSS customisation and closer code in files for OPAC and intranet.

Actually li gets diplayed with a dot at each line, we don't want this.

Test plan :
1) For each modified file run 'xsltproc file.xsl' and see there is no
   error
2) Use default XSLT in all system preferences
3) Perform a search and check display with and without patch
4) Click on a record to see details and check display with and without patch

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26262: (follow-up) Fix course details page, default configuration
Owen Leonard [Mon, 31 Aug 2020 12:33:19 +0000 (12:33 +0000)]
Bug 26262: (follow-up) Fix course details page, default configuration

Bug 25287 changed the default DataTable configuration in the OPAC so
that tables are paginated by default. This is inconsistent with the way
we currently use DataTables in the OPAC, and the change was probably
unintentional. This patch returns the default pagination configuration
to what it was before: Off.

The patch also updates opac-course-details.tt with the same DOM
configuration as opac-course-reserves.tt.

To test, apply the patch and view the list of course reserves and the
list of titles attached to a course. In both cases there should be no
pagination controls, and the tables should show all results.

Signed-off-by: Alexis Ripetti <alexis.ripetti@inLibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26262: Remove wrong dom setting in course reserves (OPAC)
Tomas Cohen Arazi [Wed, 26 Aug 2020 15:41:47 +0000 (12:41 -0300)]
Bug 26262: Remove wrong dom setting in course reserves (OPAC)

The current setting required pagination to be displayed. This was hidden
probably as a side effect of styling settings. But the docs are clear on
the fact that p and l are intended for displaying pagination controls
and table rows lenght information [1]

As the course reserves datatable is not paginated, this needs to be
fixed properly by removing those controls in the configuration. This
patch does so.

To test:
1. Have some course reserves
2. See them in the OPAC
=> FAIL: Some funky, misaligned pagination artifacts are displayed
3. Apply this patch and reload
=> SUCCESS: Things are back to normal!
4. Sign off :-D

[1] https://datatables.net/examples/basic_init/dom.html

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26301: Use CanBookBeRenewed when renewing via self-checkout
David Cook [Wed, 26 Aug 2020 07:35:36 +0000 (07:35 +0000)]
Bug 26301: Use CanBookBeRenewed when renewing via self-checkout

Currently, if you have OverduesBlockCirc set to "Ask for confirmation"
and OverduesBlockRenewing set to "allow renewing", you get caught
in a loop where you can never renew an overdue material.

This patch uses CanBookBeRenewed for renewals, rather than CanBookBeIssued,
which means the correct rules are applied to the correct scenario.

To test:

a. Set OverduesBlockCirc to "Ask for confirmation"
b. Ensure "OverduesBlockRenewing" set to "allow renewing"
0. Apply the patch
1. Checkin item barcode 3999900000001
2. Go to http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=51
3. Checkout item barcode 3999900000001 to 1 year ago
4. Go to http://localhost:8080/cgi-bin/koha/sco/sco-main.pl
5. Login as the "koha" user
6. Click on "Renew item"
7. Note that the item is renewed

8. Checkin item barcode 3999900000001
9. Go to http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=51
10. Checkout item barcode 3999900000001 to 1 year ago
11. Go to http://localhost:8080/cgi-bin/koha/sco/sco-main.pl
12. Login as the "koha" user
13. Type "3999900000001" into the box under "Scan a new item or enter its barcode"
14. Click "Submit"
15. Note the system says the item is already checked out and it prompts
you to click "Renew item" in this screen
16. Click "Renew item"
17. Note the system says "Item renewed" near the top of the screen, and the "Due"
date near the bottom of the screen is more recent than the original due date

18. Checkin item barcode 3999900000001
19. Go to http://localhost:8080/cgi-bin/koha/sco/sco-main.pl
20. Login as the "koha" user
21. Type "3999900000001" into the box under "Scan a new item or enter its barcode"
22. Click "Submit"
23. Note the system says "Item checked out" and the item appears in the checkouts
at the bottom of the screen

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26435: (QA follow-up) Terminology: Fix some more borrowers in other preferences
Katrin Fischer [Sat, 12 Sep 2020 17:53:26 +0000 (17:53 +0000)]
Bug 26435: (QA follow-up) Terminology: Fix some more borrowers in other preferences

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26435: (QA follow-up) Fix terminology: borrower to patron in new hint
Katrin Fischer [Sat, 12 Sep 2020 17:51:52 +0000 (17:51 +0000)]
Bug 26435: (QA follow-up) Fix terminology: borrower to patron in new hint

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26435: Add warning to AutoSelfCheck sysprefs
Andrew Fuerste-Henry [Fri, 11 Sep 2020 15:39:53 +0000 (15:39 +0000)]
Bug 26435: Add warning to AutoSelfCheck sysprefs

To test:
1- apply patch, restart
2- look up AutoSelfCheck sysprefs
3- confirm new note in description

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26460: Fix line ending in JSON
Nick Clemens [Mon, 14 Sep 2020 17:44:36 +0000 (17:44 +0000)]
Bug 26460: Fix line ending in JSON

Wrong line ending in JSON causes error:
Uncaught SyntaxError: missing } after property list
note: { opened at line 29579, column 15

To test:
1 - Have a title with some items not for hold in staff interface
2 - Set AllowHoldPolicyOverride to 'Allow'
3 - Attempt to place hold on the title
4 - Note JS error in the console and datatable does not load for items
5 - Apply patch
6 - Reload
7 - Error is cleared, table loads correctly

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25969: Don't set itemnumber as reserve->itemnumber
Nick Clemens [Fri, 4 Sep 2020 16:16:27 +0000 (16:16 +0000)]
Bug 25969: Don't set itemnumber as reserve->itemnumber

When a hold is checked in at the wrong destination we revert the found status
For a title level hold this means we return it to a title level hold, with no itemnumber

When we checkin the item we find the hold, but won't set the itemnumber in the hold until it is confirmed

In the script we were setting the itemnumber param, but then setting it again using the reserve itemnumber.
In all conditions before the itemnumber has been set, we don't need to set it again, especially when we do
so incorrectly

To test:
- Log in at Library A
- Place hold on item at Library A, for pickup at Library A
- Check item in at Library A
- Click "Confirm hold"
- Set library to Library B
- Check item in again (try with both the box on reutrns.pl and the box in the header)
- Click "Confirm hold and transfer"
- get error: Can't call method "biblio" on an undefined value at /kohadevbox/koha/circ/returns.pl line 147
- apply patch
- repeat
- success!
- confirm trappings of holds works as normally otherwise too

Signed-off-by: Daniel Gaghan <daniel.gaghan@pueblolibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25969: Checking in a found hold at a different branch then confirming the hold...
Kyle M Hall [Thu, 9 Jul 2020 18:36:31 +0000 (14:36 -0400)]
Bug 25969: Checking in a found hold at a different branch then confirming the hold causes internal server error

If a record level hold is filled and waiting at Library A, and the item
is checked in at Library B, and an attempt is made to re-fill the hold
with the item, Koha will return an ISE.

Test Plan:
1) Place a hold for Library A, at Library A, for pickup at Library A
2) Check in the item at Library A and fill the hold so it is waiting at Library A
3) Log in as Library B, check in the same barcode
4) Note the request to fill the hold with the item
5) Choose to fill the hold
6) Note you get an internal server error
7) Apply this patch
8) Restart all the things!
9) Repeat steps 1-5
10) No ISE!

Signed-off-by: Daniel Gaghan <daniel.gaghan@pueblolibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26420: Use translated notices for overdue_notices.pl
Jonathan Druart [Thu, 10 Sep 2020 07:42:58 +0000 (09:42 +0200)]
Bug 26420: Use translated notices for overdue_notices.pl

This script does not pass the patron's preferred lang for notices.

Test plan:
Enable TranslateNotices
Create a patron with a preferred lang for notices != default
Translate ODUE for this language
Setup the overdue notices for this patron's category
Check an item out for this patron (select the correct due date to
trigger the notice)
Run the script overdue_notices.pl
Check the message_queue table and confirm that the notice enqueued is
translated

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26269: Fix variable name mismatch for cash_register in paycollect
Martin Renvoize [Wed, 16 Sep 2020 10:02:22 +0000 (11:02 +0100)]
Bug 26269: Fix variable name mismatch for cash_register in paycollect

It appears that through various rebases the variable names in the form
and the controller script have become mismatched.  This patch corrects
the situation and clarifies their intended use.

Test plan:
1/ Turn on cash registers in sysprefs
2/ Define at least 2 cash registers in Admin
3/ Create a manual invoice on a patron
4/ Pay off half of your fee, selecting the first register
5/ Pay off the remaining fee, selecting the second register
6/ Query accountlines.register_id for your two payments
8/ Confirm the two accountlines.register_id's do not match (thus the
passed variable was used)

https://bugs.koha-community.org/show_bug.cgi?id=26469

Signed-off-by: Jessie Zairo <jzairo@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26470: Store the item before calling the after action hook
Tomas Cohen Arazi [Tue, 15 Sep 2020 19:23:05 +0000 (16:23 -0300)]
Bug 26470: Store the item before calling the after action hook

This patch makes Koha::Item->store call $self->SUPER::store before
calling the hook, so things like the itemnumber (AUTO_INCREMENT field)
are available to the plugin hook.

It does so by storing the output on a temporary variable, to keep the
current behaviour of just returning the output from SUPER::store.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t \
           t/db_dependent/Koha/Item.t \
           t/db_dependent/Koha/Items.t
=> FAIL: the hooks tests fail. Item.t hasn't been altered so should pass
3. Apply this patch
4. Repeat 2.
=> SUCCESS: Tests pass! Item.t as well! (i.e. no behaviour change)
5. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26470: Regression tests
Tomas Cohen Arazi [Tue, 15 Sep 2020 19:21:33 +0000 (16:21 -0300)]
Bug 26470: Regression tests

This patch tweaks the test plugin so it composes an exception based on
the fact that the hook was called with the item and item_id parameters
defined.

It then makes the tests expect a specific exception message with
information about this.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t
=> FAIL: Tests fail!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26407: fix query in 'title exists' in `search_for_data_inconsistencies.pl`
Fridolin Somers [Tue, 8 Sep 2020 14:54:19 +0000 (16:54 +0200)]
Bug 26407: fix query in 'title exists' in `search_for_data_inconsistencies.pl`

Bug 23871 added check for 'title exists' to `search_for_data_inconsistencies.pl`.
There is a typo in DBIx query to create or : hashref instead of arrayref.

Test plan :
1) Change title of biblio record XXX in SQL :
   UPDATE biblio SET title = '' WHERE biblionumber=XXX
2) Change title of biblio record YYY in SQL :
   UPDATE biblio SET title = NULL WHERE biblionumber=YYY
3) Run misc/maintenance/search_for_data_inconsistencies.pl
4) Check you see both records

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 20168: Compiled CSS - RTL files
Jonathan Druart [Fri, 18 Sep 2020 08:32:15 +0000 (10:32 +0200)]
Bug 20168: Compiled CSS - RTL files

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26394: Update .mailmap
Jonathan Druart [Fri, 4 Sep 2020 16:25:45 +0000 (18:25 +0200)]
Bug 26394: Update .mailmap

The .mailmap file used to generate the stats is different from the one we have in our repo. It's much more complete and should be integrated into Koha.

Test plan:
Confirm that the different mappings are correct

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26365: Remove comparison with 0000-00-00 for datecancellationprinted
Jonathan Druart [Thu, 3 Sep 2020 09:58:14 +0000 (11:58 +0200)]
Bug 26365: Remove comparison with 0000-00-00 for datecancellationprinted

Using MySQL 8:
t/db_dependent/Koha/Acquisition/Order.t .. 10/11 No method count found for Koha::Acquisition::Orders DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Incorrect DATE value: '0000-00-00' [for Statement "SELECT COUNT( * ) FROM `aqorders` `me` WHERE ( ( ( `datecancellationprinted` IS NULL OR `datecancellationprinted` = ? ) AND `ordernumber` IN ( ?, ?, ? ) ) )" with ParamValues: 0='0000-00-00', 1=23, 2=24, 3=25] at /kohadevbox/koha/Koha/Objects.pm line 597

We must remove the comparison with 0000-00-00

Highlighted by bug 23166.

I wanted to provide a DB rev but we (obviously) cannot:
MySQL [koha_kohadev]> UPDATE aqorders SET datecancellationprinted=NULL WHERE datecancellationprinted="0000-00-00";
ERROR 1292 (22007): Incorrect date value: '0000-00-00' for column 'datecancellationprinted' at row 1

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26384: (QA follow-up) Fix two exceptions
Marcel de Rooy [Fri, 11 Sep 2020 07:11:22 +0000 (07:11 +0000)]
Bug 26384: (QA follow-up) Fix two exceptions

AuthUtils.t went back to 644, but should be 755
Adding an exception in the xt test for fix-old-fsf-address.exclude

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26384: Add test to catch for missing or extra execution flags
Jonathan Druart [Mon, 7 Sep 2020 09:31:52 +0000 (11:31 +0200)]
Bug 26384: Add test to catch for missing or extra execution flags

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26384: Fix executable flags
Jonathan Druart [Mon, 7 Sep 2020 09:33:08 +0000 (11:33 +0200)]
Bug 26384: Fix executable flags

.pm must not have -x
.t must have -x
.pl must have -x

Test plan:
Apply only the first patch, run the tests and confirm that the failures
make sense
Apply this patch and confirm that the test now returns green

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26401: Remove xt/fix-old-fsf-address*
Jonathan Druart [Mon, 7 Sep 2020 09:25:38 +0000 (11:25 +0200)]
Bug 26401: Remove xt/fix-old-fsf-address*

On bug 24545 we fixed all the license statements and added a QA check + a test in our test suite.
We do not longer need this script.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26007: (QA follow-up) Fix English yml file
Marcel de Rooy [Fri, 11 Sep 2020 06:31:04 +0000 (06:31 +0000)]
Bug 26007: (QA follow-up) Fix English yml file

git grep -l -E "link:\s*\"?[0-9]" | xargs sed -i -e "/link:/ s/130/\"Title-uniform\"/"
Only one occurrence without quotes around 130.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26250: Fix regressions.t when SearchEngine=ES
Jonathan Druart [Thu, 10 Sep 2020 08:41:32 +0000 (10:41 +0200)]
Bug 26250: Fix regressions.t when SearchEngine=ES

Prior to this patch it failed with:
t/db_dependent/selenium/regressions.t .. 5/5 Can't call method "leader" on an undefined value at /kohadevbox/koha/Koha/SearchEngine/Elasticsearch.pm line 548.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23816: Fix selenium tests
Jonathan Druart [Thu, 10 Sep 2020 08:07:05 +0000 (10:07 +0200)]
Bug 23816: Fix selenium tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23816: Fix patron edition
Jonathan Druart [Thu, 10 Sep 2020 07:57:51 +0000 (09:57 +0200)]
Bug 23816: Fix patron edition

The patron edition was broken, we always got the pattern alert
Password:
Password must contain at least 8 characters, including UPPERCASE, lowercase and numbers

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26157: Correct two occurrences
Jonathan Druart [Wed, 9 Sep 2020 14:31:07 +0000 (16:31 +0200)]
Bug 26157: Correct two occurrences

We don't want to hide the warnings for all tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23816: DBRev 20.06.00.037
Jonathan Druart [Wed, 9 Sep 2020 13:13:45 +0000 (13:13 +0000)]
Bug 23816: DBRev 20.06.00.037

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23816: (QA follow-up) Use existing form validation to validate min password length
Katrin Fischer [Thu, 27 Aug 2020 18:07:16 +0000 (20:07 +0200)]
Bug 23816: (QA follow-up) Use existing form validation to validate min password length

The pattern check didn't work for me, but I figured we might
want to use the same validation as for the other numeric fields
on the form instead (upper age limit, etc.)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23816: (follow-up) Fix many things
Agustin Moyano [Thu, 27 Aug 2020 15:58:56 +0000 (12:58 -0300)]
Bug 23816: (follow-up) Fix many things

This patch:
 * reverts changes on misc/admin/set_password.pl
 * makes category param mandatory for AuthUtils::is_valid_password and AuthUtils::generate_password
 * changes onboarding.pl to set category param in AuthUtils::is_valid_password
 * Completes t/db_dependent/AuthUtils.t and drops t/AuthUtils.t
 * Removes offending <input type="number"/> and replaces it by <input type="text" inputmode="numeric" pattern="[0-9]*"/>

https://bugs.koha-community.org/show_bug.cgi?id=23826

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23816: trivial code simplification
Jonathan Druart [Wed, 19 Aug 2020 07:00:12 +0000 (09:00 +0200)]
Bug 23816: trivial code simplification

Ease readability

Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
https://bugs.koha-community.org/show_bug.cgi?id=23826

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23816: Set default value in tests
Jonathan Druart [Wed, 19 Aug 2020 06:48:19 +0000 (08:48 +0200)]
Bug 23816: Set default value in tests

We tell TestBuilder to generate the categories with NULL (and rely on
the sysprefs)

Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
https://bugs.koha-community.org/show_bug.cgi?id=23826

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23816: Add minimum password length and require strong password overrides by category
Agustin Moyano [Wed, 15 Apr 2020 20:13:02 +0000 (17:13 -0300)]
Bug 23816: Add minimum password length and require strong password overrides by category

This patch adds the capability to override minPasswordLenth and RequireStrongPassword settings by category

To test:
1. koha-shell kohadev
2. koha-mysql kohadev

3. drop database koha_kohadev;
4. create database koha_kohadev;

5. go to admin page and start webinstaller. There continue the steps until onboarding.
6. reach step 3 of onboarding and create a new administrator patron
CHECH => Password control woks as normal (Minimum length 3 and strong required)

7. finish Koha installation and enter admin with your new administrator
8. set minPasswordLength to 3 and RequireStrongPassword to “Don’t require”
9. Create a new category (CAT2 from now on.. CAT1 is the category you made in onboarding process) and set minimum password length to 8 and require strong password
10. Create two new patrons, one with CAT1(patron1) and one with CAT2 (patron2)
CHECK => In both cases, try different combinations of length and strength. For patron1 the only requirement is to have 3 letters, but for patron2 the minimum length will be 8 and will require strong password.
CHECK => Try changing patron category before saving. Password requirements will change with category change.

11. Edit CAT1 and set minimum password length to 5
12. Go to patron1 details page, and change password.
CHECH => Now password minimum length is 5, but still it doesn’t require strong password

13. Edit CAT1, leave blank minimum password length and set require strong password to yes.
14. Go to patron1 details page, and change password.
CHECH => Password minimum length is back to 3, but now strong password is required

15. Set minimum password length in CAT2 to 12.
16. Go to patron2 details page, and click to fill a random generated password
CHECK => generated password should be 12 characters length

17. Set PatronSelfRegistration to Allow in admin settings
18. Go to OPAC and fill self registration from.
CHECK => Play with patron category. For each change in category, password requirements are modified.
CHECK => Set CAT1 as patron category, set ‘aA1’ as password (or another valid password for CAT1) and before hitting submit button, change to CAT2. Form should enter invalid state, and CAT2 password requirements should be displayed as error in password input.

19. Create a patron for CAT1 and another for CAT2, leaving password blank
CHECK => For CAT1’s patron, generated password length is 8 (minimum length for generated passwords), but for CAT2’s patron should be 12

20. In admin set PatronSelfRegistrationVerifyByEmail to require
21. Fill self registration form again with CAT2 as category
CHECK => Password requirements works as previous case.
22. Leave password blank and click submit

23. select * from message_queue;
24. Copy the link in the message and paste it in OPAC
CHECH => Generated password is 12 characters long. (Copy user id for next steps)

25. In admin set OpacResetPassword to Allow
26. Go back to OPAC, reload and click on “Forgot password?” link
27. Paste user id and click submit
28. Repeat steps 23 and 24
CHECK => Info message says “Your password must contain at least 12 characters, including UPPERCASE, lowercase and numbers.”
CHECK => enter an invalid password and you’ll get the same message in warning.

29. Login OPAC with the last user and your newly created password
30. Go to “Change your password” option
CHECK => Info message says “Your password must contain at least 12 characters, including UPPERCASE, lowercase and numbers.”
CHECK => enter an invalid password and you’ll get the same message in below “New password” input.

31. prove t/db_dependent/AuthUtils.t t/db_dependent/Koha/Patron/Category.t

32. Sign off

Sponsored-by: Northeast Kansas Library - NEKLS
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23816: Add tests
Agustin Moyano [Wed, 15 Apr 2020 20:13:16 +0000 (17:13 -0300)]
Bug 23816: Add tests

Sponsored-by: Northeast Kansas Library - NEKLS
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23816: (follow-up) Define boolean column in shcema
Agustin Moyano [Thu, 16 Apr 2020 20:59:17 +0000 (17:59 -0300)]
Bug 23816: (follow-up) Define boolean column in shcema

Sponsored-by: Northeast Kansas Library - NEKLS
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23816: [DO NOT PUSH] Update category schema
Agustin Moyano [Wed, 15 Apr 2020 19:12:16 +0000 (16:12 -0300)]
Bug 23816: [DO NOT PUSH] Update category schema

Sponsored-by: Northeast Kansas Library - NEKLS
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23816: Update kohastructure and atomic update
Agustin Moyano [Wed, 15 Apr 2020 19:12:16 +0000 (16:12 -0300)]
Bug 23816: Update kohastructure and atomic update

Sponsored-by: Northeast Kansas Library - NEKLS
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>