]> git.koha-community.org Git - koha.git/log
koha.git
4 years agoBug 25662: (follow-up) Add tests for the wrong patron_id added behaviour
Tomas Cohen Arazi [Tue, 23 Jun 2020 13:35:54 +0000 (10:35 -0300)]
Bug 25662: (follow-up) Add tests for the wrong patron_id added behaviour

This patch adds trivial tests for the new error (400) raised when the
passed patron_id doesn't exist.

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25662: Make the route for holds restpect maxreserves
Tomas Cohen Arazi [Tue, 23 Jun 2020 13:33:14 +0000 (10:33 -0300)]
Bug 25662: Make the route for holds restpect maxreserves

This patch fixes the behaviour for the POST /holds route. It assumed
maxreserves was checked in CanItemBeReserved which is not the case.

Tests are added to check for this behaviour.

To test:
1. Apply the regression tests
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/holds.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: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25662: Regression tests
Tomas Cohen Arazi [Tue, 23 Jun 2020 13:11:58 +0000 (10:11 -0300)]
Bug 25662: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25958: DBRev 20.06.00.028
Jonathan Druart [Tue, 25 Aug 2020 09:57:27 +0000 (09:57 +0000)]
Bug 25958: DBRev 20.06.00.028

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25958: (QA follow-up) Implement filter in database query instead of in loop
Kyle M Hall [Mon, 24 Aug 2020 17:13:17 +0000 (13:13 -0400)]
Bug 25958: (QA follow-up) Implement filter in database query instead of in loop

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25958: (QA follow-up) Add some punctuation to new DefaultLongOverdueSkipLostStatuses
Katrin Fischer [Sat, 22 Aug 2020 02:41:20 +0000 (02:41 +0000)]
Bug 25958: (QA follow-up) Add some punctuation to new DefaultLongOverdueSkipLostStatuses

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25958: Allow LongOverdue cron to exclude specified lost values
Kyle M Hall [Tue, 28 Jul 2020 11:55:18 +0000 (07:55 -0400)]
Bug 25958: Allow LongOverdue cron to exclude specified lost values

When lost items are not marked as returned, they are still subject to
the long overdue cron, so an item that has already been marked Lost may
automatically roll to Long Overdue. In some cases, a library may not
want that lost value to change. This becomes especially important with
the introduction of Claims Returned, which uses a variety of lost.

Test Plan:
1) Set up a long overdue item that would be moved to lost by longoverdue.pl
2) Run the cronjob with the new --skip-lost-value option
3) Note the item is not altered
4) Include that value in the new system preference DefaultLongOverdueSkipLostStatuses
5) Run the cronjob *without* the new option
6) Note the item is not altered
7) Run the cronjob again with the new command line option, but set it to
a different value so the item will be affected
8) Note the item is altered as it would have been before this patch was
applied

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Rebecca Coert <rcoert@arlingtonva.us>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 23166: Early return if no set
Jonathan Druart [Tue, 25 Aug 2020 09:38:32 +0000 (11:38 +0200)]
Bug 23166: Early return if no set

It prevents valid_template check to raise
Can't call method "filter_by_current" without a package or object reference at /kohadevbox/koha/Koha/Template/Plugin/Context.pm line 49.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26139: Centralize code for "Place hold" button (detail)
Jonathan Druart [Fri, 7 Aug 2020 10:01:10 +0000 (12:01 +0200)]
Bug 26139: Centralize code for "Place hold" button (detail)

There is a "norequest" boolean passed to the include cat-toolbar.inc, to
display or not the "Pace hold" button.
This flag was not calculated in some place (ISBDdetail and moredetail
for instance)

Here we centralize the code to make it more robust and less regression
prone.

Note that the same problem appears at the OPAC (opac-MARCdetail is
always display the button). That will have to be fixed separately

Test plan:
Create biblio A with 0 item, B and C with 1 item and D with 2 items
item for B is not for loan, C is for loan and D has 1 of each
Go to the bibliographic detail page of each record and confirm that the
"Place hold" button appears appropriately.
Test the different tabs of the catalogue module

QA note: This patch is only centralizing the existing code, but it is
still too naive. To manage the visibility of this button we certainly
want to copy what is done in C4::Search::searchResults:
  # can place a hold on a item if
  # not lost nor withdrawn
  # not damaged unless AllowHoldsOnDamagedItems is true
  # item is either for loan or on order (notforloan < 0)
  $can_place_holds = 1
    if (
         !$item->{itemlost}
      && !$item->{withdrawn}
      && ( !$item->{damaged} || C4::Context->preference('AllowHoldsOnDamagedItems') )
      && ( !$item->{notforloan} || $item->{notforloan} < 0 )
    );

Signed-off-by: Didier Gautheron <didier.gautheron@biblibre.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 23166: (QA follow-up) Add POD text
Joonas Kylmälä [Mon, 24 Aug 2020 15:34:10 +0000 (18:34 +0300)]
Bug 23166: (QA follow-up) Add POD text

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 23166: Call the methods from the .inc
Jonathan Druart [Tue, 5 May 2020 13:51:25 +0000 (15:51 +0200)]
Bug 23166: Call the methods from the .inc

We do not longer need the order variables to be passed from the
controllers, we can call the methods on the biblio object instead.

There is something wrong with our ->search method and TT behaviours, it
is hard to retrieve object list in a scalar context.
If [% objects.method.count %] is called, objects.method will get the
first object of the list and count will explode (Koha::Object->count
does not exist)

We need to force the call in a scalar context to retrieve an iterator
and prevent to fetch all the objects (we could have called all then
size, but it's not efficient)

If adopted I will move the plugin on a separate bug report to ease
backport

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 23166: Add filter_by_current and _cancelled Koha::Acq::Orders methods
Jonathan Druart [Tue, 5 May 2020 13:50:17 +0000 (15:50 +0200)]
Bug 23166: Add filter_by_current and _cancelled Koha::Acq::Orders methods

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 23166: Remove filtering from controllers
Jonathan Druart [Tue, 5 May 2020 13:27:28 +0000 (15:27 +0200)]
Bug 23166: Remove filtering from controllers

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 23166: Replace the count of orders with Koha::Acq::Orders
Jonathan Druart [Thu, 20 Jun 2019 02:35:20 +0000 (21:35 -0500)]
Bug 23166: Replace the count of orders with Koha::Acq::Orders

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 23166: Remove baskets_deletedorders code
Jonathan Druart [Thu, 20 Jun 2019 02:11:20 +0000 (21:11 -0500)]
Bug 23166: Remove baskets_deletedorders code

This is never used.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 23166: Remove baskets_orders code
Jonathan Druart [Thu, 20 Jun 2019 02:10:15 +0000 (21:10 -0500)]
Bug 23166: Remove baskets_orders code

This is never used.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25033: (follow-up) Don't limit suggestions to branches if displaying by branch
Nick Clemens [Mon, 24 Aug 2020 12:26:04 +0000 (12:26 +0000)]
Bug 25033: (follow-up) Don't limit suggestions to branches if displaying by branch

In the case of organizing by branches we should not filter by branch

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25033: Fix number of tests
Katrin Fischer [Sat, 22 Aug 2020 13:24:06 +0000 (13:24 +0000)]
Bug 25033: Fix number of tests

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25033: (follow-up) Don't delete branchcode key from suggestion_ref
Nick Clemens [Wed, 5 Aug 2020 11:50:39 +0000 (11:50 +0000)]
Bug 25033: (follow-up) Don't delete branchcode key from suggestion_ref

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25033: (follow-up) Deal with 'Any' branch and don't show dropdown if organized...
Nick Clemens [Fri, 15 May 2020 12:25:05 +0000 (12:25 +0000)]
Bug 25033: (follow-up) Deal with 'Any' branch and don't show dropdown if organized by library

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25033: Improve JS code a bit
Jonathan Druart [Tue, 5 May 2020 10:33:37 +0000 (12:33 +0200)]
Bug 25033: Improve JS code a bit

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25033: Move branchfilter to top of page
Nick Clemens [Wed, 1 Apr 2020 13:39:13 +0000 (13:39 +0000)]
Bug 25033: Move branchfilter to top of page

There is confusion becase it is not obvious when the suggestions page is being limited to a branch

Moving the branch filter to the top of the page makes it easier to see

To test:
1 - Apply patch
2 - From mainpage or acqui-home note the link to suggestions takes you to suggestions limited to current branch
3 - Change the dropdown
4 - Note the page refreshes and loads the correct suggestions

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
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>
4 years agoBug 25033: Remove CountSuggestion
Nick Clemens [Wed, 1 Apr 2020 12:46:17 +0000 (12:46 +0000)]
Bug 25033: Remove CountSuggestion

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
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>
4 years agoBug 25033: Display both local and all pending suggestions counts if the numbers differ
Nick Clemens [Wed, 1 Apr 2020 12:38:02 +0000 (12:38 +0000)]
Bug 25033: Display both local and all pending suggestions counts if the numbers differ

To test:
 0 - Be in staff client as a superlibrarian
 1 - Place some suggestions
  1 for any branch
  1 for signed in branch
  1 for another branch
 2 - Go to Koha main page, 3 suggestions pending
 3 - Click 'Suggestions pending approval' - you see one suggestion
 4 - Click on 'Acquisitions' in breadcrumbs , 3 suggestions pending
 5 - Click manage suggestions - you see one suggestion
 6 - Apply patch
 7 - On mainpage and acqui-home you now see "Centerville: 1 / All libraries: 3" suggestions
 8 - Confirm that the links take you to suggestions view of your branch or all libraries respectively
 9 - Turn on IndependentBranches
10 - Create a user with acquisition and suggestions permissions but not superlibrarian in one of the branches used above
11 - Sign in as that user
11 - See "Centerville: 1" suggestion on mainpage and on acqui home

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>
4 years agoBug 26265: (QA follow-up) Remove g option from regex, add few dirs
Marcel de Rooy [Mon, 24 Aug 2020 08:03:48 +0000 (08:03 +0000)]
Bug 26265: (QA follow-up) Remove g option from regex, add few dirs

Adding .git. Using a regex.
If we make it a bit smarter, we do not need most dirs listed.

Test plan:
Run the test again

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26265: Add missing xt dir
Jonathan Druart [Fri, 21 Aug 2020 13:10:18 +0000 (15:10 +0200)]
Bug 26265: Add missing xt dir

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26265: Add test for missing directory in Makefile.PL
Jonathan Druart [Fri, 21 Aug 2020 13:09:44 +0000 (15:09 +0200)]
Bug 26265: Add test for missing directory in Makefile.PL

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26265: Add pos directory to the Makefile
Martin Renvoize [Fri, 21 Aug 2020 08:24:29 +0000 (09:24 +0100)]
Bug 26265: Add pos directory to the Makefile

This patch adds the /pos directory to the Makefile so that pos gets
properly mapped at make and install time.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 8732: DBRev 20.06.00.027
Jonathan Druart [Mon, 24 Aug 2020 10:29:50 +0000 (10:29 +0000)]
Bug 8732: DBRev 20.06.00.027

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 8732: (QA follow-up) Terminology - staff client to staff interface
Katrin Fischer [Thu, 20 Aug 2020 22:46:39 +0000 (22:46 +0000)]
Bug 8732: (QA follow-up) Terminology - staff client to staff interface

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 8732: (follow-up) Make icon show on opac details and correct pref
Nick Clemens [Tue, 18 Aug 2020 10:23:23 +0000 (10:23 +0000)]
Bug 8732: (follow-up) Make icon show on opac details and correct pref

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 8732: (QA follow-up) Fix capitalization and terminology on BiblioItemtypeInfo...
Katrin Fischer [Sat, 15 Aug 2020 03:05:31 +0000 (03:05 +0000)]
Bug 8732: (QA follow-up) Fix capitalization and terminology on BiblioItemtypeInfo description

- opac = OPAC
- add "system preference" to make context easier to understand

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 8732: undo XSLT changes
Nick Clemens [Mon, 3 Aug 2020 13:05:12 +0000 (13:05 +0000)]
Bug 8732: undo XSLT changes

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 8732: Update statement
Nick Clemens [Thu, 16 Jul 2020 11:47:04 +0000 (11:47 +0000)]
Bug 8732: Update statement

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 8732: Allowing biblio level itemtypes to display instead of MARC ones
Chris Cormack [Sun, 30 Sep 2012 21:58:06 +0000 (10:58 +1300)]
Bug 8732: Allowing biblio level itemtypes to display instead of MARC ones

This patchset adds a new syspref: BiblioItemtypeInfo

If you set BiblioItemtypeInfo to Koha, you will see the Koha
record level itemtype info. This info is also shown if item-level_itypes
is set to biblio

Display of icons are controlled by
noItemTypeImages/OpacnoItemTypeImages

Material type display is controlled by DisplayIconsXSLT/DisplayOPACIconsXSLT

To test:
 1 - Apply patch
 2 - Update database
 3 - Do an opac search and view results
 4 - Switch pref to 'Koha' and refresh
 5 - Note itemtypes appear
 6 - Click in to a record details
 7 - Note you see itemtype and icon
 8 - Switch the pref
 9 - Note you don't see record level itemtype and icon
10 - Repeat in staff interface

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 16112: Do not depend on SpecifyDueDate
Jonathan Druart [Fri, 21 Aug 2020 07:06:41 +0000 (09:06 +0200)]
Bug 16112: Do not depend on SpecifyDueDate

It's possible to specify a renewal due date in the checkouts table
even if SpecifyDueDate is off.

Also change the label from "Specify due date:" to "Renewal due date:"

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 16112: (follow-up) Form style improvements, clear date
Owen Leonard [Thu, 6 Aug 2020 12:41:23 +0000 (12:41 +0000)]
Bug 16112: (follow-up) Form style improvements, clear date

This follow-up makes some markup and style improvements in order to make
the renew form more consistent with similar forms like checkout and
check-in.

It also adds a "Clear" button for the datepicker field, matching similar
date inputs.

To test, apply the patch and go to Circulation -> Renew.

 - With or without the  SpecifyDueDate system preference enabled the
   form should look correct.
 - With the SpecifyDueDate preference enabled you should see the date
   form below the barcode input field.
 - Select a date and test that the "Clear" button works to clear it.
 - Compare to the check-in page to confirm that they look consistent
   with each other.

Signed-off-by: Marco Abi-Ramia <marco.abi-ramia@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 16112: Add the ability to define due date for batch renew
Jonathan Druart [Tue, 4 Aug 2020 14:55:56 +0000 (16:55 +0200)]
Bug 16112: Add the ability to define due date for batch renew

Same as bug 16748, for batch renew.

Test plan:
Check an item in
Renew it using the circ/renew.pl page
=> You can pick a due date!
=> The date is kept from one renew to another
Renew it until you reach the maximum number of renewals
=> You get a warning with "continue without renewing"
=> The date is still kept

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>
4 years agoBug 21750: Move collection code to its own column on checkins table
Nick Clemens [Thu, 1 Nov 2018 15:11:36 +0000 (15:11 +0000)]
Bug 21750: Move collection code to its own column on checkins table

To test:
 1 - Set 'ShowAllCheckins' to show
 2 - Set a collcection code for an item
 3 - Check it in
 4 - Note it displays in the the 'Item type' column
 5 - Apply patch
 6 - Check it in again
 7 - Note the new 'Collection' column
 8 - Hide/show the column using column visibility on the checkins page
 9 - Go to Admin->Configure columns
10 - Test the various settings for this column and check in the item to
make sure they work as expected

Signed-off-by: Devinim <kohadevinim@devinim.com.tr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24973: Load custom localization file
Bernardo Gonzalez Kriegel [Fri, 15 May 2020 21:11:16 +0000 (18:11 -0300)]
Bug 24973: Load custom localization file

It adds a new localization directory that could
host a custom SQL file for each language,
xx-YY/custom.sql

This will be the last file to be loaded at
install time, it can be used to set any difference
from default values.

It can't be deselected at install time.

Moved corresponding files for de-DE, it-IT,
nb-NO and completed es-ES

To test:
1) Apply the patch
2) Install es-ES/de-DE/it-IT/nb-NO translation (any lang)
   ( cd misc/translation; ./translate install es-ES )
3) Do a clean install using es-ES
4) After all files have been loaded check:
    * A new section labeled "Localization data added"
      with one file, custom.sql
    * Inspect the value of FrameworksLoaded syspref,
      last entry must be custom.sql
5) Remove/rename the file or localization dir and
   repeat 3/4, install must proceed normally

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25113: Refactor CirculationRules.t when testing scope combinations
Lari Taskula [Sat, 4 Apr 2020 15:01:02 +0000 (15:01 +0000)]
Bug 25113: Refactor CirculationRules.t when testing scope combinations

We used to test rule scopes by explicitly defining each combination.

When adding new scopes, it is much easier if these tests are auto-
generated for you so that you don't have to repeat similar code.

This patch removes those "duplicates" and adds a method that returns
test cases for each scope as follows:

branchcode categorycode itemtype
__________ ____________ ________
branchcode categorycode itemtype
branchcode categorycode *
branchcode *            itemtype
branchcode *            *
*          categorycode itemtype
*          categorycode *
*          *            itemtype
*          *            *

And automatically extends the test when new scopes are added.

This also obsoletes the "Get effective issuing rule in correct order"
test in t/db_dependent/Koha/IssuingRules.t

To test:
1. prove t/db_dependent/Koha/CirculationRules.t

Sponsored-by: The National Library of Finland
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
JD amended patch: perl tidy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25728: Don't prefill av's code
Jonathan Druart [Sat, 22 Aug 2020 12:11:45 +0000 (14:11 +0200)]
Bug 25728: Don't prefill av's code

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25728: fix rebase issues
Jonathan Druart [Sat, 22 Aug 2020 09:15:28 +0000 (11:15 +0200)]
Bug 25728: fix rebase issues

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25728: Use a svc script instead of the REST API endpoint
Jonathan Druart [Sat, 13 Jun 2020 10:36:01 +0000 (12:36 +0200)]
Bug 25728: Use a svc script instead of the REST API endpoint

The try to implement correctly the REST API endpoint for authorised
values failed.
This patch uses an easy to implement svc script for the POST route.

Signed-off-by: Hugo Agud <hagud@orex.es>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25728: Don't explode if no CAN_* var defined
Jonathan Druart [Tue, 9 Jun 2020 16:02:14 +0000 (18:02 +0200)]
Bug 25728: Don't explode if no CAN_* var defined

Sponsored-by: Orex Digital
Signed-off-by: Hugo Agud <hagud@orex.es>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25728: Fix the clone field feature
Jonathan Druart [Tue, 9 Jun 2020 15:57:19 +0000 (17:57 +0200)]
Bug 25728: Fix the clone field feature

Sponsored-by: Orex Digital
Signed-off-by: Hugo Agud <hagud@orex.es>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25728: Don't explode in the advanced editor
Jonathan Druart [Tue, 9 Jun 2020 15:34:30 +0000 (17:34 +0200)]
Bug 25728: Don't explode in the advanced editor

Sponsored-by: Orex Digital
Signed-off-by: Hugo Agud <hagud@orex.es>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25728: Create AV when cataloguing an authority record
Jonathan Druart [Tue, 9 Jun 2020 15:34:34 +0000 (17:34 +0200)]
Bug 25728: Create AV when cataloguing an authority record

Test plan:
Same as the first patch but when cataloguing an authority record

Sponsored-by: Orex Digital
Signed-off-by: Hugo Agud <hagud@orex.es>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25728: Create AV when adding a new item
Jonathan Druart [Mon, 8 Jun 2020 14:00:48 +0000 (16:00 +0200)]
Bug 25728: Create AV when adding a new item

We do a bit of refactoring to make the code reusable.

Test plan:
Same as the first patch but when adding/editing an item

QA note: There is a warning from the QA tools
 FAIL   koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt
   FAIL   js_in_body
                A <script> tag found inside head, must be moved to the body (see bug 17858)
I don't think how we could avoid it.

Sponsored-by: Orex Digital
Signed-off-by: Hugo Agud <hagud@orex.es>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25728: Create AV when cataloguing a bibliographic record
Jonathan Druart [Fri, 12 Jun 2020 13:22:54 +0000 (15:22 +0200)]
Bug 25728: Create AV when cataloguing a bibliographic record

This whole patch set adds the ability to create a new authorised value
directly from the cataloguing module.
It will prevent the cataloger to leave and reload the page if they need
a new one.

Test plan:
If you are logged in with a patron with the manage_authorised_values
subpermission you will be able to:
* Edit a bibliographic record
* Search for a subfield linked to an authorised values (not the "fake"
AV like itemtypes, branches, cn)
* Click the dropdown list and start searching for a value that does not
exist
* Click enter
* Fill the fields in the popup
* Save
=> Your dropdown list has the new AV :)

Note: This does not work for the advanced editor. It does not have
select2 applied to the selects. I have hardly tried but failed.

Sponsored-by: Orex Digital
Signed-off-by: Hugo Agud <hagud@orex.es>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25727: (follow-up) Some style updates, JS i18n
Owen Leonard [Fri, 21 Aug 2020 13:19:26 +0000 (13:19 +0000)]
Bug 25727: (follow-up) Some style updates, JS i18n

This patch makes to general changes. First, it makes some minor style
changes to the appearance of the dropdowns. Second, it moves the JS
content in select2.inc into a separate JS file. This is made possible by
Bug 21156.

To test, apply the patch and view a page which uses the Select2 library,
e.g. the add item screen. Confirm that the Select2-styled dropdowns look
good and work correctly.

TESTING TRANSLATABILITY

- Update a translation, e.g. fr-FR:

  > cd misc/translator
  > perl translate update fr-FR

- Open the corresponding .po file for JavaScript strings, e.g.
  misc/translator/po/fr-FR-messages-js.po
- Locate strings pulled from
  koha-tmpl/intranet-tmpl/prog/js/select2.js for translation,
  e.g.:

  msgid "No results found"
  msgstr ""

- Edit the "msgstr" string however you want (it's just for
  testing).
- Install the updated translation:

  > perl translate install fr-FR

- Switch to your newly translated language in the staff client and
  test a Select2-styled dropdown. Test that translated strings appear.
  For example:
  - Use the filter form to search for a string which isn't found. You
    should see a translated version.
  - Make a selection in one of the dropdowns. Hover your mouse over the
    "X" icon which now appears. The tooltip should be a translated
    version.

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>
4 years agoBug 25727: Default to dropdownAutoWidth
Jonathan Druart [Mon, 17 Aug 2020 14:39:43 +0000 (14:39 +0000)]
Bug 25727: Default to dropdownAutoWidth

This will set a correct width by default.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25727: Do not open options on clear
Jonathan Druart [Mon, 17 Aug 2020 12:58:10 +0000 (12:58 +0000)]
Bug 25727: Do not open options on clear

We want to restore the previous behaviour and keep the options closed when
clear is clicked

https://github.com/select2/select2/issues/3320#issuecomment-621662039

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25727: (follow-up) Use CSS specificity rather than !important
Owen Leonard [Wed, 17 Jun 2020 16:34:50 +0000 (16:34 +0000)]
Bug 25727: (follow-up) Use CSS specificity rather than !important

This patch adds specificty to the CSS which controls the "invalid"
appearance of a Select2 dropdown so that the use of "!important" can be
avoided. The patch also puts this style into our custom select2 CSS file
so that it is located with other Select2 style changes.

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>
4 years agoBug 25727: Fix highlight of a missing field
Jonathan Druart [Sat, 13 Jun 2020 13:03:50 +0000 (15:03 +0200)]
Bug 25727: Fix highlight of a missing field

In the previous version of Select2 we had only 1 'a' tag that was
visible, next to the invisible select.

Now we have a 3 nested span elt, the last one (with a role=combobox
attribute) is the one we want to style.

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>
4 years agoBug 25727: Fix default values
Jonathan Druart [Sat, 13 Jun 2020 12:08:11 +0000 (14:08 +0200)]
Bug 25727: Fix default values

The way we defined the default values does not longer work (?)
Using
  $.fn.select2.defaults.set
instead of
  jQuery.extend($.fn.select2.defaults, {
fixes the problem.

It restores the allowClear setting.

There is a change in the behavior here, the selection opens when the
clear button is clicked. That is coming from a change in Select2
apparently. We may want to hack something to restore the precedent
behaviour.

This patch also removes the redefinition of the width. It seems that the
issue that this code was trying to correct is now fixed.

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>
4 years agoBug 25727: Adjust translations
Jonathan Druart [Sat, 13 Jun 2020 11:32:56 +0000 (13:32 +0200)]
Bug 25727: Adjust translations

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>
4 years agoBug 25727: Upgrade the Select2 JS lib to version 4
Jonathan Druart [Sun, 7 Jun 2020 10:23:04 +0000 (12:23 +0200)]
Bug 25727: Upgrade the Select2 JS lib to version 4

In order to benefit from the last feature of Select we should upgrade to the version 4.
For instance it adds the ability to dynamically create new entries

https://select2.org/tagging

Test plan:
Confirm that there is no visible regression on dropdown list with select2
Like edit a bibliographic records, and the items.

Sponsored-by: Orex Digital
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>
4 years agoBug 26150: Remove the use of jquery.checkboxes plugin from inventory page
Owen Leonard [Wed, 5 Aug 2020 17:00:26 +0000 (17:00 +0000)]
Bug 26150: Remove the use of jquery.checkboxes plugin from inventory page

This patch removes the use of the jquery.checkboxes plugin from the
inventory page and replaces it with custom JS.

To test, apply the patch and go to Tools -> Inventory.

 - Submit the form with some selections which will return results on the
   following page. I filtered by library.
 - On the page showing results, test that the "Select all" and "Clear
   all" links work correctly.

Signed-off-by: Brandon J <brandon.jimenez@inLibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26157: Hide expected DBI warnings from tests
Jonathan Druart [Thu, 6 Aug 2020 11:11:50 +0000 (13:11 +0200)]
Bug 26157: Hide expected DBI warnings from tests

We must redirect them to /dev/null if we know they will appear.

Test plan:
prove the different test files and confirm that the output is clean when
this patch is applied

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 21539: addorderiso2709.pl forces librarian to select a ccode and notforloan code...
Kyle M Hall [Wed, 10 Oct 2018 15:13:37 +0000 (11:13 -0400)]
Bug 21539: addorderiso2709.pl forces librarian to select a ccode and notforloan code when using MarcItemFieldsToOrder

There is no reason that MarcItemFieldsToOrder should force librarians
to select a ccode and notforloan value for each item.
They are both optional fields.
As with location, the first value should be an empty 'none' option.

Test Plan:
1) Set up MarcItemFieldsToOrder, do *not* set mappings for ccode and notforloan
2) Add an order record to a basket that uses MarcItemFieldsToOrder
3) Note you must choose a ccode and nfl value
4) Apply this patch
5) Reload the page
6) Note you no longer have to select values for ccode and notforloan

Signed-off-by: Daniel Gaghan <daniel.gaghan@pueblolibrary.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26189: Compiled CSS
Jonathan Druart [Mon, 24 Aug 2020 09:06:39 +0000 (11:06 +0200)]
Bug 26189: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26189: Improve styling of datatables within fieldsets
Martin Renvoize [Wed, 12 Aug 2020 12:58:58 +0000 (13:58 +0100)]
Bug 26189: Improve styling of datatables within fieldsets

Unset label width restriction: The label width restriction within
fieldsets causes issues for the datatables header. Unsetting it
explicitly here resolves the line wrapping issues :)

Reset margins for datatables found inside fieldsets such that the
datatable properly utilises the available space and restore the
default datatable label font weights.

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25791: Remove win.print()
Lucas Gass [Wed, 15 Jul 2020 22:28:07 +0000 (22:28 +0000)]
Bug 25791: Remove win.print()

Test plan:
1) Turn on system preference SelfCheckReceiptPrompt
2) Check out item via /cgi-bin/koha/sco/sco-main.pl
3) Click "Finish"
4) Click 'Print receipt and end session'
5) Notice two print dialog boxes right on top of each other
6) Apply patch
7) Repeat steps 1 - 4
8) Should only get a single print dialog.
9) Test in FF/Chrome and make sure behavior is consistent

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>
4 years agoBug 25903: Add unit tests
Kyle M Hall [Thu, 20 Aug 2020 11:56:12 +0000 (07:56 -0400)]
Bug 25903: Add unit tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25903: Sending a SIP patron information request with a summary field flag in...
Kyle M Hall [Tue, 30 Jun 2020 18:37:21 +0000 (14:37 -0400)]
Bug 25903: Sending a SIP patron information request with a summary field flag in indexes 6-9 will crash server

The 'summary' field in the patron information request specifies if detail information should be send for holds,
overdues, fines, etc. The field is 10 characters in length (0-9). However, the SIP2 spec only defines indexes 0
though 5, leave 6 though 9 undefined. Some ILSs specify behavior for these undefined indexes. Apparently the
7th field is often used to request 'Fees', as opposed to 'Fines' in some ILS. Some software that integrate via
SIP try both the 5th and 7th indexes to ensure they get all fines and fees.

The problem is that Koha's SIP server crashes if any 'summary' index beyond 5 is flagged. We should simply
ignore flags beyond 5 and act as if no flags were sent.

Test Plan:
1) Enable SIP for your instance
2) Send a patron information request with a summary flag in any index beyond 5.
   i.e.: 6300120200617    124846      Y   AOMIDAY|AA21030050054321
3) Note the SIP server just closes the connection without a response
4) Apply this patch
5) Restart the SIP server
6) Send the same request
7) Note you get back the patron information response!

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jeff Gaines <jgaine@arlingtonva.us>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26076: (QA Follow up) Prevent error by using a fresh resultset
Kyle M Hall [Thu, 30 Jul 2020 13:35:38 +0000 (09:35 -0400)]
Bug 26076: (QA Follow up) Prevent error by using a fresh resultset

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26076: Sum the amount due in the database query instead of a loop in Perl
Kyle M Hall [Tue, 28 Jul 2020 16:49:35 +0000 (12:49 -0400)]
Bug 26076: Sum the amount due in the database query instead of a loop in Perl

This appears to be a bug due to inaccuracies in floating point math. I've been unable to reproduce it on demand. Sometimes when using the "Write off selected" button, Koha will give the error that the payment is more than the amount owed, even though they are the same. The solution I've implemented is to move the summation from Perl code to the database query. This video demonstrates the issue and afterward, shows the error goes away after the patch is applied: https://monosnap.com/file/pG69HC7iI9mU9kkuoCtbkVzVTffKlE

Test Plan:
1) Apply this patch
2) Restart all the things!
3) Verify that "Write off selected" functions as usual

Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26270: Fix ThingISBN after a change in behaviour
Jonathan Druart [Fri, 21 Aug 2020 12:00:51 +0000 (14:00 +0200)]
Bug 26270: Fix ThingISBN after a change in behaviour

This is just a guess! One of our tests is failing since today and we
don't modify anything in this area.
My guess is that the service is now returning the normalized version of
the ISBN

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24683: IsAvailableForItemLevelRequest sub description expanded
Andrew Nugged [Sun, 19 Jul 2020 21:16:51 +0000 (00:16 +0300)]
Bug 24683: IsAvailableForItemLevelRequest sub description expanded

Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24683: whole test formatted by 'perltidy'
Andrew Nugged [Sun, 19 Jul 2020 21:15:37 +0000 (00:15 +0300)]
Bug 24683: whole test formatted by 'perltidy'

This is complementary patch using styling from
bundled /xt/perltidyrc file

Almost no code change except a few long constant strings
broken to parts by concatenation.

Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24683: Fix for take smart rules into account in "if all unavailable"
Andrew Nugged [Sun, 19 Jul 2020 21:20:56 +0000 (00:20 +0300)]
Bug 24683: Fix for take smart rules into account in "if all unavailable"

Inside of ItemsAnyAvailableAndNotRestricted was no effect from main set
of smart rules (per record and other limits): i.e. call to
"CanItemBeReserved" was absent totally.

Because of this there was a bug: for example none of two items were
allowed to be held when first was allowed by one smart rule, BUT on loan,
and second was disallowed by another smart rule (for example,
0 "Holds per record"),

i.e. in this case both items unavailable: so on-shelf holds setting
"allow hold if all unavailable" should allow to hold first one, and not
the second one. But it was that both wasn't allowed to be held.

Solution: call to sub "CanItemBeReserved" added so it checked for
"...->{status} ne 'OK'" so now if item restricted by smart rule it also
accounted as "unavailable" and "AnyAvailavble" not counts it.

How to reproduce:

1. Add 2 smart rules (/cgi-bin/koha/admin/smart-rules.pl) with "on shelf
   holds": "if all unavailable" for all rules, no "item level holds", and
   set "holds per record" to 2 for "books" and "0" for "computer files".

2. Create only 2 items for one biblio, but different types, "book"
   and "computer file". For example in misc4dev env:
   /cgi-bin/koha/cataloguing/additem.pl?biblionumber=1#additem

3. Check out that item of type "book" to some person, for example,
   in misc4dev:
   /cgi-bin/koha/circ/circulation.pl?borrowernumber=2&barcode=3999900000001

4. Open reserve/request, for example, for item 1 and patron 1 in misc4dev
   env (/cgi-bin/koha/reserve/request.pl?biblionumber=1&borrowernumber=1)

5. It does not allow to hold, both red crossed, but computer file says
   "Exceeded max holds per record" because of "0" limit set on step 1.

6. Apply the patch.

7. Reload page on step 5 and see that "book" will be available for hold,
   but "computer file" still will be red-crossed "Exceeded max holds
   per record", now that's correct because both items unavailable:
   one because on load, another because of "0" limit for computer files.

8. Check-in book from step 3 so it will be returned to the library,

9. Reload page on step 5 and see that again no any holds available,
   but it's now also correct: "book" now returned but "on shelf holds"
   set to "if all unavailable".

Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24683: Optimize loop in ItemsAnyAvailableAndNotRestricted
Andrew Nugged [Fri, 17 Jul 2020 11:59:19 +0000 (14:59 +0300)]
Bug 24683: Optimize loop in ItemsAnyAvailableAndNotRestricted

Add cut-off shortcut (return from inside the loop) when first
"Any Available And Not Restricted" item found, because one is
enough for "Any".

Testing: no change visible for code behavior/results,
it is just faster because won't loop over the whole set.

Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 24683: Subroutine name changed (fix), no code logic changed This is the intermedi...
Andrew Nugged [Fri, 5 Jun 2020 06:59:48 +0000 (09:59 +0300)]
Bug 24683: Subroutine name changed (fix), no code logic changed This is the intermediate refactor: renamed subroutine only.

Naming mistake came because this sub is used to detect if anything
available for hold, but it used in "if ANY UNAVAILABLE rule", so actually
results of this sub negated (see below "return" in the code).

In details:

when previous refactor was done, name for subroutine was chosen
wrongly in "opposite" direction from what it actually does:

it was named "ItemsAnyAvailableForHold", but this subroutine gave
truth (1) if at least one of the items available on shelf, not lost,
not on loan, not held, and not restricted by smart rules and damaged
status. So, if this sub says that item is still "available", this
actually PREVENTS item from hold in parent sub (see negated return):

    sub IsAvailableForItemLevelRequest {
        ...
        my $any_available = ItemsAnyAvailableAndNotRestricted...
        return $any_available ? 0 : 1;
             # ^^^ if any available and not restricted - we don't allow
             #     on-shelf holds
        ...

I.e. like it named now: "ItemsAnyAvailableAndNotRestricted".

Small aside fix: white space for '&&' inside brackets added to join
operation by priority visually.

Testing plan not needed: all places where sub used it just renamed.
More: all this places/code was introduced in one older commit so there
is also no overlaps or other calls/uses for this subroutine.

Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26023: Properly secure the cashup and refund actions
Martin Renvoize [Tue, 4 Aug 2020 14:02:03 +0000 (15:02 +0100)]
Bug 26023: Properly secure the cashup and refund actions

The cash register summary page for cash management is available for users
with the 'anonymous_refund' or 'cashup' permission and the actions available
are appropriately displayed.

However, the actions are not yet correctly tested for at the server and
so a user may force submit to accomplish the action.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26023: Properly secure the cashup action for libraries
Martin Renvoize [Mon, 20 Jul 2020 08:44:05 +0000 (09:44 +0100)]
Bug 26023: Properly secure the cashup action for libraries

The libraries summary page for cash management is available for users
wit the 'anonymous_refund' permission to allow them to navigate to
alternate cash registers and search for the prior transaction to refund.

However, currently the cashup option appears, and is not blocked at the
server, for all user who may access the page. It should be blocked for
those users without the 'cashup' permission.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26253: (bug 22857 follow-up) Remove duplicated mana_config in etc/koha-conf.xml
Jonathan Druart [Thu, 20 Aug 2020 08:10:14 +0000 (10:10 +0200)]
Bug 26253: (bug 22857 follow-up) Remove duplicated mana_config in etc/koha-conf.xml

It was there already but not at the same place!

Signed-off-by: Didier Gautheron <didier.gautheron@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 26031: Add diagnostic to search_utf8.t
Jonathan Druart [Fri, 21 Aug 2020 08:06:57 +0000 (10:06 +0200)]
Bug 26031: Add diagnostic to search_utf8.t

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 25811: Add debug info to authentication.t
Jonathan Druart [Fri, 21 Aug 2020 08:49:42 +0000 (10:49 +0200)]
Bug 25811: Add debug info to authentication.t

Trying to know if the logged in patron is the one we are expecting to
(well, we are not expecting anybody to be logged in at this point!)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 19036: (follow-up) Test credits should be credits
Martin Renvoize [Thu, 20 Aug 2020 11:52:09 +0000 (12:52 +0100)]
Bug 19036: (follow-up) Test credits should be credits

A series of accountlines added to mock credits were being added with a
debit_type_code instead of a valid credit_type_code and so were being
mis-identified by the new credit numbering code trigger in the store
routine.

This patch updates the test to correctly identify the credits as credits

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: Don't use paidfor for DB fields not mapped with a MARC field
Jonathan Druart [Fri, 21 Aug 2020 10:02:07 +0000 (12:02 +0200)]
Bug 18501: Don't use paidfor for DB fields not mapped with a MARC field

On "Bug 25964: Prevent data loss when editing items from a MARC record"
we picked paidfor as an example, but it has a specific behaviour and is
now handled in Koha::Item->store.
Let's pick another one, new_status

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: (follow-up) Use t::lib::Dates::compare in tests
Martin Renvoize [Fri, 21 Aug 2020 09:21:35 +0000 (10:21 +0100)]
Bug 18501: (follow-up) Use t::lib::Dates::compare in tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: (follow-up) Add fallback to ItemHomeBranch
Martin Renvoize [Thu, 20 Aug 2020 13:02:35 +0000 (14:02 +0100)]
Bug 18501: (follow-up) Add fallback to ItemHomeBranch

When 'RefundLostOnReturnControl' is set to 'CheckinLibrary' but
return_branch is passed as undefined we should fallback to
'ItemHomeBranch' before falling back to the default rule.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: (follow-up) Do not rely on userenv->{branchcode}
Martin Renvoize [Thu, 20 Aug 2020 12:28:41 +0000 (13:28 +0100)]
Bug 18501: (follow-up) Do not rely on userenv->{branchcode}

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: (follow-up) Test undefined userenv behaviour
Martin Renvoize [Thu, 20 Aug 2020 13:28:46 +0000 (14:28 +0100)]
Bug 18501: (follow-up) Test undefined userenv behaviour

This patch adds a test to ensure that the 'Koha::Item->store' method
will function when the userenv is not set

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: (follow-up) Remove duplicate test
Martin Renvoize [Thu, 20 Aug 2020 11:38:23 +0000 (12:38 +0100)]
Bug 18501: (follow-up) Remove duplicate test

The ModItem test found in t/db_dependent/Items.t was a duplciate (but
slightly less functional) for the test we introduced for the *_on
trigger functionality in t/db_dependent/Koha/Items.t::store

The failure was a missing C4::Context mock, but the logical fix is to
simply remove the duplicate test.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: Fix QA issues
Jonathan Druart [Thu, 20 Aug 2020 09:49:08 +0000 (11:49 +0200)]
Bug 18501: Fix QA issues

 FAIL   Koha/Item.pm
   FAIL   critic
                # Variables::ProhibitConditionalDeclarations: Got 1 violation(s).
   FAIL   spelling
                 Retreive ==> Retrieve
                 appropriatly ==> appropriately
                 somehwere ==> somewhere

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: (QA follow-up) Fix regressions highlighted by unit tests
Martin Renvoize [Fri, 14 Aug 2020 16:18:12 +0000 (17:18 +0100)]
Bug 18501: (QA follow-up) Fix regressions highlighted by unit tests

The migration of unit tests in the preceeding patch highlighted a few
regressions which are dealt with here.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: (QA follow-up) Migrate and update unit tests
Martin Renvoize [Fri, 14 Aug 2020 16:16:04 +0000 (17:16 +0100)]
Bug 18501: (QA follow-up) Migrate and update unit tests

This patch moves the _FixAccountForLostAndFound tests from Circulation.t
to Koha/Items.t and updates then to call an item store as aposed to the
now removed _FixAccountForLostAndFound method.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: (QA follow-up) Remove FIXME + Track issue_id
Martin Renvoize [Fri, 14 Aug 2020 10:53:59 +0000 (11:53 +0100)]
Bug 18501: (QA follow-up) Remove FIXME + Track issue_id

We correct some compilation errors here by updating the transfered
_FixAccountForLostAndFound method to use $self references.  We add
issue_id tracking so that future reports can clearly see how a refund
relates to the original charge and finally we remove a FIXME as I agree
that the 'discard_changes' call is not required.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: Adjust condition for flagging an item found
Jonathan Druart [Fri, 14 Aug 2020 08:51:39 +0000 (10:51 +0200)]
Bug 18501: Adjust condition for flagging an item found

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: set the is_refunded flag as internal var
Jonathan Druart [Fri, 14 Aug 2020 08:48:00 +0000 (10:48 +0200)]
Bug 18501: set the is_refunded flag as internal var

After discussion with Martin we decided that it could be the correct way

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: wip - need to know it has been refunded
Jonathan Druart [Fri, 14 Aug 2020 07:56:41 +0000 (09:56 +0200)]
Bug 18501: wip - need to know it has been refunded

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: but.. what was the meaning of holdingbranch here?
Jonathan Druart [Thu, 13 Aug 2020 16:42:56 +0000 (18:42 +0200)]
Bug 18501: but.. what was the meaning of holdingbranch here?

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: Add _set_found_trigger
Jonathan Druart [Thu, 13 Aug 2020 16:42:01 +0000 (18:42 +0200)]
Bug 18501: Add _set_found_trigger

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: Auto refund if mark as found from cataloguing
Jonathan Druart [Mon, 10 Aug 2020 14:51:11 +0000 (16:51 +0200)]
Bug 18501: Auto refund if mark as found from cataloguing

If an item is marked as found (ie. not itemlost) we need to refund the
patron.

Test plan:
Mark an item as lost to create a fee for the patron
Mark it as found from the cataloguing module and confirm that the patron
is refunded

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: Remove the borrowernumber parameter
Jonathan Druart [Wed, 12 Aug 2020 13:45:24 +0000 (15:45 +0200)]
Bug 18501: Remove the borrowernumber parameter

It was not used

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: Prepare the ground
Jonathan Druart [Mon, 10 Aug 2020 14:39:08 +0000 (16:39 +0200)]
Bug 18501: Prepare the ground

This code was duplicated and we are going to need it.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 18501: (QA follow-up) Add test of *_on functionality
Martin Renvoize [Tue, 18 Aug 2020 12:26:29 +0000 (13:26 +0100)]
Bug 18501: (QA follow-up) Add test of *_on functionality

This patch adds a test for the *_on trigger functionality to ensure
matching behaviour before and after the triggers change.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
4 years agoBug 19036: DBRev 20.06.00.026
Jonathan Druart [Thu, 20 Aug 2020 10:27:33 +0000 (10:27 +0000)]
Bug 19036: DBRev 20.06.00.026

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>