]> git.koha-community.org Git - koha.git/log
koha.git
2 years agoBug 15594: (QA follow-up) Move span to publisher name, fix whitespace, only add space...
Nick Clemens [Fri, 4 Mar 2022 16:48:19 +0000 (16:48 +0000)]
Bug 15594: (QA follow-up) Move span to publisher name, fix whitespace, only add spaces once per loop

This patch updates the whitespace for readbility
Moves the Ogranization span to the subfield b, publisher name only
Moves check for last/whitespace to the loop

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 15594: Class in now unchanged after the patch
The Minh Luong [Thu, 3 Mar 2022 20:03:57 +0000 (15:03 -0500)]
Bug 15594: Class in now unchanged after the patch

I'm not sure if this is the actual issue, but I found that the patch puts the span with
the class "publisher_name" inside a new span with typeOf="Organization".

In this patch, I removed that new span, to keep it coherent with the previous code.
Also, the MARC 260 subfields are displayed correctly !

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 15594: preserve sequence of 260 subfields in (staff) detail page
Blou [Wed, 8 Dec 2021 21:45:29 +0000 (16:45 -0500)]
Bug 15594: preserve sequence of 260 subfields in (staff) detail page

When ordered $a$b$a$b$c in the MARC object, 260 subfields are displayed
$a$a$b$b$c.  This goes against the standard.

This patch preserves the order.

0) create a notice with $a$b$a subfields.  In that (mixed) order.
1) Go to staff detail page and see the fields displayed as "aab"
2) apply the patch
3) validate the aba display.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 15594: preserve sequence of 260 subfields in detail page
Blou [Mon, 6 Dec 2021 18:48:30 +0000 (13:48 -0500)]
Bug 15594: preserve sequence of 260 subfields in detail page

When ordered $a$b$a$b$c in the MARC object, 260 subfields are displayed
$a$a$b$b$c.  This goes against the standard.

This patch preserves the order.

0) create a notice with $a$b$a subfields.  In that (mixed) order.
1) Go to detail page and see the fields displayed as "aab"
2) apply the patch
3) validate the aba display.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30190: Compiled CSS
Fridolin Somers [Wed, 9 Mar 2022 08:19:01 +0000 (22:19 -1000)]
Bug 30190: Compiled CSS

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30190: Green buttons turn blue for a second when clicking them
Owen Leonard [Wed, 2 Mar 2022 14:23:36 +0000 (14:23 +0000)]
Bug 30190: Green buttons turn blue for a second when clicking them

This patch adds additional CSS to better cover various states of buttons
in the OPAC.

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

- In the OPAC, test various green buttons in varous states: default,
  hover, and active (the appearance when the button is clicked but
  before the mouse button is released).
- The button should be styled in various shades of green in all cases.
- Test a disabled button by performing a catalog search.
- On the results page, before any checkboxes are checked, the "Save"
  button should look correct.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29136: (QA follow-up) missing filters
Nick Clemens [Fri, 18 Feb 2022 16:36:56 +0000 (16:36 +0000)]
Bug 29136: (QA follow-up) missing filters

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29136: Don't redirect if the whole set is > 1
Jonathan Druart [Mon, 7 Feb 2022 16:27:37 +0000 (17:27 +0100)]
Bug 29136: Don't redirect if the whole set is > 1

To prevent a redirect when we click on a page with only 1 result

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29136: Ajaxify the patron search when placing a hold
Jonathan Druart [Tue, 1 Feb 2022 10:06:49 +0000 (11:06 +0100)]
Bug 29136: Ajaxify the patron search when placing a hold

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29771: Scalar context for split
Tomas Cohen Arazi [Thu, 23 Dec 2021 19:58:57 +0000 (16:58 -0300)]
Bug 29771: Scalar context for split

This patch tackles a very specific scenario. Calling split(...,
CGI::param) makes it be called in list context. The split docs say:

split /PATTERN/,EXPR,LIMIT

this means the first CGI param will be used as EXPR and the second one
as LIMIT, which is wrong anyway. So the fix is to just force scalar
context.

To test:
1. Not sure, just make sure nothing breaks when using the scripts in the
   browser.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29771: Remove trivial cases
Tomas Cohen Arazi [Thu, 23 Dec 2021 19:16:58 +0000 (16:16 -0300)]
Bug 29771: Remove trivial cases

I squashed the patches because they are too trivial to have a test plan.
Or it is too much work to write the test plan for such trivial cases. I
leave the original commit messages just in case.

Generally, this are all cases in which CGI::param is being called in a
trivially identifiable _list context_. i.e. they are assigned to a
@variable.

I left one case out on purpose: admin/auth_subfields_structure.pl

Paul introduced this:

my @kohafield = ''.$input->param('kohafield');
and then:
my $kohafield = $kohafield[$i];

My intuition says it is forcing scalar context on the first assignment
so the list contains a single element and then inside the loop some
$kohafield assignments should lead to undef, and even warnings. I leave
it for a separate patch because it is not that easy testable and is a
sensible area.

Bug 29771: Remove warning from  acqui/finishreceive.pl

This patch removes a warning that shows when receiving.

To test:
1. Do the acq workflow up to the receive step.
2. Once you choose the items and click on Finish
=> FAIL: There's a warning in the logs
3. Revert receipt
4. Apply this patch
5. Receive
=> SUCCESS: No more warnings
6. Sign off :-D

Bug 29771: Remove warning from svc/members/add_to_list

To test:
1. Run:
   $ tail -f /var/log/koha/kohadev/*-error.log
2. Generate a patron list
3. Perform a patron search that gives you a few
4. Select some, and choose to add them to the list
=> FAIL: The logs show the infamous warn:
CGI::param called in list context from /kohadevbox/koha/svc/members/add_to_list
5. Apply this patch
6. Restart plack and repeat 4
=> SUCCESS: No warn!
7. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30128: DBrev 21.12.00.017
Fridolin Somers [Wed, 9 Mar 2022 08:00:05 +0000 (22:00 -1000)]
Bug 30128: DBrev 21.12.00.017

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30128: DBIC Schema update
Fridolin Somers [Wed, 9 Mar 2022 07:58:02 +0000 (21:58 -1000)]
Bug 30128: DBIC Schema update

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30128: Change language_subtag_registry.description to varchar(255)
Fridolin Somers [Fri, 18 Feb 2022 06:37:13 +0000 (20:37 -1000)]
Bug 30128: Change language_subtag_registry.description to varchar(255)

In database, language_descriptions.description is VARCHAR(255).
language_subtag_registry.description is VARCH(25), it should have same size.

You can see in https://www.loc.gov/standards/iso639-2/php/code_list.php there is for example 'South American Indian languages'

Test plan :
1) Run atomic update
2) Check language_subtag_registry.description is now varchar(255)

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30035: Fix failing test
Jonathan Druart [Fri, 4 Mar 2022 07:47:15 +0000 (08:47 +0100)]
Bug 30035: Fix failing test

Looks like there was a change in the output for Spanish.
Can be 'ene.' in older versions

Sponsored-by: Orex Digital
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30203: Circulation.t: prevent locking by setting envvar
Marcel de Rooy [Thu, 3 Mar 2022 10:27:20 +0000 (10:27 +0000)]
Bug 30203: Circulation.t: prevent locking by setting envvar

Running this test without prove is disastrous. The LOCK in
the called SendCirculationAlert will ruin your data.
But no longer when you apply this patch.

Test plan:
Run prove Circulation.t
Inspect your data (e.g. borrowers table).
Run perl Circulation.t
Inspect your data (e.g. borrowers table) again.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28782: (QA follow-up) Fix missing filter
Nick Clemens [Fri, 18 Feb 2022 16:19:23 +0000 (16:19 +0000)]
Bug 28782: (QA follow-up) Fix missing filter

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28782: (QA follow-up) Bug 29844 follow-up
Nick Clemens [Fri, 18 Feb 2022 16:15:55 +0000 (16:15 +0000)]
Bug 28782: (QA follow-up) Bug 29844 follow-up

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28782: Fix cancel holds in bulk
Jonathan Druart [Fri, 28 Jan 2022 13:47:12 +0000 (14:47 +0100)]
Bug 28782: Fix cancel holds in bulk

See also bug 29969.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28782: Fix link when placing a hold for a patron from patron list
Jonathan Druart [Fri, 28 Jan 2022 13:46:38 +0000 (14:46 +0100)]
Bug 28782: Fix link when placing a hold for a patron from patron list

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28782: (follow-up) Pass real array to query_form()
Joonas Kylmälä [Sat, 30 Oct 2021 21:49:10 +0000 (21:49 +0000)]
Bug 28782: (follow-up) Pass real array to query_form()

It excepts to receive a real array and not a list, in order to be able
to generate the query parameters.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28782: Use query param list instead of splitting elements using '/'
Joonas Kylmälä [Thu, 29 Jul 2021 14:23:01 +0000 (17:23 +0300)]
Bug 28782: Use query param list instead of splitting elements using '/'

This removes the need to handle single and multiple cases separately,
thus removing bunch if-else cases and simplifying our code. This
coding style is also in line with our other .pl scripts.

To test:
 1) Make sure placing a hold still works from the following pages:

   /cgi-bin/koha/catalogue/detail.pl?biblionumber=XXX

   /cgi-bin/koha/catalogue/search.pl?q=a

   /cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=XXXX

   /cgi-bin/koha/clubs/clubs.pl (create a new club and add a patron
   there and through the clubs.pl create a hold to a bib)

Signed-off-by: Hayley Pelham <hayleypelham@catalyst.net.nz>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30147: Fix modules usage in opac-detail.pl
Fridolin Somers [Fri, 25 Feb 2022 00:24:18 +0000 (14:24 -1000)]
Bug 30147: Fix modules usage in opac-detail.pl

On the ktd sample database when trying to go to the detail page from the result list:
Undefined subroutine &CGI::Compile::ROOT::kohadevbox_koha_opac_opac_2ddetail_2epl::searchResults called at /kohadevbox/koha/opac/opac-detail.pl line 260
Turning off OpacBrowseResults makes the error disappear.

In opac-detail.pl, use C4::Search is missing searchResults and getRecords

To test:
- Search for something that gives several result pages in OPAC, example: e
- Switch to one of the last pages using link on top of results, example: 10
- Open any of the records listed in detail view
- Verify that the error is shown
- Apply patch and repeat, error is gone and browsing behaves as expected

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29826: Manage call of Template Plugin Branches GetName() with null or empty branc...
Fridolin Somers [Sat, 8 Jan 2022 01:34:49 +0000 (15:34 -1000)]
Bug 29826: Manage call of Template Plugin Branches GetName() with null or empty branchcode

Bug 26587 added a concatenation that sends a warning if var is undef :
$ prove t/db_dependent/Template/Plugin/Branches.t
Use of uninitialized value $branchcode in concatenation (.) or string at /kohadevbox/koha/Koha/Template/Plugin/Branches.pm line 35.

This patch adds an early return empty string when GetName is called with $branchcode null or empty string.

Test plan :
1) Run t/db_dependent/Template/Plugin/Branches.t without patch
2) Run with the patch to see warning disappear

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30098: Only redirect from patron search if single result is on first page
Nick Clemens [Mon, 14 Feb 2022 18:38:16 +0000 (18:38 +0000)]
Bug 30098: Only redirect from patron search if single result is on first page

This patch simply adds a check that we are oin the first page (starting at result 0)
before redirecting to a isngle patron

To test:
1 - Perform a patron search that returns 41 results, on Koha testing docker, 'a' works
2 - Go to second page of results, works
3 - Go to third page of results, redirected to the patron
4 - Apply patch
5 - Repeat search and paging
6 - On third page you remian in results and are not redirected to patron

Signed-off-by: Emmanuel Bétemps <e.betemps@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 26269: "Date due to" and "Show any items currently checked out" filters doesn...
Marion Durand [Mon, 18 Oct 2021 12:35:21 +0000 (14:35 +0200)]
Bug 26269: "Date due to" and "Show any items currently checked out" filters doesn't work properly in overdues.pl

Filter "Date due to" is now taken into account even when filled with a
future date for the displayed result and downloaded results.
Filter "Show any items currently checked out" is now taken into account
for the downloaded results.

To test:
1- Go to Circulation then to overdues
2a- Add a filter with "Date due To" > today
2b- Check that only the results with "Due date" < today are displayed
(not those with "Due date" between today and the date requested)
2c- Click on "Download file of displayed overdues"
2d- Check that the file contains only the results with "Due date" <
today (not those with "Due date" between today and the date requested)
3a- Reset filter and then add the filter "Show any items currently
checked out"
3b- Check that all the results are displayed (even those with "Due date"
> today)
3c- Click on "Download file of displayed overdues"
3d- Check that the file contains only the results with "Due date" <
today (not those with "Due date" between today and the date requested)
9- Apply the patch
10- Repeat step 1 to 8, checking that all the results corresponding to
the selected filter are now displayed/downloaded

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

Signed-off-by: Theodoros Theodoropoulos <theod@lib.auth.gr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29220: Minor fixes and improved code readability
David Gustafsson [Wed, 13 Oct 2021 13:36:43 +0000 (15:36 +0200)]
Bug 29220: Minor fixes and improved code readability

The current handling of onsite checkouts with OnSiteCheckoutsForce
syspref enabled is confusing and hard to understand. It's also fragile
with a high risk future changes could result in subtle bugs.

Also fix an inconsistency in which errors (DEBT_GUARANTORS) are considered blocking for
forced onsite checkouts.

To test:
1) Enable OnSiteCheckouts, disable OnSiteCheckoutsForce
2) Edit a biblio item and for example set Not for loan to a value
restricting loans
3) Try to check out the item for some patron
4) A message that item is not for loan should be displayed
5) Select "On-site checkout" and try again
6) The same message should be displayed
7) Try to checkout with some invalid barcode
8) A message that barcode was not found should be displayed
9) Now enable OnSiteCheckoutsForce
10) Try to checkout the item for some patron
11) A message that item is not for loan should be displayed
12) Select "On-site checkout" and try again
13) Checkout should now succeed, no messages should be displayed
14) Try to checkout with some invalid barcode
15) A message that barcode was not found should be displayed
16) All of the above steps should produce the same result with and without this patch

Additional:
Before patch:
 a) Set  NoIssuesChargeGuarantorsWithGuarantees to 1
 b) add a guarantee with another guarantor
 c) charge a 1.01 fine to other guarantor
 d) checkout is blocked due to fines
Apply patch
 e) checkout is allowed when onsite checkouts forced

Sponsored-by: Gothenburg University Library
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29877: Make POST /holds handle maxreserves correctly
Tomas Cohen Arazi [Thu, 13 Jan 2022 15:10:30 +0000 (12:10 -0300)]
Bug 29877: Make POST /holds handle maxreserves correctly

The current implementation doesn't consider the following values for the
syspref: undef and 0.

The tests mistakenly didn't cover them.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.t
=> FAIL: Tests fail, obvious warnings about comparing undefined values
         too.
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. You can try on Postman as well
=> SUCCESS: Behavior is correct!
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29877: Regression tests
Tomas Cohen Arazi [Thu, 13 Jan 2022 15:10:24 +0000 (12:10 -0300)]
Bug 29877: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30178: (bugs 27526 and 28445 follow-up) Every librarian can edit every item with...
Janusz Kaczmarek [Thu, 24 Feb 2022 20:26:46 +0000 (21:26 +0100)]
Bug 30178: (bugs 27526 and 28445 follow-up) Every librarian can edit every item with IndependentBranches on

Problem arises after applying bugfix 27526 and 28445: with
IndependentBranches on, a librarian without superlibrarian privileges,
can edit (and potentially delete) every item (i.e. also from a foreign
branch).  This is because can_be_edited calculation is buggy (in two spots).

Test plan:
1. Have (at least) two branches defined.
2. Have IndependentBranches set.
3. Have a biblio record with items belonging to different branches.
4. Be a librarian without superlibrarian rights, with editcatalogue
   and tool permissions set.

Scenario A (Edit items):
1. Go to Edit -> Edit items view (cataloguing/additems.pl).
2. You will be able to edit every item, also ones not from the branch
   you are from (cf. the button 'Actions').
3. Apply the patch.
4. Repeat 1.
5. You should be able to edit only the items from your branch.

Scenario B (Edit items in batch):
1. From Normal view go to Edit -> Edit items in batch.
2. You will be able to batch edit every item, also ones not from the branch
   you are from.
3. Apply the patch.
4. Repeat 1.
5. You should be able to edit only the items from your branch (and
   see 'Cannot edit' for others.

Scenario C (Delete items in batch):
1. From Normal view go to Edit -> Delete items in batch.
2. You will not see the string 'Cannot delete' and only by chance
   will not be able to activate the checkboxes next to foreign items.
3. Apply the patch.
4. Repeat 1.
5. You should be able to delete only the items from your branch (and
   see 'Cannot delete' for others.

Scenario D and E:
Analogous steps can be executed from Tools -> Batch item modification
and Tools -> Batch item deletion

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30072: (follow-up) Fix UT after Bug 29857
Fridolin Somers [Fri, 4 Mar 2022 00:42:04 +0000 (14:42 -1000)]
Bug 30072: (follow-up) Fix UT after Bug 29857

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30072: (follow-up) Silence useless warning
Tomas Cohen Arazi [Fri, 11 Feb 2022 18:35:31 +0000 (15:35 -0300)]
Bug 30072: (follow-up) Silence useless warning

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: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30072: Add missing hold actions plugin hooks
Tomas Cohen Arazi [Fri, 11 Feb 2022 18:28:31 +0000 (15:28 -0300)]
Bug 30072: Add missing hold actions plugin hooks

This patch introduces the after_hold_action plugin hook, with 4
different 'action' parameters:

- fill
- cancel
- suspend
- resume

To test:
1. Apply the unit tests
2. Run:
   $ kshell
  k$ t/db_dependent/Koha/Plugins/Holds_hooks.t -v
=> FAIL: The hooks are not in the code, so the expected output from the
Koha::Plugin::Test plugin is not there, and the tests fail
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Note: I think we could deprecate 'after_hold_create' and migrate it to
the one introduced here, using the 'place' action.

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: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30072: Unit tests
Tomas Cohen Arazi [Fri, 11 Feb 2022 18:28:10 +0000 (15:28 -0300)]
Bug 30072: Unit tests

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: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30125: (QA follow-up) Rename variable as cities
Nick Clemens [Fri, 18 Feb 2022 12:03:46 +0000 (12:03 +0000)]
Bug 30125: (QA follow-up) Rename variable as cities

It's what we are testing :-)

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30125: Add full-stack tests for API pagination
Tomas Cohen Arazi [Thu, 17 Feb 2022 17:50:14 +0000 (14:50 -0300)]
Bug 30125: Add full-stack tests for API pagination

This patch adds tests for all the pagination use cases on a real route
(GET /cities). It tests _page, _per_page along with the returned Link
headers and total counts (i.e. X-Total-Count, X-Base-Total-Count), and
the results themselves.

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29886: Add Koha::Suggestions->search_limited
Tomas Cohen Arazi [Fri, 14 Jan 2022 16:03:54 +0000 (13:03 -0300)]
Bug 29886: Add Koha::Suggestions->search_limited

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29886: Unit tests
Tomas Cohen Arazi [Fri, 14 Jan 2022 17:49:29 +0000 (14:49 -0300)]
Bug 29886: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30007: (follow-up) Adapt tests
Tomas Cohen Arazi [Wed, 2 Mar 2022 18:05:02 +0000 (15:05 -0300)]
Bug 30007: (follow-up) Adapt tests

This patch adapts tests to acknowledge ->cancel and ->fill methods won't
yield 'undef' borrowernumber when anonymization takes place, and even
further, and exception will be thrown and cancellation/fulfillment will
be rejected.

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

Bonus: this problem was hidding bad tests caused by 29857, fixed on this
one as well.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 25616: (follow-up) Fix t/Search.t
Fridolin Somers [Wed, 2 Mar 2022 18:52:54 +0000 (08:52 -1000)]
Bug 25616: (follow-up) Fix t/Search.t

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30007: (follow-up) Adjust Koha::Patrons->search_patrons_to_anonymise tests
Tomas Cohen Arazi [Wed, 2 Mar 2022 12:19:55 +0000 (09:19 -0300)]
Bug 30007: (follow-up) Adjust Koha::Patrons->search_patrons_to_anonymise tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: (follow-up) Fix t/db_dependent/api/v1/transfer_limits.t
Fridolin Somers [Wed, 2 Mar 2022 18:21:40 +0000 (08:21 -1000)]
Bug 29857: (follow-up) Fix t/db_dependent/api/v1/transfer_limits.t

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: (follow-up) Fix t/db_dependent/Koha/BackgroundJobs/BatchUpdateBiblio.t
Fridolin Somers [Wed, 2 Mar 2022 18:16:33 +0000 (08:16 -1000)]
Bug 29857: (follow-up) Fix t/db_dependent/Koha/BackgroundJobs/BatchUpdateBiblio.t

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: (follow-up) Fix t/db_dependent/Koha/Club/Hold.t
Fridolin Somers [Wed, 2 Mar 2022 18:04:00 +0000 (08:04 -1000)]
Bug 29857: (follow-up) Fix t/db_dependent/Koha/Club/Hold.t

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: (follow-up) Fix t/db_dependent/Koha/Plugins/Plugins.t
Fridolin Somers [Wed, 2 Mar 2022 17:57:58 +0000 (07:57 -1000)]
Bug 29857: (follow-up) Fix t/db_dependent/Koha/Plugins/Plugins.t

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: (follow-up) Fix t/Koha/REST/Plugin/Query.t
Fridolin Somers [Wed, 2 Mar 2022 17:37:47 +0000 (07:37 -1000)]
Bug 29857: (follow-up) Fix t/Koha/REST/Plugin/Query.t

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: (follow-up) Fix t/db_dependent/Koha/Patron/Modifications.t
Tomas Cohen Arazi [Wed, 2 Mar 2022 14:42:51 +0000 (11:42 -0300)]
Bug 29857: (follow-up) Fix t/db_dependent/Koha/Patron/Modifications.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: (follow-up) Fix t/db_dependent/Auth.t
Tomas Cohen Arazi [Wed, 2 Mar 2022 14:36:56 +0000 (11:36 -0300)]
Bug 29857: (follow-up) Fix t/db_dependent/Auth.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: (follow-up) Fix t/Koha/Email.t
Tomas Cohen Arazi [Wed, 2 Mar 2022 12:55:32 +0000 (09:55 -0300)]
Bug 29857: (follow-up) Fix t/Koha/Email.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: (follow-up) Fix t/Koha/Object/Message.t
Tomas Cohen Arazi [Wed, 2 Mar 2022 12:52:20 +0000 (09:52 -0300)]
Bug 29857: (follow-up) Fix t/Koha/Object/Message.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: (follow-up) Fix t/db_dependent/Koha/Biblio.t
Tomas Cohen Arazi [Wed, 2 Mar 2022 12:49:25 +0000 (09:49 -0300)]
Bug 29857: (follow-up) Fix t/db_dependent/Koha/Biblio.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: (follow-up) Fix t/Koha/Plugins/Tab.t
Tomas Cohen Arazi [Wed, 2 Mar 2022 12:31:47 +0000 (09:31 -0300)]
Bug 29857: (follow-up) Fix t/Koha/Plugins/Tab.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: (follow-up) Fix Barcode_transform_hooks.t
Tomas Cohen Arazi [Wed, 2 Mar 2022 12:28:35 +0000 (09:28 -0300)]
Bug 29857: (follow-up) Fix Barcode_transform_hooks.t

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29589: (follow-up) Add TT filter
Katrin Fischer [Sat, 26 Feb 2022 22:41:11 +0000 (23:41 +0100)]
Bug 29589: (follow-up) Add TT filter

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29589: MARCOverlayRules - fix translatability issue
Jonathan Druart [Tue, 30 Nov 2021 13:10:58 +0000 (14:10 +0100)]
Bug 29589: MARCOverlayRules - fix translatability issue

Strings must not contain html tags, we should use KohaSpan instead.

Test plan:
Apply the patch, update translation for a given language, edit XX-YY-staff-prog.po

Notice that the string is now
"The %s preference is not set, don't forget to enable it for rules to take effect."

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30035: Fix month name in prediction pattern
Jonathan Druart [Mon, 7 Feb 2022 08:26:12 +0000 (09:26 +0100)]
Bug 30035: Fix month name in prediction pattern

We are using %B to display the month name but it seems that using the
CLDR pattern LLLL would be more appropriated.
https://metacpan.org/pod/DateTime#CLDR-Patterns
%B   - The full month name.
LLLL - The wide stand-alone form for the month.

For instance in Catalan:
https://metacpan.org/pod/DateTime::Locale::ca
%B will display "de gener" when LLLL will be "gener"

Test plan:
Create a new numbering pattern:
Home > Serials > Numbering patterns > New numbering pattern
Numbering formula: {X}
Label: monthname
Add: 1
Every: 1
Set back to: 1
When more than: 999
Formatting: Name of month
And test it at the bottom of the form
Locale: Catalan
The number column should contain "gener", not "de gener"
Test other locales and confirm that the output is correct (no change
expected for English, French and Spanish for instance).

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29687: Uninitialized warning C4/XSLT line 286
Marcel de Rooy [Mon, 13 Dec 2021 13:23:57 +0000 (13:23 +0000)]
Bug 29687: Uninitialized warning C4/XSLT line 286

From plack-opac-error.log:
[WARN] Use of uninitialized value $value in concatenation (.) or string at /usr/share/koha/C4/XSLT.pm line 286.

Test plan:
An opac search triggered the warning. So repeat it without warns.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30185: Missing return in db rev 210600003.pl
Fridolin Somers [Sat, 26 Feb 2022 01:57:41 +0000 (15:57 -1000)]
Bug 30185: Missing return in db rev 210600003.pl

db rev files are constructed with a return {...}, db rev 210600003.pl is missing return word.
I don't know if it can impact the db upgrade but we should fix it for consistency.

To test upgrade from a version 21.05 and check db rev is applied.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30023: Make MarkIssueReturned use ->anonymize
Tomas Cohen Arazi [Fri, 4 Feb 2022 11:47:05 +0000 (08:47 -0300)]
Bug 30023: Make MarkIssueReturned use ->anonymize

Koha::Old::Checkout->anonymize takes care of checking the syspref and
raises an exception if not set. So no we can now leverage on it, instead
of checking manually and then tweaking the checkout object manually as
well.

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30023: Add Koha::Old::Checkout->anonymize
Tomas Cohen Arazi [Fri, 4 Feb 2022 11:40:13 +0000 (08:40 -0300)]
Bug 30023: Add Koha::Old::Checkout->anonymize

This patch adds the mentioned method. It replicates the Koha::Old::Hold
behavior, including the exception thrown on bad configuration.

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30007: Make ->anonymize methods throw an exception if AnonymousPatron is not set
Tomas Cohen Arazi [Fri, 4 Feb 2022 11:15:06 +0000 (08:15 -0300)]
Bug 30007: Make ->anonymize methods throw an exception if AnonymousPatron is not set

This patch makes the ->anonymize methods throw a
Koha::Exceptions::SysPref::NotSet exception when trying to anonymize
holds and checkouts without AnonymousPatron properly set.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Old/Checkouts.t \
           t/db_dependent/Koha/Old/Holds.t \
           t/db_dependent/Koha/Old/Hold.t
=> FAIL: Tests fail, no exception thrown
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
https://bugs.koha-community.org/show_bug.cgi?id=3007
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30007: Add Koha::Exceptions::SysPref
Tomas Cohen Arazi [Thu, 3 Feb 2022 19:22:49 +0000 (16:22 -0300)]
Bug 30007: Add Koha::Exceptions::SysPref

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
https://bugs.koha-community.org/show_bug.cgi?id=3007
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30007: Regression tests
Tomas Cohen Arazi [Fri, 4 Feb 2022 11:14:30 +0000 (08:14 -0300)]
Bug 30007: Regression tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
https://bugs.koha-community.org/show_bug.cgi?id=3007
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: (QA follow-up) Fix unit test Object.t
Fridolin Somers [Wed, 2 Mar 2022 07:04:13 +0000 (21:04 -1000)]
Bug 29857: (QA follow-up) Fix unit test Object.t

Unit test failling with :
    #   Failed test 'Exception message correct'
    #   at /kohadevbox/koha/t/db_dependent/Koha/Object.t line 335.
     #          got: 'Exception 'Koha::Exception' thrown 'Asked to embed items but its return value doesn't implement to_api'
    # '
    #     expected: 'Asked to embed items but its return value doesn't implement to_api'
     # Looks like you failed 1 test of 29.

Fixed by using $@->message like in other places.

prove t/db_dependent/Koha/Object.t

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: (QA follow-up) Add license
Marcel de Rooy [Fri, 4 Feb 2022 08:07:47 +0000 (08:07 +0000)]
Bug 29857: (QA follow-up) Add license

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: Fix behavior
Tomas Cohen Arazi [Mon, 31 Jan 2022 15:07:02 +0000 (12:07 -0300)]
Bug 29857: Fix behavior

This patch makes:
- passed parameters be rendered alphabetically to allow testing.
- only the defined parameters be rendered in the string
- the method honor the fact that $self->message should be returned if
  passed to the constructor (i.e. if the developer called
Koha::Exceptions::MyException->throw( $string ) they will expect $string
to be rendered.

To test:
1. Apply the unit tests patch
2. Run:
   $ kshell
  k$ prove t/Koha/Exceptions.t
=> FAIL: Tests fail!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: Unit tests
Tomas Cohen Arazi [Mon, 31 Jan 2022 15:06:46 +0000 (12:06 -0300)]
Bug 29857: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: Rename base class as Koha::Exception
Tomas Cohen Arazi [Mon, 31 Jan 2022 14:02:41 +0000 (11:02 -0300)]
Bug 29857: Rename base class as Koha::Exception

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: Provide a generic full_message method for our exceptions
Jonathan Druart [Wed, 12 Jan 2022 09:30:59 +0000 (10:30 +0100)]
Bug 29857: Provide a generic full_message method for our exceptions

We pass useful information when throwing exceptions, but we don't
display them! We must display all the details we need when the exception
is stringified.

Test plan:

Use the following snippet:
  use Koha::Exceptions::Elasticsearch;
  Koha::Exceptions::Elasticsearch::BadResponse->throw( type => "a good type", details => "and some details" );

Execute it without and with the patch.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29857: Make the exception classes inherit from the base class
Jonathan Druart [Wed, 12 Jan 2022 09:31:24 +0000 (10:31 +0100)]
Bug 29857: Make the exception classes inherit from the base class

We have a base class Koha::Exceptions::Exception but it's not used in
most of our exception classes

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30164: Fix datatable wrapper when no filter passed
Jonathan Druart [Wed, 23 Feb 2022 14:21:04 +0000 (15:21 +0100)]
Bug 30164: Fix datatable wrapper when no filter passed

This problem appears (at least) on the cities list view:
If you pass a filter in the "Search cities" filter in the header, it
won't be taken into account and all the cities will be displayed.

There are two problems. First we are passing an "empty" q=[] in the
body, the filter from the header is passed as URL parameters. We should
not need to pass the q if it's empty.
Then the main problem is coming from a bug in
Koha::REST::Plugin::Query but I didn't manage to track it down. If we
have two 2 passed, only the second one will be used. We are certainly
using a hash somewhere we should not.

This patch is fixing the bug but not on the correct side. A follow-up
bug should take care of the main problem at lower level.

Test plan:
Hit /admin/cities.pl
Create some cities
Use the filter in the header of the page and submit
=> Without this patch all cities are retrieved
=> With this patch applied only the relevant cities are displayed.

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29338: (follow-up) only show print button when hold is waiting or intransit
Lucas Gass [Tue, 21 Dec 2021 21:36:28 +0000 (21:36 +0000)]
Bug 29338: (follow-up) only show print button when hold is waiting or intransit

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29338: Add print hold/transfer button to request.tt
Lucas Gass [Wed, 27 Oct 2021 21:58:44 +0000 (21:58 +0000)]
Bug 29338: Add print hold/transfer button to request.tt

1. Apply patch
2. Make some holds, have some item level and some bib level
3. On request.tt notice a new column on the holds_table called 'Print hold/transfer slip'
4. Make sure the button works and takes you to the proper hold/transfer slip
5. Make sure it works well with both item/bib level holds

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30153: (QA follow-up) Fix unit tests
Martin Renvoize [Tue, 22 Feb 2022 16:28:19 +0000 (16:28 +0000)]
Bug 30153: (QA follow-up) Fix unit tests

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30153: Use uppercase AND to join query parts
Thomas Klausner [Tue, 22 Feb 2022 14:09:58 +0000 (15:09 +0100)]
Bug 30153: Use uppercase AND to join query parts

C4::Search->FindDuplicate joins title and author using 'and'
(lowercase). When this query is passed on to ElasticSearch, it
interprets the lowercase 'and' as a term to search for, because the
operator has to be in uppercases ('AND').

Test plan:
* Reproduce the bug:
- Set SearchEngine to ElasticSearch (and make sure you have the data
  indexed etc)
- Find an existing book, note the title (245a) and the author (100a)
- Create a new book (Cataloging -> New Record)
- Fill in the same title and author using the same data as in an
  existing book (and any other fields that might be required)
- Click "save"
=> A new book will be created, the Duplicate Finder has failed

* Apply the patch

* Check if it's working now:
- Create a new book (Cataloging -> New Record)
- Fill in the same title and author using the same data as in an
  existing book (and any other fields that might be required)
- Click "save"
- The DuplicateFinder should now report the already exising book

Maybe we should also check if Zebra does not have any problems with the
uppercase 'AND'? In that case, repeat the above steps, but set
SearchEngine to Zebra :-)

Sponsored-by: Steiermärkische Landesbibliothek
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29287: Add child funds to display of parent funds on acqui home
Nick Clemens [Wed, 20 Oct 2021 18:47:01 +0000 (18:47 +0000)]
Bug 29287: Add child funds to display of parent funds on acqui home

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Michael Sutherland <sudrland@vt.edu>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30132: Fix POD, show correct usage of Getopt::Long
David Schmidt [Fri, 18 Feb 2022 14:00:20 +0000 (15:00 +0100)]
Bug 30132: Fix POD, show correct usage of Getopt::Long

the USAGE of overdue_notices.pl shows options such as -date OR
-csv that should be written with double dashes like --date or --csv

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28663: Prevent discounts against void lines
Martin Renvoize [Mon, 5 Jul 2021 18:37:57 +0000 (19:37 +0100)]
Bug 28663: Prevent discounts against void lines

With the introduction of double entry accounting for VOID actions, we
need to add an additional filter to the 'Apply discount' button appearance

Test plan
1/ Add a debt
2/ Pay the debt
3/ Void the payment
4/ Confirm that with the patch applied the 'Apply discount' button does
not appear on the 'Void' accountline.

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 25025: Drag-and-drop cover image upload
Owen Leonard [Fri, 6 Aug 2021 16:31:15 +0000 (16:31 +0000)]
Bug 25025: Drag-and-drop cover image upload

This patch updates the Upload local cover image page so that the user
has the option of dragging a file from a folder on their computer
instead of using a file upload button.

The patch also adds a preview of uploaded single images and display of
existing images on the record you're adding to.

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

- Go to Tools -> Upload local cover image and test the following
  processes:

- Upload single cover image, specifying a biblionumber
  - Test dragging an image from a file on your computer
  - Test clicking the "Drop files here or click..." link.
    - You should see a preview of the image file on the screen, with
      information about the file: file name, image type, file size.
      - Click "Process images"
        - with "Existing covers will be replaced" checked
        - with "Existing covers will be replaced" unchecked

  When the upload process completes you should see information about the
  title in the page heading and a thumbnail of the cover in the sidebar.
  - Test that the image can be deleted from this page. You should be
    redirected back to this page with the same title still selected.

- Upload a zip file of images
  - Test dragging an image from a file on your computer
  - Test clicking the "Drop files here or click..." link.
    - A zip file can't be previewed onscreen but you should see the same
      file information and a Font Awesome "zip file" icon.
      - Click "Process images"

From the bibliographic detail page, click the "Images" tab, and click
"Upload." With this workflow the field asking for a biblionumber should
not appear.

From the bibliographic detail page, in the holdings table, choose Edit
-> Upload image. This process should be the same as above but should
provide item information on the screen. Confirm that images are uploaded
correctly to the specific item.

Test with AllowMultipleCovers enabled and disabled to confirm that the
"Existing covers will be replaced" checkbox is enabled only when
multiple covers are possible.

Signed-off-by: Solène Desvaux <solene.desvaux@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 20689: (follow-up) Correct scope of template variables
Owen Leonard [Thu, 18 Apr 2019 12:17:13 +0000 (12:17 +0000)]
Bug 20689: (follow-up) Correct scope of template variables

The removal of the <select>s should have been accompanied by a
correction to the scope of tagfield and tagsubfield. It is also
unnecessary to conditionally include the "value" attribute.

To test, apply the patch and test the process for editing an item search
field. All the correct values should appear in form fields during edit,
and all values should save correctly.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 20689: (follow-up) Tiny typo fix
Chris Cormack [Sun, 14 Apr 2019 21:57:27 +0000 (21:57 +0000)]
Bug 20689: (follow-up) Tiny typo fix

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 20689: (follow-up) Make it possible to add capital letter subfields to item searc...
Owen Leonard [Fri, 12 Oct 2018 15:46:43 +0000 (15:46 +0000)]
Bug 20689: (follow-up) Make it possible to add capital letter subfields to item search fields

This patch adds some custom validation to the MARC tag and subfield
fields so that they are limited to alphanumeric characters.

Both templates (the main view and the edit view) have been modified so
that item_search_fields.js can be included in both.

To test, apply the patch and test the form by entering a variety of
different character combinations. The "MARC field" and "MARC subfield"
inputs should only accept alphanumeric entries.

Test both "new" and "edit" operations.
Test other operations like delete and cancel.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Jose-Mario <jose-mario.monteiro-santos@inLibro.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 20689: Replace marc (sub)field pull downs with input fields on item search fields...
Katrin Fischer [Thu, 9 Aug 2018 22:51:43 +0000 (22:51 +0000)]
Bug 20689: Replace marc (sub)field pull downs with input fields on item search fields config

The pull down for marc subfields on the item search fields config page is
long and hard to use. It also doesn't include the commonly used
upper case letters for custom item subfields.

Also hard to use with its 999 entries is the marc field list. It doesn't
allow for tags like 01e, which exist in our MARC21 default framework.

To test:
- Go to Administration > Item search fields
- Add different mappings with and without subfields
- Verify the entered values are stored correctly
- Edit mappings
- Verify editing works and changes save correctly

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30084: Remove dependency of liblocale-codes-perl (follow-up)
Mason James [Wed, 2 Mar 2022 05:52:24 +0000 (18:52 +1300)]
Bug 30084: Remove dependency of liblocale-codes-perl (follow-up)

trival patch, no test plan

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30133: (follow-up) Update objects.search POD
Tomas Cohen Arazi [Mon, 21 Feb 2022 11:59:05 +0000 (08:59 -0300)]
Bug 30133: (follow-up) Update objects.search POD

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30133: Fix pagination in /biblios/:bibio_id/pickup_locations
Tomas Cohen Arazi [Fri, 18 Feb 2022 19:07:02 +0000 (16:07 -0300)]
Bug 30133: Fix pagination in /biblios/:bibio_id/pickup_locations

This patch does the same thing we did for items on the previous patch,
but for biblios. The tests are almost the same as well.

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30133: Simplify code
Tomas Cohen Arazi [Fri, 18 Feb 2022 18:22:36 +0000 (15:22 -0300)]
Bug 30133: Simplify code

This patch simplifies the code, and also fixes a problem with branchcode
comparisson failing, highlighted when running the tests

To test:
1. Apply the regression tests
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/items.t
=> FAIL: Tests fail. Notably:
- Link header pagination is wrong
- X-*Total-Count headers have two values (dupicated)
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30133: Avoid calling c->objects->search twice
Nick Clemens [Fri, 18 Feb 2022 14:25:41 +0000 (14:25 +0000)]
Bug 30133: Avoid calling c->objects->search twice

Calling this twice sets double pagination headers, which messes up the page for the requests and
retrieves on ly the end of the list

This patch simply avoids a doulbe call

TO DO: must implement same for Biblio->pickup_locations and cover with tests
this also returns all as needing override

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30133: Regression tests
Tomas Cohen Arazi [Fri, 18 Feb 2022 18:33:42 +0000 (15:33 -0300)]
Bug 30133: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29703: Use get_effective_rules in GetBranchItemRule
Nick Clemens [Wed, 15 Dec 2021 16:27:18 +0000 (16:27 +0000)]
Bug 29703: Use get_effective_rules in GetBranchItemRule

To test:
1 - prove -v t/db_dependent/Circulation/Branch.t

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 29824: Allow editing of quick spine labels
Lucas Gass [Fri, 7 Jan 2022 22:31:35 +0000 (22:31 +0000)]
Bug 29824: Allow editing of quick spine labels

To test:
1. Apply patch
2. Go to the quick spine label tool and enter a barcode of an item with a itemcallnumber
3. Notice the 'Edit this label' button at the bottom of the page, click it
4. Edit the itemcallnumber in some way: add some line breaks, remove some, insert some new characters, remove some characters.
5. You can now print the label with your edits.

Note: This changes nothing in the database, if you relaod the same item/itemcallnumer it will have returned to its original form

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28955: Impact News as well
Jonathan Druart [Fri, 18 Feb 2022 14:54:56 +0000 (15:54 +0100)]
Bug 28955: Impact News as well

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28955: (follow-up) Set to fall back
Martin Renvoize [Wed, 15 Dec 2021 14:36:47 +0000 (14:36 +0000)]
Bug 28955: (follow-up) Set to fall back

This patch updates the original fix to only set the template parameter
for opac sessions and updates all occurences in templats to check first
for logged_in_user.branchcode before falling back to default_branch

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 28955: Add OPAC_BRANCH_DEFAULT
Martin Renvoize [Wed, 27 Oct 2021 10:27:18 +0000 (11:27 +0100)]
Bug 28955: Add OPAC_BRANCH_DEFAULT

This patch adds support for OPAC_BRANCH_DEFAULT as an environment option
that can be passed via apache with either SetEnv or as a header for
plack.  It allows setting a default branch for the anonymous opac
session such that you can display the right opac content blocks prior to
login if you have set up per branch URI's.

To test (on top of bug 29691)
1 - Add to apache conf (/etc/apache2/sites-available/kohadev.conf)
    SetEnv OPAC_BRANCH_DEFAULT "CPL"
    RequestHeader add X-Koha-SetEnv "OPAC_BRANCH_DEFAULT CPL"
2 - Restart all
3 - Confirm that news for all and CPL show on opac mainpage
4 - Sign in as a different library
5 - Confirm users library news shows

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30060: Update DBIC Schema
Fridolin Somers [Fri, 25 Feb 2022 00:34:30 +0000 (14:34 -1000)]
Bug 30060: Update DBIC Schema

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30060: DBRev 21.12.00.016
Fridolin Somers [Thu, 24 Feb 2022 23:36:23 +0000 (13:36 -1000)]
Bug 30060: DBRev 21.12.00.016

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30060: (follow-up) Remove duplicate prior to adding key
Martin Renvoize [Tue, 15 Feb 2022 12:17:44 +0000 (12:17 +0000)]
Bug 30060: (follow-up) Remove duplicate prior to adding key

I had issues with this update as somehow my user_permissions table
contained duplicate rows which throws an error when adding the new
primary key.

This follow-up patch adds SQL to remove any duplicate rows prior to
adding the new primary key.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 30060: Add primary key to user_permissions table
Nick Clemens [Mon, 27 Sep 2021 18:34:17 +0000 (18:34 +0000)]
Bug 30060: Add primary key to user_permissions table

Without primary key DBIC is failing with something like:

GET /api/v1/suggestions/managers: unhandled exception (DBIx::Class::Exception)<<DBIx::Class::ResultSource::RowParser::_resolve_collapse(): Unable to calculate a definitive collapse co
lumn set for UserPermission (last member of the Borrower -> user_permissions chain): fetch more unique non-nullable columns at /kohadevbox/koha/Koha/Objects.pm line 394>> Koha::REST::Plugin::Exceptions::__ANON__ /
kohadevbox/koha/Koha/REST/Plugin/Exceptions.pm (73)

Test plan:
Execute the atomic update and confirm that the new PK has been added to the user_permissions table.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 25616: (QA follow-up) Catch a case in labels/label-item-search.pl
Martin Renvoize [Tue, 22 Feb 2022 16:15:11 +0000 (16:15 +0000)]
Bug 25616: (QA follow-up) Catch a case in labels/label-item-search.pl

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2 years agoBug 25616: (follow-up) Use uppercase in advanced search booleans
Fridolin Somers [Tue, 15 Feb 2022 07:21:40 +0000 (21:21 -1000)]
Bug 25616: (follow-up) Use uppercase in advanced search booleans

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>