koha.git
3 years agoBug 26988: Add API route to fetch hold pickup locations and use it in the holds table
Nick Clemens [Tue, 10 Nov 2020 13:35:14 +0000 (13:35 +0000)]
Bug 26988: Add API route to fetch hold pickup locations and use it in the holds table

To test:
1 - Place a number of holds on a record
2 - Have different pickup locations for the holds
3 - Have some libraries that are not pickup locations
4 - Load the holds tab for the record and note libraries not pickup locations are not in dropdowns
5 - Apply patch and restart all things
6 - Reload the holds table
7 - Click on a dropdown, note the spinner, should load successfully
8 - Confirm the dropdown matches the options before the patch
9 - Confirm updating the hold location works

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26963: Ignore existing libraries
Jonathan Druart [Fri, 13 Nov 2020 08:23:51 +0000 (09:23 +0100)]
Bug 26963: Ignore existing libraries

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26963: (QA follow-up) Fix up tests and cover case of undefined ccode
Nick Clemens [Wed, 11 Nov 2020 13:26:58 +0000 (13:26 +0000)]
Bug 26963: (QA follow-up) Fix up tests and cover case of undefined ccode

While this technically shouldn't happen, if a library creates itemtype limits, then flips the pref, those rules are still in the db until a ccode rule is saved.

To be extra safe, when checking for rules of one type, we should make sure the other type is undef - i.e. if looking for ccode rules, we should confirm the itype is undef for those rules

Additionally, we shouldn't set the barcode now that we are not deleting all items, so we use copynumber for our item identification field as it doesn't need to be unique in the DB

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26963: (QA follow-up) Fix cases where we expected a list
Nick Clemens [Wed, 11 Nov 2020 14:09:24 +0000 (14:09 +0000)]
Bug 26963: (QA follow-up) Fix cases where we expected a list

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26963: (QA follow-up) Update mocked return of pickup_locations
Martin Renvoize [Wed, 11 Nov 2020 15:43:57 +0000 (15:43 +0000)]
Bug 26963: (QA follow-up) Update mocked return of pickup_locations

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26963: (QA follow-up) Don't delete existing data before tests
Nick Clemens [Wed, 11 Nov 2020 12:49:00 +0000 (12:49 +0000)]
Bug 26963: (QA follow-up) Don't delete existing data before tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26963: (QA follow-up) Migrate unit tests into pickup_location
Martin Renvoize [Wed, 11 Nov 2020 16:06:21 +0000 (16:06 +0000)]
Bug 26963: (QA follow-up) Migrate unit tests into pickup_location

We wrote unit tests for _can_pickup_locations as part of this patchset,
but then I inlined the method whilst golfing. This patch moves those
tests into the existing pickup_locations test so we more thoroughly
cover the case where branch transfer limits are in play.

NOTE: The tests all assume that all items have an effective_itemtype and
ccode. I'm pretty sure items all have a type at this point, but I'm less
sure we enforce collection codes?

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26963: (QA follow-up) Convert to ResultSets
Martin Renvoize [Wed, 11 Nov 2020 08:57:21 +0000 (08:57 +0000)]
Bug 26963: (QA follow-up) Convert to ResultSets

This patch removes the previously introduced private method by
converting the arrayref returns to ResultSets appropriately and inlining
the filter search queries.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26963: (follow-up) Change subroutine name for QA tools
Nick Clemens [Wed, 11 Nov 2020 02:37:55 +0000 (02:37 +0000)]
Bug 26963: (follow-up) Change subroutine name for QA tools

It didn't like the ending _at

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26963: Don't call 'can_be_transferred' for each possible library for each item
Nick Clemens [Mon, 9 Nov 2020 13:53:51 +0000 (13:53 +0000)]
Bug 26963: Don't call 'can_be_transferred' for each possible library for each item

Currently When calling Koha::Template::Plugin::Branches::pickup_locations
we call pickup_location for each item of the bib, and for each item we get a list of possible
branches, we then check those branches against the transfer limits, this is inefficent

Given a system with 100 branches, and each branch having an item attached to one bib (100 items)
we will call can_be_transferred ~10000 times - and that will happen for each hold placed on the bib

For me this patch reduced load time from 77 seconds to 18 seconds

To test:
1 - Find a bib
2 - Place 4 title level holds
3 - Add some branches and items for this bib to your system:
  INSERT INTO branches (branchcode,branchname,pickup_location) SELECT CONCAT(branchcode,"D"),CONCAT(branchname,"A"),pickup_location FROM branches;
  INSERT INTO branches (branchcode,branchname,pickup_location) SELECT CONCAT(branchcode,"D"),CONCAT(branchname,"B"),pickup_location FROM branches;
  INSERT INTO branches (branchcode,branchname,pickup_location) SELECT CONCAT(branchcode,"D"),CONCAT(branchname,"C"),pickup_location FROM branches;
  INSERT INTO branches (branchcode,branchname,pickup_location) SELECT CONCAT(branchcode,"D"),CONCAT(branchname,"D"),pickup_location FROM branches;
  INSERT INTO items (biblionumber,biblioitemnumber,barcode,itype,homebranch,holdingbranch) SELECT 1,1,CONCAT("test-",branchcode),'BKS',branchcode,branchcode FROM branches;
4 - Set systempreferences:
    UseBranchTransferLimits = 'enforce'
     BranchTransferLimitsType = 'item type'
5 - Find the bib and click the holds tab
6 - Wait for a long time, it shoudl eventually load
7 - Apply patch and restart al the things
8 - Load the page again, it should be much faster

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26963: Unit tests
Nick Clemens [Wed, 11 Nov 2020 01:24:15 +0000 (01:24 +0000)]
Bug 26963: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: Fix the last_insert_id call
Jonathan Druart [Fri, 13 Nov 2020 07:14:40 +0000 (08:14 +0100)]
Bug 22818: Fix the last_insert_id call

DBI last_insert_id: invalid number of arguments: got handle + 3, expected handle + between 4 and 5
Usage: $h->last_insert_id($catalog, $schema, $table_name, $field_name [, \%attr ]) at /kohadevbox/koha/installer/data/mysql/updatedatabase.pl line 23326.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26948: Regression tests
Martin Renvoize [Thu, 12 Nov 2020 13:36:00 +0000 (13:36 +0000)]
Bug 26948: Regression tests

We already mock the send_or_die method from Email::Stuffer; This patch
updates that mock to extract the internal representation of the email
encoded message and looks for a known double encoded representation of a
character in the sample body.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26948: Remove double encoding from sent emails
Joonas Kylmälä [Fri, 6 Nov 2020 11:35:39 +0000 (13:35 +0200)]
Bug 26948: Remove double encoding from sent emails

The sent emails from Koha were garbled / double encoded because
Koha::Email now after the refactoring and moving to use Email::Stuffer
handles the encoding itself. Previously the Koha::Email callee had to
handle the encoding. This patch removes the double encoding in the
email subject and content.

To test:
 1) Put some UTF-8 characters like ä in the HOLD template subject and body
 2) Create hold and check-in an item to make it Waiting and cause the
 email to be send
 3) Notice the email comes garbled / double encoded
 4) Apply patch
 5) Repeat step 2) and notice the email comes without any issues in
    encoding and look OK.
 6) Make sure "prove t/Koha/Email.t" and "prove
    t/db_dependent/Letters.t" and passes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26990: (bug 22284 follow-up) Prevent hold to be placed if cannot be transferred
Jonathan Druart [Wed, 11 Nov 2020 13:55:27 +0000 (14:55 +0100)]
Bug 26990: (bug 22284 follow-up) Prevent hold to be placed if cannot be transferred

There is a missing parameter to CanItemBeReserved, we need to know if
the hold can be placed at a given pickup library.

Test plan:
1 - Set preferences:
     UseBranchTransferLimits: enforce
     BranchTransferLimitsType: itype
     AllowHoldPolicyOverride: Don't allow
2 - Set Centerville 'Book' items to not be allowed to transfer to any other library
3 - Make sure Hold policy is set to 'any library'
4 - Find a record with a Centerville item and other items
5 - Attempt to place an item level hold on the Centerville item (with a
pickup library different than Centerville)
=> Without this patch you are taken to the holds list, but your hold is not placed
Nothing indicates why hold has failed
=> With this patch you cannot select the item from Centerville
"Cannot be transferred to pickup library"

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: (QA follow-up) Respond to feedback
Andrew Isherwood [Thu, 12 Nov 2020 11:30:33 +0000 (11:30 +0000)]
Bug 22818: (QA follow-up) Respond to feedback

This commit addresses the requests from Jonathan in comment #188

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24083: (QA follow-up) Fix DB upgrade
Andrew Isherwood [Thu, 12 Nov 2020 13:38:49 +0000 (13:38 +0000)]
Bug 24083: (QA follow-up) Fix DB upgrade

This commit makes the addition of the 'unseen_renewals_allowed'
circulation rule idempotent, as highlighted by Jonathan in comment #140

Bug 24083: (QA follow-up) Fix for previous

It helps if you don't commit commented out code...

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24083: (QA follow-up) Fix failing tests
Andrew Isherwood [Thu, 12 Nov 2020 10:36:08 +0000 (10:36 +0000)]
Bug 24083: (QA follow-up) Fix failing tests

This commit fixes the failing tests mentioned by Jonathan in comment

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: Fix TestBuilder.t
Jonathan Druart [Wed, 11 Nov 2020 17:03:08 +0000 (18:03 +0100)]
Bug 22818: Fix TestBuilder.t

t/db_dependent/TestBuilder.t .. 12/13
 #   Failed test 'build_object() tests'
 #   at t/db_dependent/TestBuilder.t line 429.
Can't locate object method "_new_from_dbic" via package "Koha::MessageAttribute" (perhaps you forgot to load "Koha::MessageAttribute"?) at /kohadevbox/koha/Koha/Objects.pm line 98.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24083: DBRev 20.06.00.069
Jonathan Druart [Wed, 11 Nov 2020 14:38:12 +0000 (14:38 +0000)]
Bug 24083: DBRev 20.06.00.069

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24083: Compiled CSS
Jonathan Druart [Wed, 11 Nov 2020 14:36:26 +0000 (15:36 +0100)]
Bug 24083: Compiled CSS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24083: DBIC schema changes
Jonathan Druart [Wed, 11 Nov 2020 14:34:51 +0000 (15:34 +0100)]
Bug 24083: DBIC schema changes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24083: (follow-up) Make requested changes
Andrew Isherwood [Wed, 11 Nov 2020 13:19:18 +0000 (13:19 +0000)]
Bug 24083: (follow-up) Make requested changes

This commit makes the changes requested in comment #120

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24083: Swap the column for "Unlimited" handling
Jonathan Druart [Mon, 9 Nov 2020 15:11:02 +0000 (16:11 +0100)]
Bug 24083: Swap the column for "Unlimited" handling

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24083: Delete the new rule when needed
Jonathan Druart [Mon, 9 Nov 2020 15:10:39 +0000 (16:10 +0100)]
Bug 24083: Delete the new rule when needed

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24083: (follow-up) Squashed follow ups
Andrew Isherwood [Mon, 5 Oct 2020 11:39:48 +0000 (12:39 +0100)]
Bug 24083: (follow-up) Squashed follow ups

This squashed commit fixes:
-  a small error in the checkouts related JS

- GetRenewCount now returns 6 values when a call to it succeeds, a
failed call should also return the same number of values. This commit
adds these additional values.

- Some changes in issue.t had broken the tests for unseen renewals (the
unseen tests were using variables that had been moved out of the tests'
scope).

- Also now using Koha::CirculationRules::set_rules to set circ rules
rather than using SQL queries.

- Fixed expected number of return values from GetRenewCount

- Moved unseen tests in issue.t to the bottom of the file to remove the
risk of interference with other test circ rules.

- There was a real mess in C4/Circulation.pm due to a bad rebase back in
February. Frankly it's a wonder anything worked at all. This commit
fixes that problem and reinstates the correct patch for
C4/Circulation.pm

- Somehow I'd never noticed this before but the columns in smart-rules.tt
were misaligned when UnseenRenewals was turned off. This was due to the
display of a <td> not being conditional when it should have been. This
is now fixed.

- This commit also fixes items 1 & 2 descibed by Katrin in comment #74 ->
comment #76.

- Fixed missing check for too_unseen in opac-user.tt, this test did used
to exist but got lost during sizeable rebase a few weeks ago :-(
- Added test for too_unseen to all AUTO_RENEWAL notice templates apart
from de-DE (as previously requested by Katrin)

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24083: (follow-up) Include SelfCheckInModule
Andrew Isherwood [Mon, 5 Oct 2020 11:37:01 +0000 (12:37 +0100)]
Bug 24083: (follow-up) Include SelfCheckInModule

As highlighted by Katrin, the selfcheckin module was not aware of this
work. This commits gives it awareness of the too_unseen renew error and
the "seen" argument that can be passed to AddRenewal

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24083: (follow-up) Respond to QA feedback
Andrew Isherwood [Thu, 5 Nov 2020 10:41:56 +0000 (10:41 +0000)]
Bug 24083: (follow-up) Respond to QA feedback

This patch implements changes requested by Katrin in QA feedback
(comment #38):

- Fix QA script failures
- Fix alter table column order mismatch
- Use new convention for JS strings
- Fix terminology

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24083: (follow-up) Fix params to AddRenewal
Andrew Isherwood [Mon, 9 Mar 2020 16:04:46 +0000 (16:04 +0000)]
Bug 24083: (follow-up) Fix params to AddRenewal

The merging of Bug 23051 has added a paramter that can be passed to
C4::AddRenewal. This bug does also, so the offset of this bug's new
paramter was wrong. This patch fixes it.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24083: Add unit tests
Andrew Isherwood [Thu, 28 Nov 2019 09:04:38 +0000 (09:04 +0000)]
Bug 24083: Add unit tests

This patch adds unit tests for unseen renewals

Signed-off-by: Sally Healey <sally.Healey@cheshirewestandchester.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24083: Add support for unseen_renewals
Andrew Isherwood [Fri, 22 Nov 2019 11:08:53 +0000 (11:08 +0000)]
Bug 24083: Add support for unseen_renewals

This patch adds support for unseen renewals.

Here we retrofit knowledge of unseen renewals and add the display of unseen
renewal counts and warnings, in addition to adding the ability to
specify a renewal as being "unseen".

The functionality added here is goverened by the UnseenRenewals syspref.

Signed-off-by: Sally Healey <sally.Healey@cheshirewestandchester.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24083: Add circ rules management
Andrew Isherwood [Thu, 21 Nov 2019 14:37:05 +0000 (14:37 +0000)]
Bug 24083: Add circ rules management

This patch adds the ability to set the "Unseen renewals allowed" value
in the circulation rules

Signed-off-by: Sally Healey <sally.Healey@cheshirewestandchester.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24083: Required atomic updates & DB update
Andrew Isherwood [Thu, 21 Nov 2019 14:35:41 +0000 (14:35 +0000)]
Bug 24083: Required atomic updates & DB update

This patch adds:

- An "UnseenRenewals" circulation syspref that enables/disables the
  functionality added in this bug

- Add unseen_renewals_allowed to circulation_rules

- A change to the issues & old_issues table schemas and corresponding
  database upgrades to add issues.unseen_renewals &
  old_issues.unseen_renewals

Signed-off-by: Sally Healey <sally.Healey@cheshirewestandchester.gov.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26987: (bug 23463 follow-up) Fix serial receipt if makePreviousSerialAvailable
Jonathan Druart [Tue, 10 Nov 2020 13:11:10 +0000 (14:11 +0100)]
Bug 26987: (bug 23463 follow-up) Fix serial receipt if makePreviousSerialAvailable

$serialitem is not a Koha::Item there, we need to fetch the item before.

Test plan:
Turn makePreviousSerialAvailable on
Create a subscription
Receive an serial item, mark it "arrived"
Without this patch Koha explodes with
No property notforloan for Koha::Serial::Item at /usr/share/perl5/Exception/Class/Base.pm line 88
Koha::Object::set('Koha::Serial::Item=HASH(0x55dd67c75700)', 'HASH(0x55dd672cec30)') called at /kohadevbox/koha/serials/serials-edit.pl line 273

With this patch applied the notforloan and itype values are correctly
set for the new serial item.

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23019: DBRev 20.06.00.068
Jonathan Druart [Wed, 11 Nov 2020 14:38:12 +0000 (14:38 +0000)]
Bug 23019: DBRev 20.06.00.068

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23019: (follow-up) Fix test permissions and API definition bugs
Agustin Moyano [Tue, 10 Nov 2020 16:59:01 +0000 (13:59 -0300)]
Bug 23019: (follow-up) Fix test permissions and API definition bugs

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23019: (follow-up 2) set table name to import_batch_profiles
Jonathan Druart [Mon, 9 Nov 2020 13:46:49 +0000 (14:46 +0100)]
Bug 23019: (follow-up 2) set table name to import_batch_profiles

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23019: (follow-up) Fix other things
Agustin Moyano [Fri, 6 Nov 2020 17:50:29 +0000 (14:50 -0300)]
Bug 23019: (follow-up) Fix other things

This patch:
* Fixes table name change
* Adds schema file
* Changes api parameter name
* Fixes string escaping
* Fixes error handling

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23019: (follow-up) set table name to import_batch_profiles
Agustin Moyano [Fri, 6 Nov 2020 17:49:20 +0000 (14:49 -0300)]
Bug 23019: (follow-up) set table name to import_batch_profiles

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23019: (QA follow-up) fix test fiule permissions
Nick Clemens [Fri, 30 Oct 2020 15:34:24 +0000 (15:34 +0000)]
Bug 23019: (QA follow-up) fix test fiule permissions

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23019: (follow-up) Fix usability issues
Agustin Moyano [Thu, 27 Aug 2020 22:09:05 +0000 (19:09 -0300)]
Bug 23019: (follow-up) Fix usability issues

This patch place profile buttons in the bottom of the page, next to "Stage for import"

It removes the "Update profile" button, and changes "Add profile" to "Save profile". Save profile can be used to add and to update a profile.

It also adds feedback when a profile was saved or deleted.

Last, it also replaces input-batch-profile endpoint name for input_batch_profile, which is more aligned with other endpoint names.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23019: (QA follow-up) Fix typo Pre fill
Agustin Moyano [Wed, 1 Jul 2020 07:25:14 +0000 (07:25 +0000)]
Bug 23019: (QA follow-up) Fix typo Pre fill

Signed-off-by: Agustin Moyano <agustinmoyano@theke.io>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23019: Add profiles to stage-import-batch and magnage-import-batch pages
Agustin Moyano [Fri, 15 May 2020 14:09:49 +0000 (11:09 -0300)]
Bug 23019: Add profiles to stage-import-batch and magnage-import-batch pages

This patch adds the logic and the needed UI elements to be able to pre-load an import profile. It also displays which profile was used to stage an import in staged import manager.

To test:
1. Apply all patches
2. Updatedatabase
3. Go to Stage MARC records for Import tool in admin, and upload a file with MARC records.
CHECK => after uploading, there is a fieldset with the legend “Profile settings”
              => inside the fieldset there is a select labeled “Pre fill values with profile”. The only value it has is “Do not use profile”.

4. Change some settings, and set “profile 1” as profile name and click on “Add profile”
SUCCESS => The select now has the new profile selected

5. Change profile select to “Do not use profile”
SUCCESS => Default values are now displayed in the form

6. Reload the page and upload the file again
SUCCESS => the select still has the profile recently added

7. Select the profile, change some parameter in the form and set the profile name to “profile 2”, and click add profile
SUCCESS => there are two profiles now, and if you toggle between them, the parameter changes

8. Select profile 1, change one parameter and click on update profile
SUCCESS => if you toggle that profile with the other, the new parameter of the value is shown when you select profile 1

9. Select profile 2, change some parameter and click Add profile (leaving the name as profile 2)
SUCCESS => the page complains there is another profile with the same name, and asks if you want to replace it.

10. Click on accept
SUCCESS => profile 2 now has the new value in the parameter

11. Select profile 2 and change the name to profile 1
SUCCESS => the page complains there is another profile with that name, and asks if you want to replace it

12. Click on accept
SUCCESS => in profile select there is only one profile called profile 1 that has the values of profile 2

13. Select profile 1 and click remove profile
SUCCESS => there is no profile in profile select.

14. Create a profile and click on “Stage for import”
15. Go to Staged MARC management page
SUCCESS => Improt should have the name of the profile in profile column, and when you click on the file name, there should be the name of the profile in the details.

16. prove t/db_dependent/ImportBatch.t t/db_dependent/api/v1/import_batch_profiles.t
17. Sign off

Signed-off-by: Abbey Holt <aholt@dubuque.lib.ia.us>
Signed-off-by: Abbey Holt <aholt@dubuque.lib.ia.us>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23019: Add tests
Agustin Moyano [Fri, 15 May 2020 14:09:56 +0000 (11:09 -0300)]
Bug 23019: Add tests

Signed-off-by: Abbey Holt <aholt@dubuque.lib.ia.us>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23019: Add ImportBatchesProfile schema and set is_boolean to parse_items column
Agustin Moyano [Fri, 15 May 2020 14:09:51 +0000 (11:09 -0300)]
Bug 23019: Add ImportBatchesProfile schema and set is_boolean to parse_items column

Signed-off-by: Abbey Holt <aholt@dubuque.lib.ia.us>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23019: Add koha_object_class and koha_objects_class methods to ImportBatch.pm...
Agustin Moyano [Fri, 15 May 2020 14:09:51 +0000 (11:09 -0300)]
Bug 23019: Add koha_object_class and koha_objects_class methods to ImportBatch.pm schema

Signed-off-by: Abbey Holt <aholt@dubuque.lib.ia.us>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23019: Update database structure and add atomic update
Agustin Moyano [Fri, 15 May 2020 14:09:53 +0000 (11:09 -0300)]
Bug 23019: Update database structure and add atomic update

Signed-off-by: Abbey Holt <aholt@dubuque.lib.ia.us>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 20936: DBRev 20.06.00.067
Jonathan Druart [Wed, 11 Nov 2020 14:38:12 +0000 (14:38 +0000)]
Bug 20936: DBRev 20.06.00.067

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 20936: (follow-up) add biblio and item relation to old holds and set a limit...
Agustin Moyano [Tue, 10 Nov 2020 22:23:49 +0000 (19:23 -0300)]
Bug 20936: (follow-up) add biblio and item relation to old holds and set a limit on search holds

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 20936: (QA follow-up) Use Branches template plugin
Nick Clemens [Fri, 30 Oct 2020 17:28:52 +0000 (17:28 +0000)]
Bug 20936: (QA follow-up) Use Branches template plugin

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 20936: Add patron's hold history menu in OPAC
Agustin Moyano [Wed, 6 May 2020 22:38:19 +0000 (19:38 -0300)]
Bug 20936: Add patron's hold history menu in OPAC

This patch adds patron's hold history in OPAC.

To test:
1. apply this patch
2. Find a patron, place several holds and cancel or fulfill them
3. Go to patron's opac
CHECK => There is no 'your holds history' option in menu
4. In admin preferences enable OPACHoldsHistory
5. Go back to patron's opac
SUCCESS => There is a 'your holds history' menu option
        => Holds history displays all holds
6. Change order, and list limit
SUCCESS => All controls work as expected
7. Sign off.

Signed-off-by: Todd <tgoatley@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 20936: Add OPACHoldsHistory syspref
Agustin Moyano [Sun, 9 Feb 2020 20:53:55 +0000 (17:53 -0300)]
Bug 20936: Add OPACHoldsHistory syspref

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: DBRev 20.06.00.066
Jonathan Druart [Wed, 11 Nov 2020 14:38:12 +0000 (14:38 +0000)]
Bug 22818: DBRev 20.06.00.066

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: DBIC schema changes
Jonathan Druart [Wed, 11 Nov 2020 14:35:33 +0000 (15:35 +0100)]
Bug 22818: DBIC schema changes

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: (QA follow-up) Add hint to new library ILL email setting
Katrin Fischer [Fri, 16 Oct 2020 15:13:48 +0000 (17:13 +0200)]
Bug 22818: (QA follow-up) Add hint to new library ILL email setting

Copies the hints on the other email fields highlighting the existing
global pref.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: (QA follow-up) Add some punctuation and terminology fixes to pref descriptions
Katrin Fischer [Fri, 16 Oct 2020 15:07:26 +0000 (17:07 +0200)]
Bug 22818: (QA follow-up) Add some punctuation and terminology fixes to pref descriptions

Just branch => library and some ending punctuation.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: (QA follow-up) Add sample ILL notices to it-IT installer
Katrin Fischer [Fri, 16 Oct 2020 14:51:09 +0000 (16:51 +0200)]
Bug 22818: (QA follow-up) Add sample ILL notices to it-IT installer

Run: prove xt/sample_notices.t

de-DE are missing on purpose because of bug 24972.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: (follow-up) Respond to feedback
Andrew Isherwood [Fri, 16 Oct 2020 14:08:59 +0000 (15:08 +0100)]
Bug 22818: (follow-up) Respond to feedback

This commit implements the feedback from Katrin in comment #103 ->
comment #108:

- Fixed rebase issue mentioned in comment #103
- Fixed ILL notice display mentioned in comment #106
- Fixed bug with metadata display, though not the issue that was
mentioned in comment #107
- Fixed buttons display mentioned in comment #107, in addition to some
more buttons suffering the same issue

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: (follow-up) Respond to feedback
Andrew Isherwood [Thu, 15 Oct 2020 13:57:19 +0000 (14:57 +0100)]
Bug 22818: (follow-up) Respond to feedback

This commit fixes this bug, it was broken in a number of ways.

Fixes include:

- Added necessary config block in C4::Letters to enable the TT notice
syntax introduced in an earlier commit to work
- Changed template variables to refer to singular objects rather than
multiple e.g. borrowers -> borrower
- Fixed missing / misnamed variables

This commit also implements the additional syspref checks suggested by
Katrin in comment #87

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: (QA follow-up) Add mandatory data at install time
Martin Renvoize [Wed, 16 Sep 2020 13:57:36 +0000 (14:57 +0100)]
Bug 22818: (QA follow-up) Add mandatory data at install time

This patch adds the data from the update script into the mandatory sql
files such that it is also populated at install time.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: (QA follow-up) Sample Notices
Martin Renvoize [Thu, 9 Jul 2020 10:18:26 +0000 (11:18 +0100)]
Bug 22818: (QA follow-up) Sample Notices

Convert the update notices to TT syntax and add them into the
sample_notices file.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: (QA follow-up) Translation fix + Branch notices
Martin Renvoize [Thu, 9 Jul 2020 09:25:26 +0000 (10:25 +0100)]
Bug 22818: (QA follow-up) Translation fix + Branch notices

This patch removes the hard coded 'N/A' being passed to
GetPreparedLetter and passes in the branchcode of the ILLRequest so
notices can be branch specific.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: (QA follow-up) Template CASE correction
Martin Renvoize [Thu, 9 Jul 2020 08:42:20 +0000 (09:42 +0100)]
Bug 22818: (QA follow-up) Template CASE correction

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: (QA follow-up) Licence and POD fixes
Martin Renvoize [Thu, 9 Jul 2020 08:14:57 +0000 (09:14 +0100)]
Bug 22818: (QA follow-up) Licence and POD fixes

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: (QA follow-up) Email addressing corrections
Martin Renvoize [Thu, 9 Jul 2020 07:40:22 +0000 (08:40 +0100)]
Bug 22818: (QA follow-up) Email addressing corrections

This patch updates the patchset to use recnetly introduced methods for
obtaining the correct inbound and reply email addresses for branches.

We also move get_staff_to_address into Koha::Library alongside
inbound_email_address and rename it to inbound_ill_address.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: Unit tests
Andrew Isherwood [Thu, 9 May 2019 14:35:07 +0000 (15:35 +0100)]
Bug 22818: Unit tests

This patch adds unit tests for the new methods in Illrequest.pm

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: Add MessageAttribut{e,es}.pm
Andrew Isherwood [Thu, 9 May 2019 11:21:27 +0000 (12:21 +0100)]
Bug 22818: Add MessageAttribut{e,es}.pm

We need to be able to access individual message attributes in tests, so
adding accessors for them

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: Add generation and sending of notices
Andrew Isherwood [Wed, 8 May 2019 09:42:22 +0000 (10:42 +0100)]
Bug 22818: Add generation and sending of notices

This patch adds the ability for ILL to send notices, both triggered by
staff and triggered by events.

Staff can trigger notices to patrons from the "Manage ILL request" screen:
- ILL request ready for pickup
- ILL request unavailable
- Place request with partners

The following notices to staff are triggered automatically:
- Request has been modified by patron
- Request has been cancelled by patron

Branches can now specify an "ILL email" address to which notices
intended to inform staff of changes to requests by patrons can be sent.

The sending of notices is controlled by a few new sysprefs:
- "ILLDefaultStaffEmail" - Fallback email address for staff ILL notices
to be sent to in the absence of a branch address
- "ILLSendStaffNotices" - To specify which staff notices should be sent
automatically when requests are manipulated by patrons

Patron notices are also controlled by the patron's messaging
preferences

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: Add support for ILL notices
Andrew Isherwood [Tue, 7 May 2019 16:37:02 +0000 (17:37 +0100)]
Bug 22818: Add support for ILL notices

Here we're just adding ILL notices to the existing "letters"
infrastructure so notices can be displayed and edited

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 22818: Add notices sysprefs and DB column
Andrew Isherwood [Tue, 7 May 2019 10:09:58 +0000 (11:09 +0100)]
Bug 22818: Add notices sysprefs and DB column

This patch adds two new sysprefs. 'ILLDefaultEmail', 'ILLSendStaffNotices' and a new column to the
branches table called 'branchillemail'. It also adds five ILL related
notices.

Here we are providing the ability for a branch to have a dedicated email
address for it's ILL staff, the idea being that any notices sent by ILL
to staff need to go to specific staff, rather than the general branch
email address. If no branch specific address is defined, the address
specified in the ILLDefaultEmail syspref is used.

We're also providing a syspref 'ILLSendStaffNotices' to allow the user to specify which
notices should be sent to staff upon certain events.

We are also providing patron messaging preferences for the two patron
bound notices

We are also providing five notices for various ILL related events.

Sponsored-by: PTFS Europe
Signed-off-by: Niamh Walker-Headon <Niamh.Walker-Headon@it-tallaght.ie>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26594: (QA follow-up) Make _UpdateBorrowerDebarmentFlags a public method
Kyle M Hall [Thu, 5 Nov 2020 11:48:04 +0000 (06:48 -0500)]
Bug 26594: (QA follow-up) Make _UpdateBorrowerDebarmentFlags a public method

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26594: Fix patrons merge problem with restrictions
Fridolin Somers [Thu, 1 Oct 2020 12:19:05 +0000 (14:19 +0200)]
Bug 26594: Fix patrons merge problem with restrictions

When merging a patron A with restriction(s) into an other patron B,
the entries of borrower_debarments are OK but the value of borrowers.debarred for patron B need to be updated.
An effect of this strange storage of restrictions in both places.

Test plan :
1) Create a patron A with a manual restriction with some date and
   comment
2) Create a patron B with no restriction
3) Merge patron A and B, keeping patron B
4) Look at patron B details page
=> Without patch you see no restriction
=> With patch you see the restriction from patron A

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26594: add Unit Test
Fridolin Somers [Fri, 2 Oct 2020 07:22:36 +0000 (09:22 +0200)]
Bug 26594: add Unit Test

Run prove t/db_dependent/Patron/Borrower_Debarments.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: DBRev 20.06.00.065
Jonathan Druart [Tue, 10 Nov 2020 13:32:09 +0000 (13:32 +0000)]
Bug 23916: DBRev 20.06.00.065

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: Allow embedding the issuer object
Tomas Cohen Arazi [Tue, 10 Nov 2020 11:53:16 +0000 (08:53 -0300)]
Bug 23916: Allow embedding the issuer object

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: (follow-up) Adapt all the things to the new column and accessor names
Jonathan Druart [Tue, 10 Nov 2020 13:45:57 +0000 (14:45 +0100)]
Bug 23916: (follow-up) Adapt all the things to the new column and accessor names

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: (QA follow-up) Adapt all the things to the new column and accessor names
Tomas Cohen Arazi [Tue, 10 Nov 2020 11:47:29 +0000 (08:47 -0300)]
Bug 23916: (QA follow-up) Adapt all the things to the new column and accessor names

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: Add new attribute to API
Tomas Cohen Arazi [Tue, 10 Nov 2020 11:46:43 +0000 (08:46 -0300)]
Bug 23916: Add new attribute to API

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: (QA follow-up) Rename issuer => issuer_id [DB]
Tomas Cohen Arazi [Tue, 10 Nov 2020 11:46:18 +0000 (08:46 -0300)]
Bug 23916: (QA follow-up) Rename issuer => issuer_id [DB]

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: (follow-up) Add unit tests
Jonathan Druart [Mon, 9 Nov 2020 13:24:22 +0000 (14:24 +0100)]
Bug 23916: (follow-up) Add unit tests

Fix perlcritic error
Subroutine "new" called using indirect syntax at line 128, column 14.  See page 349 of PBP.  (Severity: 4)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: (QA follow-up) Remove stray changes and fix typo
Nick Clemens [Sat, 24 Oct 2020 02:56:15 +0000 (02:56 +0000)]
Bug 23916: (QA follow-up) Remove stray changes and fix typo

There were a couple changes that had no effect, so cleaned those up

Typo 'is' for 'if'

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: (follow-up) Fix unit test
Andrew Isherwood [Fri, 23 Oct 2020 10:55:44 +0000 (11:55 +0100)]
Bug 23916: (follow-up) Fix unit test

This commit responds to the comment made by Katrin in comment #73. I
have removed the lines cited as causing the contraint violation. The
were added in the original iteration of the bug patches and, despite
spending time trying to get to the bottom of it, I cannot figure out
why. There are no changes in the patchset relating to Koha/Patron.pm and
removing the lines does not cause any of the tests in files that *are*
affected by this patchset to fail. I do not know why these lines were
ever added in the first place, unfortunately I did not add comments
explaining (lesson learned)!

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: (follow-up) Rebase unit tests
Andrew Isherwood [Mon, 19 Oct 2020 11:55:18 +0000 (12:55 +0100)]
Bug 23916: (follow-up) Rebase unit tests

This commit is a response to Katrin's comments in comment #62:

- Fixed merge conflict

It also fixes a test which now fails due to an upstream change in
C4::Circulation

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: (follow-up) Fix terminology, use patron-title and make column consistent...
Andrew Isherwood [Mon, 12 Oct 2020 09:28:33 +0000 (10:28 +0100)]
Bug 23916: (follow-up) Fix terminology, use patron-title and make column consistent in issues and old_issues

This commit makes the changes suggested by Katrin in comment #50:

- Changed syspref from RecordIssuer to RecordStaffUserOnCheckout
- Changed terminology from "issue" to "check out" and variations
- Fixed name display to use patron-title.inc
- Made issuer column DEFAULT NULL consistently between issues and
old_issues and between the DB update and kohastructure.sql

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: (follow-up) Don't anonymise issuer and don't update action_logs on upgrade
Andrew Isherwood [Thu, 24 Sep 2020 12:55:55 +0000 (13:55 +0100)]
Bug 23916: (follow-up) Don't anonymise issuer and don't update action_logs on upgrade

This commit implements the two suggestions made by Nick in comment #41:

- Removes the attempted retrospective addition of issuers to old issues.
It was not particularly reliable, it also is not appropriate if the user
does not wish to make use of this functionality

- Removes the conversion of a NULL issuer to the anonymous borrowernumber when
anonymising checkouts

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: (follow-up) Fix column name collision
Andrew Isherwood [Mon, 18 Nov 2019 12:30:27 +0000 (12:30 +0000)]
Bug 23916: (follow-up) Fix column name collision

Seems that joining 'borrowers' into the query run in
C4::Members::GetAllIssues caused a column name collision, which blatted
the retrieval of issues.branchcode. So we now are being a bit more
specific in what is coming from where in the query.

Signed-off-by: Ben Veasey <B.T.Veasey@lboro.ac.uk>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: Add unit tests
Andrew Isherwood [Thu, 31 Oct 2019 14:26:18 +0000 (14:26 +0000)]
Bug 23916: Add unit tests

This patch adds unit tests for the new functions

Signed-off-by: Ben Veasey <B.T.Veasey@lboro.ac.uk>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: Anonymise 'issuer' when required
Andrew Isherwood [Thu, 31 Oct 2019 10:45:41 +0000 (10:45 +0000)]
Bug 23916: Anonymise 'issuer' when required

This patch adds the anonymisation of 'old_issues.issuer' alongside the
existing anonymisation of 'old_issues.borrowernumber'

Signed-off-by: Ben Veasey <B.T.Veasey@lboro.ac.uk>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: Record and display item issuer
Andrew Isherwood [Mon, 2 Mar 2020 11:04:59 +0000 (11:04 +0000)]
Bug 23916: Record and display item issuer

This patch adds the recording and display of the item issuer. This
behaviour is governed by the RecordIssuer syspref, if disabled (the
default), no recording or display of issuer will take place.

Signed-off-by: Ben Veasey <B.T.Veasey@lboro.ac.uk>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: Add "RecordIssuer" syspref
Andrew Isherwood [Thu, 31 Oct 2019 10:22:24 +0000 (10:22 +0000)]
Bug 23916: Add "RecordIssuer" syspref

This patch adds the "RecordIssuer" syspref, which is disabled by default

Signed-off-by: Ben Veasey <B.T.Veasey@lboro.ac.uk>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 23916: Add issues.issuer column and FK
Andrew Isherwood [Thu, 31 Oct 2019 10:08:42 +0000 (10:08 +0000)]
Bug 23916: Add issues.issuer column and FK

This patch adds the issues.issuer column which is a foreign key to
borrowers.borrowernumber

Signed-off-by: Ben Veasey <B.T.Veasey@lboro.ac.uk>
Signed-off-by: Bouzid Fergani <bouzid.fergani@inlibro.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26697: Make account.inc consistent between staff and opac
Martin Renvoize [Fri, 16 Oct 2020 14:57:30 +0000 (15:57 +0100)]
Bug 26697: Make account.inc consistent between staff and opac

Test plan - Regression
1/ Login to the OPAC as a user with various account charges and payments.
2/ Navigate to the 'Your charges' page.
3/ Compare the display of the table before and after applying the
patchset. They should match.

Test plan - Sync
1/ Compare koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc with
koha-tmpl/opac-tmpl/bootstrap/en/includes/accounts.inc.
2/ They files should match after the patch is applied.

Test plan - Translation
1) ./translate update fr-CA
2) Open fr-CA-opac-bootstrap.po and translated this part

msgid ""
"%s %s %sPayment %sWriteoff %sForgiven %sCredit %sLost item fee refund "
"%sRefund %s%s %s %s %s %sAccount creation fee %sAccount renewal fee
%sLost "
"item %sManual fee %sNew card %sFine %sLost item processing fee %sRental
fee "
"%sDaily rental fee %sRenewal of rental item %sRenewal of daily rental
item "
"%sHold fee %sHold waiting too long %s%s %s %s %s "

3) ./translate install fr-CA
4) Login to the OPAC as a patron with various charges
5) Check 'My charges' (in fr-CA) to confirm the translations have been
   picked up.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24603: DBRev 20.06.00.064
Jonathan Druart [Tue, 10 Nov 2020 13:32:09 +0000 (13:32 +0000)]
Bug 24603: DBRev 20.06.00.064

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24603: Simplify tests using TestBuilder
Jonathan Druart [Thu, 5 Nov 2020 13:40:29 +0000 (14:40 +0100)]
Bug 24603: Simplify tests using TestBuilder

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24603: Adjust permissions for cancel-charge.pl
Jonathan Druart [Thu, 5 Nov 2020 13:39:53 +0000 (14:39 +0100)]
Bug 24603: Adjust permissions for cancel-charge.pl

members/cancel-charge.pl should have the same permissions check than boraccount
(borrowers => edit_borrowers was missing)

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24603: (QA follow-up) Add translation to OPAC
Martin Renvoize [Fri, 16 Oct 2020 15:23:10 +0000 (16:23 +0100)]
Bug 24603: (QA follow-up) Add translation to OPAC

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24603: (QA follow-up) Make the new credit type translatable and shorten descripti...
Katrin Fischer [Mon, 5 Oct 2020 13:24:40 +0000 (13:24 +0000)]
Bug 24603: (QA follow-up) Make the new credit type translatable and shorten description a bit

Adding the new offset type and credit type to the include so it can be translated.

Also suggest shortening the db description a bit.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
https://bugs.koha-community.org/show_bug.cgi?id=24063

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24603: (follow-up) Update to double entry accounting
Martin Renvoize [Fri, 10 Jul 2020 13:49:35 +0000 (14:49 +0100)]
Bug 24603: (follow-up) Update to double entry accounting

This patch updates the logic to create a cancellation accountline and
apply it to the charge line so we correction record the transaction in
terms of double entry accounting standards.

Test plan:
1. Go to a patron's accounting section
2. Create a manual invoice
3. In Transactions tab, you should see a 'Cancel charge' button. Click
   on it. It should now be marked as cancelled
4. A cancellation line should be associated with the original charge.
5. Create another manual invoice
6. Pay it (partially or fully)
7. Notice that the 'Cancel charge' button is not available
8. Void the payment
9. 'Cancel charge' button is available again. Click on it and verify
   that it still works
10. prove t/db_dependent/Koha/Account/Lines.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
https://bugs.koha-community.org/show_bug.cgi?id=24063

Bug 24603: Fix number of unit tests

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
https://bugs.koha-community.org/show_bug.cgi?id=24063

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 24603: Allow to cancel charges in patron accounting
Julian Maurice [Thu, 6 Feb 2020 13:13:44 +0000 (14:13 +0100)]
Bug 24603: Allow to cancel charges in patron accounting

There is already a button to void a payment. It should be possible to
cancel a charge too.

This patch adds a button in patron's accounting section (Transactions
tab) that allow to cancel charges.
Charges that have been fully or partially paid cannot be cancelled.

It also fixes Koha::Account::Line::is_credit by looking at
credit_type_code instead of amount (amount can be 0 for voided payments)

It also fixes the tests for Koha::Account::Line::void when database does
not contain the borrowernumber 51 (the default in
t::lib::Mocks::mock_userenv)

Test plan:
1. Go to a patron's accounting section
2. Create a manual invoice
3. In Transactions tab, you should see a 'Cancel charge' button. Click
   on it. It should now be marked as cancelled
4. Create another manual invoice
5. Pay it (partially or fully)
6. Notice that the 'Cancel charge' button is not available
7. Void the payment
8. 'Cancel charge' button is available again. Click on it and verify
   that it still works
9. prove t/db_dependent/Koha/Account/Lines.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
3 years agoBug 26904: OPAC password recovery allows regexp in email
Fridolin Somers [Tue, 3 Nov 2020 08:19:34 +0000 (09:19 +0100)]
Bug 26904: OPAC password recovery allows regexp in email

When using OPAC password recovery form, opac/opac-password-recovery.pl :
if one provides correct login and an email, there is a check that this email is one of patron's.

This check uses RegExp with case insensitive :
  if ( $email && !( any { /^$email$/i } @emails ) )

This is a security issue since one can simply enter '.*'.
Severity is normal because the login must be a correct.

I propose to use simple string compare with lowercase to be case insensitive.

Test plan :
1) Don't apply patch
2) Enable system preference 'OpacResetPassword'
3) Go to 'OPAC > Log in to your account > Forgot your password?'
4) Enter an existing userid or cardnumber and '.*' in 'Email'
5) The password recovery is created ! (check table 'borrower_password_recovery')
6) Apply patch
7) Enter an existing userid or cardnumber and '.*' in 'Email'
8) You get the message 'No account was found with the provided information.'
9) Enter an existing userid or cardnumber and in 'Email' the corresponding email but with different case
10) The password recovery is created (check table 'borrower_password_recovery')

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>