koha.git
3 years agoBug 17229: Check if patron is expired in CanItemBeReserved
Julian Maurice [Wed, 31 Aug 2016 13:27:44 +0000 (15:27 +0200)]
Bug 17229: Check if patron is expired in CanItemBeReserved

This way, calls to ILS-DI HoldTitle and HoldItem do this check too

Added test plan to commit message :
-Set Syspref  BlockExpiredPatronOpacActions to "ON",
-Set a patron's category variable "Block expired patrons" to "Follow SysPref" or -"Block" (ideally test both).
-Get the id of a patron from this category (ie : 1234).
-Set this patron's expiration date to a date earlier than today.
-Get a biblionumber which can be reserved (ie : 5678).

Put the following string in your webbrowser (replacing OpacBaseUrl, 1234 and 5678 by your own values) :
http://[OpacBaseUrl]/cgi-bin/koha/ilsdi.pl?service=HoldTitle&patron_id=1234&bib_id=5678&request_location='127.0.0.1'

Should not create a new hold for the patron and report an error.

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
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 17229: Add unit test for BlockExpiredPatronOpacActions check
Julian Maurice [Wed, 31 Aug 2016 13:52:08 +0000 (15:52 +0200)]
Bug 17229: Add unit test for BlockExpiredPatronOpacActions check

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
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 27413: Restore debarred and debarredcomment to batch patron mod tools
Jonathan Druart [Fri, 15 Jan 2021 10:27:47 +0000 (11:27 +0100)]
Bug 27413: Restore debarred and debarredcomment to batch patron mod tools

It was added by bug 13552 but removed by 19793.

Test plan:
Update patron in a batch and confirm that you can modify the restriction
expiration and comment.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27047: Fix suggestions filtering at the OPAC
Jonathan Druart [Fri, 15 Jan 2021 10:16:26 +0000 (11:16 +0100)]
Bug 27047: Fix suggestions filtering at the OPAC

There is a "Search" input box that appears to be broken for... ever?

This patch replaces it with the DataTables filtering.

Test plan:
Create some suggestions, go to your suggestion list at the OPAC
Confirm that the filtering now works correctly

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 27299: Remove tokenization for phrase register/index with ICU
David Cook [Tue, 22 Dec 2020 22:57:38 +0000 (09:57 +1100)]
Bug 27299: Remove tokenization for phrase register/index with ICU

This patch removes tokenization for phrase register/index when
using ICU.

This should cause "exact" searches to work the same way with ICU
as they do with CHR.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27420: Use object accessor for $attr_type->class()
Martin Renvoize [Wed, 13 Jan 2021 11:22:53 +0000 (11:22 +0000)]
Bug 27420: Use object accessor for $attr_type->class()

We introduced a bug in the patron attribute forms with bug 5161.

Test plan
1/ Create two PA_CLASS authorized values
2/ Create two corresponding patron attribute types referencing the above
classes.
3/ Edit a patron, both attributes should appear within their own
fieldsets at the bottom of the member entry form.
4/ Set a value for the first of the two patron attributes and save
5/ Edit the patron again, note that the first attribute no longer
resides within it's own fieldset
6/ Apply the patch
7/ Edit the patron again, note that the first attribute now resides
inside it's own fieldset again
8/ Signoff

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.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 25054: (QA follow-up) Add space after comma for multiple aliases
Katrin Fischer [Tue, 12 Jan 2021 21:53:49 +0000 (21:53 +0000)]
Bug 25054: (QA follow-up) Add space after comma for multiple aliases

Just a little formatting change to help readability by adding
a space after comma: alias1, alias2, ...

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25054: Display search field aliases in Search Engine Configuration
Fridolin Somers [Thu, 12 Nov 2020 09:11:33 +0000 (10:11 +0100)]
Bug 25054: Display search field aliases in Search Engine Configuration

It'd be great if the Search Engine Configuration page would display
the various aliases (shortcuts) available : ti for title, sn for local-number, etc.

Patch changes Koha/SearchEngine/Elasticsearch/QueryBuilder.pm to move
hard-coded vars at the beging and adds a method to provide to %index_field_convert via a method.

Test plan :
1) Use Elasticsearch
2) Go to Administration > Search engine configuration (Elasticsearch)
3) Check you see new column 'Aliases' with for example ti for title.
4) Perform a search 'ti:<title>' and check you get results

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 11299: (follow-up) adjust tests for bug 26641, fix styling, fix population of...
Nick Clemens [Thu, 7 Jan 2021 14:27:09 +0000 (14:27 +0000)]
Bug 11299: (follow-up) adjust tests for bug 26641, fix styling, fix population of new record

This corrects parameters in tests to adjust for new parameter in LinkBibHeadings

We also add lines to remove classes before adding the correct class while linking and restore
a missing class to the icons

Lastly we correct fetching the paramters to pass to authority creation popup to ensure
values are populated on save

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 11299: Adjust call to check_cookie_auth
Jonathan Druart [Mon, 4 Jan 2021 14:46:56 +0000 (15:46 +0100)]
Bug 11299: Adjust call to check_cookie_auth

Why were we using CGI::Cookie?

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 11299: (follow-up) Rebase on recent changes
Nick Clemens [Thu, 12 Nov 2020 16:16:42 +0000 (16:16 +0000)]
Bug 11299: (follow-up) Rebase on recent changes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 11299: Fix indirect object notation
Katrin Fischer [Wed, 21 Oct 2020 02:37:28 +0000 (04:37 +0200)]
Bug 11299: Fix indirect object notation

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 11299: (follow-up) correct link
Nick Clemens [Tue, 22 Sep 2020 13:11:40 +0000 (13:11 +0000)]
Bug 11299: (follow-up) correct link

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 11299: (follow-up) Skip fields with no 9 subfields
Nick Clemens [Tue, 25 Aug 2020 11:26:31 +0000 (11:26 +0000)]
Bug 11299: (follow-up) Skip fields with no 9 subfields

To test:
1 - Disable the 'thesaurus' for a controlled field like 600a or 650a
2 - Edit a record and put random data in this field
3 - Try to link, get a JS error
4 - Apply patch
5 - Repeat
6 - No more error, field is not linked (as it has no $9 subfield)

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 11299: (follow-up) Correct rebase errors and add message class to dialog
Nick Clemens [Tue, 25 Aug 2020 10:56:51 +0000 (10:56 +0000)]
Bug 11299: (follow-up) Correct rebase errors and add message class to dialog

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 11299: (QA follow-up) Fix tests, spaces, and CSS update
Nick Clemens [Fri, 21 Aug 2020 15:47:08 +0000 (15:47 +0000)]
Bug 11299: (QA follow-up) Fix tests, spaces, and CSS update

Removed my from variables in test

Undid stray line deletions

Undid adding 1; to test file

Fix CSS replace command

Update license

Fix spelling

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
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 11299: Add a button to the biblio edition page to automatically add authority...
Bouzid Fergani [Wed, 6 Nov 2013 15:49:09 +0000 (10:49 -0500)]
Bug 11299: Add a button to the biblio edition page to automatically add authority links in the current biblio record via AJAX. Also adds a button to easily create missing authority records.

 add authority type in the form to create the missing  authority.
 when authority was found, the 600$9 field have the authid.

Testing scenario (Creating an authority record for a failed automatic link) :

 1 - In your system preferences set:
    AutoCreateAuthorities: Don't generate
    BiblioAddsAuthorities: Allow
 2 - Go to the Cataloging -> New record (koha/cataloguing/addbiblio.pl)
    Ensure you are using the basic editor
 3 - Click the "Link authorities automatically" button.
    A message should appear, telling the user "No authority link was changed."
 4 - Add random informations in field 600$a of the biblio record.
 5 - Click the "Link authorities automatically" button.
   the message box should now show  "600 - No matching authority found.".
   the 9 subfield is red
   Above the 9 subfield is a red X with a blue plus next to it
   Hover on the plus, see it is titled 'Create authority'
 6 - Click the 'Create authority' link
 7 - A new authroity form pops up, the info from the cataloging editor is prefilled
     Click the 100 field heading to expand and confirm info is transferred
 8 - Fill in necessary fields and save the new authority
 9 - The cataloging screen now has the 9 subfield populated and is green
10 - Click "Link authorities automatically" again
     Dialog says "No authority link was changed"
11 - In another tab go to System preferences and set AutoCreateAuthorities to 'Generate'
12 - Add random information to the 650 field
13 - Click 'Link authorities' button
14 - Dialog says:650 - No matching authority found. A new authority was created automatically.
15 - The subfield 9 is green and has the id of the new authority record
16 - In another tab search authorities and find an existing subject heading
17 - Add a new 650 with the info from the existing record
18 - Click 'Link authorities'
19 - The new field is correctly linked to existing authority

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
https://bugs.koha-community.org/show_bug.cgi?id=12299
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 15448: Remove items fetch
Jonathan Druart [Thu, 14 Jan 2021 09:44:46 +0000 (10:44 +0100)]
Bug 15448: Remove items fetch

We fetch them already too many times.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 15448: Fix ISE
Jonathan Druart [Thu, 14 Jan 2021 09:42:53 +0000 (10:42 +0100)]
Bug 15448: Fix ISE

The method Koha::Items->itemnumber is not covered by tests!

Trace begun at /kohadevbox/koha/Koha/Objects.pm line 592
Koha::Objects::AUTOLOAD('Koha::Items=HASH(0x55981fd94790)') called at /kohadevbox/koha/opac/opac-reserve.pl line 465

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 15448: (follow-up) Adapt to changes on bug 24254
Tomas Cohen Arazi [Mon, 21 Dec 2020 19:30:31 +0000 (16:30 -0300)]
Bug 15448: (follow-up) Adapt to changes on bug 24254

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 15448: (follow-up) Fetch the patron category once
Tomas Cohen Arazi [Fri, 4 Dec 2020 11:33:43 +0000 (08:33 -0300)]
Bug 15448: (follow-up) Fetch the patron category once

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 15448: Filter out items hidden in OPAC on placing hold
Tomas Cohen Arazi [Fri, 4 Dec 2020 11:21:36 +0000 (08:21 -0300)]
Bug 15448: Filter out items hidden in OPAC on placing hold

This patch leverages on bug 24254's
Koha::Items->filter_by_visible_in_opac to filter out items that
shouldn't be presented to the end user in the OPAC interface.

To test:
1. Circulation and Fine rules for item-level holds are set to allow.
2. Setting the OpacHiddenItems preference to "ccode: [SUPPRESS]"
3. An item with collection Code Suppress is set.
4. Search for the title in the OPAC.
=> SUCCESS: The Suppress ccode item isn't shown.
5. View the detail page for the title.
=> SUCCESS: The suppress ccode item isn't shown.
6. Place a hold on the item:
  -- Click "Show more options"
  -- Select "A specific item"
=> FAIL: the ccode with the opachiddenitems rule has an item that appear in the list to place a hold
7. Apply this patch and repeat 6
=> SUCCESS: The item doesn't show!
8. Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24254: (QA follow-up) Inlines opachiddenitems handling
Martin Renvoize [Thu, 14 Jan 2021 11:28:35 +0000 (11:28 +0000)]
Bug 24254: (QA follow-up) Inlines opachiddenitems handling

We decided to inline the opachiddenitems filter as we don't believe it
will be used exclusively.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24254: Implement separate filters and add patron param
Tomas Cohen Arazi [Mon, 21 Dec 2020 18:50:13 +0000 (15:50 -0300)]
Bug 24254: Implement separate filters and add patron param

This patch introduces two new methods for stacking filters on
Koha::Items:

- filter_out_lost
_ filter_out_opachiddenitems

This two filters are what actually happened inside the
filter_by_visible_in_opac. Everything is covered by tests.

In the process I added a Koha::Patron param to the method that is
internally used to decide if the OPACHiddenItems syspref needs to be
honoured or not. This *could* be better done with a fallback to
C4::Context->userenv if no param is passed.

I decided to leave that part for later, if we really find it would help
(e.g. if bug 10589 gets some action and we really need something here to
 handle that).

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

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 24254: Read the OpacHiddenItems preference internally
Tomas Cohen Arazi [Sat, 19 Dec 2020 13:21:18 +0000 (10:21 -0300)]
Bug 24254: Read the OpacHiddenItems preference internally

After discussing the 'rules' parameter usefulness we decided it was not
the best idea, and the gains in terms of 'performance' would me
meaningless (in-memory caching of sysprefs). This patch makes a really
minor tweak to the tests so they mock the C4::Context->yaml_preference
method, but keeping the same original rules to highlight no behaviour
change takes place.

Then the rules parameter is removed from the calls, and the tests should
keep passing.

A minor change to make $rules = undef is made to highlight the // {}
behaviour when reading the syspref..

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Items.t
=> SUCCESS: Tests pass!
3. Sign off :-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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24254: Compare itemlost with 0
Tomas Cohen Arazi [Sat, 19 Dec 2020 13:05:16 +0000 (10:05 -0300)]
Bug 24254: Compare itemlost with 0

On C4::Search and C4::Circulation the uses of the items.itemlost field
highlight the fact that the comparisson itemlost <= 0 was wrong, as it
is evaluated as a Perl boolean.

The column can only be an int and NOT NULL, so we need to check if it is
0 to ponder if not hidden.

This patch changes the tests to reflect this, and adjust the
Koha::Items->filter_by_visible_in_opac implementation to adapt to this.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Items.t
=> SUCCESS: Tests pass!
3. Sign off :-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>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24254: Add Koha::Items->filter_by_visible_in_opac
Tomas Cohen Arazi [Thu, 3 Dec 2020 18:11:14 +0000 (15:11 -0300)]
Bug 24254: Add Koha::Items->filter_by_visible_in_opac

This patch adds a method based on the original idea from Nick, but on
Koha::Items.

The idea is to build a proper filter, based on the current rules for
hiding things, directly on the DBIC query. The caller takes care of
knowing if the filtering should apply (i.e. checking the patron category
exceptions) and then it would do something like:

    my @items;
    if ( <patron_category_does_not_have_exception> ) {
        @items = $biblio->items->filter_by_visible_in_opac(
            {
                rules => $rules
            }
        );
    }
    else {
        # still want to enforce 'hidelostitems'
        @items = $biblio->items->filter_by_visible_in_opac;
    }

To test:
1. Apply this patches
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Items.t
=> SUCCESS: Tests pass!
3. Look at the use cases on the tests, read the code
=> SUCCESS: It all makes sense
4. Compare with Koha::Item->hidden_in_opac
=> SUCCESS: It all makes sense
5. Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24254: Unit tests
Tomas Cohen Arazi [Thu, 3 Dec 2020 18:11:00 +0000 (15:11 -0300)]
Bug 24254: Unit tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25775: Compiled CSS
Jonathan Druart [Thu, 14 Jan 2021 13:03:32 +0000 (14:03 +0100)]
Bug 25775: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25775: Add DataTables controls to user's checkouts table in OPAC
Owen Leonard [Wed, 9 Sep 2020 18:23:38 +0000 (18:23 +0000)]
Bug 25775: Add DataTables controls to user's checkouts table in OPAC

This patch updates the "your summary" page in the OPAC so that tables on
the logged-in user's page have DataTables controls. The patch also
tweaks the DataTable configuration of some other pages to make them all
more consistent.

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

- Log in to the OPAC as a user who has checkouts, overdues, and holds.
- On the "your summary" page, confirm that the checkouts table has
  controls at the top: A search form and link-style buttons: Clear
  filter, Copy, CSV, Print, iCal, Renew selected, and Renew all.
- Confirm that each work correctly.
- At the bottom of the page, the style of the "Renew selected" and
  "Renew all" buttons should now be side by side.
- Confirm that both buttons work correctly.
- If necessary, enable the UseCourseReserves system preference.
- Go to the OPAC course reserves page.
- Confirm that there is a working "Search courses" field at the top of
  the table.
- View the contents of a course reserve.
- There should be a "Search course reserves" field at the top of the
  table.

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>
3 years agoBug 26962: Compiled CSS
Jonathan Druart [Wed, 13 Jan 2021 16:19:28 +0000 (17:19 +0100)]
Bug 26962: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26962: (follow-up) Catch other #000066 occurrences
Lucas Gass [Wed, 13 Jan 2021 00:06:27 +0000 (00:06 +0000)]
Bug 26962: (follow-up) Catch other #000066 occurrences

Addtional test steps:
-Check printing an invoice, inscept the page and make sure none of the colors are set to #000066
-For the OPAC you must rebuild the CSS ((https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client)
-Look at some areas where you might print in the OPAC (try a list), inscept the page and make sure there is no colors set to #000066
-You can also use Jonathan's method of 'git grep -l -c 000066' to make sure no occurrences are left.
-I left macles.tt as is because I am not sure about that template

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26962: Make print.css pure black
Lucas Gass [Fri, 6 Nov 2020 22:48:06 +0000 (22:48 +0000)]
Bug 26962: Make print.css pure black

Test plan:
1. Generate some different notice/slips like ISSUESLIP, HOLD_SLIP, any slip you like
2. Inspect and see that body, p tags and see that the computed color is #333333 or #000066.
3. Apply patch
4. The computed style for color should not be #00000
5. This prints much better, especially on thermal/receipt printers

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27263: Link to preferences mentioned in system preference descriptions
Owen Leonard [Thu, 17 Dec 2020 18:30:38 +0000 (18:30 +0000)]
Bug 27263: Link to preferences mentioned in system preference descriptions

This patch attempts to locate all references to system preference names
in various system preference descriptions and link those preference
names to a search for that preference. This will allow the user to
easily jump between preferences which are related or depend on each
other.

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

- Open each preference category and confirm that the page loads without
  error.
- Test any system preference links you find to confirm that they work
  correctly.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27325: Fix singular/plural forms on the OPAC dashboard
Owen Leonard [Wed, 6 Jan 2021 16:41:48 +0000 (16:41 +0000)]
Bug 27325: Fix singular/plural forms on the OPAC dashboard

This patch adds handling of plurals to the display of counts on the
logged-in user's dashboard: checkouts, overdues, etc.

To test, apply the patch and log in to the OPAC.

 - Go to the OPAC main page and check the user dashboard area.
 - Confirm that the correct numbers and plural forms are shown for
   checkouts, overdues, holds pending, holds waiting, and messages.
 - Test each of those categories with counts of 0, 1, and more than one
   to confirm that the plural forms are correct.
 - Test with various counts of each type of message: OPAC notes as
   defined when editing a patron record and notes added via the checkout
   page.

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>
3 years agoBug 27416: Make "Modify tag" and "Add tag" translatable
Jonathan Druart [Wed, 13 Jan 2021 10:11:36 +0000 (11:11 +0100)]
Bug 27416: Make "Modify tag" and "Add tag" translatable

Those two strings are not translatable as they are passed from the
controller.

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>
3 years agoBug 26950: Fix SIP/Message.t
Jonathan Druart [Wed, 13 Jan 2021 16:14:37 +0000 (17:14 +0100)]
Bug 26950: Fix SIP/Message.t

t/db_dependent/SIP/Message.t .. 2/9
    #   Failed test 'DBIx error on duplicate issue_id'
    #   at t/db_dependent/SIP/Message.t line 643.
    # found warning: DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Duplicate entry '1' for key 'PRIMARY' [for Statement "INSERT INTO `old_issues` ( `auto_renew`, `auto_renew_error`, `borrowernumber`, `branchcode`, `date_due`, `issue_id`, `issuedate`, `issuer_id`, `itemnumber`, `lastreneweddate`, `note`, `notedate`, `noteseen`, `onsite_checkout`, `renewals`, `returndate`, `timestamp`, `unseen_renewals`) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" with ParamValues: 0=0, 1=undef, 2=57, 3='m_HHGh', 4=undef, 5=1, 6=undef, 7=undef, 8=973, 9=undef, 10=undef, 11=undef, 12=undef, 13=0, 14=0, 15='2021-01-14 16:12:47', 16='2021-01-13 16:12:48', 17=0] at /kohadevbox/koha/Koha/Object.pm line 169
    # found carped warning: The checkin for the following issue failed, Please go to the about page and check all messages on the 'System information' to see if there are configuration / data issues (Duplicate ID)$VAR1 = {
    # expected to find warning: (?^u:Duplicate entry)
    # expected to find warning: (?^u:data corrupted)
    # Looks like you failed 1 test of 35.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26991: Add action logs to search engine administration
Fridolin Somers [Tue, 10 Nov 2020 14:51:24 +0000 (15:51 +0100)]
Bug 26991: Add action logs to search engine administration

Search engine administration is very important,
we should log who/when it is changed.
I don't add a preference system to disable it,
like there is no for preference system logs.

Test plan :
1) Use searchengine Elasticsearch
2) Go to Administation > Search engine configuration (Elasticsearch)
3) Click on 'Reset Mappings' and accept
4) Edit some lines and save
5) Go to 'Tools' > 'Log viewer'
6) Select only 'Search engine' in Modules and submit
7) Select only 'Edit mappings' in Actions
8) Check you see a log
9) Select only 'Reset mappings' in Actions
10) Check you see a log

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 26123: Add message notification to patron dashboard
Lucas Gass [Wed, 7 Oct 2020 14:53:37 +0000 (14:53 +0000)]
Bug 26123: Add message notification to patron dashboard

Test plan:
1. Apply patch, restart_all
2. Add some OPAC messages by clicking 'Add a message' on Home › Circulation › Checkouts › patron
3. Log into the OPAC as that patron and you should see a notice about how many messages you have with a link to opac-user.pl
4. Add multiple OPAC messages and make sure it all continues to work.
5. Also add an OPAC note from memberentry.pl. Refresh the OPAC and you should see a 1 message added to the total
6. Try an OPAC without any messages. If there are no messages or any other kind of notification the dashboard should NOT appear at all.
7. Add a 'staff - internal' note. It should not count towards your total messages in the dashboard.
8. Test it with some other notices that would appear on the dashboard, checkouts, holds, overdues.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27306: (QA follow-up) Add space between title and subtitle
Katrin Fischer [Sun, 10 Jan 2021 22:41:46 +0000 (23:41 +0100)]
Bug 27306: (QA follow-up) Add space between title and subtitle

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27306: Add subtitle to return-claims-table
Lucas Gass [Wed, 23 Dec 2020 20:47:32 +0000 (20:47 +0000)]
Bug 27306: Add subtitle to return-claims-table

To test:
-turn on claim returned
-find some items with a 245b or add a 245b to some items
-check those items out and mark them as claimed returned
-on the borrowers /cgi-bin/koha/circ/circulation.pl page look at the return-claims-table
-no subtitle
-apply patch and clear browser cache, restart_all
-now you should see the subtitle

Signed-off-by: Kelly McElligott <kelly@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 25306: (QA follow-up) Remove framework from bulkmarcimport
Martin Renvoize [Mon, 11 Jan 2021 11:21:59 +0000 (11:21 +0000)]
Bug 25306: (QA follow-up) Remove framework from bulkmarcimport

One last instance of ModBiblioMarc in bulkmarcimport still passed the
frameworkcode.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25306: Remove framework paramter from ModBiblioMarc
Nick Clemens [Tue, 28 Apr 2020 18:36:49 +0000 (18:36 +0000)]
Bug 25306: Remove framework paramter from ModBiblioMarc

Tested with :

For a framework (not the default) :

Creation of a biblio record
Edition of this biblio record
Creation of an item of this record
Creation of an item of this record

./misc/batchRepairMissingBiblionumbers.pl OK

prove t/db_dependent/Biblio/ModBiblioMarc.t OK

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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 26950: Make Anonymous patron warnings 'errors' and refer to the system informatio...
Nick Clemens [Fri, 6 Nov 2020 12:34:11 +0000 (12:34 +0000)]
Bug 26950: Make Anonymous patron warnings 'errors' and refer to the system information tab on about.pl

Currently checkins can fail for one of two known reasons:
1 - Duplicate issue ids
2 - Anonymous borrower configuration issues

In the first case we refer to the 'data problems' or 'data corrupted' section of the about page. All errors are on the 'System information' tab and this is what we should mention

In the second case we refer to the data problems section, but information is in another section on the tab. Additionally, during checkin we issue an 'Error' but on the about page we call it a 'Warning' we should upgrade to error and specify what is broken

Additionally this patch fixes the warning that should display while issuing to a patron if anonymous is not set and patron has selected privacy

To test:
 1 - Enable system preference OPACPrivacy
 2 - Set system preference AnonymousPatron to '0'
 3 - Log in a a patron on OPAC and set your privacy to never
 4 - Issue a book to that patron in the staff client
 5 - Note there is no warning
 6 - Return the book
 7 - Note the circulation page displays an error and the checkin fails and refers to 'data problems'
 8 - Apply patch
 9 - Issue another book to patron
10 - Note warning on the circulation page
11 - Try to check in a book again
12 - Check the new message makes sense
13 - Click the link to 'about.pl' check that errors are displayed
14 - Check the logs
15 - Confirm updated error message makes sense

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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 26713: Add pagination to bottom of saved SQL reports table
Owen Leonard [Thu, 3 Dec 2020 12:06:46 +0000 (12:06 +0000)]
Bug 26713: Add pagination to bottom of saved SQL reports table

This patch adds a second pagination menu to the bottom of the report
results table.

To test, apply the patch and go to Reports.

- Run a report which will return multiple pages of results (greater
  than 20).
- The results should display with a pagination bar at the top and bottom
  of the table.
- Confirm that both pagination menus work 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 27308: Skip blank lines when inserting new
Nick Clemens [Thu, 24 Dec 2020 13:35:28 +0000 (13:35 +0000)]
Bug 27308: Skip blank lines when inserting new

The intent of the macro insert new function is to add a new field at the correct numerical place in the record. If you have a blank line while editing, however, the new line will be inserted at the blank line, rather than checking the rest of the record.

To test:
1 - Create a macro like
    new 690=‡aLOCAL SUBJECT
2 - Insert a blank line into your record somewhere before where the 690 should be inserted
3 - Run the macro
4 - Line is inserted before the blank line
5 - Apply patch
6 - Reload (ensure cache is cleared and JS files are reloaded)
7 - Remove the previously created field, but leave the blank
8 - Run the macro
9 - Field is created at correct position

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bug 27308: (QA follow-up) Remove commented line

I don't think we need to keep the original line as a comment.. this
patch simply cleans it up.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27307: Don't drop phrase directive when searching keyword index
Nick Clemens [Thu, 24 Dec 2020 14:04:55 +0000 (14:04 +0000)]
Bug 27307: Don't drop phrase directive when searching keyword index

We convert 'keyword' to '' as an index since we want it to search all fields

When we are searching 'as phrase', however, we should not drop the search type

To test:
 1 - Enable IntranetCatalogPullDown
 2 - Set searchEngine to Elasticsearch
 3 - Perform a search for 'Keyword as phrase' for a phrase that does appear in a record
 4 - You get the result
 5 - Reverse the order of words in the phrase
 6 - You still get a result?
 7 - Apply patch
 8 - Restart all the things
 9 - Reversed search does not return record
10 - Correct order and search, correct record returned

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 27307: Unit test
Nick Clemens [Thu, 24 Dec 2020 14:04:17 +0000 (14:04 +0000)]
Bug 27307: Unit test

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 26957: Don't remove words that are also operators from search terms
Nick Clemens [Mon, 23 Nov 2020 18:37:48 +0000 (18:37 +0000)]
Bug 26957: Don't remove words that are also operators from search terms

FindDuplicate has a hardcoded regex to remove 'and', 'or', and 'not' from any search fields, however,
is does this with no regard for these terms being embedded in the middle of a word or phrase.

E.g.:
'Coupland' becomes 'Coupl'
'Frog and toad' becomes 'frog toad'
etc.

This patch simplay removes the substitutions as we already quote the terms as well

To test:
1 - Add records to your system like:
    The night circus by Erin Morgenstern
    Frog and toad all year
    Nothing ever happens
2 - Attempt to add purchase suggestions like
    title: the night circus, author:Morgenstern, Erin
    title: For and toad all year
    title:nothing ever happens (case is important)
3 - No warnings about existing biblios
4 - Apply patches
5 - Delete existing suggestions
6 - Repeat step 2
7 - Each attempt should warn you of existing biblio

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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 26957: Unit tests
Nick Clemens [Mon, 23 Nov 2020 18:37:39 +0000 (18:37 +0000)]
Bug 26957: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26894: Handle subfield 0 and delete empty fields
Nick Clemens [Mon, 2 Nov 2020 12:05:47 +0000 (12:05 +0000)]
Bug 26894: Handle subfield 0 and delete empty fields

This patch corrects handling of subfield 0 when copying/moving. Before these
patches copying from subfield 0 would copy the entire field.

We also correct an error that if moving a single subfield, we can leave behind empty
fields with no subfields. They should be deleted.

To test:
1 - Define a new MARC Modification template with actions:
        Delete field 100$0
        Add new field 100$0 with value Test
        Update existing or add new field 100$0 with value TestUpdated
        Move field 100$0 to 600$0
        Copy field 600$0 to 100$0
        Copy and replace field 245$0 to 700$0
2 - Define a new record like:
    LDR 00334nam a22001217a 4500
    003 ff
    005 20201102111604.0
    008 201102b        xxu||||| |||| 00| 0 eng d
    040 _ _ ‡cvsd
    100 1 _ ‡012345‡aKnuth, Donal Ervin‡d1938
    245 _ _ ‡012345‡aThe aty of computer programming‡cDonald E. Knuth
    650 _ 0 ‡042‡aComputer programming‡9462
3 - Modify this record using the template above
4 - Note that entier 245 is copied to 700, same for 600 field
5 - Apply patch
6 - Now only subfields 0 are copied

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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 26947: Remove AUTO_INCREMENT
Jonathan Druart [Tue, 12 Jan 2021 11:29:25 +0000 (12:29 +0100)]
Bug 26947: Remove AUTO_INCREMENT

Sending a cake there
https://bugs.mysql.com/bug.php?id=20786

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26947: Update kohastructure.sql
Jonathan Druart [Fri, 4 Dec 2020 14:39:32 +0000 (15:39 +0100)]
Bug 26947: Update kohastructure.sql

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26947: Correct path for chown and chmod
Jonathan Druart [Wed, 25 Nov 2020 14:43:52 +0000 (15:43 +0100)]
Bug 26947: Correct path for chown and chmod

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26947: Replace double quotes from comments
Jonathan Druart [Thu, 19 Nov 2020 10:09:54 +0000 (11:09 +0100)]
Bug 26947: Replace double quotes from comments

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26947: Move -- comment to the COMMENT clause
Jonathan Druart [Thu, 19 Nov 2020 10:08:08 +0000 (11:08 +0100)]
Bug 26947: Move -- comment to the COMMENT clause

Sed command from bug 26947 comment 8
sed -r --in-place 's/,\s*-- (.*)$/ COMMENT "\1",/g;' installer/data/mysql/kohastructure.sql

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26947: (follow-up) Set key checks to disabled for kohastructure
Martin Renvoize [Wed, 18 Nov 2020 17:08:11 +0000 (17:08 +0000)]
Bug 26947: (follow-up) Set key checks to disabled for kohastructure

This patch adds sql calls to disable foreign key checks for the initial
kohastructure schema load and then re-enables them again for subsequent
actions.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26947: Add schema-only option to koha-dump
Nick Clemens [Fri, 13 Nov 2020 13:48:48 +0000 (13:48 +0000)]
Bug 26947: Add schema-only option to koha-dump

This patch adds a new --schema-only optoin to the koha-dump script.

This can be used to generate a new kohastructure.sql file during the release, and later to
compare the DB structure of a koha instance to the kohastructure.sql file shipped with a version
to identify any missing constraints or other db structure issues

To test:
1 - debian/scripts/koha-dump kohadev
2 - Confirm db and configs are dumped correctly
3 - Apply patch
4 - debian/scripts/koha-dump --help
5 - Confirm new option is listed and makes sense
6 - debian/scripts/koha-dump --schema-only kohadev
7 - Confirm only schema is dumped and is not zipped
8 - debian/scripts/koha-dump kohadev
9 - Confirm entire db is dumped as before

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27264: Reword sentence of OPACHoldsHistory
Caroline Cyr La Rose [Thu, 17 Dec 2020 17:19:59 +0000 (12:19 -0500)]
Bug 27264: Reword sentence of OPACHoldsHistory

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>
3 years agoBug 27356: Don't hide the SMTP servers table when last displayed is deleted
Jonathan Druart [Thu, 7 Jan 2021 10:13:48 +0000 (11:13 +0100)]
Bug 27356: Don't hide the SMTP servers table when last displayed is deleted

Found on bug 27251 which was mimicking SMTP server code for QOTD.

To recreate:
Create a SMTP server with name "a"
Create a SMTP server with name "aa"

Filter by "aa"
=> Only 1 row displayed

Delete it, confirm
=> The table disappears

Note that we could re-add this test when bug 27353 will be pushed, as
recordsTotal will contain the unfiltered number of records in the DB.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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 26701: Remove unused C4/SIP scripts
Jonathan Druart [Thu, 7 Jan 2021 14:23:17 +0000 (15:23 +0100)]
Bug 26701: Remove unused C4/SIP scripts

Those scripts are not known to be used, we can remove them from the Koha
codebase.

Test plan:
Confirm that the scripts removed by this patch are not used anywhere
from Koha.

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>
3 years agoBug 27149: Don't strip itemnumber when adding item status via Z3950Responder
Nick Clemens [Thu, 3 Dec 2020 17:04:19 +0000 (17:04 +0000)]
Bug 27149: Don't strip itemnumber when adding item status via Z3950Responder

This breaks MARCEdit integration as svc/bib uses the itemnumber field to update items

To test:
1 - sudo koha-z3950-responder --stop kohadev
2 - Run it manually:
    perl /kohadevbox/koha/misc/z3950_responder.pl -c /etc/koha/sites/kohadev/z3950 -u kohadev-koha -p /var/run/koha/kohadev/z3950-responder.pid -D -d kohadev-koha-z3950 -l /var/log/koha/kohadev/z3950.log
3 - Connect and search to verify itemnumber is in item records
    yaz-client localhost:2100
    base biblios
    find shuffle
    show 1+1
4 - sudo koha-z3950-responder --stop kohadev
5 - Run it manually to add item status
    perl /kohadevbox/koha/misc/z3950_responder.pl --add-item-status k -c /etc/koha/sites/kohadev/z3950 -u kohadev-koha -p /var/run/koha/kohadev/z3950-responder.pid -D -d kohadev-koha-z3950 -l /var/log/koha/kohadev/z3950.log
6 - Connect and search, no itemnumber in records
7 - Apply patch
8 - Stop, restart all the things, and manually start server with item status again
9 - Connect and search, itemnumbers are included

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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 27149: Unit tests
Nick Clemens [Thu, 3 Dec 2020 17:03:40 +0000 (17:03 +0000)]
Bug 27149: Unit tests

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.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 27130: Don't display itemnumber under "File type" section
Nick Clemens [Wed, 2 Dec 2020 07:55:38 +0000 (08:55 +0100)]
Bug 27130: Don't display itemnumber under "File type" section

There is no need to have the "File type" section when we attach a cover
item to an item (we cannot upload a zip file)

This patch removes the fieldset abd adds the itemnumebr to the breadcrumbs and headings.
It also adjusts the help text, removing ZIP as an option when uploading for a biblio or item

Lastly it adjusts the results page to use a heading to make things a bit clearer

Test plan:
 1 - Enable 'LocalCoverImages' system preference
 2 - Browse to the details page for a record
 3 - Under the 'Images' tab click 'Upload'
 4 - Note the display includes File type section with a biblionuber input
 5 - Upload an image and note the results page
 6 - Return to the biblio, this time on the 'Holdings' tab
 7 - Click the down arrow next to 'Edit' and choose 'Upload image'
 8 - Note the form has a File type section with an itemnumber input
 9 - Apply patch
10 - Repeat steps 2-9, making sure changes to page make sense
11 - Note the breadcrumbs have been updated
12 - Confirm you can complete the upload of the cover for an item and that results look as expected

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26851: Don't generate a notice to library if no content
Nick Clemens [Wed, 28 Oct 2020 19:00:28 +0000 (19:00 +0000)]
Bug 26851: Don't generate a notice to library if no content

To test:
 1 - Check out an over due to a patron
 2 - Set overdue triggers to a trigger less than number of days overdue
 3 - Make sure the patron has no email
 4 - Set content of ODUE notice to:
    [%# Comment will not print %]
 5 - perl misc/cronjobs/overdue_notices.pl
 6 - Check the message queue
 7 - There is a notice sent to the library:
    "These messages were not sent directly to the patrons."
    With no messages
 8 - Apply patch
 9 - Repeat
10 - No new message generated

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26593: Remove _get_discount_from_rule
Nick Clemens [Thu, 19 Nov 2020 15:46:52 +0000 (15:46 +0000)]
Bug 26593: Remove _get_discount_from_rule

This patch remove the private sub used in GetIssuingCharges in favor
of get_effective_rule

It corrects the wrong precedence for rules and adds tests to cover this
subroutine

NOTE: the 'branch' for the discount will be determined by the signed in branch,
    this is a bug to be fixed in the future

To test:
1 - Define a rentalcharge for an itemtype
2 - Define a 10% discount for library A, category A, all itemtypes
3 - Define a 50% discount for all libraries, category A, same itemtype
4 - Attempt to checkout an item from library A of the matching itemtype
5 - The 50% discount is applied
6 - Apply patches
7 - Attempt to checkout an item from library A of the matching itemtype
8 - The 10% discount is applied

prove -v t/db_dependent/Circulation.t

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26848: Fix Readonly dependency in cpanfile
Julian Maurice [Wed, 28 Oct 2020 15:29:16 +0000 (16:29 +0100)]
Bug 26848: Fix Readonly dependency in cpanfile

- It is a required module. If it is missing, Koha will not start
- Set the minimum version to 2.00. While not strictly required, it's the
version that states that "Deprecation of Readonly::XS as a requirement
for fast, readonly scalars is complete", it is available in Debian
oldoldstable (jessie, 8), and Readonly::XS was not even needed with Perl
> 5.8, which allows us to:
- Remove dependency on Readonly::XS

Signed-off-by: Mason James <mtj@kohaaloha.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 21301: add unit tests
Fridolin Somers [Fri, 4 Sep 2020 08:01:20 +0000 (10:01 +0200)]
Bug 21301: add unit tests

Run t/db_dependent/ILSDI_Services.t with and without previous patches

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>
3 years agoBug 21301: (follow-up) Remove borrowernumber in issues for GetRecords ILS-DI service
Fridolin Somers [Thu, 26 Mar 2020 12:02:14 +0000 (15:02 +0300)]
Bug 21301: (follow-up) Remove borrowernumber in issues for GetRecords ILS-DI service

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>
3 years agoBug 21301: (QA follow-up) Fix number of tests
Marcel de Rooy [Fri, 8 Nov 2019 07:07:32 +0000 (07:07 +0000)]
Bug 21301: (QA follow-up) Fix number of tests

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>
3 years agoBug 21301: Remove patron informations in reserves for GetRecords ILS-DI service
Fridolin Somers [Thu, 3 Oct 2019 13:43:56 +0000 (15:43 +0200)]
Bug 21301: Remove patron informations in reserves for GetRecords ILS-DI service

Actually, the GetRecords service gives many information :
borrowernumber (reserves field)

The issue data should not be sent by these service, its a privacy problem.

Test plan :
1) Enable ILS-DI webservice
2) Place hold on an item
3) Go to {opac}/cgi-bin/koha/ilsdi.pl?service=GetRecords&id={biblionumber}
4) Check the reserves tag content

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
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>
3 years agoBug 21301: Remove patron informations in issues for GetRecords ILS-DI service
Fridolin Somers [Wed, 2 Oct 2019 14:28:21 +0000 (16:28 +0200)]
Bug 21301: Remove patron informations in issues for GetRecords ILS-DI service

Actually, the GetRecords service gives many information :
bibliographic data (marcxml field)
item data (items field)
issue data (issues field)

The issue data should not be sent by these service, its a privacy problem.
Biblio title and author are redundant.
This patch changes to use Koha::Checkouts to get issues informations with only the addition of item barcode.

Test plan :
1) Enable ILS-DI webservice
2) Checkout an item
3) Go to {opac}/cgi-bin/koha/ilsdi.pl?service=GetRecords&id={biblionumber}
4) Check the issues tag content

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
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>
3 years agoBug 24470: Mark a batch as 'imported' if all the bib has been imported
Jonathan Druart [Wed, 9 Dec 2020 14:22:35 +0000 (15:22 +0100)]
Bug 24470: Mark a batch as 'imported' if all the bib has been imported

When a staged MARC file is used to populate a basket in acquisitions,
the status of the batch is kept as "staged" until a user repeat the operation.
The "imported" status is added to the batch when new orders are added to
a basket "from a new file" (yes!...)

Test plan:
- Create a basket
- Add to basket From a New File
- Select a marc file and stage
- Add titles to your basket
Until all your records are imported the batch will have the status
"staged"
When all your records will be imported, the status of the batch will be
"imported"

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27336: Fix xt/find-missing-filters.t
Jonathan Druart [Mon, 11 Jan 2021 09:20:11 +0000 (10:20 +0100)]
Bug 27336: Fix xt/find-missing-filters.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27336: Add POD for new package
Jonathan Druart [Mon, 11 Jan 2021 09:17:25 +0000 (10:17 +0100)]
Bug 27336: Add POD for new package

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27336: Sanitize correctly HTML id
Julian Maurice [Fri, 8 Jan 2021 09:58:45 +0000 (10:58 +0100)]
Bug 27336: Sanitize correctly HTML id

Valid characters are alphanumeric characters (a-zA-Z0-9), hyphen (-)
and underscore (_)

https://www.w3.org/TR/CSS21/syndata.html#value-def-identifier

All invalid characters will be replaced by '_'

Test plan:
1. Go to Administration » System preferences and click on 'Searching'
   tab
2. You should see a console error (Uncaught Error: Syntax error,
   unrecognized expression: #collapse_Did_you_mean/spell_checking)
3. Apply patch
4. Make sure the error is gone
5. prove t/Koha_Template_Plugin_HtmlId.t

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>
3 years agoBug 27109: Improve labels on the background job views
Jonathan Druart [Tue, 1 Dec 2020 14:41:56 +0000 (15:41 +0100)]
Bug 27109: Improve labels on the background job views

Replace "enqueued_on" with "Enqueued on", same for started_on and
ended_on

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>
3 years agoBug 27109: Remove Replay action - not implemented
Jonathan Druart [Tue, 1 Dec 2020 14:43:38 +0000 (15:43 +0100)]
Bug 27109: Remove Replay action - not implemented

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>
3 years agoBug 26797: Escape firstname to prevent relative's checkouts to crash
Jonathan Druart [Wed, 2 Dec 2020 10:25:13 +0000 (11:25 +0100)]
Bug 26797: Escape firstname to prevent relative's checkouts to crash

If no firstname is defined for a relative, the "Relative's checkouts"
tab will be "processing" forever.
JS error:
  TypeError: oObj.borrower.firstname is null

Test plan:
1 - Create a patron (PatronA) in a category with type 'Org'
    'School' in sample data works
2 - Add a guarantee (Patron B)
3 - Check out an item to PatronA
4 - Go to PatronB's record and click relativwe's checkouts
5 - There is an error and the table doe snot load
6 - Apply patch
7 - Reload
8 - Table loads correctly

Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 25292: Flushing L1 on every Z3950 server search
Jonathan Druart [Mon, 27 Apr 2020 14:25:32 +0000 (16:25 +0200)]
Bug 25292: Flushing L1 on every Z3950 server search

This patch flushes the L1 cache on each Z3950 server search.

There is no need to flush it in init_handler (when the connection is
made), the L1 cache is not accessed (this behaviour goes against what I
expected).

This means each search will fetch values from the
L2 cache (ie memcached) and persist the L1 cache (in Perl
memory cache) until the result are returned (or longer?).

Test plan:
% perl misc/z3950_responder.pl --config-dir=/kohadevbox/koha/etc/z3950
% zoomsh
ZOOM>connect localhost:2100
ZOOM>set databaseName biblios
ZOOM>search x
ZOOM>search x

Between the 2 searches you can modify the value of SearchEngine, you
will notice that the number of hits is different

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27349: DBRev 20.12.00.003
Jonathan Druart [Mon, 11 Jan 2021 09:10:06 +0000 (09:10 +0000)]
Bug 27349: DBRev 20.12.00.003

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27349: (QA follow-up) Move DB update to perl file and add description
Nick Clemens [Fri, 8 Jan 2021 14:37:30 +0000 (14:37 +0000)]
Bug 27349: (QA follow-up) Move DB update to perl file and add description

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27349: Fix Mana system preference wrong type
Fridolin Somers [Wed, 6 Jan 2021 10:47:59 +0000 (11:47 +0100)]
Bug 27349: Fix Mana system preference wrong type

Mana system preference type 'YesNo' is wrong since it has 3 values.
Change to 'Choice'

Test plan :
1) Run atomic update
2) Check in database 'Mana' system preference type is 'Choice'

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>
3 years agoBug 27090: Opac basket: fix the 'In transit from' and 'to'
Christophe Croullebois [Wed, 25 Nov 2020 10:29:40 +0000 (11:29 +0100)]
Bug 27090: Opac basket: fix the 'In transit from' and 'to'

To see the 'In  transit from' and 'to' fields in an Opac basket we have :

<span class="item-status intransit">In transit from [% Branches.GetName( item.transfertfrom ) | html %]
    to [% Branches.GetName( item.transfertto ) | html %] since [% item.transfertwhen | $KohaDates %]</span>

But in koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc we have no :

[% USE Branches %]

This patch just corrects this lack

Test plan:
1° find an item in a transit status or create one with this status
2° put it in an Opac basket
3° note that in the location column of the Opac basket the 'In transit from' and 'to' fields are empty.
4° apply the patch
5° check again and validate that the 2 fields are now filled

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27345: Add missing global permissions for superlibrarian
Jonathan Druart [Tue, 5 Jan 2021 10:35:05 +0000 (11:35 +0100)]
Bug 27345: Add missing global permissions for superlibrarian

When a superlibrarian is logged in, C4::Auth::get_template_and_user pass the CAN_user_$flag to the template, but some are missing:
suggestions, lists, cash_management

So far they are not used in the template but it will avoid a developer to spend time on it if we fix it now.

Test plan:
Compare with installer/data/mysql/mandatory/userflags.sql
Note that we don't need selfcheck

Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26983: Fix [un]select all links in inventory
Jonathan Druart [Wed, 2 Dec 2020 09:26:25 +0000 (10:26 +0100)]
Bug 26983: Fix [un]select all links in inventory

The select/unselect all links took into account only the items displayed
when the page was loaded (so 20).

Test plan:
1. Go to Tools-> Inventory-> Do a Search to produce more than 20 results
2. Select 50, 100 or All entries to show
3. click on Select All
=> All items must be selected, not only the first 20

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27351: DBRev 20.12.00.002
Jonathan Druart [Fri, 8 Jan 2021 14:21:22 +0000 (14:21 +0000)]
Bug 27351: DBRev 20.12.00.002

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27351: (QA follow-up) Use skeleton.perl and add description
Nick Clemens [Fri, 8 Jan 2021 13:35:38 +0000 (13:35 +0000)]
Bug 27351: (QA follow-up) Use skeleton.perl and add description

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27351: Fix UsageStatsCountry system preference wrong type
Fridolin Somers [Wed, 6 Jan 2021 14:32:37 +0000 (15:32 +0100)]
Bug 27351: Fix UsageStatsCountry system preference wrong type

UsageStatsCountry system preference type 'YesNo' is wrong since it has
several values.
Change to 'Choice'.
Looks like this error whas only in updatedabase 3.17.00.030.

Test plan :
1) Run atomic update
2) Check in database 'UsageStatsCountry' system preference type is
   'Choice'

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>
3 years agoBug 27164: Fix item search CSV export
Fridolin Somers [Mon, 7 Dec 2020 16:03:40 +0000 (17:03 +0100)]
Bug 27164: Fix item search CSV export

In item search CSV export, data cells are exported with double quotes.
There should also be double quotes in header cells.
Also some spaces can be removed.
Delimiter must be from system preference 'delimiter'.
TT filter must be $raw not html, only double quotes must be espaped by
duplication of it.

This may help to open the CSV with any table/calc software.

Test plan :
1.0) Create a record with title : Laurel & "Hardy"
1.2) Create an item on this record
2.0) Without patch
2.1) Perform an item search on title 'Laurel'
2.2) Export as a CSV file and save the file locally
2.3) Open the file with a table/calc software
3.0) Apply patch
3.1) Perform same item search
3.2) Export as a CSV file and save the file locally
3.3) Open the file with a table/calc software
4.0) Compare files with diff/meld
=> you see double quotes arround header cells
   and removal of space after coma
4.1) Check that delimiter is from system preference 'delimiter'
4.2) In table/calc software they should look the same

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26417: Remove warn in Koha::Patron is_valid_age
Fridolin Somers [Wed, 9 Sep 2020 11:54:34 +0000 (13:54 +0200)]
Bug 26417: Remove warn in Koha::Patron is_valid_age

In Koha::Patron is_valid_age the is a compare : $age < $low
But $low may be undef.
It generates a warn :
Use of uninitialized value $low in numeric lt (<)

Needs a test like for $high.

Test plan :
1) Run prove t/db_dependent/Koha/Patrons.t
2) Edit a patron catetory, empty "Age required" and save
3) Edit a patron of this category
4) Check in logs you don't see "Use of uninitialized value $low in numeric lt (<)"

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 27292: Add TablesSettings directive to fix columns_settings_borrowers_table
David Cook [Wed, 23 Dec 2020 04:41:58 +0000 (04:41 +0000)]
Bug 27292: Add TablesSettings directive to fix columns_settings_borrowers_table

This patch adds the USE TablesSettings directive which allows the plugin
to be invoked to fill the columns_settings_borrowers_table variable.

Test plan:
0. Do not apply the patch
1. Go to http://localhost:8081/cgi-bin/koha/reserve/request.pl?borrowernumber=51&biblionumber=29
2. View source on the page and note columns_settings_borrowers_table has no value assigned
2. Apply the patch
3. In a new tab, go to http://localhost:8081/cgi-bin/koha/reserve/request.pl?borrowernumber=51&biblionumber=29
4. Note that nothing has changed on the surfeace
5. View source ont he page and note columns_settings_borrowers_table now has a value assigned

Signed-off-by: Lucas Gass <lucas@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 27245: Replace AutoCommit=0 with txn_begin in bulkmarcimport.pl
Jonathan Druart [Fri, 18 Dec 2020 13:41:12 +0000 (14:41 +0100)]
Bug 27245: Replace AutoCommit=0 with txn_begin in bulkmarcimport.pl

To prevent
DBD::mysql::db begin_work failed: Already in a transaction at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1588, <GEN45> line 1.

Test plan:
1 - Export more than 100 records
2 - Use bulkmarcimport (with -commit=10) to import them
    perl misc/migration_tools/bulkmarcimport.pl -b -file testbmi.xml -v -m=MARCXML --commit=10
3 - Modify a record to make the import fail (for instance having a too long
lccn)
4 - Use bulkmarcimport (with -commit=10) to import them
    perl misc/migration_tools/bulkmarcimport.pl -b -file testbmi.xml -v -m=MARCXML --commit=10
5 - Notice that the import stops but that the imported record are imported (apart from the last batch of 10)

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26367: Prevent warn about undefined values when record level hold has an itemtype
Nick Clemens [Thu, 3 Sep 2020 12:15:57 +0000 (12:15 +0000)]
Bug 26367: Prevent warn about undefined values when record level hold has an itemtype

To test:
 1 - set AllowHoldItemTypeSelection to 'Allow'
 2 - Find a patron from Library A
 3 - Find a record with an item from Library A
 4 - Place a title level hold with itemtype specified for a delivery at Library A for patron and record above
 5 - perl misc/cronjobs/holds/build_holds_queue.pl
 6 - There are warns:
 Use of uninitialized value in hash element at /kohadevbox/koha/C4/HoldsQueue.pm line 523.
 Use of uninitialized value in string eq at /kohadevbox/koha/C4/HoldsQueue.pm line 523
 7 - Apply this patch
 8 - perl misc/cronjobs/holds/build_holds_queue.pl
 9 - No more warns!
10 - prove -v t/db_dependent/HoldsQueue.t
11 - All tests pass!

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 26367: Unit test
Nick Clemens [Thu, 3 Sep 2020 12:06:51 +0000 (12:06 +0000)]
Bug 26367: Unit test

This warn only appears when:
  The borrower and item branches match
  AND
  The hold fulfillment policy is any or the pickupbranch matches the items branch specified by hold_fulfillment_policy
  AND
  The request has an itemtype set

To trigger we simply add some itemtype to existing hold requests in the test

To test:
1 - prove -v t/db_dependent/HoldsQueue.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26364: Adjust unit tests
Nick Clemens [Wed, 9 Sep 2020 14:34:26 +0000 (14:34 +0000)]
Bug 26364: Adjust unit tests

We shouldn't rely on knowing exactly which ISBNs we get, we should specifically
check for what we do or don't expect.

I believe we should return biblios that have the same isbn we passed, as it signlas we have another
biblio in the catalog that matches the one we are on.

To test:
prove -v t/db_dependent/XISBN.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26364: Don't discard the passed isbn
Nick Clemens [Wed, 9 Sep 2020 13:44:45 +0000 (13:44 +0000)]
Bug 26364: Don't discard the passed isbn

I don't know, if we get rid fo this check we can now check the db for the same isbn we passed

This may be useful as we may want to see the biblio with the same isbn as long as number is different?

This will make tests fail

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 26364: Remove useless condition
Nick Clemens [Wed, 9 Sep 2020 13:40:37 +0000 (13:40 +0000)]
Bug 26364: Remove useless condition

$response_data is a hash with one key, content

Why are we checkiing it against a string?

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 26364: Remove false matches on isbn
Nick Clemens [Wed, 9 Sep 2020 13:33:17 +0000 (13:33 +0000)]
Bug 26364: Remove false matches on isbn

The test here was returning 0590353403 when searched for 9780590353403
because of the regex matching

Koha doesn't work this way unless SearchWithISBNVariations is set to 'search'
and you use a dropdown to select ISBN for searching

To test:
1 - Search catalog for nb=9780590353403
2 - Confirm you don't have results, or delete the records with results
3 - Add isbn 0590353403 to a record
4 - Repeat search, fails
5 - Enable SearchWithISBNVariations
6 - Repeat search, fails
7 - Go to advanced search, select ISBN, search for 9780590353403
8 - Get results

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 26364: Don't skip records that match the isbn we passed
Nick Clemens [Wed, 9 Sep 2020 13:24:20 +0000 (13:24 +0000)]
Bug 26364: Don't skip records that match the isbn we passed

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>