]> git.koha-community.org Git - koha.git/log
koha.git
4 years agoBug 19008: More database cleanups - QA followup
Magnus Enger [Fri, 2 Aug 2019 11:57:13 +0000 (13:57 +0200)]
Bug 19008: More database cleanups - QA followup

This patch tries to change the POD as suggested in the QA process.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 19008: More database cleanups - item transfers
Fridolin Somers [Fri, 28 Jul 2017 14:09:14 +0000 (16:09 +0200)]
Bug 19008: More database cleanups - item transfers

misc/cronjobs/cleanup_database.pl provides some database cleanup.
Yet some tables that could need cleanup are not in this script.

This patch adds cleanup for branchtransfers table.

Test plan :
- Count : select count(*),datearrived from branchtransfers group by datearrived;
- Run cleanup : misc/cronjobs/cleanup_database.pl -v --transfers 30
- Recount

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 19008: More database cleanups - old reserves
Fridolin Somers [Fri, 28 Jul 2017 14:01:51 +0000 (16:01 +0200)]
Bug 19008: More database cleanups - old reserves

misc/cronjobs/cleanup_database.pl provides some database cleanup.
Yet some tables that could need cleanup are not in this script.

This patch adds cleanup for old_reserves table.

Test plan :
- Count : select count(*),date(timestamp) from old_reserves group by date(timestamp);
- Run cleanup : misc/cronjobs/cleanup_database.pl -v --old-reserves 30
- Recount

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 19008: More database cleanups - old issues
Fridolin Somers [Fri, 28 Jul 2017 12:57:33 +0000 (14:57 +0200)]
Bug 19008: More database cleanups - old issues

misc/cronjobs/cleanup_database.pl provides some database cleanup.
Yet some tables that could need cleanup are not in this script.

This patch adds cleanup for old_issues table.

Test plan :
- Count : select count(*),date(timestamp) from old_issues group by date(timestamp);
- Run cleanup : misc/cronjobs/cleanup_database.pl -v --old-issues 30
- Recount

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 19008: More database cleanups - deleted patrons
Fridolin Somers [Fri, 28 Jul 2017 12:43:45 +0000 (14:43 +0200)]
Bug 19008: More database cleanups - deleted patrons

misc/cronjobs/cleanup_database.pl provides some database cleanup.
Yet some tables that could need cleanup are not in this script.

This patch adds cleanup for deletedborrowers table.

Test plan :
- Count : select count(*),date(updated_on) from deletedborrowers group by date(updated_on);
- Run cleanup : misc/cronjobs/cleanup_database.pl -v --deleted-patrons 30
- Recount

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 19008: More database cleanups - deleted catalog
Fridolin Somers [Fri, 28 Jul 2017 12:05:03 +0000 (14:05 +0200)]
Bug 19008: More database cleanups - deleted catalog

misc/cronjobs/cleanup_database.pl provides some database cleanup.
Yet some tables that could need cleanup are not in this script.

This patch adds cleanup for deleted catalog tables.
Note that deletedbiblio_metadata is managed by foreign key on biblionumber.

Test plan :
- Count :
select count(*),year(timestamp) from deleteditems group by year(timestamp);
select count(*),year(timestamp) from deletedbiblio group by year(timestamp);
select count(*),year(timestamp) from deletedbiblioitems group by year(timestamp);
- Run cleanup : misc/cronjobs/cleanup_database.pl -v --deleted-catalog 30
- Recount

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 19008: More database cleanups - statistics
Fridolin Somers [Fri, 28 Jul 2017 12:12:22 +0000 (14:12 +0200)]
Bug 19008: More database cleanups - statistics

misc/cronjobs/cleanup_database.pl provides some database cleanup.
Yet some tables that could need cleanup are not in this script.

This patch adds cleanup for statistics table.

Test plan :
- Count statistics : select count(*),date(datetime) from statistics group by date(datetime);
- Run cleanup : misc/cronjobs/cleanup_database.pl -v --statistics 30
- Recount statistics

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 20708: Add Withdrawn status when placing a request in staff
Jonathan Druart [Tue, 4 Feb 2020 10:17:11 +0000 (11:17 +0100)]
Bug 20708: Add Withdrawn status when placing a request in staff

Same as bug 22021 for the withdrawn status.

1. Withdraw an item
2. Place an hold on this item
Notice the new "withdrawn" status in the information column

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24569: (QA follow-up) Fix closing <a> tag
Nick Clemens [Tue, 4 Feb 2020 12:36:18 +0000 (12:36 +0000)]
Bug 24569: (QA follow-up) Fix closing <a> tag

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24569: Fix "add to basket" link (bug 23031 regression)
Jonathan Druart [Tue, 4 Feb 2020 09:44:39 +0000 (10:44 +0100)]
Bug 24569: Fix "add to basket" link (bug 23031 regression)

The modal needs to be defined in both cases.

Test plan:
Repeat test plan from bug 23031 and click on the buttons!

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 21466: Keep all AVs for a given framework
Jonathan Druart [Wed, 29 Jan 2020 11:44:57 +0000 (12:44 +0100)]
Bug 21466: Keep all AVs for a given framework

There was a major (and silly) issue in the previous version, only one AV
was kept as we erased the hash value at the end of each iteration:
$invalid_locations_per_framework->{$framework->frameworkcode } =
  { items => $items, av_category => $mss->authorised_value, kohafield => $kohafield };

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 9993: On editing basket group delivery place resets to logged in branch
Owen Leonard [Wed, 20 Nov 2019 17:00:52 +0000 (17:00 +0000)]
Bug 9993: On editing basket group delivery place resets to logged in branch

This patch modifies basketgroups.pl so that existing data about a basket
group's billing and delivery place are correctly preselected in the edit
form. These fields shouldn't reset to the logged-in user's home branch
just because they have an empty value.

To test, apply the patch and go to Acquisitions -> Vendor -> Basket
groups.

When adding or editing a basket group the pre-selected value for
"Billing place" and "Delivery place" should be correct:

   - When creating a new basket group: The logged-in user's library
     should be pre-selected.

   - When editing a basket group which has a library defined for either
     the billing or delivery places, the correct library should be
     pre-selected.

   - When editing a basket group which has no library defined for either
     the billing or delivery place there should be no library
     pre-selected (the "--" option should be pre-selected).

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 10879: OverDrive should check for OverDriveLibraryID before performing search
Owen Leonard [Tue, 19 Nov 2019 17:02:02 +0000 (17:02 +0000)]
Bug 10879: OverDrive should check for OverDriveLibraryID before performing search

This patch modifies the OPAC search results template to check for three
populated system preferences before performing an OverDrive search:
OverDriveLibraryID, OverDriveClientKey, and OverDriveClientSecret.
Previously OverDriveLibraryID was not checked, but without it the
interface reports an error performing the search.

To test you must have credentials for the OverDrive API as defined
in OverDriveClientKey, OverDriveClientSecret, and OverDriveLibraryID
system preferences.

 - With OverDriveLibraryID defined, the catalog search results page in
   the OPAC should show a link to results in the library's OverDrive
   collection.

 - With no value in the OverDriveLibraryID preference the catalog
   search page should not show any message about an OverDrive
   collection.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24560: Remove No public list text from OPAC
Lucas Gass [Sat, 1 Feb 2020 16:42:10 +0000 (16:42 +0000)]
Bug 24560: Remove No public list text from OPAC

On the OPAC, the dropdown for Lists always includes
the heading Public Lists, even if no public lists exist.
This is sub-optimal for libraries that want VirtualShelves
enabled for private lists but don't want to use public lists.

TEST PLAN:
1. have no public list and look at the List dropdown on the OPAC. It says No Public Lists.
2. Apply patch
3. It should now not say anything about public lists but still be formatted nice.
4. Add some public lists and confirm that everything looks normal.
5. Sign off

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23533: (follow-up) Add markup comments
Owen Leonard [Tue, 10 Dec 2019 17:30:41 +0000 (17:30 +0000)]
Bug 23533: (follow-up) Add markup comments

This patch adds comments to the template to highlight the markup
structure.

This patch should have no effect on the interface or functionality.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23533: Reindent patron entry form (memberentrygen.tt)
Owen Leonard [Tue, 10 Dec 2019 16:34:56 +0000 (16:34 +0000)]
Bug 23533: Reindent patron entry form (memberentrygen.tt)

This patch re-indents the template for patron entry/editing. It
makes only whitespace changes. It should have no effect on the behavior
of the page.

To test, create or edit a patron.

Test every aspect of the process. At each step the page should work
correctly. Including:

 - Adult patron
 - Child patron
 - Organizational patron
 - Quick patron add
 - Duplicate patron
 - With mandatory fields
 - With 'BorrowerUnwantedField's defined
 - With ExtendedPatronAttributes enabled

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24490: Clarify wording and function of Purchase Items link on POS
David Roberts [Mon, 27 Jan 2020 15:41:32 +0000 (15:41 +0000)]
Bug 24490: Clarify wording and function of Purchase Items link on POS

This patch changes the wording of the links on the POS side menu

To test:

1) Apply the patch
2) Check that the links on the left hand side of the screen read "Configure cash registers" and "Configure items for purchase"
3) Click both links to ensure you are taken to the relevant config pages.

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24440: Rename current_holds with current_item_level_holds
Jonathan Druart [Mon, 3 Feb 2020 12:36:54 +0000 (13:36 +0100)]
Bug 24440: Rename current_holds with current_item_level_holds

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24440: Adding 2 more tests for ->biblio
Jonathan Druart [Fri, 31 Jan 2020 14:08:00 +0000 (15:08 +0100)]
Bug 24440: Adding 2 more tests for ->biblio

Not directly related to the other changes but seems good to have them
here.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24440: (follow-up) Make related objects prefetchable
Tomas Cohen Arazi [Fri, 31 Jan 2020 03:54:27 +0000 (00:54 -0300)]
Bug 24440: (follow-up) Make related objects prefetchable

This patch creates aliases for the relations used to retrieve the linked
objects from other tables. It makes the accessor names match the used
relation name, for consistency.

This is important for code trying to be smart and guessing what needs to
be prefetched, like the API code.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Acquisition/Order.t
=> SUCCESS: Tests pass
2. Apply this patch
3. Repeat (1)
=> SUCCESS: Tests pass! No behaviour change
4. Verify the POD changes make sense
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24440: ->biblio tests
Tomas Cohen Arazi [Fri, 31 Jan 2020 03:27:05 +0000 (00:27 -0300)]
Bug 24440: ->biblio tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24440: Add ->current_holds to Koha::Acquisition::Order
Tomas Cohen Arazi [Thu, 16 Jan 2020 18:58:25 +0000 (15:58 -0300)]
Bug 24440: Add ->current_holds to Koha::Acquisition::Order

This patch introduces a method to fetch the current holds associated with the
items linked to an order line. It basically implements what's done in
parcel.pl, but fully tested and suitable for using on the API.

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

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24440: Unit tests
Tomas Cohen Arazi [Thu, 16 Jan 2020 18:58:15 +0000 (15:58 -0300)]
Bug 24440: Unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24171: Check auto_renew if confirmation is needed
Jonathan Druart [Mon, 23 Dec 2019 13:06:06 +0000 (14:06 +0100)]
Bug 24171: Check auto_renew if confirmation is needed

Test plan:
Add some fines
Check auto_renew and check an item out, using a title keyword
Pick one item
You get the confirmation box
=> Notice that the auto_renew checkbox is checked

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24171: Preserve auto_renew when triggering itemBarcodeFallbackSearch
Jonathan Druart [Tue, 17 Dec 2019 11:10:28 +0000 (12:10 +0100)]
Bug 24171: Preserve auto_renew when triggering itemBarcodeFallbackSearch

The auto_renew parameter is not sent to the template when the popup
triggered by itemBarcodeFallbackSearch is displayed.

Test plan:
- Turn on itemBarcodeFallbackSearch
- Open a patron account
- Check the checkboxes for automatic-renewal
- Search for a title keyword in the checkout input box
- Verify that auto-renewal flag is set

Note for QA: The auto_renew flag will be set in any cases. Should we
expect regression?

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: DBRev 19.12.00.018
Martin Renvoize [Tue, 4 Feb 2020 10:08:50 +0000 (10:08 +0000)]
Bug 18936: DBRev 19.12.00.018

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (QA follow-up) Fix failing test in api/v1/holds.t
Jonathan Druart [Mon, 3 Feb 2020 15:45:27 +0000 (16:45 +0100)]
Bug 18936: (QA follow-up) Fix failing test in api/v1/holds.t

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (QA follow-up) Fix failing test
Joonas Kylmälä [Mon, 3 Feb 2020 15:25:09 +0000 (15:25 +0000)]
Bug 18936: (QA follow-up) Fix failing test

Using categorycode as a scope is not possible for any of these rules
so lets remove it.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (QA follow-up) Remove 2 new occurrences of Koha::IssuingRules
Jonathan Druart [Mon, 3 Feb 2020 11:27:40 +0000 (12:27 +0100)]
Bug 18936: (QA follow-up) Remove 2 new occurrences of Koha::IssuingRules

Fix conflict with bug 13121

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (QA follow-up) Convert remaining tests to use Koha::CirculationRules
Joonas Kylmälä [Mon, 3 Feb 2020 10:20:17 +0000 (10:20 +0000)]
Bug 18936: (QA follow-up) Convert remaining tests to use Koha::CirculationRules

These two uses of Koha::IssuingRule were forgotten so this converts
them to use the new Koha::CirculationRules object.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) More fixes
Jonathan Druart [Fri, 31 Jan 2020 15:45:55 +0000 (16:45 +0100)]
Bug 18936: (follow-up) More fixes

Previous "More fixes" patch added a debugging statement, not needed.

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (QA follow-up) Add missing POD
Joonas Kylmälä [Fri, 31 Jan 2020 10:51:36 +0000 (10:51 +0000)]
Bug 18936: (QA follow-up) Add missing POD

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) Fix checkouts endpoint and its tests
Joonas Kylmälä [Wed, 29 Jan 2020 14:06:00 +0000 (14:06 +0000)]
Bug 18936: (follow-up) Fix checkouts endpoint and its tests

- Fixes a bug caused by the refactoring in
Koha/REST/V1/Checkouts.pm (run the tests without this patch and you
will see the tests fails because 'rule_name' parameter was
forgotten).

- Changes the tests to use the new Koha::CirculationRule objects
  instead of directly using issuingrules DB table

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) Adjust circ rule related tests so that they pass
Joonas Kylmälä [Wed, 29 Jan 2020 11:09:17 +0000 (11:09 +0000)]
Bug 18936: (follow-up) Adjust circ rule related tests so that they pass

Bunch of tests broke after moving from issuingrules to
circulation_rules. This accomodates the tests for this refactoring and
DB change.

The itemtype did not exist in the DB. We create it at the beginning of
the tests. Ideally we would like to create it filling the form.

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: Fix IssuingRules/guess_article_requestable_itemtypes.t
Jonathan Druart [Tue, 28 Jan 2020 15:47:39 +0000 (16:47 +0100)]
Bug 18936: Fix IssuingRules/guess_article_requestable_itemtypes.t

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) Make possible to have unlimited value for holds_per_day
Joonas Kylmälä [Tue, 28 Jan 2020 15:05:15 +0000 (15:05 +0000)]
Bug 18936: (follow-up) Make possible to have unlimited value for holds_per_day

Without this it is not possible to make for a specific patron category
or itemtype a more specific unlimited holds_per_day rule if you have a
catch all rule (categorycode = *, itemtype = *) with limited
holds_per_day value.

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) Add cloning of circulation rules back to Koha
Joonas Kylmälä [Tue, 28 Jan 2020 13:46:55 +0000 (13:46 +0000)]
Bug 18936: (follow-up) Add cloning of circulation rules back to Koha

The "Clone these rules" feature in admin/smart-rules.pl was
dropped. This re-implements the cloning using Koha objects.

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (QA follow-up) Fix inconsistencies in IssuingRules.t
Jonathan Druart [Mon, 27 Jan 2020 09:13:44 +0000 (10:13 +0100)]
Bug 18936: (QA follow-up) Fix inconsistencies in IssuingRules.t

* get_effective_rule should not pass rule_value
* indentation fix
* add comment to list the rules we have when the test _is_row_match
is executed
* compare ->rule_name and ->rule_value returns

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) Add missing import of Koha::CirculationRules
Joonas Kylmälä [Fri, 24 Jan 2020 14:13:09 +0000 (16:13 +0200)]
Bug 18936: (follow-up) Add missing import of Koha::CirculationRules

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) Fix typo in documentation
Joonas Kylmälä [Fri, 24 Jan 2020 10:46:19 +0000 (12:46 +0200)]
Bug 18936: (follow-up) Fix typo in documentation

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) Add foreign key and scope enhancement to circ rules
Jonathan Druart [Fri, 24 Jan 2020 13:54:45 +0000 (14:54 +0100)]
Bug 18936: (follow-up) Add foreign key and scope enhancement to circ rules

The previous patch modifies:
-                categorycode => undef,
-                itemtype     => undef,
-                branchcode   => $branch,
+                branchcode   => undef,

But in that condition $branchcode is not '*' and so we should not set it
to undef

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) Fix the delete rule buttons
Jonathan Druart [Fri, 24 Jan 2020 11:19:07 +0000 (12:19 +0100)]
Bug 18936: (follow-up) Fix the delete rule buttons

The itemtype and categorycode were always set to '*'

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: Replace '*' with undef
Jonathan Druart [Thu, 23 Jan 2020 15:16:12 +0000 (16:16 +0100)]
Bug 18936: Replace '*' with undef

No test was provided initially so considering out of the scope for this
one as well, but that's lacking terribly!

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: Insert default rules during the onboarding tool
Jonathan Druart [Thu, 23 Jan 2020 15:01:13 +0000 (16:01 +0100)]
Bug 18936: Insert default rules during the onboarding tool

Those default values have been picked from bug 15522
(Koha::CirculationRules)

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) Make sure we default to '*' if no rule exist
Jonathan Druart [Thu, 23 Jan 2020 13:45:36 +0000 (14:45 +0100)]
Bug 18936: (follow-up) Make sure we default to '*' if no rule exist

Making sure the code is doing what we expect.
Also this patch fix CirculationRules.t

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) Add missing circulation rule to fix tests
Joonas Kylmälä [Wed, 22 Jan 2020 17:03:03 +0000 (19:03 +0200)]
Bug 18936: (follow-up) Add missing circulation rule to fix tests

The tests passed before by a chance because the default kohadevbox
installation script added a issuing rule that had lengthunit =
days. If you use a Koha version before the commits introduced by Bug
18936 you can reproduce the Fees.t tests failing by deleting all the
issuing rules from database with

> delete issuingrules;

and then running

$ prove t/db_dependent/Koha/Charges/Fees.t

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: Fix some more tests
Jonathan Druart [Wed, 22 Jan 2020 11:27:22 +0000 (12:27 +0100)]
Bug 18936: Fix some more tests

* CanItemBeReserved
Prior to "Bug 18936: Convert issuingrules fields to circulation_rules",
GetHoldRule returned holds_per_record even if no reservesallowed was
defined. This change restores this behavior.
FIXME Note: In GetHoldRule we return itemtype only if reservesallowed is set,
not sure it is correct.

* t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t
When setting returnbranch, holdallowed and hold_fulfillment_policy, we
should not provide categorycode.

* t/db_dependent/Holds.t
Prefer to keep the existing rules instead of removing them. It got quite
hard to understand what was going on here because of the mixup with
the rule reservesallowed that was in issuingrules, and the other rules
we used for the tests. Also, categorycode should not be passed to set
those 3 rules (holdallowed, hold_fulfillment_policy and returnbranch)

* t/db_dependent/Circulation.t
Setting lengthunit to 'hours', no need to make sure the rule has been
correctly be saved

* t/db_dependent/Circulation/CalcDateDue.t
It uses hardcoded data that is not in the sample data (categorycode=C).
Let use K that exists and postpone a refactore of the whole script (to
make it create the data it needs).

* t/db_dependent/Circulation/ReturnClaims.t
* t/db_dependent/Circulation/IssuingRules/maxsuspensiondays.t
Simple replace Koha::IssuingRule with Koha::CirculationRules

* t/db_dependent/Koha/Charges/Fees.t
=> FIXME Still failing, stuck here, need help

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) Don't retrieve unused issuing rule
Joonas Kylmälä [Wed, 22 Jan 2020 10:58:37 +0000 (10:58 +0000)]
Bug 18936: (follow-up) Don't retrieve unused issuing rule

The chargename rule is not used anywhere in the code

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: Fix warning about page about wrong lengthunit
Jonathan Druart [Wed, 22 Jan 2020 13:14:41 +0000 (14:14 +0100)]
Bug 18936: Fix warning about page about wrong lengthunit

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: fixes from comment #88
Jonathan Druart [Tue, 26 Nov 2019 11:00:52 +0000 (12:00 +0100)]
Bug 18936: fixes from comment #88

- holds per day are not transferred in database update (actually not
displayed)
- in note column, I can see link "view notes" even if there is no note
- No automatic renewal after (hard limit) does not respect dateformat
and is shown in iso format

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: Fix Update DB entry
Jonathan Druart [Sun, 4 Aug 2019 20:06:00 +0000 (15:06 -0500)]
Bug 18936: Fix Update DB entry

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: Add missing filters
Jonathan Druart [Sun, 4 Aug 2019 19:31:04 +0000 (14:31 -0500)]
Bug 18936: Add missing filters

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: More fixes
Jonathan Druart [Sun, 4 Aug 2019 19:09:21 +0000 (14:09 -0500)]
Bug 18936: More fixes

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: Fix Circulation.t
Jonathan Druart [Wed, 6 Mar 2019 17:45:03 +0000 (14:45 -0300)]
Bug 18936: Fix Circulation.t

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: Replace an other insert into issuingrules
Jonathan Druart [Thu, 21 Feb 2019 22:06:39 +0000 (19:06 -0300)]
Bug 18936: Replace an other insert into issuingrules

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: new holds_per_day
Jonathan Druart [Thu, 21 Feb 2019 20:50:29 +0000 (17:50 -0300)]
Bug 18936: new holds_per_day

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: new suspension_chargeperiod
Jonathan Druart [Thu, 21 Feb 2019 20:49:21 +0000 (17:49 -0300)]
Bug 18936: new suspension_chargeperiod

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: chargename removed by bug 21753
Jonathan Druart [Thu, 21 Feb 2019 20:46:37 +0000 (17:46 -0300)]
Bug 18936: chargename removed by bug 21753

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: Fix several issues
Jonathan Druart [Fri, 7 Dec 2018 18:18:20 +0000 (15:18 -0300)]
Bug 18936: Fix several issues

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: Fix syntax issue
Jonathan Druart [Thu, 6 Dec 2018 19:54:39 +0000 (16:54 -0300)]
Bug 18936: Fix syntax issue

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: Remove last bit of Koha::IssuingRule
Jonathan Druart [Thu, 6 Dec 2018 19:32:04 +0000 (16:32 -0300)]
Bug 18936: Remove last bit of Koha::IssuingRule

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: Move guess_article_requestable_itemtypes method
Jonathan Druart [Thu, 6 Dec 2018 19:27:50 +0000 (16:27 -0300)]
Bug 18936: Move guess_article_requestable_itemtypes method

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: move get_opacitemholds_policy method
Jonathan Druart [Thu, 6 Dec 2018 19:21:06 +0000 (16:21 -0300)]
Bug 18936: move get_opacitemholds_policy method

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) Fix tests, replace old get_onshelfholds_policy method
Jesse Weaver [Mon, 26 Feb 2018 19:17:16 +0000 (12:17 -0700)]
Bug 18936: (follow-up) Fix tests, replace old get_onshelfholds_policy method

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) fix tests, null vs. empty behavior for limiting rules
Jesse Weaver [Mon, 29 Jan 2018 22:54:40 +0000 (15:54 -0700)]
Bug 18936: (follow-up) fix tests, null vs. empty behavior for limiting rules

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) Remove issuingrules from kohastructure.sql
Jesse Weaver [Mon, 29 Jan 2018 20:44:43 +0000 (13:44 -0700)]
Bug 18936: (follow-up) Remove issuingrules from kohastructure.sql

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) fix rental discount lookup
Jesse Weaver [Tue, 17 Oct 2017 23:26:31 +0000 (17:26 -0600)]
Bug 18936: (follow-up) fix rental discount lookup

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) Update REST definition for /.../kinds
Jesse Weaver [Fri, 6 Oct 2017 19:20:01 +0000 (13:20 -0600)]
Bug 18936: (follow-up) Update REST definition for /.../kinds

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) Add foreign key and scope enhancement to circ rules
Jesse Weaver [Thu, 14 Sep 2017 19:32:26 +0000 (13:32 -0600)]
Bug 18936: (follow-up) Add foreign key and scope enhancement to circ rules

This necessitates moving the circ rules from using '*' to using
undef/NULL.

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: Fix api/v1/holds.t
Tomas Cohen Arazi [Mon, 17 Jul 2017 19:21:56 +0000 (16:21 -0300)]
Bug 18936: Fix api/v1/holds.t

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: (follow-up) Fix upgrade step
Tomas Cohen Arazi [Mon, 17 Jul 2017 19:04:51 +0000 (16:04 -0300)]
Bug 18936: (follow-up) Fix upgrade step

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 18936: Convert issuingrules fields to circulation_rules
Kyle M Hall [Thu, 13 Jul 2017 14:03:54 +0000 (10:03 -0400)]
Bug 18936: Convert issuingrules fields to circulation_rules

Signed-off-by: Minna Kivinen <minna.kivinen@hamk.fi>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 21674: (RM follow-up) Fix updatedatabase error
Martin Renvoize [Fri, 31 Jan 2020 11:37:55 +0000 (11:37 +0000)]
Bug 21674: (RM follow-up) Fix updatedatabase error

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24546: Fix intentions of build_sample_item in Club/Hold.t
Jonathan Druart [Thu, 30 Jan 2020 14:38:26 +0000 (15:38 +0100)]
Bug 24546: Fix intentions of build_sample_item in Club/Hold.t

In t/db_dependent/Koha/Club/Hold.t:
my $item1 = $builder->build_sample_item({ branchcode => $library->branchcode });
my $item2 = $builder->build_sample_item({ branchcode => $library->branchcode });

build_sample_item takes either "library" or the item's attributes.
branchcode is not part of the item's table, so what those 2 lines are trying to acchieve is wrong.

Test plan:
 % prove t/db_dependent/Koha/Club/Hold.t
must return green before and after this patch

Note that this patch also remove an uneeded debugging statement.

This has been caught by bug 24363.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24213: Fix Koha::Object->get_from_storage if the object has been deleted
Jonathan Druart [Wed, 11 Dec 2019 08:39:30 +0000 (09:39 +0100)]
Bug 24213: Fix Koha::Object->get_from_storage if the object has been deleted

Without this patch it fails with something like:
  DBIC result _type  isn't of the _type Subscription at t/db_dependent/Biblio.t line 627.

Test plan:
- Apply the first patch (Add tests)
- Confirm that they fail
- Apply this patch
- Confirm that the tests pass

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24213: Add tests
Jonathan Druart [Wed, 11 Dec 2019 08:39:15 +0000 (09:39 +0100)]
Bug 24213: Add tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24467: (QA follow-up) Clarify tests wording for ->count methods
Josef Moravec [Fri, 31 Jan 2020 09:47:54 +0000 (09:47 +0000)]
Bug 24467: (QA follow-up) Clarify tests wording for ->count methods

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24467: (QA follow-up) Fix POD in Koha::Biblio
Josef Moravec [Fri, 31 Jan 2020 09:46:56 +0000 (09:46 +0000)]
Bug 24467: (QA follow-up) Fix POD in Koha::Biblio

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24467: Remove _count methods introduced for API use
Tomas Cohen Arazi [Wed, 22 Jan 2020 15:21:22 +0000 (16:21 +0100)]
Bug 24467: Remove _count methods introduced for API use

This patch removes some methods that were introduced for API usage in
the first iteration of the object embedding development effort.

Those methods were obsoleted by bug 24528, which introduces a smarter
way for Koha::Object->to_api to embed *_count attributes on the output
structure based on the relationships and a call to ->count.

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

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24528: Add a syntax to x-koha-embed to specify counts
Tomas Cohen Arazi [Wed, 29 Jan 2020 12:24:35 +0000 (09:24 -0300)]
Bug 24528: Add a syntax to x-koha-embed to specify counts

This patch adds a + syntax to specify on the x-koha-embed header that we
want the count of a relation in the response. For example:

GET /patrons/1
x-koha-embed: checkouts+count

Would return a JSON representation of a Koha::Patron, with a new
attribute added: checkouts_count, which will be the result of calling
$patron->checkouts->count.

This is all done automatically in to_api. This patch makes parsing the
x-koha-embed header build the right structure for passing to the to_api
method.

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

Sponsored-by: ByWater Solutions
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24528: Add *_count support to to_api
Tomas Cohen Arazi [Tue, 28 Jan 2020 19:24:51 +0000 (16:24 -0300)]
Bug 24528: Add *_count support to to_api

This patch adds a way to tell to_api an attribute needs to be calculated
as the count on an existing method/relationship result. For example, if
we wanted to include the holds_count attribute for a Koha::Patron
object, we would call it:

    $ patron_json = $patron->to_api({ embed => { holds_count => { is_count => 1 } } });

This way to_api will internally call

    $json->{holds_count} = $self->holds->count;

To test:
1. Apply the tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Object.t
=> FAIL: Tests fail!
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: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24528: Unit tests for Koha::Object->to_api
Tomas Cohen Arazi [Tue, 28 Jan 2020 19:14:01 +0000 (16:14 -0300)]
Bug 24528: Unit tests for Koha::Object->to_api

This patch introduces unit tests for the new to_api bejaviour for
*_count methods.

To test:
1. Apply this patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Object.t
=> FAIL: Tests fail because the feature is not implemented

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24523: Add missing </p>
Lucas Gass [Mon, 27 Jan 2020 22:06:06 +0000 (22:06 +0000)]
Bug 24523: Add missing </p>

Signed-off-by: David Roberts <david.roberts@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24330: When importing patrons from CSV, automatically strip BOM from file if...
Kyle M Hall [Thu, 2 Jan 2020 15:30:54 +0000 (10:30 -0500)]
Bug 24330: When importing patrons from CSV, automatically strip BOM from file if it exists

We have a partner that exports UTF-8 CSV files, and is experiencing the same thing as the author of this article: https://www.freecodecamp.org/news/a-quick-tale-about-feff-the-invisible-character-cd25cd4630e7/

In short, Excel is inserting an invisible UTF-8 character at the start of the file, so that the column name "cardnumber" is actually named "\x{feff}cardnumber", causing "cardnumber" to be blank.

A simple solution is provided here: https://stackoverflow.com/questions/24390034/remove-bom-from-string-with-perl

Test Plan:
1) Download the example.csv file
2) Attempt to import it using the patron import tool
3) Note the invalid column name error
4) Apply this patch, restart all the things!
5) Attempt the import again
6) Assuming you have a branchcode MPL and a cataegory code S, the patron should import!

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Maggie Wong <maggie.wong@yccece.edu.hk>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 21674: DBRev 19.12.00.017
Martin Renvoize [Thu, 30 Jan 2020 15:44:17 +0000 (15:44 +0000)]
Bug 21674: DBRev 19.12.00.017

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 21674: Remove duplicates from library_groups before adding the uniq constraint
Jonathan Druart [Tue, 21 Jan 2020 14:01:51 +0000 (15:01 +0100)]
Bug 21674: Remove duplicates from library_groups before adding the uniq constraint

To avoid to make it fails if duplicates existed prior to this change

Credit for the SQL query goes to Nick, thanks!

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 21674: Prevent to insert twice the same library in a group
Jonathan Druart [Wed, 11 Dec 2019 11:51:23 +0000 (12:51 +0100)]
Bug 21674: Prevent to insert twice the same library in a group

When you create hierarchical groups of libraries you are not allowed to add
several times the same library to a given group/subgroup. The libraries
that are part of the group is not displayed on the interface, to prevent
the user to select it.

However this restriction is only done template-side, the controller and
module does not handle it.

To prevent that this patchset enforces the constraint at DB level, and
display a message to the end user.

Test plan:
- Go to Home › Administration › Library groups
- Add a group
- Add a library
- reload the page several times
=> Without this patch the same library appears several times in the group
=> With this patch applied you will see a friendly error message

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 21674: DB changes
Jonathan Druart [Wed, 11 Dec 2019 11:51:14 +0000 (12:51 +0100)]
Bug 21674: DB changes

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24377: Record passed branch if renewing via cron
Nick Clemens [Thu, 16 Jan 2020 13:09:58 +0000 (13:09 +0000)]
Bug 24377: Record passed branch if renewing via cron

To test:
1 - Checkout an item with auto renewal set and eligible for auto renew
2 - Set no renewal before in the circ rules to 99 (something greater than the checkout period)
3 - perl misc/cronjobs/automatic_renewals.pl
4 - Check the statistics table, note the branch for renewal is null
    SELECT * FROM statistics WHERE itemnumber={itemnumber} AND type='RENEWAL'
5 - Apply patch
6 - Repeat 1-4
7 - Note the branch is set to the issuing branch

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Ed Veal <eveal@mckinneytexas.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24377: Unit test
Nick Clemens [Thu, 16 Jan 2020 13:09:50 +0000 (13:09 +0000)]
Bug 24377: Unit test

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24543: Fix wrong test in api/v1/checkouts.t
Jonathan Druart [Thu, 30 Jan 2020 10:51:25 +0000 (11:51 +0100)]
Bug 24543: Fix wrong test in api/v1/checkouts.t

In t/db_dependent/api/v1/checkouts.t we define a circulation rule with renewalperiod=7.
But then the expected due date is today+14 days.
However, at the beginning of the script, the due_date of the issue is today+14 days.

That highlight that the renewal period is not taken into account.

The circulation rule is created with renewalperiod and renewalsallowed,
however GetLoanLength check the existence of issuelength to return the rule.
GetLoanLength finally return the default rule, with renewalperiod=0

Note that this has been found working on bug 18936, code will be cleaned on that patchset.

Test plan:
 % prove t/db_dependent/api/v1/checkouts.t
must return green before and after this patch

Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24487: Add 2 more tests
Jonathan Druart [Thu, 23 Jan 2020 09:47:17 +0000 (10:47 +0100)]
Bug 24487: Add 2 more tests

And make sure tests pass if there is no patron with borrowernumber=10 in
DB.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Ammended test description
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24487: Don't apply matching criteria to path parameters
Agustin Moyano [Thu, 23 Jan 2020 04:50:29 +0000 (01:50 -0300)]
Bug 24487: Don't apply matching criteria to path parameters

This patch separates query parameters from path parameters, and uses exact matching for the later.

To test:
1. Apply this patch
2. prove t/Koha/REST/Plugin/Query.t t/db_dependent/Koha/REST/Plugin/Objects.t
SUCCESS => tests ok
3. Sign off

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24487: Regresion test
Agustin Moyano [Wed, 22 Jan 2020 23:44:04 +0000 (20:44 -0300)]
Bug 24487: Regresion test

This patch introduces a regresion test where a path parameter is combined with 'contains' match criteria

To test:
1. apply this patch
2. prove t/db_dependent/Koha/REST/Plugin/Objects.t

Test should fail at this point.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23031: Make 'add to basket' accessible in one click (fix regression)
Jonathan Druart [Mon, 13 Jan 2020 11:04:46 +0000 (12:04 +0100)]
Bug 23031: Make 'add to basket' accessible in one click (fix regression)

Since bug 21364 we have 'view' then 'add to basket' that is accessible
in 2 clicks. We should have it directly accessible.

Test plan:
Create a new basket
Add a new order to the basket (note that the link is directly
accessible)
When a new order is added you can close the basket from the basket list
view
Note that the dropdown button displays correctly

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24347: (follow-up) Remove custom catalog search from acquisitions
Owen Leonard [Mon, 6 Jan 2020 15:09:08 +0000 (15:09 +0000)]
Bug 24347: (follow-up) Remove custom catalog search from acquisitions

This patch removes the "neworderbiblio" script and template which are
made obsolete by the "search to order" feature.

deleted:    acqui/neworderbiblio.pl
deleted:    koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderbiblio.tt

Some documentation in addorder.pl has been corrected to remove reference
to neworderbiblio.pl.

To test, apply the patch and verify that the correct files have been
removed.

Search the Koha codebase to verify that no links to
acqui/neworderbiblio.pl remain.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 24347: Add a 'search to order' option similar to 'search to hold'
Owen Leonard [Mon, 6 Jan 2020 01:45:21 +0000 (01:45 +0000)]
Bug 24347: Add a 'search to order' option similar to 'search to hold'

This patch modifes the process of searching for an existing record
to add to a basket. Now the search is performed as a keyword search in
the regular catalog rather than via a custom search script. Options are
added to the search results and detail pages to add results to an order.

This process follows the same pattern as the "Search to hold" feature:
When the search is initiated, a cookie is set with the requisite
information--in this case vendor id and basket number.

If the search results or bibliographic detail pages detect that a
"searchToOrder" cookie is present, the correct "Add order" link will be
shown. Like with the "search to hold" feature, the cookie expires in 10
minutes.

To test, apply the patch and log into the staff client as a user who has
permission to add to a basket in acquisitions.

 - Go to Acquisitions -> Vendor -> Basket -> Add to basket.
 - Using the "From an existing record" option, perform a search.
 - On the search results page, test the "Add order" link which appears
   with each result. Clicking the link should take you to the "New
   order" page for the correct vendor and basket. The catalog
   details section of the form should include the correct information.
 - From the search results page view the bibliographic details page for
   any record. There should be a new toolbar button, "Add order." Verify
   that it works correctly.
   - Test the same thing from all bibliographic detail pages: Normal,
     MARC, Labeled MARC, ISBD, as well as the items page
     (moredetail.pl).
 - Test this process for both the locations in acquisitions where one
   can add to an existing basket: Vendor search results and the basket
   detail page
 - Test the cookie timeout: Wait 10 minutes and perform another catalog
   search. The "Add order" link should no longer be present.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23594: Fix bad resolution conflict with bug 16784
Jonathan Druart [Thu, 23 Jan 2020 08:59:55 +0000 (09:59 +0100)]
Bug 23594: Fix bad resolution conflict with bug 16784

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23594: Add missing html filters
Jonathan Druart [Wed, 22 Jan 2020 09:04:21 +0000 (10:04 +0100)]
Bug 23594: Add missing html filters

Also fixes the following QA failure:
forbidden pattern: Attribute type should not be used for script tags (bug 20053) (line 840)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
4 years agoBug 23594: Restore previous view after delete or update itemtype
Jonathan Druart [Tue, 22 Oct 2019 10:00:18 +0000 (12:00 +0200)]
Bug 23594: Restore previous view after delete or update itemtype

We want to restore the previous view when suggestions are deleted or
their itemtypes are updated.
To avoid c/p the code is moved to a new subroutine.

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>